企业入驻
parent
ea00ef9ad5
commit
44f2aff05e
|
@ -62,6 +62,11 @@
|
|||
<artifactId>february-common-swagger</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.february.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TCarType {
|
||||
private Integer carTypeId;
|
||||
private String carTypeName;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.february.system.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class Tadmin {
|
||||
private Integer adminId;
|
||||
private String adminName;
|
||||
private String adminPhone;
|
||||
private String adminPassword;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date adminRole;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.february.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Tcar {
|
||||
|
||||
private Integer carId;//主键id
|
||||
private String carVin;//vin
|
||||
private String carBh;//车牌号
|
||||
private Integer carTypeId;//车型id
|
||||
private Integer actuateId;//驱动编号
|
||||
private Integer batteryId;//电池编号
|
||||
private Integer batteryMakerId;//电池厂家id
|
||||
private Integer motorManufactuerId;//电机厂家id
|
||||
private Integer carStatus;//车辆状态
|
||||
private String operatingArea;//运行区域
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.february.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Tuser {
|
||||
private Integer userId;
|
||||
private String userName;
|
||||
private String userPhone;
|
||||
private String userPssword;
|
||||
private String carVin;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.february.system.domain.constants;
|
||||
|
||||
/**
|
||||
* @description: 系统常量
|
||||
* @author
|
||||
*/
|
||||
public class Constants {
|
||||
/**
|
||||
* 成功标记
|
||||
*/
|
||||
public static final Integer SUCCESS = 200;
|
||||
public static final String SUCCESS_MSG = "操作成功";
|
||||
/**
|
||||
* 失败标记
|
||||
*/
|
||||
public static final Integer ERROR = 500;
|
||||
public static final String ERROR_MSG = "操作异常";
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.february.system.domain.constants;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @description: Jwt常量
|
||||
*/
|
||||
public class JwtConstants {
|
||||
|
||||
/**
|
||||
* 用户ID字段
|
||||
*/
|
||||
public static final String DETAILS_USER_ID = "user_id";
|
||||
|
||||
/**
|
||||
* 用户名字段
|
||||
*/
|
||||
public static final String DETAILS_USERNAME = "username";
|
||||
|
||||
/**
|
||||
* 用户标识
|
||||
*/
|
||||
public static final String USER_KEY = "user_key";
|
||||
|
||||
/**
|
||||
* 令牌秘钥
|
||||
*/
|
||||
public final static String SECRET = "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.february.system.domain.constants;
|
||||
|
||||
/**
|
||||
* @ClassName:
|
||||
* @Description:
|
||||
* @Author: duKai
|
||||
* @Date: 2023/6/27
|
||||
*/
|
||||
public class RabbitMQConstants {
|
||||
|
||||
/**
|
||||
* 短信队列名称
|
||||
*/
|
||||
public static final String SEND_SMS_QUEUE_NAME = "sms_queue";
|
||||
|
||||
public static final String COUNT_LOGIN_BY_DAY = "count_login_by_day";
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.february.system.domain.constants;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @description: 令牌常量
|
||||
*/
|
||||
public class TokenConstants {
|
||||
/**
|
||||
* 缓存有效期,默认720(分钟)
|
||||
*/
|
||||
public final static long EXPIRATION = 720;
|
||||
/**
|
||||
* 缓存刷新时间,默认120(分钟)
|
||||
*/
|
||||
public final static long REFRESH_TIME = 120;
|
||||
/**
|
||||
* 权限缓存前缀
|
||||
*/
|
||||
public final static String LOGIN_TOKEN_KEY = "login_tokens:";
|
||||
/**
|
||||
* token标识
|
||||
*/
|
||||
public static final String TOKEN = "token";
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.february.system.domain.result;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @description: 列表返回结果集
|
||||
*/
|
||||
@Data
|
||||
public class PageResult<T> implements Serializable {
|
||||
/**
|
||||
* 总条数
|
||||
*/
|
||||
private long total;
|
||||
/**
|
||||
* 结果集合
|
||||
*/
|
||||
private List<T> list;
|
||||
public PageResult() {
|
||||
}
|
||||
public PageResult(long total, List<T> list) {
|
||||
this.total = total;
|
||||
this.list = list;
|
||||
}
|
||||
public static <T> PageResult<T> toPageResult(long total, List<T> list){
|
||||
return new PageResult(total , list);
|
||||
}
|
||||
public static <T> Result<PageResult<T>> toResult(long total, List<T> list){
|
||||
return Result.success(PageResult.toPageResult(total,list));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.february.system.domain.result;
|
||||
|
||||
import com.february.system.domain.constants.Constants;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @description: 响应信息主体
|
||||
*/
|
||||
@Data
|
||||
public class Result<T> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
public static final int SUCCESS = Constants.SUCCESS;
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
public static final int FAIL = Constants.ERROR;
|
||||
/**
|
||||
* 返回状态码
|
||||
*/
|
||||
private int code;
|
||||
/**
|
||||
* 响应信息
|
||||
*/
|
||||
private String msg;
|
||||
/**
|
||||
* 响应数据
|
||||
*/
|
||||
private T data;
|
||||
|
||||
public static <T> Result<T> success() {
|
||||
return restResult(null, SUCCESS, Constants.SUCCESS_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> success(T data) {
|
||||
return restResult(data, SUCCESS, Constants.SUCCESS_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> success(T data, String msg) {
|
||||
return restResult(data, SUCCESS, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error() {
|
||||
return restResult(null, FAIL, Constants.ERROR_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(String msg) {
|
||||
return restResult(null, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(T data) {
|
||||
return restResult(data, FAIL, Constants.ERROR_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(T data, String msg) {
|
||||
return restResult(data, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(int code, String msg) {
|
||||
return restResult(null, code, msg);
|
||||
}
|
||||
|
||||
private static <T> Result<T> restResult(T data, int code, String msg) {
|
||||
Result<T> apiResult = new Result<>();
|
||||
apiResult.setCode(code);
|
||||
apiResult.setData(data);
|
||||
apiResult.setMsg(msg);
|
||||
return apiResult;
|
||||
}
|
||||
}
|
|
@ -22,5 +22,12 @@
|
|||
<artifactId>february-merchant-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-common-core</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-merchant-settlement</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.february</groupId>
|
||||
<version>3.6.3</version>
|
||||
<artifactId>february-merchant-server</artifactId>
|
||||
|
@ -34,11 +34,7 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- RuoYi Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-common-log</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
|
@ -52,6 +48,42 @@
|
|||
<version>3.6.3</version>
|
||||
</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>-->
|
||||
|
||||
<!-- <!– 图片上传 –>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.github.tobato</groupId>-->
|
||||
<!-- <artifactId>fastdfs-client</artifactId>-->
|
||||
<!-- <version>1.26.5</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
package com.february;
|
||||
package com.february.merchant;
|
||||
|
||||
import com.february.common.security.annotation.EnableCustomConfig;
|
||||
import com.february.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@SpringBootApplication
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
|
@ -0,0 +1,63 @@
|
|||
package com.february.merchant.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.february.merchant.service.AddCarService;
|
||||
import com.february.system.domain.Tadmin;
|
||||
import com.february.system.domain.Tcar;
|
||||
import com.february.system.domain.Tuser;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.february.system.domain.result.Result;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/add")
|
||||
@Log4j2
|
||||
public class AddCarController {
|
||||
@Autowired
|
||||
private AddCarService addCarService;
|
||||
@Autowired
|
||||
|
||||
private HttpServletRequest request;
|
||||
|
||||
@PostMapping("addCar")
|
||||
public Result addCar(@RequestBody Tcar tcar){
|
||||
log.info("功能名称:添加车辆,请求URI:{},请求方式:{},请求结果:{}"
|
||||
,request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(tcar));
|
||||
addCarService.addCar(tcar);
|
||||
Result<Object> result = Result.success();
|
||||
log.info("功能名称:添加车辆,响应URI:{},相应方式:{},响应结果:{}"
|
||||
,request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户名获取用户信息
|
||||
*/
|
||||
@PostMapping("/findByadminName/{adminName}")
|
||||
public Result<Tadmin> findByadminName(@PathVariable String adminName){
|
||||
log.info("功能名称:根据用户名获取用户信息,请求URI:{},请求方式:{},请求参数:{}"
|
||||
,request.getRequestURI(),request.getMethod(),adminName);
|
||||
Tadmin tadmin=addCarService.findByadminName(adminName);
|
||||
Result<Tadmin> result = Result.success(tadmin);
|
||||
log.info("功能名称:根据用户名获取用户信息,响应URI:{},相应方式:{},响应结果:{}"
|
||||
,request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户名获取用户信息
|
||||
*/
|
||||
@PostMapping("/findByuserName/{userName}")
|
||||
public Result<Tuser> findByuserName(@PathVariable String userName){
|
||||
log.info("功能名称:根据客户名获取用户信息,请求URI:{},请求方式:{},请求参数:{}"
|
||||
,request.getRequestURI(),request.getMethod(),userName);
|
||||
Tuser tuser= addCarService.findByuserName(userName);
|
||||
Result<Tuser> result = Result.success(tuser);
|
||||
log.info("功能名称:根据客户名获取用户信息,响应URI:{},响应方式:{},响应结果:{}"
|
||||
,request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.february.merchant.mapper;
|
||||
|
||||
import com.february.system.domain.Tadmin;
|
||||
import com.february.system.domain.Tcar;
|
||||
import com.february.system.domain.Tuser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
public interface AddCarMapper {
|
||||
void addCar(Tcar tcar);
|
||||
|
||||
Tadmin findByadminName(String adminName);
|
||||
|
||||
Tuser findByuserName(String userName);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.february.merchant.service;
|
||||
|
||||
import com.february.system.domain.Tadmin;
|
||||
import com.february.system.domain.Tcar;
|
||||
import com.february.system.domain.Tuser;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface AddCarService {
|
||||
void addCar(Tcar tcar);
|
||||
|
||||
Tadmin findByadminName(String adminName);
|
||||
|
||||
Tuser findByuserName(String userName);
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.february.merchant.service.impl;
|
||||
|
||||
import com.february.merchant.mapper.AddCarMapper;
|
||||
import com.february.merchant.service.AddCarService;
|
||||
import com.february.system.domain.Tadmin;
|
||||
import com.february.system.domain.Tcar;
|
||||
import com.february.system.domain.Tuser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AddCarServiceImpl implements AddCarService {
|
||||
@Autowired
|
||||
private AddCarMapper addCarMapper;
|
||||
|
||||
@Override
|
||||
public void addCar(Tcar tcar) {
|
||||
addCarMapper.addCar(tcar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tadmin findByadminName(String adminName) {
|
||||
return addCarMapper.findByadminName(adminName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tuser findByuserName(String userName) {
|
||||
return addCarMapper.findByuserName(userName);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9204
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: merchant-settlement
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 10.100.1.4:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 10.100.1.4:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -0,0 +1,30 @@
|
|||
<?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.february.merchant.mapper.AddCarMapper">
|
||||
|
||||
|
||||
<insert id="addCar">
|
||||
INSERT INTO `car`.`t_car` (`car_id`, `car_vin`, `car_bh`, `car_type_id`, `actuate_id`, `battery_id`, `battery_maker_id`, `motor_manufacturer_id`, `car_status`, `operating_area`) VALUES
|
||||
(
|
||||
null,
|
||||
#{carVin},
|
||||
#{carBh},
|
||||
#{carTypeId},
|
||||
#{actuateId},
|
||||
#{batteryId},
|
||||
#{batteryMakerId},
|
||||
#{motorManufactuerId},
|
||||
#{carStatus},
|
||||
#{operatingArea}
|
||||
)
|
||||
</insert>
|
||||
<select id="findByadminName" resultType="com.february.system.domain.Tadmin">
|
||||
select *
|
||||
from t_admin where admin_name=#{adminName}
|
||||
</select>
|
||||
<select id="findByuserName" resultType="com.february.system.domain.Tuser">
|
||||
select *
|
||||
from t_user where user_name=#{userName}
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue