Compare commits

..

1 Commits
master ... dev

Author SHA1 Message Date
caolin 19cffe1c7c 验证 2024-06-30 17:06:29 +08:00
15 changed files with 36 additions and 302 deletions

13
pom.xml
View File

@ -35,6 +35,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- 获取spring boot相关应用程序信息 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -186,14 +191,6 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>

View File

@ -29,8 +29,7 @@ public class CorsConfig implements WebMvcConfigurer {
"/error",
"/webjars/**",
"/doc.html",
"/tdQuestion/duima/*",
"/tdSysUserMember/duima/**");
"/tdQuestion/duima/*");
}

View File

@ -1,35 +1,10 @@
package com.jwl.driver.server.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jwl.driver.server.dto.MemberQueryDto;
import com.jwl.driver.server.dto.UserMemberDto;
import com.jwl.driver.server.entity.TdSysUser;
import com.jwl.driver.server.entity.TdSysUserMember;
import com.jwl.driver.server.exception.BusinessException;
import com.jwl.driver.server.response.BaseResponse;
import com.jwl.driver.server.service.ITdCarService;
import com.jwl.driver.server.service.ITdMemberService;
import com.jwl.driver.server.service.ITdSysUserMemberService;
import com.jwl.driver.server.service.ITdSysUserService;
import com.jwl.driver.server.vo.MemberVo;
import com.jwl.driver.server.vo.UserMemberVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.User;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* ;
@ -38,87 +13,8 @@ import java.util.Map;
* @author Automated procedures
* @since 2023-08-10
*/
@RestController
@RequestMapping("/tdSysUserMember")
@Slf4j
@Api(tags = "用户会员")
@Controller
@RequestMapping("//tdSysUserMember")
public class TdSysUserMemberController {
@Resource
private ITdMemberService memberService;
@Resource
private ITdSysUserMemberService userMemberService;
@Resource
private ITdCarService tdCarService;
@Resource
private ITdSysUserService userService;
/**
*
* */
@ApiOperation("查询车型列表")
@GetMapping("/duima/car/list")
public Map getCarList(){
Map<String, Object> result = new HashMap<>();
result.put("code", 200);
result.put("data", tdCarService.list());
return result;
}
/**
*
* */
@ApiOperation("查询会员类型列表")
@GetMapping("/duima/member/list")
public Map getMemberList(MemberQueryDto memberQueryDto){
Map<String, Object> result = new HashMap<>();
result.put("code", 200);
result.put("data", memberService.queryMember(memberQueryDto));
return result;
}
//查询用户会员列表
@ApiOperation("查询会员用户列表")
@GetMapping("/duima/user/member/list")
public Map getUserMemberList(UserMemberDto userMemberDto){
Map<String, Object> result = new HashMap<>();
result.put("code", 200);
result.put("data", userMemberService.queryUserMemberList(userMemberDto));
return result;
}
//新增会员
@ApiOperation("新增用户会员")
@PostMapping("/duima/user/member")
public Map addUserMember(@RequestBody UserMemberVo userMemberVo){
Map<String, Object> result = new HashMap<>();
final LocalDateTime nowTime = LocalDateTime.now();
//跟进手机号查询用户
LambdaQueryWrapper<TdSysUser> cond = new LambdaQueryWrapper<TdSysUser>()
.eq(TdSysUser::getPhone,userMemberVo.getPhone());
TdSysUser user = userService.getOne(cond);
if(user == null){
result.put("code", 500);
result.put("msg", "用户不存在");
return result;
}
TdSysUserMember userMember = new TdSysUserMember()
.setMemberId(userMemberVo.getMemberId())
.setUserId(user.getUserId())
.setCreateTime(nowTime)
.setUpdateTime(nowTime)
.setStartDate(LocalDateTime.of(LocalDate.now(), LocalTime.MIN))
.setEndDate(LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusYears(1).minusSeconds(1));
result.put("code", 200);
result.put("data", userMemberService.saveOrUpdate(userMember));
return result;
}
}

View File

@ -22,7 +22,4 @@ public class LoginUserDto {
@ApiModelProperty(value = "登陆验证码",required = true)
@NotBlank(message = "登陆验证码不能为空")
private String code;
@ApiModelProperty(value = "来源")
private String id;
}

View File

@ -1,9 +0,0 @@
package com.jwl.driver.server.dto;
import lombok.Data;
@Data
public class UserMemberDto {
private String phone;
private Integer memberId;
}

View File

@ -1,12 +1,7 @@
package com.jwl.driver.server.mapper;
import com.jwl.driver.server.dto.UserMemberDto;
import com.jwl.driver.server.entity.TdSysUserMember;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jwl.driver.server.vo.UserMemberVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@ -18,5 +13,4 @@ import java.util.List;
*/
public interface TdSysUserMemberMapper extends BaseMapper<TdSysUserMember> {
List<UserMemberVo> queryUserMemberList(@Param("userMemberDto") UserMemberDto userMemberDto);
}

View File

@ -1,12 +1,8 @@
package com.jwl.driver.server.service;
import com.jwl.driver.server.dto.UserMemberDto;
import com.jwl.driver.server.entity.OrderPayInfo;
import com.jwl.driver.server.entity.TdSysUserMember;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jwl.driver.server.vo.UserMemberVo;
import java.util.List;
/**
* <p>
@ -24,6 +20,4 @@ public interface ITdSysUserMemberService extends IService<TdSysUserMember> {
* @return
*/
Boolean purchaseMember(OrderPayInfo payInfo);
List<UserMemberVo> queryUserMemberList(UserMemberDto userMemberDto);
}

View File

@ -2,7 +2,6 @@ package com.jwl.driver.server.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jwl.driver.server.dto.UserMemberDto;
import com.jwl.driver.server.entity.OrderPayInfo;
import com.jwl.driver.server.entity.TdMember;
import com.jwl.driver.server.entity.TdSysUserMember;
@ -13,7 +12,6 @@ import com.jwl.driver.server.service.ITdMemberService;
import com.jwl.driver.server.service.ITdSysUserMemberService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jwl.driver.server.service.ITdSysUserService;
import com.jwl.driver.server.vo.UserMemberVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -21,7 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;
import java.util.Objects;
/**
@ -95,9 +92,4 @@ public class TdSysUserMemberServiceImpl extends ServiceImpl<TdSysUserMemberMappe
}
return Boolean.TRUE;
}
@Override
public List<UserMemberVo> queryUserMemberList(UserMemberDto userMemberDto) {
return getBaseMapper().queryUserMemberList(userMemberDto);
}
}

View File

@ -2,7 +2,6 @@ package com.jwl.driver.server.service.impl;
import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jwl.driver.server.constant.Constants;
import com.jwl.driver.server.dto.DriverSchoolDto;
@ -14,9 +13,11 @@ import com.jwl.driver.server.mapper.TdSysUserMapper;
import com.jwl.driver.server.redis.RedisCache;
import com.jwl.driver.server.service.ITdSysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jwl.driver.server.util.*;
import com.jwl.driver.server.util.DateTimeUtil;
import com.jwl.driver.server.util.SecurityUtil;
import com.jwl.driver.server.util.SmsUtil;
import com.jwl.driver.server.util.TokenThreadUtil;
import com.jwl.driver.server.vo.LoginUserVo;
import com.jwl.driver.server.vo.SchoolVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -87,25 +88,11 @@ public class TdSysUserServiceImpl extends ServiceImpl<TdSysUserMapper, TdSysUser
TdSysUser tdSysUser = this.baseMapper.selectOne(cond);
//todo 用户基础信息填写这里还要完善一下
if (tdSysUser == null) {
tdSysUser = new TdSysUser()
.setUserName("车友")
.setAvatar("")
.setPhone(loginUserDto.getPhone())
.setCreateTime(LocalDateTime.now());
//根据id查询驾校信息
if(!StringUtil.isNullOrEmpty(loginUserDto.getId())){
String result = HttpUtils.sendGet("https://xueche.ahduima.com/duima/applet/school/"+loginUserDto.getId());
JSONObject jsonObject = JSONObject.parseObject(result);
if(jsonObject.get("data") != null){
SchoolVO schoolVO = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("data")), SchoolVO.class);
tdSysUser.setSchoolId(schoolVO.getSchoolId())
.setSchoolName(schoolVO.getSchoolName())
.setSchoolPhone(schoolVO.getPhone());
}
}
int insert = this.getBaseMapper().insert(tdSysUser);
if (insert != 1) {
throw new BusinessException("用户注册异常");

View File

@ -1,20 +0,0 @@
package com.jwl.driver.server.vo;
import lombok.Data;
@Data
public class SchoolVO {
private Long schoolId;
/** 驾校名称 */
private String schoolName;
/** 负责人 */
private String leader;
/** 联系电话 */
private String phone;
/** 部门状态0正常 1停用 */
private String status;
}

View File

@ -1,70 +0,0 @@
package com.jwl.driver.server.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@Accessors(chain = true)
@ApiModel("用户学员")
public class UserMemberVo {
@ApiModelProperty("用户标识")
private Long userId;
@ApiModelProperty("手机号")
private String phone;
/**
*
*/
@ApiModelProperty("会员结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endDate;
/**
*
*/
@ApiModelProperty("会员开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startDate;
/**
*
*/
@ApiModelProperty("会员标识")
private Integer memberId;
/**
*
*/
@ApiModelProperty("会员名称")
private String memberName;
/**
*
*/
@ApiModelProperty("车型标识")
private Integer carTypeId;
@ApiModelProperty("车型")
private String carName;
/**
*
*/
@ApiModelProperty("科目")
private String subjects;
/**
*
*/
@ApiModelProperty("会员价格,单位元")
private BigDecimal price;
}

View File

@ -1,27 +1,27 @@
spring:
# redis 配置
redis:
# host: 127.0.0.1
# port: 6379
# database: 8
# timeout: 5000
# auth: caolin123
host: 118.31.23.45
port: 6973
host: 127.0.0.1
port: 6379
database: 8
timeout: 5000
password: c12&%3s7l=
auth: caolin123
# host: 118.31.23.45
# port: 6973
# database: 8
# timeout: 5000
# password: c12&%3s7l=
# 数据库 配置
datasource:
# 本地
# url: jdbc:mysql://127.0.0.1:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
# username: root
# password: 123456
# 测试库
url: jdbc:mysql://118.31.23.45:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
url: jdbc:mysql://127.0.0.1:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
username: root
password: admin231280
password: 123456
# 测试库
# url: jdbc:mysql://118.31.23.45:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
# username: root
# password: admin231280
# 生产库
# url: jdbc:mysql://114.55.169.15:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
# username: root

View File

@ -1,7 +1,7 @@
spring:
# redis 配置
redis:
host: 118.31.23.45
host: 127.0.0.1
port: 6973
database: 8
timeout: 5000
@ -9,6 +9,6 @@ spring:
# 数据库 配置
datasource:
url: jdbc:mysql://118.31.23.45:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
url: jdbc:mysql://127.0.0.1:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
username: root
password: admin231280

View File

@ -2,12 +2,18 @@ server:
port: 8888
servlet:
context-path: '/driver-api'
# 程序状态监控
management:
endpoints:
web:
exposure:
include: "*"
spring:
application:
name: '@artifactId@'
profiles:
active: prod
active: dev
#mybatis
mybatis-plus:
mapper-locations: classpath*:/mapper/**Mapper.xml

View File

@ -2,33 +2,4 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jwl.driver.server.mapper.TdSysUserMemberMapper">
<select id="queryUserMemberList" resultType="com.jwl.driver.server.vo.UserMemberVo">
select
tm.MEMBER_ID,
tm.MEMBER_NAME,
tm.CAR_TYPE_ID,
tm.PRICE,
tm.SUBJECTS,
su.USER_ID,
su.PHONE,
c.CAR_NAME,
um.START_DATE,
um.END_DATE
from
td_sys_user_member um
left join td_member tm on um.MEMBER_ID = tm.MEMBER_ID
left join td_sys_user su on su.USER_ID = um.USER_ID
left join td_car c on c.CAR_TYPE_ID = TM.CAR_TYPE_ID
<where>
<if test="userMemberDto.phone !=null">
and su.PHONE like concat("%" + #{userMemberDto.phone} + "%")
</if>
<if test="userMemberDto.memberId !=null">
and tm.MEMBER_ID = #{userMemberDto.memberId}
</if>
</where>
order by um.CREATE_TIME
</select>
</mapper>