Commit d4e4289a authored by chenwj's avatar chenwj

新增代币申请和Dapp申请接口

parent e741d97e
package com.roo.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel("dapps审核对象")
public class DappsAuditDTO {
private Long id;
@ApiModelProperty("Dapp网络")
private String chainCode;
@ApiModelProperty("Dapp名称")
private String name;
@ApiModelProperty("Dapp链接")
private String link;
@ApiModelProperty("Dapp简介")
private String description;
@ApiModelProperty("DappLogo链接")
private String logo;
@ApiModelProperty("电话")
private String tel;
@ApiModelProperty("微信")
private String wechat;
@ApiModelProperty("使用教程链接")
private String instructions;
@ApiModelProperty("审核不通过原因")
private String reason;
@ApiModelProperty("审核状态 1:待审核|2:审核通过|3:已处理|4:审核失败")
private Byte status;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新时间")
private Date updateTime;
}
package com.roo.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel("代币申请对象")
@Data
public class TokenAuditDTO {
private Long id;
@ApiModelProperty("项目网络")
private String chainCode;
@ApiModelProperty("代币名称(英文)")
private String nameEn;
@ApiModelProperty("代币符号")
private String symbol;
@ApiModelProperty("代币名称")
private String name;
@ApiModelProperty("合约地址")
private String contractId;
@ApiModelProperty("精度")
private Integer decimal;
@ApiModelProperty("数量")
private Long totalSupply;
@ApiModelProperty("项目简介")
private String description;
@ApiModelProperty("邮箱地址")
private String email;
@ApiModelProperty("官网")
private String officailWeb;
@ApiModelProperty("logo链接")
private String logo;
@ApiModelProperty("审核不通过原因")
private String reason;
@ApiModelProperty("审核状态 1:待审核|2:审核通过|3:已处理|4:审核失败")
private Byte status;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新时间")
private Date updateTime;
}
package com.roo.enums;
public enum AuditStatusEnum {
PENDING_REVIEW((byte) 1),
EXAMINATION_PASSED((byte) 2),
PROCESSED((byte) 3),
AUDIT_FAILURE((byte) 4);
private byte code;
AuditStatusEnum(byte code) {
this.code = code;
}
public byte getCode() {
return code;
}
}
......@@ -78,6 +78,36 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<!--mybatis自动生成代码插件-->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<phase>deploy</phase>
</execution>
</executions>
<configuration>
<!-- generator 工具配置文件的位置 -->
<configurationFile>src\main\resources\generator\generatorConfig.xml</configurationFile>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.8</version>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
......
package com.roo.controller;
import com.roo.commons.tools.utils.Result;
import com.roo.dto.DappsAuditDTO;
import com.roo.service.DappsAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/dappsAudit")
public class DappsAuditController {
@Autowired
private DappsAuditService dappsAuditService;
@RequestMapping("/settleIn")
public Result settleIn(@RequestBody DappsAuditDTO dto) {
dappsAuditService.save(dto);
return new Result();
}
}
package com.roo.controller;
import com.roo.commons.tools.utils.Result;
import com.roo.dto.TokenAuditDTO;
import com.roo.service.TokenAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/tokenAudit")
public class TokenAuditController {
@Autowired
private TokenAuditService tokenAuditService;
@RequestMapping("/settleIn")
public Result settleIn(@RequestBody TokenAuditDTO dto) {
tokenAuditService.save(dto);
return new Result();
}
}
package com.roo.dao;
import com.roo.entity.DappsAudit;
import com.roo.entity.DappsAuditExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Repository
public interface DappsAuditMapper {
int countByExample(DappsAuditExample example);
int deleteByExample(DappsAuditExample example);
int deleteByPrimaryKey(Long id);
int insert(DappsAudit record);
int insertSelective(DappsAudit record);
List<DappsAudit> selectByExample(DappsAuditExample example);
DappsAudit selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") DappsAudit record, @Param("example") DappsAuditExample example);
int updateByExample(@Param("record") DappsAudit record, @Param("example") DappsAuditExample example);
int updateByPrimaryKeySelective(DappsAudit record);
int updateByPrimaryKey(DappsAudit record);
}
\ No newline at end of file
package com.roo.dao;
import com.roo.entity.TokenAudit;
import com.roo.entity.TokenAuditExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Repository
public interface TokenAuditMapper {
int countByExample(TokenAuditExample example);
int deleteByExample(TokenAuditExample example);
int deleteByPrimaryKey(Long id);
int insert(TokenAudit record);
int insertSelective(TokenAudit record);
List<TokenAudit> selectByExample(TokenAuditExample example);
TokenAudit selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") TokenAudit record, @Param("example") TokenAuditExample example);
int updateByExample(@Param("record") TokenAudit record, @Param("example") TokenAuditExample example);
int updateByPrimaryKeySelective(TokenAudit record);
int updateByPrimaryKey(TokenAudit record);
}
\ No newline at end of file
package com.roo.entity;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@Builder
public class DappsAudit implements Serializable {
private Long id;
private String chainCode;
private String name;
private String link;
private String description;
private String logo;
private String tel;
private String wechat;
private String instructions;
private String reason;
private Byte status;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.roo.entity;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@Builder
public class TokenAudit implements Serializable {
private Long id;
private String chainCode;
private String nameEn;
private String symbol;
private String name;
private String contractId;
private Integer decimal;
private Long totalSupply;
private String description;
private String email;
private String officailWeb;
private String logo;
private String reason;
private Byte status;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.roo.service;
import com.roo.dto.DappsAuditDTO;
public interface DappsAuditService {
void save(DappsAuditDTO dto);
}
package com.roo.service;
import com.roo.dto.TokenAuditDTO;
public interface TokenAuditService {
void save(TokenAuditDTO dto);
}
package com.roo.service.impl;
import com.roo.dao.DappsAuditMapper;
import com.roo.dto.DappsAuditDTO;
import com.roo.entity.DappsAudit;
import com.roo.enums.AuditStatusEnum;
import com.roo.service.DappsAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class DappsAuditServiceImpl implements DappsAuditService {
@Autowired
private DappsAuditMapper dappsAuditMapper;
@Override
public void save(DappsAuditDTO dto) {
dappsAuditMapper.insert(DappsAudit.builder()
.chainCode(dto.getChainCode())
.createTime(new Date())
.description(dto.getDescription())
.instructions(dto.getInstructions())
.link(dto.getLink())
.logo(dto.getLogo())
.name(dto.getName())
.reason(dto.getReason())
.tel(dto.getTel())
.wechat(dto.getWechat())
.status(AuditStatusEnum.PENDING_REVIEW.getCode())
.build());
}
}
package com.roo.service.impl;
import com.roo.dao.TokenAuditMapper;
import com.roo.dto.TokenAuditDTO;
import com.roo.entity.TokenAudit;
import com.roo.enums.AuditStatusEnum;
import com.roo.service.TokenAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class TokenAuditServiceImpl implements TokenAuditService {
@Autowired
private TokenAuditMapper tokenAuditMapper;
@Override
public void save(TokenAuditDTO dto) {
tokenAuditMapper.insert(TokenAudit.builder()
.chainCode(dto.getChainCode())
.contractId(dto.getContractId())
.createTime(new Date())
.decimal(dto.getDecimal())
.description(dto.getDescription())
.email(dto.getEmail())
.logo(dto.getLogo())
.name(dto.getName())
.nameEn(dto.getNameEn())
.officailWeb(dto.getOfficailWeb())
.symbol(dto.getSymbol())
.totalSupply(dto.getTotalSupply())
.status(AuditStatusEnum.PENDING_REVIEW.getCode())
.build());
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- 导入配置文件 -->
<properties resource="bootstrap.yml"/>
<!-- defaultModelType="flat" 设置复合主键时不单独为主键创建实体 -->
<context id="MySql" defaultModelType="flat">
<!-- 生成的POJO实现java.io.Serializable接口 -->
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
<!-- 覆盖生成的xml,而不是追加 -->
<commentGenerator>
<property name="suppressDate" value="true"/>
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!-- 数据库连接,直接通过${}读取application.properties里的配置 -->
<jdbcConnection
driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.4.9:3306/roo_wallet?useUnicode=true&amp;characterEncoding=utf8"
userId="root"
password="MyNewPass@123">
<property name="nullCatalogMeansCurrent" value="true" />
</jdbcConnection>
<!-- 生成POJO对象 -->
<javaModelGenerator targetPackage="com.roo.entity"
targetProject="src/main/java">
</javaModelGenerator>
<!-- 生成mapper xml文件 -->
<sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources">
<property name="enableSubPackages" value="false"/>
</sqlMapGenerator>
<!-- 生成mapper xml对应dao接口-->
<javaClientGenerator targetPackage="com.roo.dao"
targetProject="src/main/java" type="XMLMAPPER">
</javaClientGenerator>
<!--生成对应表及类名-->
<table tableName="t_token_audit" domainObjectName="TokenAudit"
enableCountByExample="true" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
</table>
</context>
</generatorConfiguration>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment