企业入驻

master
liujiaxin 2023-11-20 13:55:50 +08:00
parent ea00ef9ad5
commit 44f2aff05e
21 changed files with 490 additions and 7 deletions

View File

@ -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>

View File

@ -0,0 +1,9 @@
package com.february.system.domain;
import lombok.Data;
@Data
public class TCarType {
private Integer carTypeId;
private String carTypeName;
}

View File

@ -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;
}

View File

@ -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;//运行区域
}

View File

@ -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;
}

View File

@ -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 = "操作异常";
}

View File

@ -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";
}

View File

@ -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";
}

View File

@ -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";
}

View File

@ -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));
}
}

View File

@ -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;
}
}

View File

@ -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>

View File

@ -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>
<!-- &lt;!&ndash; SpringBoot Web&ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-web</artifactId>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; Druid &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.alibaba</groupId>-->
<!-- <artifactId>druid-spring-boot-starter</artifactId>-->
<!-- <version>1.2.8</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; Mysql Connector &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>mysql</groupId>-->
<!-- <artifactId>mysql-connector-java</artifactId>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; Mybatis 依赖配置 &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
<!-- <version>2.2.2</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; Pagehelper &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.github.pagehelper</groupId>-->
<!-- <artifactId>pagehelper-spring-boot-starter</artifactId>-->
<!-- <version>1.4.1</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; 图片上传 &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.github.tobato</groupId>-->
<!-- <artifactId>fastdfs-client</artifactId>-->
<!-- <version>1.26.5</version>-->
<!-- </dependency>-->
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>

View File

@ -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) {

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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}

View File

@ -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>

View File

@ -32,4 +32,5 @@
<url>http://10.100.1.5:8081/repository/maven-releases/</url>
</repository>
</distributionManagement>
</project>