master
肖凡 2023-11-19 21:32:26 +08:00
parent 1686f3a5bb
commit 49e5ef680a
31 changed files with 369 additions and 18 deletions

View File

@ -7,13 +7,14 @@
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="bwie-customer" />
<module name="bwie-user" />
<module name="bwie-vip" />
<module name="bwie-merch" />
<module name="bwie-common" />
<module name="bwie-rabbit" />
<module name="bwie-gateway" />
<module name="bwie-auth" />
<module name="bwie-merch" />
<module name="bwie-customer" />
</profile>
</annotationProcessing>
</component>
@ -26,6 +27,7 @@
<module name="bwie-merch" options="-parameters" />
<module name="bwie-rabbit" options="-parameters" />
<module name="bwie-user" options="-parameters" />
<module name="bwie-vip" options="-parameters" />
</option>
</component>
</project>

View File

@ -8,6 +8,7 @@
<file url="file://$PROJECT_DIR$/bwie-moudels/bwie-merch/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-moudels/bwie-rabbit/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-moudels/bwie-user/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-moudels/bwie-vip/src/main/java" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,17 @@
package com.bwie.common.domain;
import lombok.Data;
import java.util.Date;
@Data
public class Vip {
private Integer vipId;
private String vipName;
private Integer vipAge;
private String vipGender;
private Integer customerId;
private String vipTel;
private String vipGrade;
private Date regDate;
}

View File

@ -0,0 +1,12 @@
package com.bwie.common.domain.request;
import lombok.Data;
@Data
public class VipRequest {
private Integer vipId;
private String vipName;
private Integer pageNum=1;
private Integer pageSize=3;
}

View File

@ -1,4 +1,5 @@
com\bwie\common\domain\Merch.class
com\bwie\common\domain\request\VipRequest.class
com\bwie\common\result\PageResult.class
com\bwie\common\domain\request\LoginRequest.class
com\bwie\common\domain\User.class
@ -13,6 +14,7 @@ com\bwie\common\domain\request\MerchRequest.class
com\bwie\common\constants\TokenConstants.class
com\bwie\common\utils\OssUtil.class
com\bwie\common\result\Result.class
com\bwie\common\domain\Vip.class
com\bwie\common\domain\request\UserRequest.class
com\bwie\common\config\RedisConfig.class
com\bwie\common\domain\Customer.class

View File

@ -6,7 +6,9 @@ D:\zhuangao5\safeway\bwie-common\src\main\java\com\bwie\common\config\RedisConfi
D:\zhuangao5\safeway\bwie-common\src\main\java\com\bwie\common\utils\StringUtils.java
D:\zhuangao5\safeway\bwie-common\src\main\java\com\bwie\common\domain\request\CustomerRequest.java
D:\zhuangao5\safeway\bwie-common\src\main\java\com\bwie\common\domain\request\MerchRequest.java
D:\zhuangao5\safeway\bwie-common\src\main\java\com\bwie\common\domain\Vip.java
D:\zhuangao5\safeway\bwie-common\src\main\java\com\bwie\common\constants\RabbitMQQueueConstants.java
D:\zhuangao5\safeway\bwie-common\src\main\java\com\bwie\common\domain\request\VipRequest.java
D:\zhuangao5\safeway\bwie-common\src\main\java\com\bwie\common\utils\FastUtil.java
D:\zhuangao5\safeway\bwie-common\src\main\java\com\bwie\common\constants\RabbitName.java
D:\zhuangao5\safeway\bwie-common\src\main\java\com\bwie\common\domain\request\LoginRequest.java

View File

@ -74,12 +74,12 @@ public class AuthFilter implements GlobalFilter, Ordered {
if (null == hasKey || !hasKey) {
return GatewayUtils.errorResponse(exchange, "token过期");
}
redisTemplate.expire(TokenConstants.LOGIN_TOKEN_KEY + userKey, 15, TimeUnit.MINUTES);
// String jsonStr = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
// SysUser sysUser = JSONObject.parseObject(jsonStr, SysUser.class);
// Date lastLoginTime = sysUser.getLastLoginTime();
// long between = DateUtil.between(lastLoginTime, new Date(), DateUnit.MINUTE);
// if (between >= 10) {
// redisTemplate.expire(TokenConstants.LOGIN_TOKEN_KEY + userKey, 15, TimeUnit.MINUTES);

View File

@ -27,7 +27,7 @@ public class CustomerController {
log.info("执行操作:查询列表,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(customerRequest));
Result<PageResult<Customer>> result=customerService.list(customerRequest);
log.info("执行操作:查询列表,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:查询列表,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(result));
return result;
}
@ -37,7 +37,7 @@ public class CustomerController {
request.getMethod(), JSONObject.toJSONString(customer));
Result result=Result.success();
customerService.add(customer);
log.info("执行操作:添加,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:添加,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(result));
return result;
}
@ -48,7 +48,7 @@ public class CustomerController {
request.getMethod(), JSONObject.toJSONString(customer));
Result result=Result.success();
customerService.update(customer);
log.info("执行操作:添加,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:添加,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(result));
return result;
}
@ -58,7 +58,7 @@ public class CustomerController {
log.info("执行操作:回显,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(customerId));
Customer customer=customerService.findById(customerId);
log.info("执行操作:回显,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:回显,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(customer));
return Result.success(customer);
}
@ -69,7 +69,7 @@ public class CustomerController {
request.getMethod(), JSONObject.toJSONString(customerId));
Result result=Result.success();
customerService.deleteId(customerId);
log.info("执行操作:添加,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:添加,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(customerId));
return result;
}

View File

@ -27,7 +27,7 @@ public class MerchController {
log.info("查询列表,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(merchRequest));
Result<PageResult<Merch>> result=merchService.list(merchRequest);
log.info("查询列表,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("查询列表,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(result));
return result;
}

View File

@ -26,7 +26,7 @@ public class UserController {
log.info("执行操作:查询手机号,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(phone));
User user=userService.findByPhone(phone);
log.info("执行操作:查询手机号,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:查询手机号,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(user));
return Result.success(user);
}
@ -36,7 +36,7 @@ public class UserController {
log.info("执行操作:查询员工列表,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(userRequest));
Result<PageResult<User>> result=userService.list(userRequest);
log.info("执行操作:查询员工列表,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:查询员工列表,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(result));
return result;
}
@ -46,7 +46,7 @@ public class UserController {
log.info("执行操作:查询员工列表,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(userRequest));
Result<PageResult<User>> result=userService.list2(userRequest);
log.info("执行操作:查询员工列表,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:查询员工列表,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(result));
return result;
}
@ -57,7 +57,7 @@ public class UserController {
request.getMethod(),JSONObject.toJSONString(user));
Result result=Result.success();
userService.add(user);
log.info("执行操作:添加,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:添加,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(result));
return result;
}
@ -68,7 +68,7 @@ public class UserController {
request.getMethod(),JSONObject.toJSONString(user));
Result result=Result.success();
userService.update(user);
log.info("执行操作:修改,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:修改,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(result));
return result;
}
@ -79,7 +79,7 @@ public class UserController {
log.info("执行操作:回显,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(userId));
User user=userService.findById(userId);
log.info("执行操作:回显,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:回显,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(userId));
return Result.success(user);
}
@ -90,7 +90,7 @@ public class UserController {
request.getMethod(),JSONObject.toJSONString(userId));
Result result=Result.success();
userService.deleteId(userId);
log.info("执行操作:删除,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
log.info("执行操作:删除,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(result));
return result;
}

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>bwie-moudels</artifactId>
<groupId>com.bwie</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bwie-vip</artifactId>
<dependencies>
<!-- 系统公共 依赖 -->
<dependency>
<groupId>com.bwie</groupId>
<artifactId>bwie-common</artifactId>
</dependency>
<!-- SpringBoot Web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.8</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- Mybatis 依赖配置 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
<!-- Pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.1</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,11 @@
package com.bwie.vip;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class VipApp {
public static void main(String[] args) {
SpringApplication.run(VipApp.class);
}
}

View File

@ -0,0 +1,78 @@
package com.bwie.vip.controller;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.domain.User;
import com.bwie.common.domain.Vip;
import com.bwie.common.domain.request.VipRequest;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.vip.service.VipService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController
@Log4j2
public class VipController {
@Autowired
VipService vipService;
@Autowired
HttpServletRequest request;
@PostMapping("/list")
public Result<PageResult<Vip>> list(@RequestBody VipRequest vipRequest){
log.info("执行操作:查询会员列表,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(vipRequest));
Result<PageResult<Vip>> result=vipService.list(vipRequest);
log.info("执行操作:查询会员列表,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(), JSONObject.toJSONString(vipRequest));
return result;
}
@PostMapping("/add")
public Result add(@RequestBody Vip vip){
log.info("执行操作:添加,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(vip));
Result result=Result.success();
vipService.add(vip);
log.info("执行操作:添加,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(result));
return result;
}
@PostMapping("/update")
public Result update(@RequestBody Vip vip){
log.info("执行操作:修改,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(vip));
Result result=Result.success();
vipService.update(vip);
log.info("执行操作:修改,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(result));
return result;
}
@PostMapping("/findById/{vipId}")
public Result<Vip> findById(@PathVariable Integer vipId){
log.info("执行操作:回显,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(vipId));
Vip vip=vipService.findById(vipId);
log.info("执行操作:回显,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(vip));
return Result.success(vip);
}
@DeleteMapping("deleteId/{vipId}")
public Result deleteId(@PathVariable Integer vipId){
log.info("执行操作:删除,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(vipId));
Result result=Result.success();
vipService.deleteId(vipId);
log.info("执行操作:删除,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
request.getMethod(),JSONObject.toJSONString(result));
return result;
}
}

View File

@ -0,0 +1,21 @@
package com.bwie.vip.mapper;
import com.bwie.common.domain.Vip;
import com.bwie.common.domain.request.VipRequest;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import java.util.List;
@Mapper
@Component
public interface VipMapper {
List<Vip> list(VipRequest vipRequest);
void add(Vip vip);
void update(Vip vip);
Vip findById(Integer vipId);
void deleteId(Integer vipId);
}

View File

@ -0,0 +1,18 @@
package com.bwie.vip.service;
import com.bwie.common.domain.Vip;
import com.bwie.common.domain.request.VipRequest;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
public interface VipService {
Result<PageResult<Vip>> list(VipRequest vipRequest);
void add(Vip vip);
void update(Vip vip);
Vip findById(Integer vipId);
void deleteId(Integer vipId);
}

View File

@ -0,0 +1,47 @@
package com.bwie.vip.service;
import com.bwie.common.domain.Vip;
import com.bwie.common.domain.request.VipRequest;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.vip.mapper.VipMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class VipServiceimpl implements VipService{
@Autowired
VipMapper vipMapper;
@Override
public Result<PageResult<Vip>> list(VipRequest vipRequest) {
PageHelper.startPage(vipRequest.getPageNum(),vipRequest.getPageSize());
List<Vip> list=vipMapper.list(vipRequest);
PageInfo<Vip> info = new PageInfo<>(list);
return PageResult.toResult(info.getTotal(),list);
}
@Override
public void add(Vip vip) {
vipMapper.add(vip);
}
@Override
public void update(Vip vip) {
vipMapper.update(vip);
}
@Override
public Vip findById(Integer vipId) {
return vipMapper.findById(vipId);
}
@Override
public void deleteId(Integer vipId) {
vipMapper.deleteId(vipId);
}
}

View File

@ -0,0 +1,29 @@
# Tomcat
server:
port: 9006
# Spring
spring:
main:
allow-circular-references: true
jackson:
date-format: yyyy-MM-dd
time-zone: GMT+8
application:
# 应用名称
name: bwie-vip
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 111.229.36.192:8848
config:
# 配置中心地址
server-addr: 111.229.36.192:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bwie.vip.mapper.VipMapper">
<insert id="add">
insert into t_vip(
vip_name,
vip_age,
vip_gender,
customer_id,
vip_tel,
vip_grade,
reg_date
) values (
#{vipName},
#{vipAge},
#{vipGender},
#{customerId},
#{vipTel},
#{vipGrade},
now()
)
</insert>
<update id="update">
update t_vip set
vip_name=#{vipName},
vip_age=#{vipAge},
vip_gender=#{vipGender},
customer_id=#{customerId},
vip_tel=#{vipTel},
vip_grade=#{vipGrade},
reg_date=#{regDate}
where vip_id=#{vipId}
</update>
<delete id="deleteId">
delete from t_vip where vip_id=#{vipId}
</delete>
<select id="list" resultType="com.bwie.common.domain.Vip">
select * from t_vip
<where>
<if test="vipId!=null and vipId!=null">
and vip_id=#{vipId}
</if>
<if test="vipName!=null and vipName!=''">
and vip_name like concat('%',#{vipName},'%')
</if>
</where>
</select>
<select id="findById" resultType="com.bwie.common.domain.Vip">
select * from t_vip where vip_id=#{vipId}
</select>
</mapper>

View File

@ -16,6 +16,7 @@
<module>bwie-rabbit</module>
<module>bwie-merch</module>
<module>bwie-customer</module>
<module>bwie-vip</module>
</modules>
<!--==============================================公共============================================================-->