commit 9429ce55039f0e3a67975cf8da97357d11f7f126 Author: DESKTOP-EUEHMTS\WXK <314315830@qq.com> Date: Wed Mar 22 17:39:07 2023 +0800 init version diff --git a/5575183_wx.szfinest.com_nginx.zip b/5575183_wx.szfinest.com_nginx.zip new file mode 100644 index 0000000..62a39ac Binary files /dev/null and b/5575183_wx.szfinest.com_nginx.zip differ diff --git a/5592355_wx.sznewsoft.com_nginx.zip b/5592355_wx.sznewsoft.com_nginx.zip new file mode 100644 index 0000000..090754c Binary files /dev/null and b/5592355_wx.sznewsoft.com_nginx.zip differ diff --git a/fenis-trip/fenis-trip.iml b/fenis-trip/fenis-trip.iml new file mode 100644 index 0000000..a1668b8 --- /dev/null +++ b/fenis-trip/fenis-trip.iml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fenis-trip/pom.xml b/fenis-trip/pom.xml new file mode 100644 index 0000000..3813127 --- /dev/null +++ b/fenis-trip/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.2.9.RELEASE + + + + com.hc + fenis-trip + pom + 0.0.1-SNAPSHOT + fenis-trip + Demo project for Spring Boot + + + trip-business + trip-core + trip-web + + + + 11 + 1.2.5 + 2.1.4 + 1.2.5 + 4.1.5 + [7.2.0, 7.2.99] + 3.3.0 + 1.2.70 + 4.9.9 + 3.0.0 + + + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + org.projectlombok + lombok + true + + + + + com.spring4all + swagger-spring-boot-starter + 1.6.0.RELEASE + + + + + + diff --git a/fenis-trip/trip-business/pom.xml b/fenis-trip/trip-business/pom.xml new file mode 100644 index 0000000..119ea50 --- /dev/null +++ b/fenis-trip/trip-business/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + com.hc + fenis-trip + 0.0.1-SNAPSHOT + + + trip-business + 0.0.1-SNAPSHOT + trip-business + Demo project for Spring Boot + + + 11 + + + + + + com.hc + trip-core + ${project.version} + + + + com.github.pagehelper + pagehelper-spring-boot-starter + ${pagehelper.version} + + + mybatis-spring-boot-starter + org.mybatis.spring.boot + + + + + + + + + diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/BannerMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/BannerMapper.java new file mode 100644 index 0000000..79377d3 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/BannerMapper.java @@ -0,0 +1,18 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.Banner; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 广告表 + * (Banner)表数据库访问层 + * + * @author java + * @since 2021-04-30 14:19:19 + */ + +@Repository +public interface BannerMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/NewsMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/NewsMapper.java new file mode 100644 index 0000000..e4a089e --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/NewsMapper.java @@ -0,0 +1,18 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.News; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 新闻表 + * (News)表数据库访问层 + * + * @author java + * @since 2021-04-30 14:03:23 + */ + +@Repository +public interface NewsMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/NewsTagMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/NewsTagMapper.java new file mode 100644 index 0000000..3412dd4 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/NewsTagMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.NewsTag; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 新闻标签表(NewsTag)表数据库访问层 + * + * @author java + * @since 2021-04-30 14:03:24 + */ + +@Repository +public interface NewsTagMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/NewsTagRelaxMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/NewsTagRelaxMapper.java new file mode 100644 index 0000000..50bf89b --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/NewsTagRelaxMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.NewsTagRelax; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * (NewsTagRelax)表数据库访问层 + * + * @author java + * @since 2021-04-30 14:03:25 + */ + +@Repository +public interface NewsTagRelaxMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/RolesMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/RolesMapper.java new file mode 100644 index 0000000..82f8b1f --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/RolesMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.Roles; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * (Roles)表数据库访问层 + * + * @author java + * @since 2021-04-30 15:08:18 + */ + +@Repository +public interface RolesMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryMapper.java new file mode 100644 index 0000000..91656c6 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.Scenery; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 景点表(Scenery)表数据库访问层 + * + * @author java + * @since 2021-04-25 09:27:40 + */ + +@Repository +public interface SceneryMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryPictureMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryPictureMapper.java new file mode 100644 index 0000000..809a1d0 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryPictureMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.SceneryPicture; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 景点图片表(SceneryPicture)表数据库访问层 + * + * @author java + * @since 2021-04-27 15:26:10 + */ + +@Repository +public interface SceneryPictureMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryTagMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryTagMapper.java new file mode 100644 index 0000000..43b9a07 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryTagMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.SceneryTag; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 景点标签(SceneryTag)表数据库访问层 + * + * @author java + * @since 2021-04-27 15:26:10 + */ + +@Repository +public interface SceneryTagMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryTicketsMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryTicketsMapper.java new file mode 100644 index 0000000..a92f5ca --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryTicketsMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.SceneryTickets; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 景点门票表(SceneryTickets)表数据库访问层 + * + * @author java + * @since 2021-04-25 09:34:29 + */ + +@Repository +public interface SceneryTicketsMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryTicketsTypeMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryTicketsTypeMapper.java new file mode 100644 index 0000000..b7e3bdb --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryTicketsTypeMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.SceneryTicketsType; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 门票类型表(SceneryTicketsType)表数据库访问层 + * + * @author java + * @since 2021-04-25 09:39:56 + */ + +@Repository +public interface SceneryTicketsTypeMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryVideoMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryVideoMapper.java new file mode 100644 index 0000000..9cebca7 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/SceneryVideoMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.SceneryVideo; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 景点视频表(SceneryVideo)表数据库访问层 + * + * @author java + * @since 2021-04-27 15:26:48 + */ + +@Repository +public interface SceneryVideoMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserOrderDetailMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserOrderDetailMapper.java new file mode 100644 index 0000000..80904e7 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserOrderDetailMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.UserOrderDetail; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * 订单详情表(UserOrderDetail)表数据库访问层 + * + * @author java + * @since 2021-04-30 17:01:28 + */ + +@Repository +public interface UserOrderDetailMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserOrdersMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserOrdersMapper.java new file mode 100644 index 0000000..b3f8233 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserOrdersMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.UserOrders; +import org.springframework.stereotype.Repository; +import com.hc.tripcore.utils.mapper.Mapper; + +/** + * 订单表(UserOrders)表数据库访问层 + * + * @author java + * @since 2021-04-30 17:01:29 + */ + +@Repository +public interface UserOrdersMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserShopMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserShopMapper.java new file mode 100644 index 0000000..eee52f6 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserShopMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.UserShop; +import org.springframework.stereotype.Repository; +import com.hc.tripcore.utils.mapper.Mapper; + +/** + * 购物车表(UserShop)表数据库访问层 + * + * @author java + * @since 2021-04-30 17:01:30 + */ + +@Repository +public interface UserShopMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserTicketsMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserTicketsMapper.java new file mode 100644 index 0000000..7506618 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UserTicketsMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.UserTickets; +import org.springframework.stereotype.Repository; +import com.hc.tripcore.utils.mapper.Mapper; + +/** + * 用户门票(UserTickets)表数据库访问层 + * + * @author java + * @since 2021-04-30 17:01:30 + */ + +@Repository +public interface UserTicketsMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UsersMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UsersMapper.java new file mode 100644 index 0000000..994fddb --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UsersMapper.java @@ -0,0 +1,27 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.Users; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * (Users)表数据库访问层 + * + * @author java + * @since 2021-04-25 17:45:10 + */ + +@Repository +public interface UsersMapper extends Mapper { + + /** + * 通过用户openid 获取用户信息 + * + * @param openId 微信用户标识 + * @return 实例对象数组 + */ + List selectUserByOpenId(String openId); + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UsersRoleMapper.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UsersRoleMapper.java new file mode 100644 index 0000000..51d332f --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/mapper/UsersRoleMapper.java @@ -0,0 +1,17 @@ +package com.hc.tripbusiness.mapper; + +import com.hc.tripbusiness.model.UsersRole; +import com.hc.tripcore.utils.mapper.Mapper; +import org.springframework.stereotype.Repository; + +/** + * (UsersRole)表数据库访问层 + * + * @author java + * @since 2021-04-30 15:08:37 + */ + +@Repository +public interface UsersRoleMapper extends Mapper { + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Banner.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Banner.java new file mode 100644 index 0000000..04b6b22 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Banner.java @@ -0,0 +1,74 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotNull; + + +/** + * 广告表 + * (Banner)实体类 + * + * @author java + * @since 2021-04-30 14:19:19 + */ + +@Data +public class Banner implements Serializable { + + private static final long serialVersionUID = 667839688154296150L; + + + /** + * ID主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "ID主键") + private Integer bannerId; + + /** + * 主题 + */ + @ApiModelProperty(value = "主题", required = true) + @NotNull + private String bannerTitle; + + /** + * 广告连接 + */ + @ApiModelProperty(value = "广告连接", required = true) + @NotNull + private String bannerUrl; + + /** + * 索引 + */ + @ApiModelProperty(value = "索引") + private Integer bannerIndex; + + /** + * 点击后跳转的目的链接 + */ + @ApiModelProperty(value = "点击后跳转的目的链接", required = true) + private String targetUrl; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/News.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/News.java new file mode 100644 index 0000000..d5adadc --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/News.java @@ -0,0 +1,69 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotNull; + + +/** + * 新闻表 + * (News)实体类 + * + * @author java + * @since 2021-04-30 14:03:22 + */ + +@Data +public class News implements Serializable { + + private static final long serialVersionUID = 235012938178936468L; + + + /** + * 新闻id + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "新闻id") + private Integer newsId; + + /** + * 标题 + */ + @ApiModelProperty(value = "标题", required = true) + @NotNull + private String newsTitle; + + /** + * 标题配图 + */ + @ApiModelProperty(value = "标题配图", required = true) + @NotNull + private String newsLogo; + + /** + * 新闻内容 + */ + @ApiModelProperty(value = "新闻内容", required = true) + @NotNull + private String newsContent; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/NewsTag.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/NewsTag.java new file mode 100644 index 0000000..581db75 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/NewsTag.java @@ -0,0 +1,54 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotNull; + + +/** + * 新闻标签表(NewsTag)实体类 + * + * @author java + * @since 2021-04-30 14:03:24 + */ + +@Data +public class NewsTag implements Serializable { + + private static final long serialVersionUID = -39154458050657705L; + + + /** + * 主键id + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键id") + private Integer tagId; + + /** + * 类别名称 + */ + @ApiModelProperty(value = "类别名称", required = true) + @NotNull + private String tagName; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/NewsTagRelax.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/NewsTagRelax.java new file mode 100644 index 0000000..8b9f5d7 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/NewsTagRelax.java @@ -0,0 +1,61 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotNull; + + +/** + * (NewsTagRelax)实体类 + * + * @author java + * @since 2021-04-30 14:03:25 + */ + +@Data +public class NewsTagRelax implements Serializable { + + private static final long serialVersionUID = 917744923319773742L; + + + /** + * 主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键") + private Integer newsTagRelaxId; + + /** + * 标签id + */ + @ApiModelProperty(value = "标签id", required = true) + @NotNull + private Integer tagId; + + /** + * 新闻id + */ + @ApiModelProperty(value = "新闻id", required = true) + @NotNull + private Integer newsId; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Roles.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Roles.java new file mode 100644 index 0000000..1933ab9 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Roles.java @@ -0,0 +1,42 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotNull; + + +/** + * (Roles)实体类 + * + * @author java + * @since 2021-04-30 15:08:17 + */ + +@Data +public class Roles implements Serializable { + + private static final long serialVersionUID = -66181277016540076L; + + + /** + * 主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键") + private Integer id; + + /** + * 角色名称 + */ + @ApiModelProperty(value = "角色名称", required = true) + @NotNull + private String name; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Scenery.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Scenery.java new file mode 100644 index 0000000..262a84f --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Scenery.java @@ -0,0 +1,109 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotNull; + + +/** + * 景点表(Scenery)实体类 + * + * @author java + * @since 2021-04-25 09:27:39 + */ + +@Data +@ApiModel(value = "景点表") +public class Scenery implements Serializable { + + private static final long serialVersionUID = 912947094192635315L; + + + /** + * 主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键") + private Integer sceneryId; + + /** + * 景区名称 + */ + @ApiModelProperty(value = "景区名称", required = true) + @NotNull + private String sceneryName; + + /** + * 景点公告 + */ + @ApiModelProperty(value = "景点公告", required = true) + private String sceneryNotes; + + /** + * 景点排序 + */ + @ApiModelProperty(value = "景点排序") + private Integer sceneryIndex; + + /** + * 景点介绍 + */ + @ApiModelProperty(value = "景点介绍", required = true) + private String sceneryIntroduce; + + /** + * 景点Logo + */ + @ApiModelProperty(value = "景点Logo", required = true) + private String sceneryLogo; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; + + /** + * 开放时间 + */ + @ApiModelProperty(value = "开放时间") + private Long startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(value = "结束时间") + private Long endTime; + + /** + * 联系电话 + */ + @ApiModelProperty(value = "联系电话") + private String phone; + + /** + * 官网 + */ + @ApiModelProperty(value = "官网") + private String website; + + /** + * 交通 + */ + @ApiModelProperty(value = "交通") + private String traffic; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryPicture.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryPicture.java new file mode 100644 index 0000000..9d525e7 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryPicture.java @@ -0,0 +1,79 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotNull; + + +/** + * 景点图片表(SceneryPicture)实体类 + * + * @author java + * @since 2021-04-27 15:26:10 + */ + +@Data +@ApiModel(value = "景点图片表") +public class SceneryPicture implements Serializable { + + private static final long serialVersionUID = -40027829476880747L; + + + /** + * 主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键") + private Integer sceneryPictureId; + + /** + * 图片名称 + */ + @ApiModelProperty(value = "图片名称", required = true) + private String pictureName; + + /** + * 图片地址 + */ + @ApiModelProperty(value = "图片地址", required = true) + private String pictureUrl; + + /** + * 图片介绍 + */ + @ApiModelProperty(value = "图片介绍", required = true) + private String pictureIntroduce; + + /** + * 图片排序 + */ + @ApiModelProperty(value = "图片排序") + private Integer pictureIndex; + + /** + * 景区id + */ + @ApiModelProperty(value = "景区id", required = true) + @NotNull + private Integer sceneryId; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryTag.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryTag.java new file mode 100644 index 0000000..8410d32 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryTag.java @@ -0,0 +1,55 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.persistence.Id; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.validation.constraints.NotNull; + + +/** + * 景点标签(SceneryTag)实体类 + * + * @author java + * @since 2021-04-27 15:26:10 + */ + +@Data +@ApiModel(value = "景点标签表") +public class SceneryTag implements Serializable { + + private static final long serialVersionUID = -57206923209950362L; + + + /** + * 主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键") + private Integer sceneryTagId; + + /** + * 景区标签 + */ + @ApiModelProperty(value = "景区标签", required = true) + @NotNull + private String tagName; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryTickets.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryTickets.java new file mode 100644 index 0000000..7675c15 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryTickets.java @@ -0,0 +1,93 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.persistence.Id; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.validation.constraints.NotNull; + + +/** + * 景点门票表(SceneryTickets)实体类 + * + * @author java + * @since 2021-04-25 09:34:29 + */ + +@Data +@ApiModel(value = "门票表") +public class SceneryTickets implements Serializable { + + private static final long serialVersionUID = -56795734829011871L; + + + /** + * 主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键", required = true) + private Integer sceneryTicketId; + + /** + * 景区门票类型 + */ + @ApiModelProperty(value = "景区门票类型", required = true) + @NotNull + private Integer ticketsTypeId; + + /** + * 门票名字 + */ + @ApiModelProperty(value = "门票名字", required = true) + private String ticketsName; + + /** + * 门票价格 + */ + @ApiModelProperty(value = "门票价格", required = true) + private Double ticketsPrice; + + /** + * 门票介绍 + */ + @ApiModelProperty(value = "门票介绍", required = true) + private String ticketIntroduce; + + /** + * 门票logo + */ + @ApiModelProperty(value = "门票logo", required = true) + private String ticketsLogo; + + /** + * 景区id + */ + @ApiModelProperty(value = "景区id", required = true) + @NotNull + private Integer sceneryId; + + /** + * 销售数量 + */ + @ApiModelProperty(value = "销售数量 ", required = true) + private Integer ticketSellNum; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryTicketsType.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryTicketsType.java new file mode 100644 index 0000000..7a26459 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryTicketsType.java @@ -0,0 +1,56 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotNull; + + +/** + * 门票类型表(SceneryTicketsType)实体类 + * + * @author java + * @since 2021-04-25 09:39:56 + */ + +@Data +@ApiModel(value = "门票类型表") +public class SceneryTicketsType implements Serializable { + + private static final long serialVersionUID = -56522778678792842L; + + + /** + * 主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键") + private Integer ticketsTypeId; + + /** + * 门票类型名称 + */ + @ApiModelProperty(value = "门票类型名称", required = true) + @NotNull + private String ticketName; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryVideo.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryVideo.java new file mode 100644 index 0000000..2d8bf66 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/SceneryVideo.java @@ -0,0 +1,81 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.Id; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.validation.constraints.NotNull; + + +/** + * 景点视频表(SceneryVideo)实体类 + * + * @author java + * @since 2021-04-27 15:26:47 + */ + +@Data +@ApiModel(value = "景点视频表") +public class SceneryVideo implements Serializable { + + private static final long serialVersionUID = -13473191696203048L; + + + /** + * 主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键") + private Integer sceneryVideoId; + + /** + * 视频名称 + */ + @ApiModelProperty(value = "视频名称", required = true) + @NotNull + private String videoName; + + /** + * 视频介绍 + */ + @ApiModelProperty(value = "视频介绍", required = true) + private String videoIntroduce; + + /** + * 排序字段 + */ + @ApiModelProperty(value = "排序字段") + private Integer videoIndex; + + /** + * 资源地址 + */ + @ApiModelProperty(value = "资源地址", required = true) + private String videoUrl; + + /** + * 外键 + */ + @ApiModelProperty(value = "外键", required = true) + @NotNull + private Integer sceneryId; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserOrderDetail.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserOrderDetail.java new file mode 100644 index 0000000..12957fa --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserOrderDetail.java @@ -0,0 +1,64 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + + +/** + * 订单详情表(UserOrderDetail)实体类 + * + * @author java + * @since 2021-04-30 17:01:27 + */ + +@Data +public class UserOrderDetail implements Serializable { + + private static final long serialVersionUID = 884717817060295517L; + + + /** + * 主键id + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键id") + private Integer orderDetailId; + + /** + * 订单id + */ + @ApiModelProperty(value = "订单id", required = true) + private Integer orderId; + + /** + * 门票id + */ + @ApiModelProperty(value = "门票id", required = true) + private Integer sceneryTicketId; + + /** + * 购买数量 + */ + @ApiModelProperty(value = "购买数量", required = true) + private Integer num; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserOrders.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserOrders.java new file mode 100644 index 0000000..d181d8e --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserOrders.java @@ -0,0 +1,113 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import tk.mybatis.mapper.annotation.Version; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + + +/** + * 订单表(UserOrders)实体类 + * + * @author java + * @since 2021-04-30 17:01:29 + */ + +@Data +public class UserOrders implements Serializable { + + private static final long serialVersionUID = 654720203617863422L; + + + /** + * 主键id + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键id") + private Integer ordersId; + + /** + * 订单号 + */ + @ApiModelProperty(value = "订单号", required = true) + private String orderNo; + + /** + * 用户id + */ + @ApiModelProperty(value = "用户id", required = true) + private Integer userId; + + /** + * 商品介绍 + */ + @ApiModelProperty(value = "商品介绍", required = true) + private String body; + + /** + * 订单名称 + */ + @ApiModelProperty(value = "订单名称", required = true) + private String subject; + + /** + * 订单总金额 + */ + @ApiModelProperty(value = "订单总金额", required = true) + private Double totalAmount; + + /** + * 订单状态 + */ + @ApiModelProperty(value = "订单状态", required = true) + private Integer orderStatus; + + /** + * 是否删除 + */ + @ApiModelProperty(value = "是否删除", required = true) + private Integer isDe; + + /** + * 支付宝交易号 + */ + @ApiModelProperty(value = "支付宝交易号", required = true) + private String aliTradeNo; + + /** + * 微信交易号 + */ + @ApiModelProperty(value = "微信交易号", required = true) + private String wxTradeNo; + + /** + * 发票id + */ + @ApiModelProperty(value = "发票id", required = true) + private Integer userInvoicesId; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; + + /** + * 乐观锁 + */ + @ApiModelProperty(value = "乐观锁") + @Version + private Integer version; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserShop.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserShop.java new file mode 100644 index 0000000..783137b --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserShop.java @@ -0,0 +1,64 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + + +/** + * 购物车表(UserShop)实体类 + * + * @author java + * @since 2021-04-30 17:01:30 + */ + +@Data +public class UserShop implements Serializable { + + private static final long serialVersionUID = -18437284989870592L; + + + /** + * 主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键") + private Integer userShopId; + + /** + * 用户id + */ + @ApiModelProperty(value = "用户id", required = true) + private Integer userId; + + /** + * 门票id + */ + @ApiModelProperty(value = "门票id", required = true) + private Integer sceneryTicketId; + + /** + * 数量id + */ + @ApiModelProperty(value = "数量id", required = true) + private Integer num; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserTickets.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserTickets.java new file mode 100644 index 0000000..ce87296 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UserTickets.java @@ -0,0 +1,102 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import tk.mybatis.mapper.annotation.Version; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + + +/** + * 用户门票(UserTickets)实体类 + * + * @author java + * @since 2021-04-30 17:01:30 + */ + +@Data +public class UserTickets implements Serializable { + + private static final long serialVersionUID = 689996508632270417L; + + + /** + * 主键id + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键id") + private Integer userTicketsId; + + /** + * 门票id + */ + @ApiModelProperty(value = "门票id", required = true) + private String sceneryTicketId; + + /** + * 票密码(保留) + */ + @ApiModelProperty(value = "票密码(保留)", required = true) + private String ticketsPass; + + /** + * 票号 + */ + @ApiModelProperty(value = "票号", required = true) + private String ticketsNo; + + /** + * 二维码地址 + */ + @ApiModelProperty(value = "二维码地址", required = true) + private String ticketsCode; + + /** + * 门票得有效期时间 + */ + @ApiModelProperty(value = "门票得有效期时间", required = true) + private Long ticketsTime; + + /** + * 用户id + */ + @ApiModelProperty(value = "用户id", required = true) + private Integer userId; + + /** + * 是否使用 + */ + @ApiModelProperty(value = "是否使用", required = true) + private Boolean isUse; + + /** + * 使用时间戳 + */ + @ApiModelProperty(value = "使用时间戳", required = true) + private Long usedTime; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Long createTime; + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private Long updateTime; + + /** + * 乐观锁 + */ + @ApiModelProperty(value = "乐观锁") + @Version + private Integer version; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Users.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Users.java new file mode 100644 index 0000000..57ffb72 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/Users.java @@ -0,0 +1,71 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + + +/** + * (Users)实体类 + * + * @author java + * @since 2021-04-27 14:47:03 + */ + +@Data +@ApiModel(value = "用户表") +public class Users implements Serializable { + + private static final long serialVersionUID = 942617439502094031L; + + + /** + * 主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键") + private Long id; + + /** + * 用户名 + */ + @ApiModelProperty(value = "用户名") + private String username; + + /** + * 密码 + */ + @ApiModelProperty(value = "密码") + private String password; + + /** + * 微信用户标识 + */ + @ApiModelProperty(value = "微信用户标识", required = true) + private String openid; + + /** + * 用户头像 + */ + @ApiModelProperty(value = "用户头像") + private String userLogo; + + /** + * 社区昵称 + */ + @ApiModelProperty(value = "社区昵称") + private String nickname; + + /** + * 性别 + */ + @ApiModelProperty(value = "性别") + private String gender; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UsersRole.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UsersRole.java new file mode 100644 index 0000000..c09c79d --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/UsersRole.java @@ -0,0 +1,49 @@ +package com.hc.tripbusiness.model; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotNull; + + +/** + * (UsersRole)实体类 + * + * @author java + * @since 2021-04-30 15:08:37 + */ + +@Data +public class UsersRole implements Serializable { + + private static final long serialVersionUID = -33538509975795305L; + + + /** + * 主键 + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "主键") + private Integer id; + + /** + * 角色信息 + */ + @ApiModelProperty(value = "角色信息", required = true) + @NotNull + private Integer roleId; + + /** + * 用户信息 + */ + @ApiModelProperty(value = "用户信息", required = true) + @NotNull + private Integer userId; +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/jwt/GenerateAuthToken.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/jwt/GenerateAuthToken.java new file mode 100644 index 0000000..6436ecb --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/jwt/GenerateAuthToken.java @@ -0,0 +1,57 @@ +package com.hc.tripbusiness.model.jwt; + +import com.hc.tripbusiness.model.Users; +import com.hc.tripbusiness.model.login.AccessEntity; +import com.hc.tripbusiness.model.login.AuthEntity; +import com.hc.tripbusiness.model.login.TokenEntity; +import com.hc.tripcore.utils.redis.RedisUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.SerializationUtils; + +import java.util.Objects; + +@Slf4j +@Component +public class GenerateAuthToken { + + private final RedisUtil redisUtil; + + @Autowired + public GenerateAuthToken(RedisUtil redisUtil) { + this.redisUtil = redisUtil; + } + + public AccessEntity generateToken(AuthEntity auth, Users user) { + + AccessEntity accessEntity = new AccessEntity(); + accessEntity.setAuth(auth); + TokenEntity tokenEntity = new TokenEntity(); + // 默认超时 8 小时 + tokenEntity.setExpires(60 * 60 * 8); + String token = JWTUtil.sign(auth.getUserName(), auth.getPassword()); + tokenEntity.setId(token); + + + accessEntity.setToken(tokenEntity); + String accessEntityStr = null; + try { + accessEntityStr = new String(Objects.requireNonNull(SerializationUtils.serialize(accessEntity))); + } catch (Exception e) { + log.warn("{}-{}用户登录出错", auth.getUserName(), auth.getPassword()); + } + // 写入到 redis + redisUtil.set(accessEntity.getToken().getId(), + accessEntityStr, + accessEntity.getToken().getExpires()); + + if (user != null) { + tokenEntity.setPermissionLevel(4); + accessEntity.setUser(user); + } + + log.info("用户登录成功 user={}", auth.getUserName()); + return accessEntity; + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/jwt/JWTUtil.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/jwt/JWTUtil.java new file mode 100644 index 0000000..a20392d --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/jwt/JWTUtil.java @@ -0,0 +1,74 @@ +package com.hc.tripbusiness.model.jwt; + +import com.auth0.jwt.JWT; +import com.auth0.jwt.JWTVerifier; +import com.auth0.jwt.algorithms.Algorithm; +import com.auth0.jwt.exceptions.JWTDecodeException; +import com.auth0.jwt.interfaces.DecodedJWT; +import org.springframework.stereotype.Component; + +import java.io.UnsupportedEncodingException; +import java.util.Date; + +@Component +public class JWTUtil { + + // 过期时间8小时0分钟 + + private static final long EXPIRE_TIME = 8 * 60 * 60 * 1000 ; + + /** + * 校验token是否正确 + * + * @param token 密钥 + * @param secret 用户的密码 + * @return 是否正确 + */ + public static boolean verify(String token, String userName, String secret) { + try { + Algorithm algorithm = Algorithm.HMAC256(secret); + JWTVerifier verifier = JWT.require(algorithm) + .withClaim("userName", userName) + .build(); + DecodedJWT jwt = verifier.verify(token); + return true; + } catch (Exception exception) { + return false; + } + } + + /** + * 获得token中的信息无需secret解密也能获得 + * + * @return token中包含的用户名 + */ + public static String getUserName(String token) { + try { + DecodedJWT jwt = JWT.decode(token); + return jwt.getClaim("userName").asString(); + } catch (JWTDecodeException e) { + return null; + } + } + + /** + * 生成签名,2小时后过期 + * + * @param userName 用户名 + * @param secret 用户的密码 + * @return 加密的token + */ + public static String sign(String userName, String secret) { + try { + Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME); + Algorithm algorithm = Algorithm.HMAC256(secret); + // 附带userName信息 + return JWT.create() + .withClaim("userName", userName) + .withExpiresAt(date) + .sign(algorithm); + } catch (UnsupportedEncodingException e) { + return null; + } + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/login/AccessEntity.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/login/AccessEntity.java new file mode 100644 index 0000000..755147a --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/login/AccessEntity.java @@ -0,0 +1,31 @@ +package com.hc.tripbusiness.model.login; + +import com.hc.tripbusiness.model.Users; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@ApiModel +@Data +public class AccessEntity implements Serializable{ + + /** + * 序列化标识 + */ + private static final long serialVersionUID = -5164168823800497252L; + + @ApiModelProperty(value = "用户信息") + private AuthEntity auth; + + @ApiModelProperty(value = "token",example = "e781d000-0498-46d3-90df-96edfd95bcd6") + private TokenEntity token; + + @ApiModelProperty(value = "user") + private Users user; + +// @ApiModelProperty(value = "userAdmin") +// private UserAdmin userAdmin; + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/login/AuthEntity.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/login/AuthEntity.java new file mode 100644 index 0000000..c4c15a5 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/login/AuthEntity.java @@ -0,0 +1,23 @@ +package com.hc.tripbusiness.model.login; + +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +public class AuthEntity implements Serializable { + + private static final long serialVersionUID = -9061398570055647081L; + + @NotNull(message = "用户名不可以为空") + private String userName; + + @NotNull(message = "密码不可以为空") + private String password; + + @NotNull(message = "登录类型不可以为空") + private Integer loginType; + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/login/TokenEntity.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/login/TokenEntity.java new file mode 100644 index 0000000..c1c773d --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/model/login/TokenEntity.java @@ -0,0 +1,23 @@ +package com.hc.tripbusiness.model.login; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TokenEntity implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -6482495805136843397L; + + private String id; // token的ID + + private long expires; // 过期时间 + + //1,2,3d对应后台123级管理员,4作为新增的前台用户 + + private Integer permissionLevel; // 权限级别 + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/BannerService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/BannerService.java new file mode 100644 index 0000000..9c95e55 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/BannerService.java @@ -0,0 +1,61 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.Banner; +import org.springframework.stereotype.Component; + + +/** + * 广告表 + * (Banner)表服务接口 + * + * @author java + * @since 2021-04-30 14:19:19 + */ + +@Component +public interface BannerService { + + /** + * 通过ID查询单条数据 + * + * @param bannerId 主键 + * @return 实例对象 + */ + Banner queryById(Integer bannerId); + + /** + * 新增数据 + * + * @param banner 实例对象 + * @return 实例对象 + */ + Banner insert(Banner banner); + + /** + * 修改数据 + * + * @param banner 实例对象 + * @return 实例对象 + */ + Banner update(Banner banner); + + /** + * 通过主键删除数据 + * + * @param bannerId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer bannerId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/NewsService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/NewsService.java new file mode 100644 index 0000000..618b6ab --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/NewsService.java @@ -0,0 +1,61 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.News; +import org.springframework.stereotype.Component; + + +/** + * 新闻表 + * (News)表服务接口 + * + * @author java + * @since 2021-04-30 14:03:23 + */ + +@Component +public interface NewsService { + + /** + * 通过ID查询单条数据 + * + * @param newsId 主键 + * @return 实例对象 + */ + News queryById(Integer newsId); + + /** + * 新增数据 + * + * @param news 实例对象 + * @return 实例对象 + */ + News insert(News news); + + /** + * 修改数据 + * + * @param news 实例对象 + * @return 实例对象 + */ + News update(News news); + + /** + * 通过主键删除数据 + * + * @param newsId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer newsId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/NewsTagRelaxService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/NewsTagRelaxService.java new file mode 100644 index 0000000..2e86ac3 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/NewsTagRelaxService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.NewsTagRelax; +import org.springframework.stereotype.Component; + + +/** + * (NewsTagRelax)表服务接口 + * + * @author java + * @since 2021-04-30 14:03:25 + */ + +@Component +public interface NewsTagRelaxService { + + /** + * 通过ID查询单条数据 + * + * @param newsTagRelaxId 主键 + * @return 实例对象 + */ + NewsTagRelax queryById(Integer newsTagRelaxId); + + /** + * 新增数据 + * + * @param newsTagRelax 实例对象 + * @return 实例对象 + */ + NewsTagRelax insert(NewsTagRelax newsTagRelax); + + /** + * 修改数据 + * + * @param newsTagRelax 实例对象 + * @return 实例对象 + */ + NewsTagRelax update(NewsTagRelax newsTagRelax); + + /** + * 通过主键删除数据 + * + * @param newsTagRelaxId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer newsTagRelaxId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/NewsTagService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/NewsTagService.java new file mode 100644 index 0000000..abe8170 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/NewsTagService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.NewsTag; +import org.springframework.stereotype.Component; + + +/** + * 新闻标签表(NewsTag)表服务接口 + * + * @author java + * @since 2021-04-30 14:03:24 + */ + +@Component +public interface NewsTagService { + + /** + * 通过ID查询单条数据 + * + * @param tagId 主键 + * @return 实例对象 + */ + NewsTag queryById(Integer tagId); + + /** + * 新增数据 + * + * @param newsTag 实例对象 + * @return 实例对象 + */ + NewsTag insert(NewsTag newsTag); + + /** + * 修改数据 + * + * @param newsTag 实例对象 + * @return 实例对象 + */ + NewsTag update(NewsTag newsTag); + + /** + * 通过主键删除数据 + * + * @param tagId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer tagId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/RolesService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/RolesService.java new file mode 100644 index 0000000..2bc3288 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/RolesService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.Roles; +import org.springframework.stereotype.Component; + + +/** + * (Roles)表服务接口 + * + * @author java + * @since 2021-04-30 15:08:18 + */ + +@Component +public interface RolesService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + Roles queryById(Integer id); + + /** + * 新增数据 + * + * @param roles 实例对象 + * @return 实例对象 + */ + Roles insert(Roles roles); + + /** + * 修改数据 + * + * @param roles 实例对象 + * @return 实例对象 + */ + Roles update(Roles roles); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Integer id); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryPictureService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryPictureService.java new file mode 100644 index 0000000..08fb34e --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryPictureService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.SceneryPicture; +import org.springframework.stereotype.Component; + + +/** + * 景点图片表(SceneryPicture)表服务接口 + * + * @author java + * @since 2021-04-27 15:26:10 + */ + +@Component +public interface SceneryPictureService { + + /** + * 通过ID查询单条数据 + * + * @param sceneryPictureId 主键 + * @return 实例对象 + */ + SceneryPicture queryById(Integer sceneryPictureId); + + /** + * 新增数据 + * + * @param sceneryPicture 实例对象 + * @return 实例对象 + */ + SceneryPicture insert(SceneryPicture sceneryPicture); + + /** + * 修改数据 + * + * @param sceneryPicture 实例对象 + * @return 实例对象 + */ + SceneryPicture update(SceneryPicture sceneryPicture); + + /** + * 通过主键删除数据 + * + * @param sceneryPictureId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer sceneryPictureId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryService.java new file mode 100644 index 0000000..b8bfe5f --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.Scenery; +import org.springframework.stereotype.Component; + + +/** + * 景点表(Scenery)表服务接口 + * + * @author java + * @since 2021-04-25 09:27:40 + */ + +@Component +public interface SceneryService { + + /** + * 通过ID查询单条数据 + * + * @param sceneryId 主键 + * @return 实例对象 + */ + Scenery queryById(Integer sceneryId); + + /** + * 新增数据 + * + * @param scenery 实例对象 + * @return 实例对象 + */ + Scenery insert(Scenery scenery); + + /** + * 修改数据 + * + * @param scenery 实例对象 + * @return 实例对象 + */ + Scenery update(Scenery scenery); + + /** + * 通过主键删除数据 + * + * @param sceneryId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer sceneryId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryTagService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryTagService.java new file mode 100644 index 0000000..c93c78b --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryTagService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.SceneryTag; +import org.springframework.stereotype.Component; + + +/** + * 景点标签(SceneryTag)表服务接口 + * + * @author java + * @since 2021-04-27 15:26:11 + */ + +@Component +public interface SceneryTagService { + + /** + * 通过ID查询单条数据 + * + * @param sceneryTagId 主键 + * @return 实例对象 + */ + SceneryTag queryById(Integer sceneryTagId); + + /** + * 新增数据 + * + * @param sceneryTag 实例对象 + * @return 实例对象 + */ + SceneryTag insert(SceneryTag sceneryTag); + + /** + * 修改数据 + * + * @param sceneryTag 实例对象 + * @return 实例对象 + */ + SceneryTag update(SceneryTag sceneryTag); + + /** + * 通过主键删除数据 + * + * @param sceneryTagId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer sceneryTagId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryTicketsService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryTicketsService.java new file mode 100644 index 0000000..041f31c --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryTicketsService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.SceneryTickets; +import org.springframework.stereotype.Component; + + +/** + * 景点门票表(SceneryTickets)表服务接口 + * + * @author java + * @since 2021-04-25 09:34:29 + */ + +@Component +public interface SceneryTicketsService { + + /** + * 通过ID查询单条数据 + * + * @param sceneryTicketId 主键 + * @return 实例对象 + */ + SceneryTickets queryById(Integer sceneryTicketId); + + /** + * 新增数据 + * + * @param sceneryTickets 实例对象 + * @return 实例对象 + */ + SceneryTickets insert(SceneryTickets sceneryTickets); + + /** + * 修改数据 + * + * @param sceneryTickets 实例对象 + * @return 实例对象 + */ + SceneryTickets update(SceneryTickets sceneryTickets); + + /** + * 通过主键删除数据 + * + * @param sceneryTicketId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer sceneryTicketId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryTicketsTypeService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryTicketsTypeService.java new file mode 100644 index 0000000..e90c961 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryTicketsTypeService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.SceneryTicketsType; +import org.springframework.stereotype.Component; + + +/** + * 门票类型表(SceneryTicketsType)表服务接口 + * + * @author java + * @since 2021-04-25 09:39:56 + */ + +@Component +public interface SceneryTicketsTypeService { + + /** + * 通过ID查询单条数据 + * + * @param ticketsTypeId 主键 + * @return 实例对象 + */ + SceneryTicketsType queryById(Integer ticketsTypeId); + + /** + * 新增数据 + * + * @param sceneryTicketsType 实例对象 + * @return 实例对象 + */ + SceneryTicketsType insert(SceneryTicketsType sceneryTicketsType); + + /** + * 修改数据 + * + * @param sceneryTicketsType 实例对象 + * @return 实例对象 + */ + SceneryTicketsType update(SceneryTicketsType sceneryTicketsType); + + /** + * 通过主键删除数据 + * + * @param ticketsTypeId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer ticketsTypeId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryVideoService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryVideoService.java new file mode 100644 index 0000000..0ae28a5 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/SceneryVideoService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.SceneryVideo; +import org.springframework.stereotype.Component; + + +/** + * 景点视频表(SceneryVideo)表服务接口 + * + * @author java + * @since 2021-04-27 15:26:48 + */ + +@Component +public interface SceneryVideoService { + + /** + * 通过ID查询单条数据 + * + * @param sceneryVideoId 主键 + * @return 实例对象 + */ + SceneryVideo queryById(Integer sceneryVideoId); + + /** + * 新增数据 + * + * @param sceneryVideo 实例对象 + * @return 实例对象 + */ + SceneryVideo insert(SceneryVideo sceneryVideo); + + /** + * 修改数据 + * + * @param sceneryVideo 实例对象 + * @return 实例对象 + */ + SceneryVideo update(SceneryVideo sceneryVideo); + + /** + * 通过主键删除数据 + * + * @param sceneryVideoId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer sceneryVideoId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserOrderDetailService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserOrderDetailService.java new file mode 100644 index 0000000..2cf8d57 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserOrderDetailService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.UserOrderDetail; +import org.springframework.stereotype.Component; + + +/** + * 订单详情表(UserOrderDetail)表服务接口 + * + * @author java + * @since 2021-04-30 17:01:28 + */ + +@Component +public interface UserOrderDetailService { + + /** + * 通过ID查询单条数据 + * + * @param orderDetailId 主键 + * @return 实例对象 + */ + UserOrderDetail queryById(Integer orderDetailId); + + /** + * 新增数据 + * + * @param userOrderDetail 实例对象 + * @return 实例对象 + */ + UserOrderDetail insert(UserOrderDetail userOrderDetail); + + /** + * 修改数据 + * + * @param userOrderDetail 实例对象 + * @return 实例对象 + */ + UserOrderDetail update(UserOrderDetail userOrderDetail); + + /** + * 通过主键删除数据 + * + * @param orderDetailId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer orderDetailId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserOrdersService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserOrdersService.java new file mode 100644 index 0000000..2bfd006 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserOrdersService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.UserOrders; +import org.springframework.stereotype.Component; + + +/** + * 订单表(UserOrders)表服务接口 + * + * @author java + * @since 2021-04-30 17:01:29 + */ + +@Component +public interface UserOrdersService { + + /** + * 通过ID查询单条数据 + * + * @param ordersId 主键 + * @return 实例对象 + */ + UserOrders queryById(Integer ordersId); + + /** + * 新增数据 + * + * @param userOrders 实例对象 + * @return 实例对象 + */ + UserOrders insert(UserOrders userOrders); + + /** + * 修改数据 + * + * @param userOrders 实例对象 + * @return 实例对象 + */ + UserOrders update(UserOrders userOrders); + + /** + * 通过主键删除数据 + * + * @param ordersId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer ordersId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserShopService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserShopService.java new file mode 100644 index 0000000..ad24303 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserShopService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.UserShop; +import org.springframework.stereotype.Component; + + +/** + * 购物车表(UserShop)表服务接口 + * + * @author java + * @since 2021-04-30 17:01:30 + */ + +@Component +public interface UserShopService { + + /** + * 通过ID查询单条数据 + * + * @param userShopId 主键 + * @return 实例对象 + */ + UserShop queryById(Integer userShopId); + + /** + * 新增数据 + * + * @param userShop 实例对象 + * @return 实例对象 + */ + UserShop insert(UserShop userShop); + + /** + * 修改数据 + * + * @param userShop 实例对象 + * @return 实例对象 + */ + UserShop update(UserShop userShop); + + /** + * 通过主键删除数据 + * + * @param userShopId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer userShopId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserTicketsService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserTicketsService.java new file mode 100644 index 0000000..d632899 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UserTicketsService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.UserTickets; +import org.springframework.stereotype.Component; + + +/** + * 用户门票(UserTickets)表服务接口 + * + * @author java + * @since 2021-04-30 17:01:30 + */ + +@Component +public interface UserTicketsService { + + /** + * 通过ID查询单条数据 + * + * @param userTicketsId 主键 + * @return 实例对象 + */ + UserTickets queryById(Integer userTicketsId); + + /** + * 新增数据 + * + * @param userTickets 实例对象 + * @return 实例对象 + */ + UserTickets insert(UserTickets userTickets); + + /** + * 修改数据 + * + * @param userTickets 实例对象 + * @return 实例对象 + */ + UserTickets update(UserTickets userTickets); + + /** + * 通过主键删除数据 + * + * @param userTicketsId 主键 + * @return 是否成功 + */ + boolean deleteById(Integer userTicketsId); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UsersRoleService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UsersRoleService.java new file mode 100644 index 0000000..792e87f --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UsersRoleService.java @@ -0,0 +1,60 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.UsersRole; +import org.springframework.stereotype.Component; + + +/** + * (UsersRole)表服务接口 + * + * @author java + * @since 2021-04-30 15:08:37 + */ + +@Component +public interface UsersRoleService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + UsersRole queryById(Integer id); + + /** + * 新增数据 + * + * @param usersRole 实例对象 + * @return 实例对象 + */ + UsersRole insert(UsersRole usersRole); + + /** + * 修改数据 + * + * @param usersRole 实例对象 + * @return 实例对象 + */ + UsersRole update(UsersRole usersRole); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Integer id); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UsersService.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UsersService.java new file mode 100644 index 0000000..504c2f6 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/UsersService.java @@ -0,0 +1,78 @@ +package com.hc.tripbusiness.service; + +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.Users; +import com.hc.tripbusiness.model.login.AccessEntity; +import org.springframework.stereotype.Component; + + +/** + * (Users)表服务接口 + * + * @author java + * @since 2021-04-25 17:45:10 + */ + +@Component +public interface UsersService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + Users queryById(Long id); + + /** + * 新增数据 + * + * @param users 实例对象 + * @return 实例对象 + */ + Users insert(Users users); + + /** + * 修改数据 + * + * @param users 实例对象 + * @return 实例对象 + */ + Users update(Users users); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Long id); + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + PageInfo queryAllByLimit(int page, int size); + + /** + * 微信官方用户登录 + * + * @param appid + * @param code + * @return + */ + String login(String appid, String code); + + /** + * 依据openId 获取用户信息 + * + * @param openId + * @return + */ + AccessEntity selectUserByOpenId(String openId); + + +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/BannerServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/BannerServiceImpl.java new file mode 100644 index 0000000..3d3ab7b --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/BannerServiceImpl.java @@ -0,0 +1,88 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.Banner; +import com.hc.tripbusiness.mapper.BannerMapper; +import com.hc.tripbusiness.service.BannerService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 广告表 + * (Banner)表服务实现类 + * + * @author java + * @since 2021-04-30 14:19:20 + */ + +@Service("bannerService") +public class BannerServiceImpl implements BannerService { + + private final BannerMapper bannerMapper; + + public BannerServiceImpl(BannerMapper bannerMapper) { + this.bannerMapper = bannerMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param bannerId 主键 + * @return 实例对象 + */ + @Override + public Banner queryById(Integer bannerId) { + return this.bannerMapper.selectByPrimaryKey(bannerId); + } + + /** + * 新增数据 + * + * @param banner 实例对象 + * @return 实例对象 + */ + @Override + public Banner insert(Banner banner) { + banner.setCreateTime(System.currentTimeMillis()); + this.bannerMapper.insert(banner); + return banner; + } + + /** + * 修改数据 + * + * @param banner 实例对象 + * @return 实例对象 + */ + @Override + public Banner update(Banner banner) { + banner.setUpdateTime(System.currentTimeMillis()); + this.bannerMapper.updateByPrimaryKeySelective(banner); + return this.queryById(banner.getBannerId()); + } + + /** + * 通过主键删除数据 + * + * @param bannerId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer bannerId) { + return this.bannerMapper.deleteByPrimaryKey(bannerId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.bannerMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/NewsServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/NewsServiceImpl.java new file mode 100644 index 0000000..5525198 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/NewsServiceImpl.java @@ -0,0 +1,88 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.News; +import com.hc.tripbusiness.mapper.NewsMapper; +import com.hc.tripbusiness.service.NewsService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 新闻表 + * (News)表服务实现类 + * + * @author java + * @since 2021-04-30 14:03:23 + */ + +@Service("newsService") +public class NewsServiceImpl implements NewsService { + + private final NewsMapper newsMapper; + + public NewsServiceImpl(NewsMapper newsMapper) { + this.newsMapper = newsMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param newsId 主键 + * @return 实例对象 + */ + @Override + public News queryById(Integer newsId) { + return this.newsMapper.selectByPrimaryKey(newsId); + } + + /** + * 新增数据 + * + * @param news 实例对象 + * @return 实例对象 + */ + @Override + public News insert(News news) { + news.setCreateTime(System.currentTimeMillis()); + this.newsMapper.insert(news); + return news; + } + + /** + * 修改数据 + * + * @param news 实例对象 + * @return 实例对象 + */ + @Override + public News update(News news) { + news.setUpdateTime(System.currentTimeMillis()); + this.newsMapper.updateByPrimaryKeySelective(news); + return this.queryById(news.getNewsId()); + } + + /** + * 通过主键删除数据 + * + * @param newsId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer newsId) { + return this.newsMapper.deleteByPrimaryKey(newsId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.newsMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/NewsTagRelaxServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/NewsTagRelaxServiceImpl.java new file mode 100644 index 0000000..6aba443 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/NewsTagRelaxServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.NewsTagRelax; +import com.hc.tripbusiness.mapper.NewsTagRelaxMapper; +import com.hc.tripbusiness.service.NewsTagRelaxService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * (NewsTagRelax)表服务实现类 + * + * @author java + * @since 2021-04-30 14:03:25 + */ + +@Service("newsTagRelaxService") +public class NewsTagRelaxServiceImpl implements NewsTagRelaxService { + + private final NewsTagRelaxMapper newsTagRelaxMapper; + + public NewsTagRelaxServiceImpl(NewsTagRelaxMapper newsTagRelaxMapper) { + this.newsTagRelaxMapper = newsTagRelaxMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param newsTagRelaxId 主键 + * @return 实例对象 + */ + @Override + public NewsTagRelax queryById(Integer newsTagRelaxId) { + return this.newsTagRelaxMapper.selectByPrimaryKey(newsTagRelaxId); + } + + /** + * 新增数据 + * + * @param newsTagRelax 实例对象 + * @return 实例对象 + */ + @Override + public NewsTagRelax insert(NewsTagRelax newsTagRelax) { + newsTagRelax.setCreateTime(System.currentTimeMillis()); + this.newsTagRelaxMapper.insert(newsTagRelax); + return newsTagRelax; + } + + /** + * 修改数据 + * + * @param newsTagRelax 实例对象 + * @return 实例对象 + */ + @Override + public NewsTagRelax update(NewsTagRelax newsTagRelax) { + newsTagRelax.setUpdateTime(System.currentTimeMillis()); + this.newsTagRelaxMapper.updateByPrimaryKeySelective(newsTagRelax); + return this.queryById(newsTagRelax.getNewsTagRelaxId()); + } + + /** + * 通过主键删除数据 + * + * @param newsTagRelaxId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer newsTagRelaxId) { + return this.newsTagRelaxMapper.deleteByPrimaryKey(newsTagRelaxId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.newsTagRelaxMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/NewsTagServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/NewsTagServiceImpl.java new file mode 100644 index 0000000..b522ac9 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/NewsTagServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.NewsTag; +import com.hc.tripbusiness.mapper.NewsTagMapper; +import com.hc.tripbusiness.service.NewsTagService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 新闻标签表(NewsTag)表服务实现类 + * + * @author java + * @since 2021-04-30 14:03:24 + */ + +@Service("newsTagService") +public class NewsTagServiceImpl implements NewsTagService { + + private final NewsTagMapper newsTagMapper; + + public NewsTagServiceImpl(NewsTagMapper newsTagMapper) { + this.newsTagMapper = newsTagMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param tagId 主键 + * @return 实例对象 + */ + @Override + public NewsTag queryById(Integer tagId) { + return this.newsTagMapper.selectByPrimaryKey(tagId); + } + + /** + * 新增数据 + * + * @param newsTag 实例对象 + * @return 实例对象 + */ + @Override + public NewsTag insert(NewsTag newsTag) { + newsTag.setCreateTime(System.currentTimeMillis()); + this.newsTagMapper.insert(newsTag); + return newsTag; + } + + /** + * 修改数据 + * + * @param newsTag 实例对象 + * @return 实例对象 + */ + @Override + public NewsTag update(NewsTag newsTag) { + newsTag.setUpdateTime(System.currentTimeMillis()); + this.newsTagMapper.updateByPrimaryKeySelective(newsTag); + return this.queryById(newsTag.getTagId()); + } + + /** + * 通过主键删除数据 + * + * @param tagId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer tagId) { + return this.newsTagMapper.deleteByPrimaryKey(tagId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.newsTagMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/RolesServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/RolesServiceImpl.java new file mode 100644 index 0000000..b3a4c39 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/RolesServiceImpl.java @@ -0,0 +1,85 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.Roles; +import com.hc.tripbusiness.mapper.RolesMapper; +import com.hc.tripbusiness.service.RolesService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * (Roles)表服务实现类 + * + * @author java + * @since 2021-04-30 15:08:18 + */ + +@Service("rolesService") +public class RolesServiceImpl implements RolesService { + + private final RolesMapper rolesMapper; + + public RolesServiceImpl(RolesMapper rolesMapper) { + this.rolesMapper = rolesMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public Roles queryById(Integer id) { + return this.rolesMapper.selectByPrimaryKey(id); + } + + /** + * 新增数据 + * + * @param roles 实例对象 + * @return 实例对象 + */ + @Override + public Roles insert(Roles roles) { + this.rolesMapper.insert(roles); + return roles; + } + + /** + * 修改数据 + * + * @param roles 实例对象 + * @return 实例对象 + */ + @Override + public Roles update(Roles roles) { + this.rolesMapper.updateByPrimaryKeySelective(roles); + return this.queryById(roles.getId()); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer id) { + return this.rolesMapper.deleteByPrimaryKey(id) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.rolesMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryPictureServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryPictureServiceImpl.java new file mode 100644 index 0000000..9fd20a2 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryPictureServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.SceneryPicture; +import com.hc.tripbusiness.mapper.SceneryPictureMapper; +import com.hc.tripbusiness.service.SceneryPictureService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 景点图片表(SceneryPicture)表服务实现类 + * + * @author java + * @since 2021-04-27 15:26:10 + */ + +@Service("sceneryPictureService") +public class SceneryPictureServiceImpl implements SceneryPictureService { + + private final SceneryPictureMapper sceneryPictureMapper; + + public SceneryPictureServiceImpl(SceneryPictureMapper sceneryPictureMapper) { + this.sceneryPictureMapper = sceneryPictureMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param sceneryPictureId 主键 + * @return 实例对象 + */ + @Override + public SceneryPicture queryById(Integer sceneryPictureId) { + return this.sceneryPictureMapper.selectByPrimaryKey(sceneryPictureId); + } + + /** + * 新增数据 + * + * @param sceneryPicture 实例对象 + * @return 实例对象 + */ + @Override + public SceneryPicture insert(SceneryPicture sceneryPicture) { + sceneryPicture.setCreateTime(System.currentTimeMillis()); + this.sceneryPictureMapper.insert(sceneryPicture); + return sceneryPicture; + } + + /** + * 修改数据 + * + * @param sceneryPicture 实例对象 + * @return 实例对象 + */ + @Override + public SceneryPicture update(SceneryPicture sceneryPicture) { + sceneryPicture.setUpdateTime(System.currentTimeMillis()); + this.sceneryPictureMapper.updateByPrimaryKeySelective(sceneryPicture); + return this.queryById(sceneryPicture.getSceneryPictureId()); + } + + /** + * 通过主键删除数据 + * + * @param sceneryPictureId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer sceneryPictureId) { + return this.sceneryPictureMapper.deleteByPrimaryKey(sceneryPictureId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.sceneryPictureMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryServiceImpl.java new file mode 100644 index 0000000..6c62ab7 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.Scenery; +import com.hc.tripbusiness.mapper.SceneryMapper; +import com.hc.tripbusiness.service.SceneryService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 景点表(Scenery)表服务实现类 + * + * @author java + * @since 2021-04-25 09:27:40 + */ + +@Service("sceneryService") +public class SceneryServiceImpl implements SceneryService { + + private final SceneryMapper sceneryMapper; + + public SceneryServiceImpl(SceneryMapper sceneryMapper) { + this.sceneryMapper = sceneryMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param sceneryId 主键 + * @return 实例对象 + */ + @Override + public Scenery queryById(Integer sceneryId) { + return this.sceneryMapper.selectByPrimaryKey(sceneryId); + } + + /** + * 新增数据 + * + * @param scenery 实例对象 + * @return 实例对象 + */ + @Override + public Scenery insert(Scenery scenery) { + scenery.setCreateTime(System.currentTimeMillis()); + this.sceneryMapper.insert(scenery); + return scenery; + } + + /** + * 修改数据 + * + * @param scenery 实例对象 + * @return 实例对象 + */ + @Override + public Scenery update(Scenery scenery) { + scenery.setUpdateTime(System.currentTimeMillis()); + this.sceneryMapper.updateByPrimaryKeySelective(scenery); + return this.queryById(scenery.getSceneryId()); + } + + /** + * 通过主键删除数据 + * + * @param sceneryId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer sceneryId) { + return this.sceneryMapper.deleteByPrimaryKey(sceneryId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.sceneryMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryTagServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryTagServiceImpl.java new file mode 100644 index 0000000..4497492 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryTagServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.SceneryTag; +import com.hc.tripbusiness.mapper.SceneryTagMapper; +import com.hc.tripbusiness.service.SceneryTagService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 景点标签(SceneryTag)表服务实现类 + * + * @author java + * @since 2021-04-27 15:26:11 + */ + +@Service("sceneryTagService") +public class SceneryTagServiceImpl implements SceneryTagService { + + private final SceneryTagMapper sceneryTagMapper; + + public SceneryTagServiceImpl(SceneryTagMapper sceneryTagMapper) { + this.sceneryTagMapper = sceneryTagMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param sceneryTagId 主键 + * @return 实例对象 + */ + @Override + public SceneryTag queryById(Integer sceneryTagId) { + return this.sceneryTagMapper.selectByPrimaryKey(sceneryTagId); + } + + /** + * 新增数据 + * + * @param sceneryTag 实例对象 + * @return 实例对象 + */ + @Override + public SceneryTag insert(SceneryTag sceneryTag) { + sceneryTag.setCreateTime(System.currentTimeMillis()); + this.sceneryTagMapper.insert(sceneryTag); + return sceneryTag; + } + + /** + * 修改数据 + * + * @param sceneryTag 实例对象 + * @return 实例对象 + */ + @Override + public SceneryTag update(SceneryTag sceneryTag) { + sceneryTag.setUpdateTime(System.currentTimeMillis()); + this.sceneryTagMapper.updateByPrimaryKeySelective(sceneryTag); + return this.queryById(sceneryTag.getSceneryTagId()); + } + + /** + * 通过主键删除数据 + * + * @param sceneryTagId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer sceneryTagId) { + return this.sceneryTagMapper.deleteByPrimaryKey(sceneryTagId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.sceneryTagMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryTicketsServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryTicketsServiceImpl.java new file mode 100644 index 0000000..5cc25e3 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryTicketsServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.SceneryTickets; +import com.hc.tripbusiness.mapper.SceneryTicketsMapper; +import com.hc.tripbusiness.service.SceneryTicketsService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 景点门票表(SceneryTickets)表服务实现类 + * + * @author java + * @since 2021-04-25 09:34:29 + */ + +@Service("sceneryTicketsService") +public class SceneryTicketsServiceImpl implements SceneryTicketsService { + + private final SceneryTicketsMapper sceneryTicketsMapper; + + public SceneryTicketsServiceImpl(SceneryTicketsMapper sceneryTicketsMapper) { + this.sceneryTicketsMapper = sceneryTicketsMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param sceneryTicketId 主键 + * @return 实例对象 + */ + @Override + public SceneryTickets queryById(Integer sceneryTicketId) { + return this.sceneryTicketsMapper.selectByPrimaryKey(sceneryTicketId); + } + + /** + * 新增数据 + * + * @param sceneryTickets 实例对象 + * @return 实例对象 + */ + @Override + public SceneryTickets insert(SceneryTickets sceneryTickets) { + sceneryTickets.setCreateTime(System.currentTimeMillis()); + this.sceneryTicketsMapper.insert(sceneryTickets); + return sceneryTickets; + } + + /** + * 修改数据 + * + * @param sceneryTickets 实例对象 + * @return 实例对象 + */ + @Override + public SceneryTickets update(SceneryTickets sceneryTickets) { + sceneryTickets.setUpdateTime(System.currentTimeMillis()); + this.sceneryTicketsMapper.updateByPrimaryKeySelective(sceneryTickets); + return this.queryById(sceneryTickets.getSceneryTicketId()); + } + + /** + * 通过主键删除数据 + * + * @param sceneryTicketId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer sceneryTicketId) { + return this.sceneryTicketsMapper.deleteByPrimaryKey(sceneryTicketId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.sceneryTicketsMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryTicketsTypeServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryTicketsTypeServiceImpl.java new file mode 100644 index 0000000..df9c22f --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryTicketsTypeServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.SceneryTicketsType; +import com.hc.tripbusiness.mapper.SceneryTicketsTypeMapper; +import com.hc.tripbusiness.service.SceneryTicketsTypeService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 门票类型表(SceneryTicketsType)表服务实现类 + * + * @author java + * @since 2021-04-25 09:39:56 + */ + +@Service("sceneryTicketsTypeService") +public class SceneryTicketsTypeServiceImpl implements SceneryTicketsTypeService { + + private final SceneryTicketsTypeMapper sceneryTicketsTypeMapper; + + public SceneryTicketsTypeServiceImpl(SceneryTicketsTypeMapper sceneryTicketsTypeMapper) { + this.sceneryTicketsTypeMapper = sceneryTicketsTypeMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param ticketsTypeId 主键 + * @return 实例对象 + */ + @Override + public SceneryTicketsType queryById(Integer ticketsTypeId) { + return this.sceneryTicketsTypeMapper.selectByPrimaryKey(ticketsTypeId); + } + + /** + * 新增数据 + * + * @param sceneryTicketsType 实例对象 + * @return 实例对象 + */ + @Override + public SceneryTicketsType insert(SceneryTicketsType sceneryTicketsType) { + sceneryTicketsType.setCreateTime(System.currentTimeMillis()); + this.sceneryTicketsTypeMapper.insert(sceneryTicketsType); + return sceneryTicketsType; + } + + /** + * 修改数据 + * + * @param sceneryTicketsType 实例对象 + * @return 实例对象 + */ + @Override + public SceneryTicketsType update(SceneryTicketsType sceneryTicketsType) { + sceneryTicketsType.setUpdateTime(System.currentTimeMillis()); + this.sceneryTicketsTypeMapper.updateByPrimaryKeySelective(sceneryTicketsType); + return this.queryById(sceneryTicketsType.getTicketsTypeId()); + } + + /** + * 通过主键删除数据 + * + * @param ticketsTypeId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer ticketsTypeId) { + return this.sceneryTicketsTypeMapper.deleteByPrimaryKey(ticketsTypeId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.sceneryTicketsTypeMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryVideoServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryVideoServiceImpl.java new file mode 100644 index 0000000..8f10ffd --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/SceneryVideoServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.SceneryVideo; +import com.hc.tripbusiness.mapper.SceneryVideoMapper; +import com.hc.tripbusiness.service.SceneryVideoService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 景点视频表(SceneryVideo)表服务实现类 + * + * @author java + * @since 2021-04-27 15:26:48 + */ + +@Service("sceneryVideoService") +public class SceneryVideoServiceImpl implements SceneryVideoService { + + private final SceneryVideoMapper sceneryVideoMapper; + + public SceneryVideoServiceImpl(SceneryVideoMapper sceneryVideoMapper) { + this.sceneryVideoMapper = sceneryVideoMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param sceneryVideoId 主键 + * @return 实例对象 + */ + @Override + public SceneryVideo queryById(Integer sceneryVideoId) { + return this.sceneryVideoMapper.selectByPrimaryKey(sceneryVideoId); + } + + /** + * 新增数据 + * + * @param sceneryVideo 实例对象 + * @return 实例对象 + */ + @Override + public SceneryVideo insert(SceneryVideo sceneryVideo) { + sceneryVideo.setCreateTime(System.currentTimeMillis()); + this.sceneryVideoMapper.insert(sceneryVideo); + return sceneryVideo; + } + + /** + * 修改数据 + * + * @param sceneryVideo 实例对象 + * @return 实例对象 + */ + @Override + public SceneryVideo update(SceneryVideo sceneryVideo) { + sceneryVideo.setUpdateTime(System.currentTimeMillis()); + this.sceneryVideoMapper.updateByPrimaryKeySelective(sceneryVideo); + return this.queryById(sceneryVideo.getSceneryVideoId()); + } + + /** + * 通过主键删除数据 + * + * @param sceneryVideoId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer sceneryVideoId) { + return this.sceneryVideoMapper.deleteByPrimaryKey(sceneryVideoId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.sceneryVideoMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserOrderDetailServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserOrderDetailServiceImpl.java new file mode 100644 index 0000000..426c20f --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserOrderDetailServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.UserOrderDetail; +import com.hc.tripbusiness.mapper.UserOrderDetailMapper; +import com.hc.tripbusiness.service.UserOrderDetailService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 订单详情表(UserOrderDetail)表服务实现类 + * + * @author java + * @since 2021-04-30 17:01:28 + */ + +@Service("userOrderDetailService") +public class UserOrderDetailServiceImpl implements UserOrderDetailService { + + private final UserOrderDetailMapper userOrderDetailMapper; + + public UserOrderDetailServiceImpl(UserOrderDetailMapper userOrderDetailMapper) { + this.userOrderDetailMapper = userOrderDetailMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param orderDetailId 主键 + * @return 实例对象 + */ + @Override + public UserOrderDetail queryById(Integer orderDetailId) { + return this.userOrderDetailMapper.selectByPrimaryKey(orderDetailId); + } + + /** + * 新增数据 + * + * @param userOrderDetail 实例对象 + * @return 实例对象 + */ + @Override + public UserOrderDetail insert(UserOrderDetail userOrderDetail) { + userOrderDetail.setCreateTime(System.currentTimeMillis()); + this.userOrderDetailMapper.insert(userOrderDetail); + return userOrderDetail; + } + + /** + * 修改数据 + * + * @param userOrderDetail 实例对象 + * @return 实例对象 + */ + @Override + public UserOrderDetail update(UserOrderDetail userOrderDetail) { + userOrderDetail.setUpdateTime(System.currentTimeMillis()); + this.userOrderDetailMapper.updateByPrimaryKeySelective(userOrderDetail); + return this.queryById(userOrderDetail.getOrderDetailId()); + } + + /** + * 通过主键删除数据 + * + * @param orderDetailId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer orderDetailId) { + return this.userOrderDetailMapper.deleteByPrimaryKey(orderDetailId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.userOrderDetailMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserOrdersServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserOrdersServiceImpl.java new file mode 100644 index 0000000..22f9d9c --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserOrdersServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.UserOrders; +import com.hc.tripbusiness.mapper.UserOrdersMapper; +import com.hc.tripbusiness.service.UserOrdersService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 订单表(UserOrders)表服务实现类 + * + * @author java + * @since 2021-04-30 17:01:29 + */ + +@Service("userOrdersService") +public class UserOrdersServiceImpl implements UserOrdersService { + + private final UserOrdersMapper userOrdersMapper; + + public UserOrdersServiceImpl(UserOrdersMapper userOrdersMapper) { + this.userOrdersMapper = userOrdersMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param ordersId 主键 + * @return 实例对象 + */ + @Override + public UserOrders queryById(Integer ordersId) { + return this.userOrdersMapper.selectByPrimaryKey(ordersId); + } + + /** + * 新增数据 + * + * @param userOrders 实例对象 + * @return 实例对象 + */ + @Override + public UserOrders insert(UserOrders userOrders) { + userOrders.setCreateTime(System.currentTimeMillis()); + this.userOrdersMapper.insert(userOrders); + return userOrders; + } + + /** + * 修改数据 + * + * @param userOrders 实例对象 + * @return 实例对象 + */ + @Override + public UserOrders update(UserOrders userOrders) { + userOrders.setUpdateTime(System.currentTimeMillis()); + this.userOrdersMapper.updateByPrimaryKeySelective(userOrders); + return this.queryById(userOrders.getOrdersId()); + } + + /** + * 通过主键删除数据 + * + * @param ordersId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer ordersId) { + return this.userOrdersMapper.deleteByPrimaryKey(ordersId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.userOrdersMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserShopServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserShopServiceImpl.java new file mode 100644 index 0000000..cf8aa85 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserShopServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.UserShop; +import com.hc.tripbusiness.mapper.UserShopMapper; +import com.hc.tripbusiness.service.UserShopService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 购物车表(UserShop)表服务实现类 + * + * @author java + * @since 2021-04-30 17:01:30 + */ + +@Service("userShopService") +public class UserShopServiceImpl implements UserShopService { + + private final UserShopMapper userShopMapper; + + public UserShopServiceImpl(UserShopMapper userShopMapper) { + this.userShopMapper = userShopMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param userShopId 主键 + * @return 实例对象 + */ + @Override + public UserShop queryById(Integer userShopId) { + return this.userShopMapper.selectByPrimaryKey(userShopId); + } + + /** + * 新增数据 + * + * @param userShop 实例对象 + * @return 实例对象 + */ + @Override + public UserShop insert(UserShop userShop) { + userShop.setCreateTime(System.currentTimeMillis()); + this.userShopMapper.insert(userShop); + return userShop; + } + + /** + * 修改数据 + * + * @param userShop 实例对象 + * @return 实例对象 + */ + @Override + public UserShop update(UserShop userShop) { + userShop.setUpdateTime(System.currentTimeMillis()); + this.userShopMapper.updateByPrimaryKeySelective(userShop); + return this.queryById(userShop.getUserShopId()); + } + + /** + * 通过主键删除数据 + * + * @param userShopId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer userShopId) { + return this.userShopMapper.deleteByPrimaryKey(userShopId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.userShopMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserTicketsServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserTicketsServiceImpl.java new file mode 100644 index 0000000..eaf25ca --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UserTicketsServiceImpl.java @@ -0,0 +1,87 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.UserTickets; +import com.hc.tripbusiness.mapper.UserTicketsMapper; +import com.hc.tripbusiness.service.UserTicketsService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 用户门票(UserTickets)表服务实现类 + * + * @author java + * @since 2021-04-30 17:01:31 + */ + +@Service("userTicketsService") +public class UserTicketsServiceImpl implements UserTicketsService { + + private final UserTicketsMapper userTicketsMapper; + + public UserTicketsServiceImpl(UserTicketsMapper userTicketsMapper) { + this.userTicketsMapper = userTicketsMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param userTicketsId 主键 + * @return 实例对象 + */ + @Override + public UserTickets queryById(Integer userTicketsId) { + return this.userTicketsMapper.selectByPrimaryKey(userTicketsId); + } + + /** + * 新增数据 + * + * @param userTickets 实例对象 + * @return 实例对象 + */ + @Override + public UserTickets insert(UserTickets userTickets) { + userTickets.setCreateTime(System.currentTimeMillis()); + this.userTicketsMapper.insert(userTickets); + return userTickets; + } + + /** + * 修改数据 + * + * @param userTickets 实例对象 + * @return 实例对象 + */ + @Override + public UserTickets update(UserTickets userTickets) { + userTickets.setUpdateTime(System.currentTimeMillis()); + this.userTicketsMapper.updateByPrimaryKeySelective(userTickets); + return this.queryById(userTickets.getUserTicketsId()); + } + + /** + * 通过主键删除数据 + * + * @param userTicketsId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer userTicketsId) { + return this.userTicketsMapper.deleteByPrimaryKey(userTicketsId) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.userTicketsMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UsersRoleServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UsersRoleServiceImpl.java new file mode 100644 index 0000000..9dd6601 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UsersRoleServiceImpl.java @@ -0,0 +1,85 @@ +package com.hc.tripbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.model.UsersRole; +import com.hc.tripbusiness.mapper.UsersRoleMapper; +import com.hc.tripbusiness.service.UsersRoleService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * (UsersRole)表服务实现类 + * + * @author java + * @since 2021-04-30 15:08:37 + */ + +@Service("usersRoleService") +public class UsersRoleServiceImpl implements UsersRoleService { + + private final UsersRoleMapper usersRoleMapper; + + public UsersRoleServiceImpl(UsersRoleMapper usersRoleMapper) { + this.usersRoleMapper = usersRoleMapper; + } + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public UsersRole queryById(Integer id) { + return this.usersRoleMapper.selectByPrimaryKey(id); + } + + /** + * 新增数据 + * + * @param usersRole 实例对象 + * @return 实例对象 + */ + @Override + public UsersRole insert(UsersRole usersRole) { + this.usersRoleMapper.insert(usersRole); + return usersRole; + } + + /** + * 修改数据 + * + * @param usersRole 实例对象 + * @return 实例对象 + */ + @Override + public UsersRole update(UsersRole usersRole) { + this.usersRoleMapper.updateByPrimaryKeySelective(usersRole); + return this.queryById(usersRole.getId()); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer id) { + return this.usersRoleMapper.deleteByPrimaryKey(id) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.usersRoleMapper::selectAll); + } +} diff --git a/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UsersServiceImpl.java b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UsersServiceImpl.java new file mode 100644 index 0000000..da92c74 --- /dev/null +++ b/fenis-trip/trip-business/src/main/java/com/hc/tripbusiness/service/impl/UsersServiceImpl.java @@ -0,0 +1,150 @@ +package com.hc.tripbusiness.service.impl; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hc.tripbusiness.mapper.UsersMapper; +import com.hc.tripbusiness.model.Users; +import com.hc.tripbusiness.model.jwt.GenerateAuthToken; +import com.hc.tripbusiness.model.login.AccessEntity; +import com.hc.tripbusiness.model.login.AuthEntity; +import com.hc.tripbusiness.service.UsersService; +import com.hc.tripcore.utils.enums.InfoEnum; +import com.hc.tripcore.utils.exception.ResponseException; +import com.hc.tripcore.utils.tool.JsonUtils; +import com.hc.tripcore.utils.wechat.WxMaConfiguration; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.exception.WxErrorException; +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +/** + * (Users)表服务实现类 + * + * @author java + * @since 2021-04-25 17:45:11 + */ + +@Slf4j +@Service("usersService") +public class UsersServiceImpl implements UsersService { + + private final UsersMapper usersMapper; + + private final GenerateAuthToken generateAuthToken; + + public UsersServiceImpl(UsersMapper usersMapper, GenerateAuthToken generateAuthToken) { + this.usersMapper = usersMapper; + this.generateAuthToken = generateAuthToken; + } + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public Users queryById(Long id) { + return this.usersMapper.selectByPrimaryKey(id); + } + + /** + * 新增数据 + * + * @param users 实例对象 + * @return 实例对象 + */ + @Override + public Users insert(Users users) { + this.usersMapper.insert(users); + return users; + } + + /** + * 修改数据 + * + * @param users 实例对象 + * @return 实例对象 + */ + @Override + public Users update(Users users) { + this.usersMapper.updateByPrimaryKeySelective(users); + return this.queryById(users.getId()); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Long id) { + return this.usersMapper.deleteByPrimaryKey(id) > 0; + } + + /** + * 分页查询多条数据 + * + * @param page 页码 + * @param size 查询条数 + * @return 对象列表 + */ + @Override + public PageInfo queryAllByLimit(int page, int size) { + return PageHelper.startPage(page, size).doSelectPageInfo(this.usersMapper::selectAll); + } + + @Override + public String login(String appid, String code) { + + if (StringUtils.isBlank(code)) { + return "empty jscode"; + } + + final WxMaService wxService = WxMaConfiguration.getMaService(appid); + try { + WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(code); + log.info(session.getSessionKey()); + log.info(session.getOpenid()); + + //TODO 可以增加自己的逻辑,关联业务相关数据 + + List users = usersMapper.selectUserByOpenId(session.getOpenid()); + if (CollectionUtils.isEmpty(users)) { + Users user = new Users(); + user.setOpenid(session.getOpenid()); + usersMapper.insert(user); + } + + return JsonUtils.toJson(session); + } catch (WxErrorException e) { + log.error(e.getMessage(), e); + return e.toString(); + } + } + + @Override + public AccessEntity selectUserByOpenId(String openId) { + + List users = usersMapper.selectUserByOpenId(openId); + if (CollectionUtils.isEmpty(users)) { + throw new ResponseException(InfoEnum.LOGIN_USER_NAME_ERROR); + } + + Users user = users.get(0); + AuthEntity authEntity = new AuthEntity(); + authEntity.setUserName(openId); + authEntity.setPassword(RandomStringUtils.randomAlphanumeric(10)); + authEntity.setLoginType(1); + return generateAuthToken.generateToken(authEntity, user); + } + + +} diff --git a/fenis-trip/trip-business/src/main/resources/mapper/BannerMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/BannerMapper.xml new file mode 100644 index 0000000..8efe63a --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/BannerMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + banner_id, + banner_title, + banner_url, + banner_index, + target_url, + create_time, + update_time + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/NewsMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/NewsMapper.xml new file mode 100644 index 0000000..60bf384 --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/NewsMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + news_id, + news_title, + news_logo, + news_content, + create_time, + update_time + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/NewsTagMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/NewsTagMapper.xml new file mode 100644 index 0000000..b0666cb --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/NewsTagMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + tag_id, + tag_name, + create_time, + update_time + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/NewsTagRelaxMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/NewsTagRelaxMapper.xml new file mode 100644 index 0000000..c136285 --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/NewsTagRelaxMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + news_tag_relax_id, + tag_id, + news_id, + create_time, + update_time + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/RolesMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/RolesMapper.xml new file mode 100644 index 0000000..0033d43 --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/RolesMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + id, + `name` + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/SceneryMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/SceneryMapper.xml new file mode 100644 index 0000000..8304571 --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/SceneryMapper.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + scenery_id, + scenery_name, + scenery_notes, + scenery_index, + scenery_introduce, + scenery_logo, + create_time, + update_time, + start_time, + end_time, + phone, + website, + traffic + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/SceneryPictureMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/SceneryPictureMapper.xml new file mode 100644 index 0000000..9bd60bb --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/SceneryPictureMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + scenery_picture_id, + picture_name, + picture_url, + picture_introduce, + picture_index, + scenery_id, + create_time, + update_time + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/SceneryTagMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/SceneryTagMapper.xml new file mode 100644 index 0000000..286f113 --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/SceneryTagMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + scenery_tag_id, + tag_name, + create_time, + update_time + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/SceneryTicketsMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/SceneryTicketsMapper.xml new file mode 100644 index 0000000..c784141 --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/SceneryTicketsMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + scenery_ticket_id, + tickets_type_id, + tickets_name, + tickets_price, + ticket_introduce, + tickets_logo, + scenery_id, + ticket_sell_num, + create_time, + update_time + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/SceneryTicketsTypeMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/SceneryTicketsTypeMapper.xml new file mode 100644 index 0000000..f2322ed --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/SceneryTicketsTypeMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + tickets_type_id, + ticket_name, + create_time, + update_time + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/SceneryVideoMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/SceneryVideoMapper.xml new file mode 100644 index 0000000..8c726df --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/SceneryVideoMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + scenery_video_id, + video_name, + video_introduce, + video_index, + video_url, + scenery_id, + create_time, + update_time + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/UserOrderDetailMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/UserOrderDetailMapper.xml new file mode 100644 index 0000000..d623dfd --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/UserOrderDetailMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + order_detail_id, + order_id, + scenery_ticket_id, + num, + create_time, + update_time + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/UserOrdersMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/UserOrdersMapper.xml new file mode 100644 index 0000000..fbe976f --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/UserOrdersMapper.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + orders_id, + order_no, + user_id, + `body`, + `subject`, + total_amount, + order_status, + is_de, + ali_trade_no, + wx_trade_no, + user_invoices_id, + create_time, + update_time, + version + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/UserShopMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/UserShopMapper.xml new file mode 100644 index 0000000..9446780 --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/UserShopMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + user_shop_id, + user_id, + scenery_ticket_id, + num, + create_time, + update_time + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/UserTicketsMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/UserTicketsMapper.xml new file mode 100644 index 0000000..b489127 --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/UserTicketsMapper.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + user_tickets_id, + scenery_ticket_id, + tickets_pass, + tickets_no, + tickets_code, + tickets_time, + user_id, + is_use, + used_time, + create_time, + update_time, + version + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/UsersMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/UsersMapper.xml new file mode 100644 index 0000000..f6dcd6f --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/UsersMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + id, + username, + `password`, + user_logo, + nickname, + gender, + openid + + + + + diff --git a/fenis-trip/trip-business/src/main/resources/mapper/UsersRoleMapper.xml b/fenis-trip/trip-business/src/main/resources/mapper/UsersRoleMapper.xml new file mode 100644 index 0000000..e6105c3 --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mapper/UsersRoleMapper.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + id, + role_id, + user_id + + + diff --git a/fenis-trip/trip-business/src/main/resources/mybatis-config.xml b/fenis-trip/trip-business/src/main/resources/mybatis-config.xml new file mode 100644 index 0000000..7313d8f --- /dev/null +++ b/fenis-trip/trip-business/src/main/resources/mybatis-config.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + diff --git a/fenis-trip/trip-business/trip-business.iml b/fenis-trip/trip-business/trip-business.iml new file mode 100644 index 0000000..ee687d6 --- /dev/null +++ b/fenis-trip/trip-business/trip-business.iml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fenis-trip/trip-core/pom.xml b/fenis-trip/trip-core/pom.xml new file mode 100644 index 0000000..a8237f7 --- /dev/null +++ b/fenis-trip/trip-core/pom.xml @@ -0,0 +1,118 @@ + + + 4.0.0 + + com.hc + fenis-trip + 0.0.1-SNAPSHOT + + + trip-core + 0.0.1-SNAPSHOT + trip-core + Demo project for Spring Boot + + 11 + + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + ${mybatis.version} + + + + tk.mybatis + mapper + ${tk.version} + + + + org.springframework.boot + spring-boot-starter-data-redis + + + io.lettuce + lettuce-core + + + + + + redis.clients + jedis + + + + org.apache.commons + commons-lang3 + + + + org.apache.commons + commons-pool2 + + + + + org.springframework.boot + spring-boot-starter-validation + + + + com.qiniu + qiniu-java-sdk + ${qiniu.version} + + + + + com.auth0 + java-jwt + ${auth0.jwt.version} + + + + org.apache.httpcomponents + httpcore + + + + org.apache.httpcomponents + httpclient + + + + + org.jdom + jdom + 2.0.2 + + + + + commons-httpclient + commons-httpclient + 3.1 + + + + com.alipay.sdk + alipay-sdk-java + ${alipay.version} + + + + com.github.binarywang + weixin-java-miniapp + ${weixin.miniapp.version} + + + + + + + diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/constants/OrderConstants.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/constants/OrderConstants.java new file mode 100644 index 0000000..d43cb01 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/constants/OrderConstants.java @@ -0,0 +1,11 @@ +package com.hc.tripcore.utils.constants; + +/** + * @author 10696 + * @since 2020/11/26 14:49 + */ + +public interface OrderConstants { + + String ORDER_REFUND = "10000"; +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/enums/ErrorEnum.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/enums/ErrorEnum.java new file mode 100644 index 0000000..a2ec49a --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/enums/ErrorEnum.java @@ -0,0 +1,34 @@ +package com.hc.tripcore.utils.enums; + +import lombok.Getter; + +/** + * @author JIA + * 自定义错误枚举类 + */ + +@Getter +public enum ErrorEnum { + + /* 系统级别 */ + + ERROR_REQUEST(100,"请求失败"), + ERROR_BAD_REQUEST(400,"请求语法错误"), + ERROR_UNAUTHORIZED(401,"未授权"), + ERROR_FORBIDDEN(403,"服务器拒绝请求"), + ERROR_NOT_FOUND(404,"请求资源不存在"), + ERROR_METHOD_NOT_AllOWED(405,"指定的请求方法,被禁用"), + ERROR_REQUEST_TIMEOUT(408,"请求超时"), + ERROR_REQUEST_ENTITY_TOO_LARGE(413,"请求实体过大,超出处理能力"), + ERROR_REQUEST_URI_TOO_LONG(414,"请求URL太长,拒绝访问") + + ; + private final Integer key; + private final String msg; + + ErrorEnum(Integer key, String msg) { + this.key = key; + this.msg = msg; + } + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/enums/InfoEnum.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/enums/InfoEnum.java new file mode 100644 index 0000000..6c373b1 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/enums/InfoEnum.java @@ -0,0 +1,40 @@ +package com.hc.tripcore.utils.enums; + +import lombok.Getter; + +/** + * @author JIA + * 自定义消息枚举类 + */ +@Getter +public enum InfoEnum { + + NULL_PARAMETER(400, "请求参数错误"), + + LOGIN_USER_NAME_ERROR(201, "用户名错误,此用户不存在"), + + LOGIN_PASSWORD_ERROR(202, "密码错误,请重新输入"), + + LOGIN_REGISTER_RE(204, "用户已存在,不可重复注册"), + + SESSION_EXPIRED(205, "无资源权限,请登录"), + + AUTHCODE_ERROR(206, "验证码输入错误"), + + PAPER_ERROR(212, "此试卷已过期,请联系管理员重新设置"), + + TOKEN_ERROR(209, "非法token,禁止进入系统"), + + USER_INVOICES_ERROR(210, "此订单已申请发票,请不要重复操作"), + + ORDER_ERROR(211, "订单已存在,请不要重复操作"); + + private final Integer key; + private final String msg; + + InfoEnum(Integer key, String msg) { + this.key = key; + this.msg = msg; + } + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/enums/SuccessEnum.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/enums/SuccessEnum.java new file mode 100644 index 0000000..cc9709d --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/enums/SuccessEnum.java @@ -0,0 +1,32 @@ +package com.hc.tripcore.utils.enums; + +import lombok.Getter; + +/** + * @author JIA + * 自定义成功枚举类 + */ +@Getter +public enum SuccessEnum { + + /* 系统级别 */ + + SUCCESS_REQUEST(200, "服务请求成功"), + SUCCESS_CREATED(201, "请求成功,服务器创建资源"), + SUCCESS_ACCEPTED(202, "请求成功,服务器尚未处理"), + SUCCESS_NON_AUTHORITATIVE(203,"请求成功,信息非授权"), + SUCCESS_NO_CONTENT(204,"请求成功,无内容"), + SUCCESS_RESET_CONTENT(205,"请求成功,内容重置"), + SUCCESS_PARTIAL_CONTENT(206,"请求成功,部分内容已处理") + + ; + + private final Integer key; + private final String msg; + + SuccessEnum(Integer key, String msg) { + this.key = key; + this.msg = msg; + } + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/exception/ResponseException.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/exception/ResponseException.java new file mode 100644 index 0000000..684293f --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/exception/ResponseException.java @@ -0,0 +1,34 @@ +package com.hc.tripcore.utils.exception; + + +import com.hc.tripcore.utils.enums.InfoEnum; + +/** + * @author JIA + */ + +public class ResponseException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + private Integer code; + + public ResponseException(Integer code,String message){ + super(message); + this.code = code; + } + + public ResponseException(InfoEnum infoEnum){ + super(infoEnum.getMsg()); + this.code = infoEnum.getKey(); + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/mapper/Mapper.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/mapper/Mapper.java new file mode 100644 index 0000000..40c8074 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/mapper/Mapper.java @@ -0,0 +1,19 @@ +package com.hc.tripcore.utils.mapper; + +import tk.mybatis.mapper.common.BaseMapper; +import tk.mybatis.mapper.common.ConditionMapper; +import tk.mybatis.mapper.common.IdsMapper; +import tk.mybatis.mapper.common.special.InsertListMapper; + +/** + * 定制版MyBatis Mapper插件接口,如需其他接口参考官方文档自行添加。 + * + * @author mybatis + */ +public interface Mapper + extends + BaseMapper, + ConditionMapper, + IdsMapper, + InsertListMapper { +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/msm/MessageService.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/msm/MessageService.java new file mode 100644 index 0000000..13acfaf --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/msm/MessageService.java @@ -0,0 +1,101 @@ +package com.hc.tripcore.utils.msm; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import java.util.Random; + +/** + * @author Andrew + * @create 2019/02/18 10:39 + */ +@Configuration +@EnableConfigurationProperties(MsgConfig.class) +@Slf4j +public class MessageService { + + private final MsgConfig msgConfig; + + @Autowired + public MessageService(MsgConfig msgConfig) { + this.msgConfig = msgConfig; + } + + private JSONObject sendHttp(String url, String params) throws Exception { + CloseableHttpClient client = HttpClients.createDefault(); + HttpPost method = new HttpPost(url); + StringEntity entity = new StringEntity(params, "utf-8"); + entity.setContentEncoding("UTF-8"); + entity.setContentType("application/x-www-form-urlencoded"); + setHeader(method); + method.setEntity(entity); + HttpResponse resp = client.execute(method); + String result = EntityUtils.toString(resp.getEntity()); + client.close(); + return JSON.parseObject(result); + } + + private void setHeader(HttpPost method) { + Random random = new Random(); + long nonce = Math.abs(random.nextLong()); + long timpStamp = (System.currentTimeMillis() / 1000); + String sign = DigestUtils.sha1Hex(msgConfig.getAPP_SECRIT() + nonce + timpStamp); + method.addHeader("App-Key", msgConfig.getAPP_KEY()); + method.addHeader("Nonce", nonce + ""); + method.addHeader("Timestamp", timpStamp + ""); + method.addHeader("Signature", sign); + } + + + public String sendValidShortMessage(String phone) { + try { + String params = "mobile=" + phone + "&templateId=" + msgConfig.getTEMPLATE_ID() + "®ion=" + msgConfig.getREGION(); + JSONObject obj = sendHttp(msgConfig.getSEND_CODE_URL(), params); + if (obj != null && obj.get("code") != null && "200".equals(obj.get("code").toString())) { + return (String) obj.get("sessionId"); + } else { + return ""; + } + } catch (Exception e) { + log.error(e.getMessage()); + return ""; + } + } + + @Deprecated + public boolean validCode(String sessionId, String code) { + try { + + String params = "sessionId=" + sessionId + "&code=" + code; + JSONObject obj = sendHttp(msgConfig.getVERIF_CODE_URL(), params); + + if ((obj != null) && (obj.get("code") != null) && ("200".equals(obj.get("code").toString())) + && ("true".equals(obj.get("success").toString()))) { + log.debug("verify:" + params + ": obj:" + obj.toString()); + + return true; + + } else { + + assert obj != null; + log.debug("verify:" + params + ": obj:" + obj.toString()); + return false; + } + } catch (Exception e) { + log.error(e.getMessage()); + return false; + } + } + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/msm/MsgConfig.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/msm/MsgConfig.java new file mode 100644 index 0000000..ddd2b24 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/msm/MsgConfig.java @@ -0,0 +1,26 @@ +package com.hc.tripcore.utils.msm; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * @author Andrew + * @create 2019/02/18 10:40 + */ +@Data +@ConfigurationProperties(prefix = "rong") +public class MsgConfig { + + private String TEMPLATE_ID; + + private String REGION; + + private String SEND_CODE_URL; + + private String APP_SECRIT; + + private String APP_KEY; + + private String VERIF_CODE_URL; + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/oss/QiNiuUtil.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/oss/QiNiuUtil.java new file mode 100644 index 0000000..ae0abe8 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/oss/QiNiuUtil.java @@ -0,0 +1,50 @@ +package com.hc.tripcore.utils.oss; + +import com.qiniu.util.Auth; +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * @author JIA + */ + +@Data +@Component +public class QiNiuUtil { + + @Value("${oss.access-key}") + private String accessKey; + + @Value("${oss.secret-key}") + private String secretKey; + + @Value("${oss.bucket}") + private String bucket; + + @Value("${oss.file-domain}") + private String fileDomain; + + private Auth auth; + + private Auth getAuth() { + if (Objects.isNull(auth)) { + auth = Auth.create(getAccessKey(), getSecretKey()); + } + return auth; + } + + public Map getUpToken() { + Map map = new HashMap<>(2); + String upToken = getAuth().uploadToken(bucket); + map.put("upToken", upToken); + map.put("domain", fileDomain); + return map; + } + + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/alipay/bean/AliPayBean.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/alipay/bean/AliPayBean.java new file mode 100644 index 0000000..aa8fa29 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/alipay/bean/AliPayBean.java @@ -0,0 +1,50 @@ +package com.hc.tripcore.utils.pay.browser.alipay.bean; + +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author 10696 + * @since 2020/11/26 14:43 + */ + +@Data +public class AliPayBean { + + /** + * 商户订单号 + */ + @NotNull(message = "订单号不可以为空") + private String out_trade_no; + + /** + * 订单名称 + */ + @NotNull(message = "订单名称不可以为空") + private String subject; + + /** + * 付款金额 + */ + @NotNull(message = "付款金额不可以为空") + private String total_amount; + + /** + * 商品描述 + */ + @NotNull(message = "商品描述不可以为空") + private String body; + + /** + * 超时时间参数 + */ + private String timeout_express = "10m"; + + /** + * 产品编号 + */ + private String product_code = "FAST_INSTANT_TRADE_PAY"; + + +} \ No newline at end of file diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/alipay/bean/AliPayRefundBean.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/alipay/bean/AliPayRefundBean.java new file mode 100644 index 0000000..8bb37fc --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/alipay/bean/AliPayRefundBean.java @@ -0,0 +1,31 @@ +package com.hc.tripcore.utils.pay.browser.alipay.bean; + +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author 10696 + * @since 2020/11/26 14:44 + */ + +@Data +public class AliPayRefundBean { + + /** + * 商品订单号 + */ + @NotNull + private String out_trade_no; + /** + * 支付宝交易号 + */ + @NotNull + private String trade_no; + /** + * 退款金额 + */ + @NotNull + private Double refund_amount; + +} \ No newline at end of file diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/alipay/processor/AliPayProcessor.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/alipay/processor/AliPayProcessor.java new file mode 100644 index 0000000..1f1bead --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/alipay/processor/AliPayProcessor.java @@ -0,0 +1,92 @@ +package com.hc.tripcore.utils.pay.browser.alipay.processor; + +import com.alibaba.fastjson.JSON; +import com.alipay.api.AlipayApiException; +import com.alipay.api.AlipayClient; +import com.alipay.api.DefaultAlipayClient; +import com.alipay.api.request.AlipayTradePagePayRequest; +import com.alipay.api.request.AlipayTradeRefundRequest; +import com.hc.tripcore.utils.pay.browser.alipay.bean.AliPayBean; +import com.hc.tripcore.utils.pay.browser.alipay.bean.AliPayRefundBean; +import com.hc.tripcore.utils.properties.PayProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author JIA + */ + +@Component("aliPayProcessor") +public class AliPayProcessor { + + @Autowired + private PayProperties payProperties; + + /** + * 支付宝支付配置 + * + * @return 接口对象 + */ + public AlipayClient alipayClient(String aliPayPublicKey) { + // 1、获得初始化的AliPayClient + String serverUrl = payProperties.getAliPay().getGatewayUrl(); + String appId = payProperties.getAliPay().getAppId(); + String privateKey = payProperties.getAliPay().getPrivateKey(); + String format = "json"; + String charset = payProperties.getAliPay().getCharset(); + String signType = payProperties.getAliPay().getSignType(); + return new DefaultAlipayClient(serverUrl, appId, privateKey, format, charset, aliPayPublicKey, signType); + } + + /** + * 支付 + * + * @param aliPayBean + * @return 实例对象 + * @throws AlipayApiException + */ + public String pay(AliPayBean aliPayBean) throws AlipayApiException { + + // 2、设置请求参数 + String aliPayPublicKey = payProperties.getAliPay().getPublicKey(); + String notifyUrl = payProperties.getAliPay().getNotifyUrl(); + String returnUrl = payProperties.getAliPay().getReturnUrl(); + // 构造请求 + AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest(); + // 页面跳转同步通知页面路径 + alipayRequest.setReturnUrl(returnUrl); + // 服务器异步通知页面路径 + alipayRequest.setNotifyUrl(notifyUrl); + // 封装参数 + alipayRequest.setBizContent(JSON.toJSONString(aliPayBean)); + // 连接参数 + AlipayClient alipayClient = alipayClient(aliPayPublicKey); + // 3、请求支付宝进行付款,并获取支付结果 + String result = alipayClient.pageExecute(alipayRequest).getBody(); + // 返回付款信息 + return result; + } + + /** + * 退款 + * + * @param aliPayRefundBean + * @return 实例对象 + * @throws AlipayApiException + */ + public String refund(AliPayRefundBean aliPayRefundBean) throws AlipayApiException { + // 2、设置请求参数 + String aliPayPublicKey = payProperties.getAliPay().getKey(); + // 构造请求 + AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); + request.setBizContent(JSON.toJSONString(aliPayRefundBean)); + //连接参数 + AlipayClient alipayClient = alipayClient(aliPayPublicKey); + // 3、请求支付宝进行退款,并获取支付结果 + String result = alipayClient.execute(request).getBody(); + // 返回退款信息 + return result; + } + + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/wxpay/utils/WebUtils.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/wxpay/utils/WebUtils.java new file mode 100644 index 0000000..7f9cb95 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/wxpay/utils/WebUtils.java @@ -0,0 +1,43 @@ +package com.hc.tripcore.utils.pay.browser.wxpay.utils; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.RequestEntity; +import org.apache.commons.httpclient.methods.StringRequestEntity; + +import java.io.BufferedInputStream; +import java.util.HashMap; +import java.util.Map; + +/** + * @author zdx + */ +public class WebUtils { + + public static Map getMwebUrl(String url, String xmlParam){ + String jsonStr = null; + HttpClient httpClient = new HttpClient(); + Map map = new HashMap(); + try { + PostMethod method = null; + RequestEntity reqEntity = new StringRequestEntity(xmlParam,"text/json","UTF-8"); + method = new PostMethod(url); + method.setRequestEntity(reqEntity); + method.addRequestHeader("Content-Type","application/json;charset=utf-8"); + httpClient.executeMethod(method); + StringBuffer resBodyBuf = new StringBuffer(); + byte[] responseBody = new byte[1024]; + int readCount = 0; + BufferedInputStream is = new BufferedInputStream(method.getResponseBodyAsStream()); + while((readCount = is.read(responseBody,0,responseBody.length))!=-1){ + resBodyBuf.append(new String(responseBody,0,readCount,"utf-8")); + } + jsonStr = resBodyBuf.toString(); + map = XMLUtils.parseXmlToList(jsonStr); + } catch (Exception e) { + e.printStackTrace(); + } + return map; + } + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/wxpay/utils/XMLUtils.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/wxpay/utils/XMLUtils.java new file mode 100644 index 0000000..e3821b7 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/pay/browser/wxpay/utils/XMLUtils.java @@ -0,0 +1,51 @@ +package com.hc.tripcore.utils.pay.browser.wxpay.utils; + +import org.jdom2.Document; +import org.jdom2.Element; +import org.jdom2.input.SAXBuilder; +import org.xml.sax.InputSource; + +import java.io.StringReader; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author zdx + */ +public class XMLUtils { + + /** + * description: 解析微信通知xml + * + * @param xml + * @return + * @author ex_yangxiaoyi + * @see + */ + @SuppressWarnings({ "unused", "rawtypes", "unchecked" }) + public static Map parseXmlToList(String xml) { + Map retMap = new HashMap(); + try { + StringReader read = new StringReader(xml); + // 创建新的输入源SAX 解析器将使用 InputSource 对象来确定如何读取 XML 输入 + InputSource source = new InputSource(read); + // 创建一个新的SAXBuilder + SAXBuilder sb = new SAXBuilder(); + // 通过输入源构造一个Document + Document doc = (Document) sb.build(source); + Element root = doc.getRootElement();// 指向根节点 + List es = root.getChildren(); + if (es != null && es.size() != 0) { + for (Element element : es) { + retMap.put(element.getName(), element.getValue()); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return retMap; + + } + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/properties/AliPayProperties.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/properties/AliPayProperties.java new file mode 100644 index 0000000..b024951 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/properties/AliPayProperties.java @@ -0,0 +1,31 @@ +package com.hc.tripcore.utils.properties; + +import lombok.Data; +import org.springframework.stereotype.Component; + +/** + * @author 10696 + * @since 2020/11/26 14:20 + */ +@Data +@Component +public class AliPayProperties { + + private String appId; + + private String privateKey; + + private String publicKey; + + private String notifyUrl; + + private String returnUrl; + + private String signType; + + private String charset; + + private String gatewayUrl; + + private String key; +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/properties/PayProperties.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/properties/PayProperties.java new file mode 100644 index 0000000..50a7bc4 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/properties/PayProperties.java @@ -0,0 +1,36 @@ +package com.hc.tripcore.utils.properties; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * @author 10696 + */ + +@Component("payProperties") +@ConfigurationProperties("hc.pay") +public class PayProperties { + + private AliPayProperties aliPay = new AliPayProperties(); + + private WxPayProperties wxPay = new WxPayProperties(); + + public AliPayProperties getAliPay() { + return aliPay; + } + + public void setAliPay(AliPayProperties aliPay) { + this.aliPay = aliPay; + } + + public WxPayProperties getWxPay() { + return wxPay; + } + + public void setWxPay(WxPayProperties wxPay) { + this.wxPay = wxPay; + } + + + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/properties/WxPayProperties.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/properties/WxPayProperties.java new file mode 100644 index 0000000..a543809 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/properties/WxPayProperties.java @@ -0,0 +1,37 @@ +package com.hc.tripcore.utils.properties; + +import lombok.Data; +import org.springframework.stereotype.Component; + +/** + * @author 10696 + */ +@Data +@Component +public class WxPayProperties { + + private String appid; + + private String mch_id; + + private String sign_key; + + private String nonce_str; + + private String sign; + + private String body; + + private String out_trade_no; + + private int total_fee; + + private String spbill_create_ip; + + private String notify_url; + + private String trade_type; + + private String scene_info; + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/redis/RedisUtil.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/redis/RedisUtil.java new file mode 100644 index 0000000..d81a314 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/redis/RedisUtil.java @@ -0,0 +1,281 @@ +package com.hc.tripcore.utils.redis; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +/** + * SpringData Redis工具类 + * 序列化工具,已回退到jdk序列 + * + * @author JIA + */ +@Component +public class RedisUtil { + + private final RedisTemplate redisTemplate; + + @Autowired + public RedisUtil(RedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + } + + /** + * 指定缓存失效时间 + * + * @param key 键值 + * @param time 时间 + * @return 布尔 + */ + public boolean expire(String key, long time) { + try { + if (time > 0) { + redisTemplate.expire(key, time, TimeUnit.SECONDS); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + + /** + * 判断key是否存在 + * + * @param key 键值 + * @return 布尔 + */ + public boolean hasKey(String key) { + try { + return redisTemplate.hasKey(key); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 删除缓存 + * + * @param key 键值 + */ + public void del(String... key) { + if (key != null && key.length > 0) { + if (key.length == 1) { + redisTemplate.delete(key[0]); + } else { + redisTemplate.delete(CollectionUtils.arrayToList(key)); + } + } + } + + + /** + * 放入存储,不设置时间 + * + * @param key 键值 + * @param value 对象 + * @return 布尔 + */ + public boolean set(String key, Object value) { + try { + redisTemplate.opsForValue().set(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 放入缓存,并设置时间 + * + * @param key 键值 + * @param value 对象 + * @param time 时间 + * @return 布尔 + */ + + public boolean set(String key, Object value, long time) { + try { + if (time > 0) { + redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); + } else { + set(key, value); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 依据key 获取缓存 + * + * @param key 键值 + * @return 实例对象 + */ + public Object get(String key) { + return key == null ? null : redisTemplate.opsForValue().get(key); + } + + /** + * HashMap存入缓存 + * + * @param key 键值 + * @param map Map对象 + * @return 布尔 + */ + public boolean hashMapSet(String key, Map map) { + try { + redisTemplate.opsForHash().putAll(key, map); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + + /** + * HashGet获取 + * + * @param key 键值 + * @param item 散列值 + * @return 实例对象 + */ + public Object hashGet(String key, String item) { + return redisTemplate.opsForHash().get(key, item); + } + + /** + * hash表中放入数据,如果不存在将创建 + * + * @param key 键值 + * @param item 散列值 + * @param value 对象 + * @return 布尔 + */ + public boolean hashSet(String key, String item, Object value) { + try { + redisTemplate.opsForHash().put(key, item, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 删除hash表中的值 + * + * @param key 键值 + * @param item 散列值 + */ + public void hashDel(String key, Object... item) { + redisTemplate.opsForHash().delete(key, item); + } + + /** + * 判断hash表中是否有该项的值 + * + * @param key 键值 + * @param item 散列值 + * @return 布尔 + */ + public boolean hashHasKey(String key, String item) { + return redisTemplate.opsForHash().hasKey(key, item); + } + + /** + * 根据key获取Set中的所有值 + * + * @param key 键值 + * @return 实例对象数组 + */ + public Set setGet(String key) { + try { + return redisTemplate.opsForSet().members(key); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 将数据放入set缓存 + * + * @param key 键值 + * @param values 对象数组 + * @return 成功个数 + */ + public long setSet(String key, Object... values) { + try { + return redisTemplate.opsForSet().add(key, values); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 将set数据放入缓存,并设置时间 + * + * @param key 键值 + * @param time 时间 + * @param values 对象数组 + * @return 个数 + */ + public long setSetAndTime(String key, long time, Object... values) { + try { + Long count = redisTemplate.opsForSet().add(key, values); + if (time > 0) { + expire(key, time); + } + return count; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 获取set缓存的长度 + * + * @param key 键值 + * @return 个数 + */ + public long setGetSetSize(String key) { + try { + return redisTemplate.opsForSet().size(key); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 移除值为value的 + * + * @param key 键值 + * @param values 实例对象 + * @return 个数 + */ + public long setRemove(String key, Object... values) { + try { + Long count = redisTemplate.opsForSet().remove(key, values); + return count; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/result/Result.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/result/Result.java new file mode 100644 index 0000000..07f7464 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/result/Result.java @@ -0,0 +1,84 @@ +package com.hc.tripcore.utils.result; + + +import com.hc.tripcore.utils.enums.InfoEnum; +import com.hc.tripcore.utils.enums.SuccessEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +/** + * @author JIA + */ +@Data +public class Result implements Serializable { + + private static final long serialVersionUID = 1L; + + + @ApiModelProperty(example = "200") + private Integer code; + + @ApiModelProperty(example = "服务请求成功") + private String msg; + + private T data; + + public Result() { + + } + + /** + * 请求成功 返回数据 + * + * @param object + * @param + * @return 实例对象 + */ + public static Result success(T object) { + Result result = new Result(); + result.setCode(SuccessEnum.SUCCESS_REQUEST.getKey()); + result.setMsg(SuccessEnum.SUCCESS_REQUEST.getMsg()); + result.setData(object); + return result; + } + + /** + * 请求成功 + * + * @return 实例对象 + */ + public static Result success() { + return success(null); + } + + /** + * 自定义信息返回 + * + * @param infoEnum 自定义枚举 + * @return 实例对象 + */ + public static Result info(InfoEnum infoEnum) { + Result result = new Result(); + result.setCode(infoEnum.getKey()); + result.setMsg(infoEnum.getMsg()); + return result; + } + + /** + * 自定义异常返回 + * + * @param key + * @param msg + * @return 实例对象 + */ + public static Result exception(Integer key, String msg) { + Result result = new Result(); + result.setCode(key); + result.setMsg(msg); + return result; + } + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/status/CodeFlagEnum.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/status/CodeFlagEnum.java new file mode 100644 index 0000000..7aac1dc --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/status/CodeFlagEnum.java @@ -0,0 +1,25 @@ +package com.hc.tripcore.utils.status; + +import lombok.Getter; + +/** + * @author 10696 + * @since 2020/11/20 10:31 + */ + +@Getter +public enum CodeFlagEnum { + + OBJECT_ENABLE_CODE(1, "标识有效"), + + OBJECT_DISABLED_CODE(0, "标识无效"); + + private final Integer code; + + private final String flag; + + CodeFlagEnum(Integer code, String flag) { + this.code = code; + this.flag = flag; + } +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/status/CourseFlagEnum.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/status/CourseFlagEnum.java new file mode 100644 index 0000000..9d809a3 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/status/CourseFlagEnum.java @@ -0,0 +1,26 @@ +package com.hc.tripcore.utils.status; + +import lombok.Getter; + +/** + * @author 10696 + * @since 2020/11/25 9:48 + */ +@Getter +public enum CourseFlagEnum { + + COURSE_REQUIRE_CODE(1, "必修"), + + COURSE_OPTIONAL_CODE(2, "选修"); + + private final Integer code; + + private final String flag; + + CourseFlagEnum(Integer code, String flag) { + this.code = code; + this.flag = flag; + } + + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/status/OrdersFlagEnum.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/status/OrdersFlagEnum.java new file mode 100644 index 0000000..1dbe694 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/status/OrdersFlagEnum.java @@ -0,0 +1,27 @@ +package com.hc.tripcore.utils.status; + +import lombok.Getter; + +/** + * @author 10696 + * @since 2020/11/26 17:47 + */ +@Getter +public enum OrdersFlagEnum { + + + ORDERS_FLAG_UNPAID(0, "未支付"), + + ORDERS_FLAG_PAID(1, "已支付"), + + ORDERS_FLAG_REFUNDED(2, "已退款"); + + private final Integer code; + + private final String flag; + + OrdersFlagEnum(Integer code, String flag) { + this.code = code; + this.flag = flag; + } +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/Compute.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/Compute.java new file mode 100644 index 0000000..c3fa5f8 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/Compute.java @@ -0,0 +1,98 @@ +package com.hc.tripcore.utils.tool; + +import java.math.BigDecimal; + +/** + * @author Andrew + */ +public class Compute { // 默认除法运算精度 + private static final int DEF_DIV_SCALE = 10; // 这个类不能实例化 + + private Compute() { + } + + /** + * 提供精确的加法运算。 + * + * @param v1 被加数 + * @param v2 加数 + * @return 两个参数的和 + */ + public static double add(double v1, double v2) { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.add(b2).doubleValue(); + } + + /** + * 提供精确的减法运算。 + * + * @param v1 被减数 + * @param v2 减数 + * @return 两个参数的差 + */ + public static double sub(double v1, double v2) { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.subtract(b2).doubleValue(); + } + + /** + * 提供精确的乘法运算。 + * + * @param v1 被乘数 + * @param v2 乘数 + * @return 两个参数的积 + */ + public static double mul(double v1, double v2) { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.multiply(b2).doubleValue(); + } + + /** + * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 小数点以后10位,以后的数字四舍五入。 + * + * @param v1 被除数 + * @param v2 除数 + * @return 两个参数的商 + */ + public static double div(double v1, double v2) { + return div(v1, v2, DEF_DIV_SCALE); + } + + /** + * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 定精度,以后的数字四舍五入。 + * + * @param v1 被除数 + * @param v2 除数 + * @param scale 表示表示需要精确到小数点以后几位。 + * @return 两个参数的商 + */ + public static double div(double v1, double v2, int scale) { + if (scale < 0) { + throw new IllegalArgumentException( + "The scale must be a positive integer or zero"); + } + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue(); + } + + /** + * 提供精确的小数位四舍五入处理。 + * + * @param v 需要四舍五入的数字 + * @param scale 小数点后保留几位 + * @return 四舍五入后的结果 + */ + public static double round(double v, int scale) { + if (scale < 0) { + throw new IllegalArgumentException( + "The scale must be a positive integer or zero"); + } + BigDecimal b = new BigDecimal(Double.toString(v)); + BigDecimal one = new BigDecimal("1"); + return b.divide(one, scale, BigDecimal.ROUND_HALF_UP).doubleValue(); + } +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/IdGenerator.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/IdGenerator.java new file mode 100644 index 0000000..11ac079 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/IdGenerator.java @@ -0,0 +1,142 @@ +package com.hc.tripcore.utils.tool; + +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Random; +import java.util.UUID; + +/** + * @author Andrew + */ +public class IdGenerator { + + public static String[] chars = new String[]{ + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", + "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", + "O", "P", "Q", "R", "S", "T", "U", "V","W", "X", "Y", "Z" + }; + + /** + * 获取短UUID,保证在百万数量级唯一,长度为 8 位,例子(tbN7ru6S,2B6orRJp) + * 用途:短信验证码,重设的用户密码...等等,对长度比较敏感的 ID + * @return 字符串型 短UUID + */ + public static String getShortUuid(){ + StringBuffer stringBuffer = new StringBuffer(); + String uuid = UUID.randomUUID().toString().replace("-", ""); + for (int i = 0; i < 8; i++){ + String str = uuid.substring(i * 4, i * 4 + 4); + int strInteger = Integer.parseInt(str, 16); + stringBuffer.append(chars[strInteger % 0x3E]); //除62取余 + } + return stringBuffer.toString(); + } + + /** + * 获取 nano 时间因子作为时间ID,位数为 14 位数字 例子(89864091147334) + * 可以用作 数据库 中的 ID 字段 + * @return 字符串型 ID + */ + public static String getShortTimeId() { + String dateString = String.valueOf(System.nanoTime()); + return dateString; + } + + /** + * 获取 “日期时分秒 + nano 时间因子” 作为时间ID,位数为 28 位数字 例子(2017011223042793189007681236) + * 可以用作 数据库 中的 ID 字段 + * @return 字符串型 ID + */ + public static String getTimeId() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); + String dateString = sdf.format(new Date()); + dateString += String.valueOf(System.nanoTime()); + return dateString; + } + + /** + * 获取标准的 uuid,长度为 32 位,例子(5d02334e-da48-4952-a168-ca19444efbe2) + * @return + */ + public static String getUuid() { + UUID uuid = UUID.randomUUID(); + return (uuid.toString()); + } + + /** + * 对字符串md5加密 + * + * @param str + * @return + */ + public static String getMD5(String str) { + try { + // 生成一个MD5加密计算摘要 + MessageDigest md = MessageDigest.getInstance("MD5"); + // 计算md5函数 + md.update(str.getBytes()); + // digest()最后确定返回md5 hash值,返回值为8为字符串。因为md5 hash值是16位的hex值,实际上就是8位的字符 + // BigInteger函数则将8位的字符串转换成16位hex值,用字符串来表示;得到字符串形式的hash值 + return new BigInteger(1, md.digest()).toString(16); + } catch (Exception e) { + return ""; + } + } + + /*** + * 密码hash加密 + * @param password + * @return + */ + public static String passwordToHash(String password) { + try { + MessageDigest digest = MessageDigest.getInstance("SHA-256"); + digest.update(password.getBytes()); + byte[] src = digest.digest(); + StringBuilder stringBuilder = new StringBuilder(); + // 字节数组转16进制字符串 + // https://my.oschina.net/u/347386/blog/182717 + for (byte aSrc : src) { + String s = Integer.toHexString(aSrc & 0xFF); + if (s.length() < 2) { + stringBuilder.append('0'); + } + stringBuilder.append(s); + } + return stringBuilder.toString(); + } catch (NoSuchAlgorithmException ignore) { + } + return null; + } + public static String getRandomPwd(){ + Random rd = new Random(); +// String n=""; + int getNum; + /** + do { + getNum = Math.abs(rd.nextInt())%10 + 48;//产生数字0-9的随机数 + //getNum = Math.abs(rd.nextInt())%26 + 97;//产生字母a-z的随机数 + char num1 = (char)getNum; + String dn = Character.toString(num1); + n += dn; + } while (n.length()<6); + */ + //改进效率 + StringBuffer buf = new StringBuffer(); + do { +// getNum = Math.abs(rd.nextInt())%10 + 48;//产生数字0-9的随机数 + getNum = Math.abs(rd.nextInt()%10) + 48;//产生数字0-9的随机数 + //getNum = Math.abs(rd.nextInt())%26 + 97;//产生字母a-z的随机数 + char num1 = (char)getNum; + String dn = Character.toString(num1); + buf.append(dn); + } while (buf.length()<6); + return buf.toString(); + } + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/JsonUtils.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/JsonUtils.java new file mode 100644 index 0000000..c771eda --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/JsonUtils.java @@ -0,0 +1,29 @@ +package com.hc.tripcore.utils.tool; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * @author JIA + */ +public class JsonUtils { + + private static final ObjectMapper JSON = new ObjectMapper(); + + static { + JSON.setSerializationInclusion(JsonInclude.Include.NON_NULL); + JSON.configure(SerializationFeature.INDENT_OUTPUT, Boolean.TRUE); + } + + public static String toJson(Object obj) { + try { + return JSON.writeValueAsString(obj); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + + return null; + } +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/Verification.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/Verification.java new file mode 100644 index 0000000..41b12d2 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/tool/Verification.java @@ -0,0 +1,98 @@ +package com.hc.tripcore.utils.tool; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Andrew + */ +public class Verification { + + public static boolean verificationAndString(String ...args){ + + for(int i=0;i list){ + if ((null == list) || (list.isEmpty())) { + return false; + } + return true; + } + + public static List getReturnList(List list, int perPage,int page) { + /* + List newlist = new ArrayList<>(); + if((perPage <=0) || (page < 1) || (null == list) || (list.size() ==0)) { + return newlist; + } + + //超过范围 + if(((page-1) * perPage) > list.size()) { + return newlist; + } + + + for(int index = ((page-1) * perPage); index < (page * perPage);index ++){ + if(index >= list.size()){ + break; + } + newlist.add(list.get(index)); + + } + return newlist; + */ + + int start,end; + + if((perPage <=0) || (page < 1) || (null == list) || (list.size() ==0) || + (((page-1) * perPage) > list.size())) { + return new ArrayList<>(); + } + + start = (page-1) * perPage; + //这里subList是左闭右开的,不包括toindex的这个元素,所以如果是需要取最后一个元素,toindex+1 + end = ((start + perPage) >= list.size())?(list.size()-1+1):(start+perPage); + return list.subList(start, end); + } +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/wechat/WxMaConfiguration.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/wechat/WxMaConfiguration.java new file mode 100644 index 0000000..b78f07b --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/wechat/WxMaConfiguration.java @@ -0,0 +1,142 @@ +package com.hc.tripcore.utils.wechat; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; +import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage; +import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage; +import cn.binarywang.wx.miniapp.config.WxMaInMemoryConfig; +import cn.binarywang.wx.miniapp.message.WxMaMessageHandler; +import cn.binarywang.wx.miniapp.message.WxMaMessageRouter; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; +import me.chanjar.weixin.common.exception.WxErrorException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import javax.annotation.PostConstruct; +import java.io.File; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author JIA + * 小程序 配置 + */ + +@Configuration +@EnableConfigurationProperties(WxMaProperties.class) +public class WxMaConfiguration { + + private WxMaProperties properties; + + private static Map routers = Maps.newHashMap(); + private static Map maServices = Maps.newHashMap(); + + + @Autowired + public WxMaConfiguration(WxMaProperties properties) { + this.properties = properties; + } + + public static WxMaService getMaService(String appid) { + WxMaService wxService = maServices.get(appid); + if (wxService == null) { + throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid)); + } + + return wxService; + } + + public static WxMaMessageRouter getRouter(String appid) { + return routers.get(appid); + } + + @PostConstruct + public void init() { + List configs = this.properties.getConfigs(); + if (configs == null) { + throw new RuntimeException("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!"); + } + maServices = configs.stream() + .map(a -> { + WxMaInMemoryConfig config = new WxMaInMemoryConfig(); + config.setAppid(a.getAppid()); + config.setSecret(a.getSecret()); + config.setToken(a.getToken()); + config.setAesKey(a.getAesKey()); + config.setMsgDataFormat(a.getMsgDataFormat()); + WxMaService service = new WxMaServiceImpl(); + service.setWxMaConfig(config); + routers.put(a.getAppid(), this.newRouter(service)); + return service; + }).collect(Collectors.toMap(s -> s.getWxMaConfig().getAppid(), a -> a)); + } + + private WxMaMessageRouter newRouter(WxMaService service) { + final WxMaMessageRouter router = new WxMaMessageRouter(service); + router + .rule().handler(logHandler).next() + .rule().async(false).content("模板").handler(templateMsgHandler).end() + .rule().async(false).content("文本").handler(textHandler).end() + .rule().async(false).content("图片").handler(picHandler).end() + .rule().async(false).content("二维码").handler(qrcodeHandler).end(); + return router; + } + + private final WxMaMessageHandler templateMsgHandler = (wxMessage, context, service, sessionManager) -> { + service.getMsgService().sendTemplateMsg(WxMaTemplateMessage.builder() + .templateId("此处更换为自己的模板id") + .formId("自己替换可用的formid") + .data(Lists.newArrayList( + new WxMaTemplateMessage.Data("keyword1", "339208499", "#173177"))) + .toUser(wxMessage.getFromUser()) + .build()); + }; + + private final WxMaMessageHandler logHandler = (wxMessage, context, service, sessionManager) -> { + System.out.println("收到消息:" + wxMessage.toString()); + service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("收到信息为:" + wxMessage.toJson()) + .toUser(wxMessage.getFromUser()).build()); + }; + + private final WxMaMessageHandler textHandler = (wxMessage, context, service, sessionManager) -> { + service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("回复文本消息") + .toUser(wxMessage.getFromUser()).build()); + }; + + private final WxMaMessageHandler picHandler = (wxMessage, context, service, sessionManager) -> { + try { + WxMediaUploadResult uploadResult = service.getMediaService() + .uploadMedia("image", "png", + ClassLoader.getSystemResourceAsStream("tmp.png")); + service.getMsgService().sendKefuMsg( + WxMaKefuMessage + .newImageBuilder() + .mediaId(uploadResult.getMediaId()) + .toUser(wxMessage.getFromUser()) + .build()); + } catch (WxErrorException e) { + e.printStackTrace(); + } + }; + + private final WxMaMessageHandler qrcodeHandler = (wxMessage, context, service, sessionManager) -> { + try { + final File file = service.getQrcodeService().createQrcode("123", 430); + WxMediaUploadResult uploadResult = service.getMediaService().uploadMedia("image", file); + service.getMsgService().sendKefuMsg( + WxMaKefuMessage + .newImageBuilder() + .mediaId(uploadResult.getMediaId()) + .toUser(wxMessage.getFromUser()) + .build()); + } catch (WxErrorException e) { + e.printStackTrace(); + } + }; + + +} diff --git a/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/wechat/WxMaProperties.java b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/wechat/WxMaProperties.java new file mode 100644 index 0000000..f8f7034 --- /dev/null +++ b/fenis-trip/trip-core/src/main/java/com/hc/tripcore/utils/wechat/WxMaProperties.java @@ -0,0 +1,46 @@ +package com.hc.tripcore.utils.wechat; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.util.List; + +/** + * @author JIA + */ + +@Data +@ConfigurationProperties(prefix = "wx.miniapp") +public class WxMaProperties { + + private List configs; + + @Data + public static class Config { + /** + * 设置微信小程序的appid + */ + private String appid; + + /** + * 设置微信小程序的Secret + */ + private String secret; + + /** + * 设置微信小程序消息服务器配置的token + */ + private String token; + + /** + * 设置微信小程序消息服务器配置的EncodingAESKey + */ + private String aesKey; + + /** + * 消息格式,XML或者JSON + */ + private String msgDataFormat; + } + +} diff --git a/fenis-trip/trip-core/src/main/resources/application.properties b/fenis-trip/trip-core/src/main/resources/application.properties new file mode 100644 index 0000000..d641d8c --- /dev/null +++ b/fenis-trip/trip-core/src/main/resources/application.properties @@ -0,0 +1,5 @@ +oss.access-key=IbM95nqve70SCvl0AYWPfmflAEVUvJx8o3S76NJ0 +oss.secret-key=1WucYYYpPx0u6Yx5cGnBcWPIv23y5okGiahefqKg +oss.bucket=test +oss.file-domain=http://test.hcinfos.cn + diff --git a/fenis-trip/trip-core/trip-core.iml b/fenis-trip/trip-core/trip-core.iml new file mode 100644 index 0000000..100e32d --- /dev/null +++ b/fenis-trip/trip-core/trip-core.iml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fenis-trip/trip-web/pom.xml b/fenis-trip/trip-web/pom.xml new file mode 100644 index 0000000..cc0337c --- /dev/null +++ b/fenis-trip/trip-web/pom.xml @@ -0,0 +1,80 @@ + + + 4.0.0 + + com.hc + fenis-trip + 0.0.1-SNAPSHOT + + + trip-web + 0.0.1-SNAPSHOT + trip-web + war + Demo project for Spring Boot + + + 11 + + + + + + com.hc + trip-core + ${project.version} + + + + com.alibaba + druid + ${druid.version} + + + + com.hc + trip-business + ${project.version} + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + + org.springframework.boot + spring-boot-starter-aop + + + + mysql + mysql-connector-java + runtime + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/ServletInitializer.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/ServletInitializer.java new file mode 100644 index 0000000..8298939 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/ServletInitializer.java @@ -0,0 +1,16 @@ +package com.hc.tripweb; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * @author 10696 + */ +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(TripWebApplication.class); + } + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/TripWebApplication.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/TripWebApplication.java new file mode 100644 index 0000000..fdb3961 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/TripWebApplication.java @@ -0,0 +1,20 @@ +package com.hc.tripweb; + +import com.spring4all.swagger.EnableSwagger2Doc; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import tk.mybatis.spring.annotation.MapperScan; + +@SpringBootApplication +@ComponentScan("com.hc") +@MapperScan("com.hc.tripbusiness.mapper") +@EnableSwagger2Doc +public class TripWebApplication { + + public static void main(String[] args) { + SpringApplication.run(TripWebApplication.class, args); + } + +} + diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/config/CrossConfig.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/config/CrossConfig.java new file mode 100644 index 0000000..a02fcc6 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/config/CrossConfig.java @@ -0,0 +1,36 @@ +package com.hc.tripweb.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +import java.util.Collections; + +/** + * @author JIA + * 跨域 配置 + */ + +@Configuration +public class CrossConfig { + + @Bean + public CorsFilter corsFilter() { + final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + final CorsConfiguration configuration = new CorsConfiguration(); + + configuration.setAllowCredentials(true); + configuration.setAllowedOrigins(Collections.singletonList("*")); + configuration.setAllowedHeaders(Collections.singletonList("*")); + configuration.setAllowedMethods(Collections.singletonList("*")); + configuration.setMaxAge(300L); + + source.registerCorsConfiguration("/**", configuration); + return new CorsFilter(source); + + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/config/SwaggerOneConfig.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/config/SwaggerOneConfig.java new file mode 100644 index 0000000..93947e8 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/config/SwaggerOneConfig.java @@ -0,0 +1,43 @@ +package com.hc.tripweb.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; + +/** + * @author 10696 + * 已将最新版本回退到最低版本 + */ + +@Configuration +public class SwaggerOneConfig { + + @Bean + public Docket createRestApiFront() { + return new Docket(DocumentationType.SWAGGER_12) + .apiInfo(apiInfo()) + .groupName("front-api") + .select() + .apis(RequestHandlerSelectors.basePackage("com.hc.tripweb.controller")) + .paths(PathSelectors.any()) + .build(); + } + + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("Swagger一接口文档") + .description("这里是一行描述") + .contact(new Contact("作者", "作者地址", "作者邮箱")) + .version("1.0") + .build(); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/BannerController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/BannerController.java new file mode 100644 index 0000000..a9d290b --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/BannerController.java @@ -0,0 +1,65 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.Banner; +import com.hc.tripbusiness.service.BannerService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 广告表 + * (Banner)表控制层 + * + * @author java + * @since 2021-04-30 14:19:20 + */ + +@RestController +@RequestMapping("/api/banner") +public class BannerController { + + /** + * 服务对象 + */ + private final BannerService bannerService; + + public BannerController(BannerService bannerService) { + this.bannerService = bannerService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 Banner", response = Result.class) + public Result selectBanner(@PathVariable("id") Integer id) { + return Result.success(this.bannerService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 Banner", response = Result.class) + public Result addBanner(@Valid @RequestBody Banner banner) { + return Result.success(bannerService.insert(banner)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 Banner", response = Result.class) + public Result updateBanner(@RequestBody Banner banner) { + return Result.success(bannerService.update(banner)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 Banner", response = Result.class) + public Result deleteBanner(@PathVariable("id") Integer id) { + return Result.success(bannerService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 Banner列表(分页)", response = Result.class) + public Result listBanner(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(bannerService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/NewsController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/NewsController.java new file mode 100644 index 0000000..2886438 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/NewsController.java @@ -0,0 +1,65 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.News; +import com.hc.tripbusiness.service.NewsService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 新闻表 + * (News)表控制层 + * + * @author java + * @since 2021-04-30 14:03:23 + */ + +@RestController +@RequestMapping("/api/news") +public class NewsController { + + /** + * 服务对象 + */ + private final NewsService newsService; + + public NewsController(NewsService newsService) { + this.newsService = newsService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 News", response = Result.class) + public Result selectNews(@PathVariable("id") Integer id) { + return Result.success(this.newsService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 News", response = Result.class) + public Result addNews(@Valid @RequestBody News news) { + return Result.success(newsService.insert(news)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 News", response = Result.class) + public Result updateNews(@RequestBody News news) { + return Result.success(newsService.update(news)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 News", response = Result.class) + public Result deleteNews(@PathVariable("id") Integer id) { + return Result.success(newsService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 News列表(分页)", response = Result.class) + public Result listNews(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(newsService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/NewsTagController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/NewsTagController.java new file mode 100644 index 0000000..63cbf7e --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/NewsTagController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.NewsTag; +import com.hc.tripbusiness.service.NewsTagService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 新闻标签表(NewsTag)表控制层 + * + * @author java + * @since 2021-04-30 14:03:24 + */ + +@RestController +@RequestMapping("/api/newsTag") +public class NewsTagController { + + /** + * 服务对象 + */ + private final NewsTagService newsTagService; + + public NewsTagController(NewsTagService newsTagService) { + this.newsTagService = newsTagService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 NewsTag", response = Result.class) + public Result selectNewsTag(@PathVariable("id") Integer id) { + return Result.success(this.newsTagService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 NewsTag", response = Result.class) + public Result addNewsTag(@Valid @RequestBody NewsTag newsTag) { + return Result.success(newsTagService.insert(newsTag)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 NewsTag", response = Result.class) + public Result updateNewsTag(@RequestBody NewsTag newsTag) { + return Result.success(newsTagService.update(newsTag)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 NewsTag", response = Result.class) + public Result deleteNewsTag(@PathVariable("id") Integer id) { + return Result.success(newsTagService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 NewsTag列表(分页)", response = Result.class) + public Result listNewsTag(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(newsTagService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/NewsTagRelaxController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/NewsTagRelaxController.java new file mode 100644 index 0000000..b288c00 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/NewsTagRelaxController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.NewsTagRelax; +import com.hc.tripbusiness.service.NewsTagRelaxService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * (NewsTagRelax)表控制层 + * + * @author java + * @since 2021-04-30 14:03:25 + */ + +@RestController +@RequestMapping("/api/newsTagRelax") +public class NewsTagRelaxController { + + /** + * 服务对象 + */ + private final NewsTagRelaxService newsTagRelaxService; + + public NewsTagRelaxController(NewsTagRelaxService newsTagRelaxService) { + this.newsTagRelaxService = newsTagRelaxService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 NewsTagRelax", response = Result.class) + public Result selectNewsTagRelax(@PathVariable("id") Integer id) { + return Result.success(this.newsTagRelaxService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 NewsTagRelax", response = Result.class) + public Result addNewsTagRelax(@Valid @RequestBody NewsTagRelax newsTagRelax) { + return Result.success(newsTagRelaxService.insert(newsTagRelax)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 NewsTagRelax", response = Result.class) + public Result updateNewsTagRelax(@RequestBody NewsTagRelax newsTagRelax) { + return Result.success(newsTagRelaxService.update(newsTagRelax)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 NewsTagRelax", response = Result.class) + public Result deleteNewsTagRelax(@PathVariable("id") Integer id) { + return Result.success(newsTagRelaxService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 NewsTagRelax列表(分页)", response = Result.class) + public Result listNewsTagRelax(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(newsTagRelaxService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/RolesController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/RolesController.java new file mode 100644 index 0000000..fe3af79 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/RolesController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.Roles; +import com.hc.tripbusiness.service.RolesService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * (Roles)表控制层 + * + * @author java + * @since 2021-04-30 15:08:18 + */ + +@RestController +@RequestMapping("/api/roles") +public class RolesController { + + /** + * 服务对象 + */ + private final RolesService rolesService; + + public RolesController(RolesService rolesService) { + this.rolesService = rolesService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 Roles", response = Result.class) + public Result selectRoles(@PathVariable("id") Integer id) { + return Result.success(this.rolesService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 Roles", response = Result.class) + public Result addRoles(@Valid @RequestBody Roles roles) { + return Result.success(rolesService.insert(roles)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 Roles", response = Result.class) + public Result updateRoles(@RequestBody Roles roles) { + return Result.success(rolesService.update(roles)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 Roles", response = Result.class) + public Result deleteRoles(@PathVariable("id") Integer id) { + return Result.success(rolesService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 Roles列表(分页)", response = Result.class) + public Result listRoles(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(rolesService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryController.java new file mode 100644 index 0000000..c9602f5 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.Scenery; +import com.hc.tripbusiness.service.SceneryService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 景点表(Scenery)表控制层 + * + * @author java + * @since 2021-04-25 09:27:40 + */ + +@RestController +@RequestMapping("/api/scenery") +public class SceneryController { + + /** + * 服务对象 + */ + private final SceneryService sceneryService; + + public SceneryController(SceneryService sceneryService) { + this.sceneryService = sceneryService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 Scenery", response = Result.class) + public Result selectScenery(@PathVariable("id") Integer id) { + return Result.success(this.sceneryService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 Scenery", response = Result.class) + public Result addScenery(@Valid @RequestBody Scenery scenery) { + return Result.success(sceneryService.insert(scenery)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 Scenery", response = Result.class) + public Result updateScenery(@RequestBody Scenery scenery) { + return Result.success(sceneryService.update(scenery)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 Scenery", response = Result.class) + public Result deleteScenery(@PathVariable("id") Integer id) { + return Result.success(sceneryService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 Scenery列表(分页)", response = Result.class) + public Result listScenery(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(sceneryService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryPictureController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryPictureController.java new file mode 100644 index 0000000..70a0a00 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryPictureController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.SceneryPicture; +import com.hc.tripbusiness.service.SceneryPictureService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 景点图片表(SceneryPicture)表控制层 + * + * @author java + * @since 2021-04-27 15:26:10 + */ + +@RestController +@RequestMapping("/api/sceneryPicture") +public class SceneryPictureController { + + /** + * 服务对象 + */ + private final SceneryPictureService sceneryPictureService; + + public SceneryPictureController(SceneryPictureService sceneryPictureService) { + this.sceneryPictureService = sceneryPictureService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 SceneryPicture", response = Result.class) + public Result selectSceneryPicture(@PathVariable("id") Integer id) { + return Result.success(this.sceneryPictureService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 SceneryPicture", response = Result.class) + public Result addSceneryPicture(@Valid @RequestBody SceneryPicture sceneryPicture) { + return Result.success(sceneryPictureService.insert(sceneryPicture)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 SceneryPicture", response = Result.class) + public Result updateSceneryPicture(@RequestBody SceneryPicture sceneryPicture) { + return Result.success(sceneryPictureService.update(sceneryPicture)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 SceneryPicture", response = Result.class) + public Result deleteSceneryPicture(@PathVariable("id") Integer id) { + return Result.success(sceneryPictureService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 SceneryPicture列表(分页)", response = Result.class) + public Result listSceneryPicture(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(sceneryPictureService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryTagController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryTagController.java new file mode 100644 index 0000000..b5ad71b --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryTagController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.SceneryTag; +import com.hc.tripbusiness.service.SceneryTagService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 景点标签(SceneryTag)表控制层 + * + * @author java + * @since 2021-04-27 15:26:11 + */ + +@RestController +@RequestMapping("/api/sceneryTag") +public class SceneryTagController { + + /** + * 服务对象 + */ + private final SceneryTagService sceneryTagService; + + public SceneryTagController(SceneryTagService sceneryTagService) { + this.sceneryTagService = sceneryTagService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 SceneryTag", response = Result.class) + public Result selectSceneryTag(@PathVariable("id") Integer id) { + return Result.success(this.sceneryTagService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 SceneryTag", response = Result.class) + public Result addSceneryTag(@Valid @RequestBody SceneryTag sceneryTag) { + return Result.success(sceneryTagService.insert(sceneryTag)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 SceneryTag", response = Result.class) + public Result updateSceneryTag(@RequestBody SceneryTag sceneryTag) { + return Result.success(sceneryTagService.update(sceneryTag)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 SceneryTag", response = Result.class) + public Result deleteSceneryTag(@PathVariable("id") Integer id) { + return Result.success(sceneryTagService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 SceneryTag列表(分页)", response = Result.class) + public Result listSceneryTag(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(sceneryTagService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryTicketsController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryTicketsController.java new file mode 100644 index 0000000..f530e1c --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryTicketsController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.SceneryTickets; +import com.hc.tripbusiness.service.SceneryTicketsService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 景点门票表(SceneryTickets)表控制层 + * + * @author java + * @since 2021-04-25 09:34:29 + */ + +@RestController +@RequestMapping("/api/sceneryTickets") +public class SceneryTicketsController { + + /** + * 服务对象 + */ + private final SceneryTicketsService sceneryTicketsService; + + public SceneryTicketsController(SceneryTicketsService sceneryTicketsService) { + this.sceneryTicketsService = sceneryTicketsService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 SceneryTickets", response = Result.class) + public Result selectSceneryTickets(@PathVariable("id") Integer id) { + return Result.success(this.sceneryTicketsService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 SceneryTickets", response = Result.class) + public Result addSceneryTickets(@Valid @RequestBody SceneryTickets sceneryTickets) { + return Result.success(sceneryTicketsService.insert(sceneryTickets)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 SceneryTickets", response = Result.class) + public Result updateSceneryTickets(@RequestBody SceneryTickets sceneryTickets) { + return Result.success(sceneryTicketsService.update(sceneryTickets)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 SceneryTickets", response = Result.class) + public Result deleteSceneryTickets(@PathVariable("id") Integer id) { + return Result.success(sceneryTicketsService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 SceneryTickets列表(分页)", response = Result.class) + public Result listSceneryTickets(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(sceneryTicketsService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryTicketsTypeController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryTicketsTypeController.java new file mode 100644 index 0000000..5231cd1 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryTicketsTypeController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.SceneryTicketsType; +import com.hc.tripbusiness.service.SceneryTicketsTypeService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 门票类型表(SceneryTicketsType)表控制层 + * + * @author java + * @since 2021-04-25 09:39:57 + */ + +@RestController +@RequestMapping("/api/sceneryTicketsType") +public class SceneryTicketsTypeController { + + /** + * 服务对象 + */ + private final SceneryTicketsTypeService sceneryTicketsTypeService; + + public SceneryTicketsTypeController(SceneryTicketsTypeService sceneryTicketsTypeService) { + this.sceneryTicketsTypeService = sceneryTicketsTypeService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 SceneryTicketsType", response = Result.class) + public Result selectSceneryTicketsType(@PathVariable("id") Integer id) { + return Result.success(this.sceneryTicketsTypeService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 SceneryTicketsType", response = Result.class) + public Result addSceneryTicketsType(@Valid @RequestBody SceneryTicketsType sceneryTicketsType) { + return Result.success(sceneryTicketsTypeService.insert(sceneryTicketsType)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 SceneryTicketsType", response = Result.class) + public Result updateSceneryTicketsType(@RequestBody SceneryTicketsType sceneryTicketsType) { + return Result.success(sceneryTicketsTypeService.update(sceneryTicketsType)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 SceneryTicketsType", response = Result.class) + public Result deleteSceneryTicketsType(@PathVariable("id") Integer id) { + return Result.success(sceneryTicketsTypeService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 SceneryTicketsType列表(分页)", response = Result.class) + public Result listSceneryTicketsType(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(sceneryTicketsTypeService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryVideoController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryVideoController.java new file mode 100644 index 0000000..9811d22 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/SceneryVideoController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.SceneryVideo; +import com.hc.tripbusiness.service.SceneryVideoService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 景点视频表(SceneryVideo)表控制层 + * + * @author java + * @since 2021-04-27 15:26:48 + */ + +@RestController +@RequestMapping("/api/sceneryVideo") +public class SceneryVideoController { + + /** + * 服务对象 + */ + private final SceneryVideoService sceneryVideoService; + + public SceneryVideoController(SceneryVideoService sceneryVideoService) { + this.sceneryVideoService = sceneryVideoService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 SceneryVideo", response = Result.class) + public Result selectSceneryVideo(@PathVariable("id") Integer id) { + return Result.success(this.sceneryVideoService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 SceneryVideo", response = Result.class) + public Result addSceneryVideo(@Valid @RequestBody SceneryVideo sceneryVideo) { + return Result.success(sceneryVideoService.insert(sceneryVideo)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 SceneryVideo", response = Result.class) + public Result updateSceneryVideo(@RequestBody SceneryVideo sceneryVideo) { + return Result.success(sceneryVideoService.update(sceneryVideo)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 SceneryVideo", response = Result.class) + public Result deleteSceneryVideo(@PathVariable("id") Integer id) { + return Result.success(sceneryVideoService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 SceneryVideo列表(分页)", response = Result.class) + public Result listSceneryVideo(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(sceneryVideoService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserOrderDetailController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserOrderDetailController.java new file mode 100644 index 0000000..6f013ba --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserOrderDetailController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.UserOrderDetail; +import com.hc.tripbusiness.service.UserOrderDetailService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 订单详情表(UserOrderDetail)表控制层 + * + * @author java + * @since 2021-04-30 17:01:28 + */ + +@RestController +@RequestMapping("/api/userOrderDetail") +public class UserOrderDetailController { + + /** + * 服务对象 + */ + private final UserOrderDetailService userOrderDetailService; + + public UserOrderDetailController(UserOrderDetailService userOrderDetailService) { + this.userOrderDetailService = userOrderDetailService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 UserOrderDetail", response = Result.class) + public Result selectUserOrderDetail(@PathVariable("id") Integer id) { + return Result.success(this.userOrderDetailService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 UserOrderDetail", response = Result.class) + public Result addUserOrderDetail(@Valid @RequestBody UserOrderDetail userOrderDetail) { + return Result.success(userOrderDetailService.insert(userOrderDetail)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 UserOrderDetail", response = Result.class) + public Result updateUserOrderDetail(@RequestBody UserOrderDetail userOrderDetail) { + return Result.success(userOrderDetailService.update(userOrderDetail)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 UserOrderDetail", response = Result.class) + public Result deleteUserOrderDetail(@PathVariable("id") Integer id) { + return Result.success(userOrderDetailService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 UserOrderDetail列表(分页)", response = Result.class) + public Result listUserOrderDetail(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(userOrderDetailService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserOrdersController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserOrdersController.java new file mode 100644 index 0000000..b33dd0a --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserOrdersController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.UserOrders; +import com.hc.tripbusiness.service.UserOrdersService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 订单表(UserOrders)表控制层 + * + * @author java + * @since 2021-04-30 17:01:29 + */ + +@RestController +@RequestMapping("/api/userOrders") +public class UserOrdersController { + + /** + * 服务对象 + */ + private final UserOrdersService userOrdersService; + + public UserOrdersController(UserOrdersService userOrdersService) { + this.userOrdersService = userOrdersService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 UserOrders", response = Result.class) + public Result selectUserOrders(@PathVariable("id") Integer id) { + return Result.success(this.userOrdersService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 UserOrders", response = Result.class) + public Result addUserOrders(@Valid @RequestBody UserOrders userOrders) { + return Result.success(userOrdersService.insert(userOrders)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 UserOrders", response = Result.class) + public Result updateUserOrders(@RequestBody UserOrders userOrders) { + return Result.success(userOrdersService.update(userOrders)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 UserOrders", response = Result.class) + public Result deleteUserOrders(@PathVariable("id") Integer id) { + return Result.success(userOrdersService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 UserOrders列表(分页)", response = Result.class) + public Result listUserOrders(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(userOrdersService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserShopController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserShopController.java new file mode 100644 index 0000000..9f0ee45 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserShopController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.UserShop; +import com.hc.tripbusiness.service.UserShopService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 购物车表(UserShop)表控制层 + * + * @author java + * @since 2021-04-30 17:01:30 + */ + +@RestController +@RequestMapping("/api/userShop") +public class UserShopController { + + /** + * 服务对象 + */ + private final UserShopService userShopService; + + public UserShopController(UserShopService userShopService) { + this.userShopService = userShopService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 UserShop", response = Result.class) + public Result selectUserOrders(@PathVariable("id") Integer id) { + return Result.success(this.userShopService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 UserShop", response = Result.class) + public Result addUserShop(@Valid @RequestBody UserShop userShop) { + return Result.success(userShopService.insert(userShop)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 UserShop", response = Result.class) + public Result updateUserShop(@RequestBody UserShop userShop) { + return Result.success(userShopService.update(userShop)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 UserShop", response = Result.class) + public Result deleteUserShop(@PathVariable("id") Integer id) { + return Result.success(userShopService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 UserShop列表(分页)", response = Result.class) + public Result listUserShop(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(userShopService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserTicketsController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserTicketsController.java new file mode 100644 index 0000000..1b01c72 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UserTicketsController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.UserTickets; +import com.hc.tripbusiness.service.UserTicketsService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * 用户门票(UserTickets)表控制层 + * + * @author java + * @since 2021-04-30 17:01:31 + */ + +@RestController +@RequestMapping("/api/userTickets") +public class UserTicketsController { + + /** + * 服务对象 + */ + private final UserTicketsService userTicketsService; + + public UserTicketsController(UserTicketsService userTicketsService) { + this.userTicketsService = userTicketsService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 UserTickets", response = Result.class) + public Result selectUserTickets(@PathVariable("id") Integer id) { + return Result.success(this.userTicketsService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 UserTickets", response = Result.class) + public Result addUserTickets(@Valid @RequestBody UserTickets userTickets) { + return Result.success(userTicketsService.insert(userTickets)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 UserTickets", response = Result.class) + public Result updateUserTickets(@RequestBody UserTickets userTickets) { + return Result.success(userTicketsService.update(userTickets)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 UserTickets", response = Result.class) + public Result deleteUserTickets(@PathVariable("id") Integer id) { + return Result.success(userTicketsService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 UserTickets列表(分页)", response = Result.class) + public Result listUserTickets(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(userTicketsService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UsersController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UsersController.java new file mode 100644 index 0000000..9bf6e52 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UsersController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.Users; +import com.hc.tripbusiness.service.UsersService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * (Users)表控制层 + * + * @author java + * @since 2021-04-25 17:45:11 + */ + +@RestController +@RequestMapping("/api/users") +public class UsersController { + + /** + * 服务对象 + */ + private final UsersService usersService; + + public UsersController(UsersService usersService) { + this.usersService = usersService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 Users", response = Result.class) + public Result selectUsers(@PathVariable("id") Long id) { + return Result.success(this.usersService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 Users", response = Result.class) + public Result addUsers(@Valid @RequestBody Users users) { + return Result.success(usersService.insert(users)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 Users", response = Result.class) + public Result updateUsers(@RequestBody Users users) { + return Result.success(usersService.update(users)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 Users", response = Result.class) + public Result deleteUsers(@PathVariable("id") Long id) { + return Result.success(usersService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 Users列表(分页)", response = Result.class) + public Result listUsers(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(usersService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UsersRoleController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UsersRoleController.java new file mode 100644 index 0000000..f0ca4c4 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/UsersRoleController.java @@ -0,0 +1,64 @@ +package com.hc.tripweb.controller; + +import com.hc.tripbusiness.model.UsersRole; +import com.hc.tripbusiness.service.UsersRoleService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + + +/** + * (UsersRole)表控制层 + * + * @author java + * @since 2021-04-30 15:08:37 + */ + +@RestController +@RequestMapping("/api/usersRole") +public class UsersRoleController { + + /** + * 服务对象 + */ + private final UsersRoleService usersRoleService; + + public UsersRoleController(UsersRoleService usersRoleService) { + this.usersRoleService = usersRoleService; + } + + @GetMapping("/{id}") + @ApiOperation(value = "依据主键获取 UsersRole", response = Result.class) + public Result selectUsersRole(@PathVariable("id") Integer id) { + return Result.success(this.usersRoleService.queryById(id)); + } + + @PostMapping("/insert") + @ApiOperation(value = "新增 UsersRole", response = Result.class) + public Result addUsersRole(@Valid @RequestBody UsersRole usersRole) { + return Result.success(usersRoleService.insert(usersRole)); + } + + @PutMapping("/update") + @ApiOperation(value = "修改 UsersRole", response = Result.class) + public Result updateUsersRole(@RequestBody UsersRole usersRole) { + return Result.success(usersRoleService.update(usersRole)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation(value = "依据主键删除 UsersRole", response = Result.class) + public Result deleteUsersRole(@PathVariable("id") Integer id) { + return Result.success(usersRoleService.deleteById(id)); + } + + @GetMapping("/list") + @ApiOperation(value = "获取 UsersRole列表(分页)", response = Result.class) + public Result listUsersRole(@RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "0") Integer size) { + return Result.success(usersRoleService.queryAllByLimit(page, size)); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/WeChatLoginController.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/WeChatLoginController.java new file mode 100644 index 0000000..d50c275 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/controller/WeChatLoginController.java @@ -0,0 +1,39 @@ +package com.hc.tripweb.controller; + + +import com.hc.tripbusiness.model.login.AccessEntity; +import com.hc.tripbusiness.service.UsersService; +import com.hc.tripcore.utils.result.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * @author JIA + */ + +@RestController +@RequestMapping(value = "/api/weChat") +public class WeChatLoginController { + + private final UsersService usersService; + + @Autowired + public WeChatLoginController(UsersService usersService) { + this.usersService = usersService; + } + + @GetMapping("/login") + @ApiOperation(value = "小程序官方登录", response = Result.class) + public String login(@RequestParam String appid, @RequestParam String code) { + return usersService.login(appid, code); + } + + @GetMapping("/openId/{openId}") + @ApiOperation(value = "依据OpenId,获取用户信息", response = Result.class) + public AccessEntity selectUserByOpenId(@PathVariable("openId") String openId) { + return usersService.selectUserByOpenId(openId); + } + + +} diff --git a/fenis-trip/trip-web/src/main/java/com/hc/tripweb/handler/ExceptionResultHandler.java b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/handler/ExceptionResultHandler.java new file mode 100644 index 0000000..b764620 --- /dev/null +++ b/fenis-trip/trip-web/src/main/java/com/hc/tripweb/handler/ExceptionResultHandler.java @@ -0,0 +1,105 @@ +package com.hc.tripweb.handler; + + +import com.hc.tripcore.utils.exception.ResponseException; +import com.hc.tripcore.utils.result.Result; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.jdbc.UncategorizedSQLException; +import org.springframework.validation.BindingResult; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.MissingServletRequestParameterException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import java.util.Set; + +/** + * @author JIA + */ + +@RestControllerAdvice +public class ExceptionResultHandler { + + Logger logger = LoggerFactory.getLogger(this.getClass()); + + @ExceptionHandler(MethodArgumentNotValidException.class) + @ResponseStatus(HttpStatus.OK) + @ResponseBody + public Result handleMethodArgumentNotValidException(MethodArgumentNotValidException exception) { + logger.error(exception.getMessage()); + StringBuilder errorInfo = new StringBuilder(); + BindingResult bindingResult = exception.getBindingResult(); + for (int i = 0; i < bindingResult.getFieldErrors().size(); i++) { + if (i > 0) { + errorInfo.append(","); + } + FieldError fieldError = bindingResult.getFieldErrors().get(i); + errorInfo.append(fieldError.getField()).append(" :").append(fieldError.getDefaultMessage()); + } + //返回BaseResponse + Result response = new Result(); + response.setMsg(errorInfo.toString()); + response.setCode(401); + return response; + } + + @ExceptionHandler(MissingServletRequestParameterException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + public Result handleRequestParameterException(MissingServletRequestParameterException e) { + logger.error(e.getMessage()); + return Result.exception(HttpStatus.BAD_REQUEST.value(), e.getMessage()); + } + + @ExceptionHandler(ConstraintViolationException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseBody + public Result handleConstraintViolationException(ConstraintViolationException exception) { + logger.error(exception.getMessage()); + StringBuilder errorInfo = new StringBuilder(); + String errorMessage; + + Set> violations = exception.getConstraintViolations(); + for (ConstraintViolation item : violations) { + errorInfo.append(item.getMessage()).append(","); + } + errorMessage = errorInfo.toString().substring(0, errorInfo.toString().length() - 1); + + //返回BaseResponse + Result response = new Result(); + response.setMsg(errorMessage); + response.setCode(402); + return response; + } + + + @ExceptionHandler(ResponseException.class) + @ResponseStatus(HttpStatus.OK) + @ResponseBody + public Result handleResponseException(ResponseException e) { + logger.error(e.getMessage()); + return Result.exception(e.getCode(), e.getMessage()); + } + + @ExceptionHandler(UncategorizedSQLException.class) + @ResponseBody + @ResponseStatus(HttpStatus.NOT_FOUND) + public Result handleSqlException(UncategorizedSQLException e) { + return Result.exception(e.hashCode(), e.getCause().toString()); + } + + @ExceptionHandler(Exception.class) + @ResponseBody + @ResponseStatus(HttpStatus.BAD_REQUEST) + public Result handleException(Exception e) { + logger.error(e.getMessage()); + return Result.exception(-1, e.getMessage()); + } + +} diff --git a/fenis-trip/trip-web/src/main/resources/application-dev.yml b/fenis-trip/trip-web/src/main/resources/application-dev.yml new file mode 100644 index 0000000..d4acd47 --- /dev/null +++ b/fenis-trip/trip-web/src/main/resources/application-dev.yml @@ -0,0 +1,21 @@ +spring: + profiles: dev + datasource: + url: jdbc:mysql://1.116.136.247:3306/fenis_trip?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowMultiQueries=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true + username: root + password: 123456 + redis: + host: 1.116.136.247 + database: 1 + port: 6379 + password: mypass + timeout: 2000 + lettuce: + pool: + max-idle: 2000 + max-active: 10 + max-wait: -1ms + min-idle: 0 + +server: + port: 8081 \ No newline at end of file diff --git a/fenis-trip/trip-web/src/main/resources/application-pro.yml b/fenis-trip/trip-web/src/main/resources/application-pro.yml new file mode 100644 index 0000000..1f20449 --- /dev/null +++ b/fenis-trip/trip-web/src/main/resources/application-pro.yml @@ -0,0 +1,21 @@ +spring: + profiles: pro + datasource: + url: jdbc:mysql://1.116.136.247:3306/fenis_trip?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowMultiQueries=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true + username: root + password: 123456 + redis: + host: 47.104.62.154 + database: 1 + port: 6379 + password: mypass + timeout: 2000 + lettuce: + pool: + max-idle: 2000 + max-active: 10 + max-wait: -1ms + min-idle: 0 + +server: + port: 8080 diff --git a/fenis-trip/trip-web/src/main/resources/application.yml b/fenis-trip/trip-web/src/main/resources/application.yml new file mode 100644 index 0000000..c24fe05 --- /dev/null +++ b/fenis-trip/trip-web/src/main/resources/application.yml @@ -0,0 +1,35 @@ +spring: + application: + name: fenis-trip + resources: + static-locations: classpath:/static/,classpath:/resources/ + profiles: + active: pro + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + +mybatis: + mapper-locations: classpath:mapper/*.xml + config-location: classpath:mybatis-config.xml + type-aliases-package: com.hc.acbusiness.model + +swagger: + enabled: true + +rong: + TEMPLATE_ID: dbVeHPNx41jaeiyhFNBaZX + REGION: 86 + SEND_CODE_URL: http://api.sms.ronghub.com/sendCode.json + APP_SECRIT: BEV264hUatgD + APP_KEY: mgb7ka1nmddyg + VERIF_CODE_URL: http://api.sms.ronghub.com/verifyCode.json + +wx: + miniapp: + configs: + - appid: wx8f787d4dbb3b3cdd + secret: 17eea0ec61f584d5984ef4811121447e + token: XXX # 微信小程序消息服务器配置的token + aesKey: XXX # 微信小程序消息服务器配置的EncodingAESKey + msgDataFormat: JSON diff --git a/fenis-trip/trip-web/src/test/java/com/hc/tripweb/TripWebApplicationTests.java b/fenis-trip/trip-web/src/test/java/com/hc/tripweb/TripWebApplicationTests.java new file mode 100644 index 0000000..d939dbe --- /dev/null +++ b/fenis-trip/trip-web/src/test/java/com/hc/tripweb/TripWebApplicationTests.java @@ -0,0 +1,16 @@ +package com.hc.tripweb; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class TripWebApplicationTests { + + + + @Test + void contextLoads() { + System.out.println(Runtime.getRuntime().availableProcessors()); + } + +} diff --git a/fenis-trip/trip-web/trip-web.iml b/fenis-trip/trip-web/trip-web.iml new file mode 100644 index 0000000..85b794c --- /dev/null +++ b/fenis-trip/trip-web/trip-web.iml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fenis_trip-2021-5-24.sql b/fenis_trip-2021-5-24.sql new file mode 100644 index 0000000..f017bf6 --- /dev/null +++ b/fenis_trip-2021-5-24.sql @@ -0,0 +1,442 @@ +/* + Navicat Premium Data Transfer + + Source Server : 腾讯云测试 + Source Server Type : MySQL + Source Server Version : 80024 + Source Host : 1.116.136.247:3306 + Source Schema : fenis_trip + + Target Server Type : MySQL + Target Server Version : 80024 + File Encoding : 65001 + + Date: 24/05/2021 15:23:49 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for banner +-- ---------------------------- +DROP TABLE IF EXISTS `banner`; +CREATE TABLE `banner` ( + `banner_id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'ID主键', + `banner_title` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主题', + `banner_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '广告连接', + `banner_index` int(0) NOT NULL DEFAULT 0 COMMENT '索引', + `target_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '点击后跳转的目的链接', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`banner_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '广告表\r\n' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of banner +-- ---------------------------- + +-- ---------------------------- +-- Table structure for hotel +-- ---------------------------- +DROP TABLE IF EXISTS `hotel`; +CREATE TABLE `hotel` ( + `hotel_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '酒店id', + `hotel_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '酒店名称', + `hotel_logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '酒店logo', + `hotel_content` blob NOT NULL COMMENT '酒店内容', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`hotel_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '酒店表\r\n' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of hotel +-- ---------------------------- + +-- ---------------------------- +-- Table structure for hotel_video +-- ---------------------------- +DROP TABLE IF EXISTS `hotel_video`; +CREATE TABLE `hotel_video` ( + `hotel_video_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `video_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频名称', + `video_introduce` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频介绍', + `video_index` int(0) NULL DEFAULT NULL COMMENT '排序字段', + `video_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资源地址', + `hotel_id` int(10) UNSIGNED ZEROFILL NOT NULL COMMENT '酒店ID', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`hotel_video_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '酒店视频表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of hotel_video +-- ---------------------------- + +-- ---------------------------- +-- Table structure for news +-- ---------------------------- +DROP TABLE IF EXISTS `news`; +CREATE TABLE `news` ( + `news_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '新闻id', + `news_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题', + `news_logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题配图', + `news_content` blob NOT NULL COMMENT '新闻内容', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`news_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '新闻表\r\n' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of news +-- ---------------------------- + +-- ---------------------------- +-- Table structure for news_tag +-- ---------------------------- +DROP TABLE IF EXISTS `news_tag`; +CREATE TABLE `news_tag` ( + `tag_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键id', + `tag_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类别名称', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`tag_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '新闻标签表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of news_tag +-- ---------------------------- + +-- ---------------------------- +-- Table structure for news_tag_relax +-- ---------------------------- +DROP TABLE IF EXISTS `news_tag_relax`; +CREATE TABLE `news_tag_relax` ( + `news_tag_relax_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `tag_id` int(0) NULL DEFAULT NULL COMMENT '标签id', + `news_id` int(0) NULL DEFAULT NULL COMMENT '新闻id', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`news_tag_relax_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of news_tag_relax +-- ---------------------------- + +-- ---------------------------- +-- Table structure for permissions +-- ---------------------------- +DROP TABLE IF EXISTS `permissions`; +CREATE TABLE `permissions` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '权限名称', + `parent_id` int(0) NULL DEFAULT NULL COMMENT '父级id', + `level_id` int(0) NULL DEFAULT NULL COMMENT '层级id', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `permissions_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由地址', + `sort` int(0) NULL DEFAULT NULL COMMENT '排序', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of permissions +-- ---------------------------- + +-- ---------------------------- +-- Table structure for role_permission +-- ---------------------------- +DROP TABLE IF EXISTS `role_permission`; +CREATE TABLE `role_permission` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `role_id` int(0) NOT NULL COMMENT '角色id', + `permission_id` int(0) NOT NULL COMMENT '权限id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of role_permission +-- ---------------------------- + +-- ---------------------------- +-- Table structure for roles +-- ---------------------------- +DROP TABLE IF EXISTS `roles`; +CREATE TABLE `roles` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色名称', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of roles +-- ---------------------------- + +-- ---------------------------- +-- Table structure for scenery +-- ---------------------------- +DROP TABLE IF EXISTS `scenery`; +CREATE TABLE `scenery` ( + `scenery_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `scenery_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '景区名称', + `scenery_notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '景点公告', + `scenery_index` int(0) NULL DEFAULT NULL COMMENT '景点排序', + `scenery_introduce` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '景点介绍', + `scenery_logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '景点Logo', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + `start_time` bigint(0) NULL DEFAULT NULL COMMENT '开放时间', + `end_time` bigint(0) NULL DEFAULT NULL COMMENT '结束时间', + `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话', + `website` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '官网', + `traffic` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '交通', + PRIMARY KEY (`scenery_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '景点表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of scenery +-- ---------------------------- +INSERT INTO `scenery` VALUES (1, '红山森林动物园', 'string', 0, '红毛猩猩是动物园的“镇园之宝”', 'string', 0, 0, 0, 0, '18530065188', 'string', '红山森林动物园/火车站北广场,距我5.7km'); +INSERT INTO `scenery` VALUES (2, '南京总统府', 'string', 1, '见证六个世纪得历史变迁', 'string', 0, 0, 0, 0, '15039108221', 'string', '总统府/1912商圈,距我1.1km'); + +-- ---------------------------- +-- Table structure for scenery_picture +-- ---------------------------- +DROP TABLE IF EXISTS `scenery_picture`; +CREATE TABLE `scenery_picture` ( + `scenery_picture_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `picture_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片名称', + `picture_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片地址', + `picture_introduce` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片介绍', + `picture_index` int(0) NULL DEFAULT NULL COMMENT '图片排序', + `scenery_id` int(0) NOT NULL COMMENT '景区id', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`scenery_picture_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '景点图片表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of scenery_picture +-- ---------------------------- + +-- ---------------------------- +-- Table structure for scenery_tag +-- ---------------------------- +DROP TABLE IF EXISTS `scenery_tag`; +CREATE TABLE `scenery_tag` ( + `scenery_tag_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `tag_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '景区标签', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`scenery_tag_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '景点标签' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of scenery_tag +-- ---------------------------- + +-- ---------------------------- +-- Table structure for scenery_tickets +-- ---------------------------- +DROP TABLE IF EXISTS `scenery_tickets`; +CREATE TABLE `scenery_tickets` ( + `scenery_ticket_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `tickets_type_id` int(0) NULL DEFAULT NULL COMMENT '景区门票类型', + `tickets_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '门票名字', + `tickets_price` decimal(11, 2) NULL DEFAULT NULL COMMENT '门票价格', + `ticket_introduce` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '门票介绍', + `tickets_logo` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '门票logo', + `scenery_id` int(0) NOT NULL COMMENT '景区id', + `ticket_sell_num` int(0) NULL DEFAULT NULL COMMENT '销售数量 ', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`scenery_ticket_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '景点门票表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of scenery_tickets +-- ---------------------------- +INSERT INTO `scenery_tickets` VALUES (1, 1, '测试', 100.00, '测试', 'string', 1, 100, 1600000, 1600000); +INSERT INTO `scenery_tickets` VALUES (2, 1, '门票名称', 0.01, '门票介绍', '门票图片路径', 1, 0, NULL, NULL); + +-- ---------------------------- +-- Table structure for scenery_tickets_type +-- ---------------------------- +DROP TABLE IF EXISTS `scenery_tickets_type`; +CREATE TABLE `scenery_tickets_type` ( + `tickets_type_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `ticket_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '门票类型名称', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`tickets_type_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '门票类型表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of scenery_tickets_type +-- ---------------------------- +INSERT INTO `scenery_tickets_type` VALUES (1, '成人票', NULL, NULL); +INSERT INTO `scenery_tickets_type` VALUES (2, '儿童票', NULL, NULL); + +-- ---------------------------- +-- Table structure for scenery_video +-- ---------------------------- +DROP TABLE IF EXISTS `scenery_video`; +CREATE TABLE `scenery_video` ( + `scenery_video_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `video_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频名称', + `video_introduce` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频介绍', + `video_index` int(0) NULL DEFAULT NULL COMMENT '排序字段', + `video_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资源地址', + `scenery_id` int(0) NOT NULL COMMENT '外键', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`scenery_video_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '景点视频表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of scenery_video +-- ---------------------------- + +-- ---------------------------- +-- Table structure for user_order_detail +-- ---------------------------- +DROP TABLE IF EXISTS `user_order_detail`; +CREATE TABLE `user_order_detail` ( + `order_detail_id` int(0) NOT NULL COMMENT '主键id', + `order_id` int(0) NULL DEFAULT NULL COMMENT '订单id', + `scenery_ticket_id` int(0) NULL DEFAULT NULL COMMENT '门票id', + `num` int(0) NULL DEFAULT NULL COMMENT '购买数量', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`order_detail_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单详情表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of user_order_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for user_orders +-- ---------------------------- +DROP TABLE IF EXISTS `user_orders`; +CREATE TABLE `user_orders` ( + `orders_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键id', + `order_no` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单号', + `user_id` int(0) NOT NULL COMMENT '用户id', + `body` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品介绍', + `subject` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '订单名称', + `total_amount` decimal(11, 2) NOT NULL COMMENT '订单总金额', + `order_status` int(0) NULL DEFAULT NULL COMMENT '订单状态', + `is_de` int(0) NULL DEFAULT NULL COMMENT '是否删除', + `ali_trade_no` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付宝交易号', + `wx_trade_no` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信交易号', + `user_invoices_id` int(0) NULL DEFAULT NULL COMMENT '发票id', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + `version` int(0) NULL DEFAULT NULL COMMENT '乐观锁', + PRIMARY KEY (`orders_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单表' ROW_FORMAT = Compact; + +-- ---------------------------- +-- Records of user_orders +-- ---------------------------- + +-- ---------------------------- +-- Table structure for user_shop +-- ---------------------------- +DROP TABLE IF EXISTS `user_shop`; +CREATE TABLE `user_shop` ( + `user_shop_id` int(0) NOT NULL COMMENT '主键', + `user_id` int(0) NULL DEFAULT NULL COMMENT '用户id', + `scenery_ticket_id` int(0) NULL DEFAULT NULL COMMENT '门票id', + `num` int(0) NULL DEFAULT NULL COMMENT '数量id', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`user_shop_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '购物车表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of user_shop +-- ---------------------------- + +-- ---------------------------- +-- Table structure for user_tickets +-- ---------------------------- +DROP TABLE IF EXISTS `user_tickets`; +CREATE TABLE `user_tickets` ( + `user_tickets_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键id', + `scenery_ticket_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '门票id', + `tickets_pass` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '票密码(保留)', + `tickets_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '票号', + `tickets_code` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '二维码地址', + `tickets_time` bigint(0) NULL DEFAULT NULL COMMENT '门票得有效期时间', + `user_id` int(0) NULL DEFAULT NULL COMMENT '用户id', + `is_use` tinyint(0) NOT NULL COMMENT '是否使用', + `used_time` bigint(0) NULL DEFAULT NULL COMMENT '使用时间戳', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + `version` int(0) NULL DEFAULT NULL COMMENT '乐观锁', + PRIMARY KEY (`user_tickets_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户门票' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of user_tickets +-- ---------------------------- + +-- ---------------------------- +-- Table structure for users +-- ---------------------------- +DROP TABLE IF EXISTS `users`; +CREATE TABLE `users` ( + `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户名', + `password` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '密码', + `user_logo` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户头像', + `nickname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '社区昵称', + `gender` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '性别', + `openid` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信openid', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of users +-- ---------------------------- +INSERT INTO `users` VALUES (10, NULL, NULL, NULL, NULL, NULL, 'owjUD5dEt9nxwbkI0rnhuBIXEeRM'); +INSERT INTO `users` VALUES (11, NULL, NULL, NULL, NULL, NULL, 'o94Uw5N9fgp4FXrklZ5bEs0AW5-U'); +INSERT INTO `users` VALUES (12, NULL, NULL, NULL, NULL, NULL, 'o94Uw5OuN_TH5jEbi2novb0w8rnM'); +INSERT INTO `users` VALUES (14, NULL, NULL, NULL, NULL, NULL, 'o94Uw5NRI9Gy1-WIi2Ak2rsCEetE'); +INSERT INTO `users` VALUES (15, NULL, NULL, NULL, NULL, NULL, 'o94Uw5AXcSNpHIITcftos9q_1Aig'); + +-- ---------------------------- +-- Table structure for users_role +-- ---------------------------- +DROP TABLE IF EXISTS `users_role`; +CREATE TABLE `users_role` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + `role_id` int(0) NOT NULL COMMENT '角色信息', + `user_id` int(0) NOT NULL COMMENT '用户信息', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of users_role +-- ---------------------------- + +-- ---------------------------- +-- Table structure for wifi +-- ---------------------------- +DROP TABLE IF EXISTS `wifi`; +CREATE TABLE `wifi` ( + `wifi_id` int(0) NOT NULL AUTO_INCREMENT, + `wifi_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'wifi跳转PORTAL', + `create_time` bigint(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(0) NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`wifi_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'wifi接入portal地址表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of wifi +-- ---------------------------- + +SET FOREIGN_KEY_CHECKS = 1;