Pre Merge pull request !320 from muzi/dev

pull/320/MERGE
muzi 2 years ago committed by Gitee
commit 636fec875b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -216,6 +216,7 @@
<module>ruoyi-modules</module>
<module>ruoyi-api</module>
<module>ruoyi-common</module>
<module>ruoyi-modules/ruoyi-invest</module>
</modules>
<packaging>pom</packaging>

@ -0,0 +1,17 @@
package com.ruoyi.system.api.model;
import lombok.Data;
import java.io.Serializable;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/10 20:07
*/
@Data
public class IdVo implements Serializable {
private Integer id;
}

@ -0,0 +1,20 @@
package com.ruoyi.system.api.model;
import lombok.Data;
import java.io.Serializable;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/10 20:57
*/
//登录的vo实体类
@Data
public class LoginVo implements Serializable {
private String nickName;
private String userPass;
private String code;
private String phone;
}

@ -0,0 +1,41 @@
package com.ruoyi.system.api.model;
import lombok.Data;
import java.io.Serializable;
/**
* @Description //TODO
* @Author
* @Date 2022/11/14 18:34
*/
@Data
public class PageInfoVo implements Serializable {
//分页
private Integer pageNum;
private Integer pageSize;
//区间查询
private Integer maxprice;
private Integer minprice;
//模糊条件查询
private String keyWord;
//根据类型
private Integer id;
private Integer pid;
}

@ -0,0 +1,19 @@
package com.ruoyi.system.api.model;
import lombok.Data;
import java.io.Serializable;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/14 8:05
*/
@Data
public class PassWordCode implements Serializable {
private Integer userId;
private String oldPassword;
private String newPassword;
}

@ -0,0 +1,19 @@
package com.ruoyi.system.api.model;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.io.Serializable;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/11 8:18
*/
@Data
public class PhoneVo extends BaseEntity {
private String phone;
private String code;
}

@ -0,0 +1,133 @@
package com.ruoyi.system.api.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/10 15:03
*/
@Data
public class TbUserVo extends BaseEntity {
private Long userId;
private String token;
/**
*
*/
private String userName;
/**
*
*/
private String nickName;
/**
*
*/
private String email;
/**
*
*/
private String phonenumber;
/**
*
*/
private Integer age;
/**
* 0 1 2
*/
private Integer sex;
/**
*
*/
private String avatar;
/**
* ()
*/
private String userCard;
/**
*
*/
private String password;
/**
* 0 1
*/
private Integer status;
/**
* 0 2
*/
private Integer delFlag;
/**
* IP
*/
private String loginIp;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date loginDate;
/**
*
*/
private String createBy;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date createTime;
/**
*
*/
private String updateBy;
/**
* ()
*/
private Double userPrice;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date updateTime;
/**
*
*/
private String remark;
/**
* (0,1)
*/
private Integer realnameState;
/**
*
*/
private Integer honorIntegral;
}

@ -36,6 +36,7 @@ public class TokenController
{
// 用户登录
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
// 获取登录token
return R.ok(tokenService.createToken(userInfo));
}

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9200
port: 9100
# Spring
spring:

@ -16,6 +16,10 @@
</description>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- SpringCloud Openfeign -->
<dependency>

@ -62,6 +62,7 @@ public class TokenService
Map<String, Object> rspMap = new HashMap<String, Object>();
rspMap.put("access_token", JwtUtils.createToken(claimsMap));
rspMap.put("expires_in", expireTime);
System.err.println(rspMap);
return rspMap;
}

@ -23,6 +23,13 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--knife4j-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.7</version>
</dependency>
<!-- Swagger -->
<dependency>
<groupId>io.springfox</groupId>

@ -0,0 +1,44 @@
package com.ruoyi.common.swagger.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
@Configuration
@EnableSwagger2
public class Knife4jConfiguration {
@Bean(value = "dockerBean")
public Docket dockerBean() {
//指定使用Swagger2规范
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(webApiInfo())
//分组名称
.groupName("WebApi")
.select()
//这里指定Controller扫描包路径
.apis(RequestHandlerSelectors.basePackage("com.ruoyi"))
.paths(PathSelectors.any())
.build();
return docket;
}
private ApiInfo webApiInfo() {
return new ApiInfoBuilder()
//描述字段支持Markdown语法
.title("Weekly-API")
.contact(new Contact("木子", "https://www.muzi.net/", "muzi@muzi.com"))
.description("实训项目端")
.version("1.0")
.build();
}
}

@ -8,6 +8,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
*
* @author ruoyi
*/
@Configuration
@Primary
public class SwaggerWebConfiguration implements WebMvcConfigurer
{
@Override

@ -16,6 +16,19 @@
<dependencies>
<!-- knife4j-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-ui</artifactId>
<version>2.0.7</version>
</dependency>
<!-- SpringCloud Gateway -->
<dependency>
<groupId>org.springframework.cloud</groupId>

@ -7,6 +7,7 @@ import org.springframework.cloud.gateway.config.GatewayProperties;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.support.NameUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.config.ResourceHandlerRegistry;
import org.springframework.web.reactive.config.WebFluxConfigurer;
@ -19,6 +20,7 @@ import springfox.documentation.swagger.web.SwaggerResourcesProvider;
* @author ruoyi
*/
@Component
@Primary
public class SwaggerProvider implements SwaggerResourcesProvider, WebFluxConfigurer
{
/**

@ -13,6 +13,9 @@
<module>ruoyi-gen</module>
<module>ruoyi-job</module>
<module>ruoyi-file</module>
<module>ruoyi-potenza</module>
<module>ruoyi-user</module>
<module>ruoyi-product</module>
</modules>
<artifactId>ruoyi-modules</artifactId>

@ -0,0 +1,108 @@
<?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>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-invest</artifactId>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,34 @@
package com.ruoyi.invest;
import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
*
*
* @author ruoyi
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
public class RuoYiInvestApplication
{
public static void main(String[] args)
{
SpringApplication.run(RuoYiInvestApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 投资模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

@ -0,0 +1,105 @@
package com.ruoyi.invest.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.invest.service.TbFirmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.invest.domain.TbFirm;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-01-13
*/
@RestController
@RequestMapping("/firm")
public class TbFirmController extends BaseController
{
@Autowired
private TbFirmService tbFirmService;
/**
*
*/
// @RequiresPermissions("system:firm:list")
@GetMapping("/list")
public TableDataInfo list(TbFirm tbFirm)
{
startPage();
List<TbFirm> list = tbFirmService.selectTbFirmList(tbFirm);
return getDataTable(list);
}
/**
*
*/
// @RequiresPermissions("system:firm:export")
@Log(title = "企业", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbFirm tbFirm)
{
List<TbFirm> list = tbFirmService.selectTbFirmList(tbFirm);
ExcelUtil<TbFirm> util = new ExcelUtil<TbFirm>(TbFirm.class);
util.exportExcel(response, list, "企业数据");
}
/**
*
*/
// @RequiresPermissions("system:firm:query")
@GetMapping(value = "/{firmId}")
public AjaxResult getInfo(@PathVariable("firmId") Long firmId)
{
return success(tbFirmService.selectTbFirmByFirmId(firmId));
}
/**
*
*/
// @RequiresPermissions("system:firm:add")
@Log(title = "企业", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TbFirm tbFirm)
{
return toAjax(tbFirmService.insertTbFirm(tbFirm));
}
/**
*
*/
// @RequiresPermissions("system:firm:edit")
@Log(title = "企业", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TbFirm tbFirm)
{
return toAjax(tbFirmService.updateTbFirm(tbFirm));
}
/**
*
*/
// @RequiresPermissions("system:firm:remove")
@Log(title = "企业", businessType = BusinessType.DELETE)
@DeleteMapping("/{firmIds}")
public AjaxResult remove(@PathVariable Long[] firmIds)
{
return toAjax(tbFirmService.deleteTbFirmByFirmIds(firmIds));
}
}

@ -0,0 +1,104 @@
package com.ruoyi.invest.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.invest.domain.TbInvest;
import com.ruoyi.invest.service.TbInvestService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-01-13
*/
@RestController
@RequestMapping("/invest")
public class TbInvestController extends BaseController
{
@Autowired
private TbInvestService tbInvestService;
/**
*
*/
// @RequiresPermissions("system:invest:list")
@GetMapping("/list")
public TableDataInfo list(TbInvest tbInvest)
{
startPage();
List<TbInvest> list = tbInvestService.selectTbInvestList(tbInvest);
return getDataTable(list);
}
/**
*
*/
// @RequiresPermissions("system:invest:export")
@Log(title = "投资", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbInvest tbInvest)
{
List<TbInvest> list = tbInvestService.selectTbInvestList(tbInvest);
ExcelUtil<TbInvest> util = new ExcelUtil<TbInvest>(TbInvest.class);
util.exportExcel(response, list, "投资数据");
}
/**
*
*/
// @RequiresPermissions("system:invest:query")
@GetMapping(value = "/{investId}")
public AjaxResult getInfo(@PathVariable("investId") Long investId)
{
return success(tbInvestService.selectTbInvestByInvestId(investId));
}
/**
*
*/
// @RequiresPermissions("system:invest:add")
@Log(title = "投资", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TbInvest tbInvest)
{
return toAjax(tbInvestService.insertTbInvest(tbInvest));
}
/**
*
*/
// @RequiresPermissions("system:invest:edit")
@Log(title = "投资", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TbInvest tbInvest)
{
return toAjax(tbInvestService.updateTbInvest(tbInvest));
}
/**
*
*/
// @RequiresPermissions("system:invest:remove")
@Log(title = "投资", businessType = BusinessType.DELETE)
@DeleteMapping("/{investIds}")
public AjaxResult remove(@PathVariable Long[] investIds)
{
return toAjax(tbInvestService.deleteTbInvestByInvestIds(investIds));
}
}

@ -0,0 +1,71 @@
package com.ruoyi.invest.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName tb_firm
*/
@TableName(value ="tb_firm")
@Data
public class TbFirm implements Serializable {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Integer firmId;
/**
*
*/
private String firmName;
/**
* logo
*/
private String firmPic;
/**
*
*/
private Double firmMarket;
/**
*
*/
private String firmDesc;
/**
* 0:2:
*/
private Integer delFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private String createBy;
/**
*
*/
private Date updateTime;
/**
*
*/
private String updateBy;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,76 @@
package com.ruoyi.invest.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName tb_invest
*/
@TableName(value ="tb_invest")
@Data
public class TbInvest implements Serializable {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Integer investId;
/**
* id
*/
private Integer userId;
/**
* id
*/
private Integer firmId;
/**
*
*/
private Double investAmount;
/**
*
*/
private Double investYield;
/**
* 0:1:
*/
private Integer investState;
/**
* 0:2:
*/
private Integer delFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private String createBy;
/**
*
*/
private Date updateTime;
/**
*
*/
private String updateBy;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,65 @@
package com.ruoyi.invest.mapper;
import com.ruoyi.invest.domain.TbFirm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Entity com.ruoyi.invest.domain.TbFirm
*/
@Mapper
public interface TbFirmMapper extends BaseMapper<TbFirm> {
/**
*
*
* @param firmId
* @return
*/
public TbFirm selectTbFirmByFirmId(Long firmId);
/**
*
*
* @param tbFirm
* @return
*/
public List<TbFirm> selectTbFirmList(TbFirm tbFirm);
/**
*
*
* @param tbFirm
* @return
*/
public int insertTbFirm(TbFirm tbFirm);
/**
*
*
* @param tbFirm
* @return
*/
public int updateTbFirm(TbFirm tbFirm);
/**
*
*
* @param firmId
* @return
*/
public int deleteTbFirmByFirmId(Long firmId);
/**
*
*
* @param firmIds
* @return
*/
public int deleteTbFirmByFirmIds(Long[] firmIds);
}

@ -0,0 +1,65 @@
package com.ruoyi.invest.mapper;
import com.ruoyi.invest.domain.TbInvest;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Entity com.ruoyi.invest.domain.TbInvest
*/
@Mapper
public interface TbInvestMapper extends BaseMapper<TbInvest> {
/**
*
*
* @param investId
* @return
*/
public TbInvest selectTbInvestByInvestId(Long investId);
/**
*
*
* @param tbInvest
* @return
*/
public List<TbInvest> selectTbInvestList(TbInvest tbInvest);
/**
*
*
* @param tbInvest
* @return
*/
public int insertTbInvest(TbInvest tbInvest);
/**
*
*
* @param tbInvest
* @return
*/
public int updateTbInvest(TbInvest tbInvest);
/**
*
*
* @param investId
* @return
*/
public int deleteTbInvestByInvestId(Long investId);
/**
*
*
* @param investIds
* @return
*/
public int deleteTbInvestByInvestIds(Long[] investIds);
}

@ -0,0 +1,59 @@
package com.ruoyi.invest.service;
import com.ruoyi.invest.domain.TbFirm;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
*
*/
public interface TbFirmService extends IService<TbFirm> {
/**
*
*
* @param firmId
* @return
*/
public TbFirm selectTbFirmByFirmId(Long firmId);
/**
*
*
* @param tbFirm
* @return
*/
public List<TbFirm> selectTbFirmList(TbFirm tbFirm);
/**
*
*
* @param tbFirm
* @return
*/
public int insertTbFirm(TbFirm tbFirm);
/**
*
*
* @param tbFirm
* @return
*/
public int updateTbFirm(TbFirm tbFirm);
/**
*
*
* @param firmIds
* @return
*/
public int deleteTbFirmByFirmIds(Long[] firmIds);
/**
*
*
* @param firmId
* @return
*/
public int deleteTbFirmByFirmId(Long firmId);
}

@ -0,0 +1,59 @@
package com.ruoyi.invest.service;
import com.ruoyi.invest.domain.TbInvest;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
*
*/
public interface TbInvestService extends IService<TbInvest> {
/**
*
*
* @param investId
* @return
*/
public TbInvest selectTbInvestByInvestId(Long investId);
/**
*
*
* @param tbInvest
* @return
*/
public List<TbInvest> selectTbInvestList(TbInvest tbInvest);
/**
*
*
* @param tbInvest
* @return
*/
public int insertTbInvest(TbInvest tbInvest);
/**
*
*
* @param tbInvest
* @return
*/
public int updateTbInvest(TbInvest tbInvest);
/**
*
*
* @param investIds
* @return
*/
public int deleteTbInvestByInvestIds(Long[] investIds);
/**
*
*
* @param investId
* @return
*/
public int deleteTbInvestByInvestId(Long investId);
}

@ -0,0 +1,99 @@
package com.ruoyi.invest.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.invest.domain.TbFirm;
import com.ruoyi.invest.service.TbFirmService;
import com.ruoyi.invest.mapper.TbFirmMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*/
@Service
public class TbFirmServiceImpl extends ServiceImpl<TbFirmMapper, TbFirm>
implements TbFirmService{
@Autowired
private TbFirmMapper tbFirmMapper;
/**
*
*
* @param firmId
* @return
*/
@Override
public TbFirm selectTbFirmByFirmId(Long firmId)
{
return tbFirmMapper.selectTbFirmByFirmId(firmId);
}
/**
*
*
* @param tbFirm
* @return
*/
@Override
public List<TbFirm> selectTbFirmList(TbFirm tbFirm)
{
return tbFirmMapper.selectTbFirmList(tbFirm);
}
/**
*
*
* @param tbFirm
* @return
*/
@Override
public int insertTbFirm(TbFirm tbFirm)
{
tbFirm.setCreateTime(DateUtils.getNowDate());
return tbFirmMapper.insertTbFirm(tbFirm);
}
/**
*
*
* @param tbFirm
* @return
*/
@Override
public int updateTbFirm(TbFirm tbFirm)
{
tbFirm.setUpdateTime(DateUtils.getNowDate());
return tbFirmMapper.updateTbFirm(tbFirm);
}
/**
*
*
* @param firmIds
* @return
*/
@Override
public int deleteTbFirmByFirmIds(Long[] firmIds)
{
return tbFirmMapper.deleteTbFirmByFirmIds(firmIds);
}
/**
*
*
* @param firmId
* @return
*/
@Override
public int deleteTbFirmByFirmId(Long firmId)
{
return tbFirmMapper.deleteTbFirmByFirmId(firmId);
}
}

@ -0,0 +1,99 @@
package com.ruoyi.invest.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.invest.domain.TbInvest;
import com.ruoyi.invest.service.TbInvestService;
import com.ruoyi.invest.mapper.TbInvestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*/
@Service
public class TbInvestServiceImpl extends ServiceImpl<TbInvestMapper, TbInvest>
implements TbInvestService{
@Autowired
private TbInvestMapper tbInvestMapper;
/**
*
*
* @param investId
* @return
*/
@Override
public TbInvest selectTbInvestByInvestId(Long investId)
{
return tbInvestMapper.selectTbInvestByInvestId(investId);
}
/**
*
*
* @param tbInvest
* @return
*/
@Override
public List<TbInvest> selectTbInvestList(TbInvest tbInvest)
{
return tbInvestMapper.selectTbInvestList(tbInvest);
}
/**
*
*
* @param tbInvest
* @return
*/
@Override
public int insertTbInvest(TbInvest tbInvest)
{
tbInvest.setCreateTime(DateUtils.getNowDate());
return tbInvestMapper.insertTbInvest(tbInvest);
}
/**
*
*
* @param tbInvest
* @return
*/
@Override
public int updateTbInvest(TbInvest tbInvest)
{
tbInvest.setUpdateTime(DateUtils.getNowDate());
return tbInvestMapper.updateTbInvest(tbInvest);
}
/**
*
*
* @param investIds
* @return
*/
@Override
public int deleteTbInvestByInvestIds(Long[] investIds)
{
return tbInvestMapper.deleteTbInvestByInvestIds(investIds);
}
/**
*
*
* @param investId
* @return
*/
@Override
public int deleteTbInvestByInvestId(Long investId)
{
return tbInvestMapper.deleteTbInvestByInvestId(investId);
}
}

@ -0,0 +1,25 @@
# Tomcat
server:
port: 9301
# Spring
spring:
application:
# 应用名称
name: ruoyi-invest
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/ruoyi-invest" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
</configuration>

@ -0,0 +1,93 @@
<?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.ruoyi.invest.mapper.TbFirmMapper">
<resultMap type="com.ruoyi.invest.domain.TbFirm" id="TbFirmResult">
<result property="firmId" column="firm_id" />
<result property="firmName" column="firm_name" />
<result property="firmPic" column="firm_pic" />
<result property="firmMarket" column="firm_market" />
<result property="firmDesc" column="firm_desc" />
<result property="delFlag" column="del_flag" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectTbFirmVo">
select firm_id, firm_name, firm_pic, firm_market, firm_desc, del_flag, create_time, create_by, update_time, update_by from tb_firm
</sql>
<select id="selectTbFirmList" parameterType="com.ruoyi.invest.domain.TbFirm" resultMap="TbFirmResult">
<include refid="selectTbFirmVo"/>
<where>
<if test="firmName != null and firmName != ''"> and firm_name like concat('%', #{firmName}, '%')</if>
<if test="firmPic != null and firmPic != ''"> and firm_pic = #{firmPic}</if>
<if test="firmMarket != null "> and firm_market = #{firmMarket}</if>
<if test="firmDesc != null and firmDesc != ''"> and firm_desc = #{firmDesc}</if>
</where>
</select>
<select id="selectTbFirmByFirmId" parameterType="Long" resultMap="TbFirmResult">
<include refid="selectTbFirmVo"/>
where firm_id = #{firmId}
</select>
<insert id="insertTbFirm" parameterType="com.ruoyi.invest.domain.TbFirm">
insert into tb_firm
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="firmId != null">firm_id,</if>
<if test="firmName != null">firm_name,</if>
<if test="firmPic != null">firm_pic,</if>
<if test="firmMarket != null">firm_market,</if>
<if test="firmDesc != null">firm_desc,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="firmId != null">#{firmId},</if>
<if test="firmName != null">#{firmName},</if>
<if test="firmPic != null">#{firmPic},</if>
<if test="firmMarket != null">#{firmMarket},</if>
<if test="firmDesc != null">#{firmDesc},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateTbFirm" parameterType="com.ruoyi.invest.domain.TbFirm">
update tb_firm
<trim prefix="SET" suffixOverrides=",">
<if test="firmName != null">firm_name = #{firmName},</if>
<if test="firmPic != null">firm_pic = #{firmPic},</if>
<if test="firmMarket != null">firm_market = #{firmMarket},</if>
<if test="firmDesc != null">firm_desc = #{firmDesc},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where firm_id = #{firmId}
</update>
<delete id="deleteTbFirmByFirmId" parameterType="Long">
delete from tb_firm where firm_id = #{firmId}
</delete>
<delete id="deleteTbFirmByFirmIds" parameterType="String">
delete from tb_firm where firm_id in
<foreach item="firmId" collection="array" open="(" separator="," close=")">
#{firmId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,96 @@
<?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.ruoyi.invest.mapper.TbInvestMapper">
<resultMap type="com.ruoyi.invest.domain.TbInvest" id="TbInvestResult">
<result property="investId" column="invest_id" />
<result property="userId" column="user_id" />
<result property="firmId" column="firm_id" />
<result property="investAmount" column="invest_amount" />
<result property="investYield" column="invest_yield" />
<result property="investState" column="invest_state" />
<result property="delFlag" column="del_flag" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectTbInvestVo">
select invest_id, user_id, firm_id, invest_amount, invest_yield, invest_state, del_flag, create_time, create_by, update_time, update_by from tb_invest
</sql>
<select id="selectTbInvestList" parameterType="com.ruoyi.invest.domain.TbInvest" resultMap="TbInvestResult">
<include refid="selectTbInvestVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="firmId != null "> and firm_id = #{firmId}</if>
<if test="investAmount != null "> and invest_amount = #{investAmount}</if>
<if test="investYield != null "> and invest_yield = #{investYield}</if>
<if test="investState != null "> and invest_state = #{investState}</if>
</where>
</select>
<select id="selectTbInvestByInvestId" parameterType="Long" resultMap="TbInvestResult">
<include refid="selectTbInvestVo"/>
where invest_id = #{investId}
</select>
<insert id="insertTbInvest" parameterType="com.ruoyi.invest.domain.TbInvest" useGeneratedKeys="true" keyProperty="investId">
insert into tb_invest
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="firmId != null">firm_id,</if>
<if test="investAmount != null">invest_amount,</if>
<if test="investYield != null">invest_yield,</if>
<if test="investState != null">invest_state,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="firmId != null">#{firmId},</if>
<if test="investAmount != null">#{investAmount},</if>
<if test="investYield != null">#{investYield},</if>
<if test="investState != null">#{investState},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateTbInvest" parameterType="com.ruoyi.invest.domain.TbInvest">
update tb_invest
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="firmId != null">firm_id = #{firmId},</if>
<if test="investAmount != null">invest_amount = #{investAmount},</if>
<if test="investYield != null">invest_yield = #{investYield},</if>
<if test="investState != null">invest_state = #{investState},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where invest_id = #{investId}
</update>
<delete id="deleteTbInvestByInvestId" parameterType="Long">
delete from tb_invest where invest_id = #{investId}
</delete>
<delete id="deleteTbInvestByInvestIds" parameterType="String">
delete from tb_invest where invest_id in
<foreach item="investId" collection="array" open="(" separator="," close=")">
#{investId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,111 @@
<?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>ruoyi-modules</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.ruoyi.potenza</groupId>
<artifactId>com.ruoyi.potenza</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.2</version>
</dependency>
<!-- SpringCloud Alibaba Nacos-->
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,34 @@
package com.ruoyi.potenza;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/12 20:33
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
public class RuoYiPotenzaApplication {
public static void main(String[] args)
{
SpringApplication.run(RuoYiPotenzaApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

@ -0,0 +1,140 @@
package com.ruoyi.potenza.controller;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.potenza.domain.TbBorrower;
import com.ruoyi.potenza.domain.vo.IdVo;
import com.ruoyi.potenza.service.TbBorrowerService;
import com.ruoyi.potenza.utils.AverageCapitalPlusInterestUtils;
import com.ruoyi.potenza.utils.AverageCapitalUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/13 16:00
*/
@RequestMapping("/borrower")
@RestController
@Slf4j
public class BorrowerController extends BaseController {
@Autowired
private TbBorrowerService tbBorrowerService;
@PostMapping("/pageList")
public TableDataInfo pageList(@RequestBody TbBorrower tbBorrower){
startPage();
return getDataTable(tbBorrowerService.pageList(tbBorrower));
}
//贷款申请
@PostMapping("/save")
public AjaxResult save(@RequestBody TbBorrower tbBorrower){
boolean save = tbBorrowerService.save(tbBorrower);
return AjaxResult.success(save);
}
//逻辑删除
@PostMapping("/BorrowerDele")
public AjaxResult save(@RequestBody IdVo idVo){
return tbBorrowerService.borrowerDele(idVo);
}
@GetMapping("/list")
public TableDataInfo list(TbBorrower tbBorrower)
{
startPage();
List<TbBorrower> list = tbBorrowerService.selectTbBorrowerList(tbBorrower);
return getDataTable(list);
}
/**
*
*/
@Log(title = "贷款", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbBorrower tbBorrower)
{
List<TbBorrower> list = tbBorrowerService.selectTbBorrowerList(tbBorrower);
ExcelUtil<TbBorrower> util = new ExcelUtil<TbBorrower>(TbBorrower.class);
util.exportExcel(response, list, "贷款数据");
}
/**
*
*/
@GetMapping(value = "/{borrowerById}")
public AjaxResult getInfo(@PathVariable("borrowerId") Long borrowerId)
{
return success(tbBorrowerService.selectTbBorrowerByBorrowerId(borrowerId));
}
/**
*
*/
@Log(title = "贷款", businessType = BusinessType.INSERT)
@PostMapping("/borrowerInsert")
public AjaxResult add(@RequestBody TbBorrower tbBorrower)
{
return toAjax(tbBorrowerService.insertTbBorrower(tbBorrower));
}
/**
*
*/
@Log(title = "贷款", businessType = BusinessType.UPDATE)
@PutMapping("/borrowerUpdate")
public AjaxResult edit(@RequestBody TbBorrower tbBorrower)
{
return toAjax(tbBorrowerService.updateTbBorrower(tbBorrower));
}
@PostMapping("/borrowerInserts")
public AjaxResult borrowerInserts(@RequestBody TbBorrower tbBorrower)
{
return toAjax(tbBorrowerService.borrowerInserts(tbBorrower));
}
@PostMapping("/loans")
public AjaxResult loans(@RequestBody TbBorrower tbBorrower)
{
return tbBorrowerService.loans(tbBorrower);
}
@PostMapping("ttt")
public void ttt(){
AverageCapitalUtils.main();
AverageCapitalPlusInterestUtils.main();
}
}

@ -0,0 +1,111 @@
package com.ruoyi.potenza.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.potenza.domain.vo.PeriodDetailVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.potenza.domain.TbBorrowerPeriods;
import com.ruoyi.potenza.service.TbBorrowerPeriodsService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/13 16:00
*/
@RequestMapping("periods")
@RestController
@Slf4j
public class BorrowerPeriodsController extends BaseController{
@Autowired
private TbBorrowerPeriodsService tbBorrowerPeriodsService;
/**
*
*/
@RequiresPermissions("potenza:periods:list")
@GetMapping("/list")
public TableDataInfo list(TbBorrowerPeriods tbBorrowerPeriods)
{
startPage();
List<TbBorrowerPeriods> list = tbBorrowerPeriodsService.selectTbBorrowerPeriodsList(tbBorrowerPeriods);
return getDataTable(list);
}
/**
*
*/
@Log(title = "贷款周期", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbBorrowerPeriods tbBorrowerPeriods)
{
List<TbBorrowerPeriods> list = tbBorrowerPeriodsService.selectTbBorrowerPeriodsList(tbBorrowerPeriods);
ExcelUtil<TbBorrowerPeriods> util = new ExcelUtil<TbBorrowerPeriods>(TbBorrowerPeriods.class);
util.exportExcel(response, list, "贷款周期数据");
}
/**
*
*/
@GetMapping(value = "/{periodsById}")
public AjaxResult getInfo(@PathVariable("periodsId") Long periodsId)
{
return success(tbBorrowerPeriodsService.selectTbBorrowerPeriodsByPeriodsId(periodsId));
}
/**
*
*/
@Log(title = "贷款周期", businessType = BusinessType.INSERT)
@PostMapping("periodsInsert")
public AjaxResult add(@RequestBody TbBorrowerPeriods tbBorrowerPeriods)
{
return toAjax(tbBorrowerPeriodsService.insertTbBorrowerPeriods(tbBorrowerPeriods));
}
/**
*
*/
@Log(title = "贷款周期", businessType = BusinessType.UPDATE)
@PutMapping("/periodsUpdate")
public AjaxResult edit(@RequestBody TbBorrowerPeriods tbBorrowerPeriods)
{
return toAjax(tbBorrowerPeriodsService.updateTbBorrowerPeriods(tbBorrowerPeriods));
}
/**
*
*/
@Log(title = "贷款周期", businessType = BusinessType.DELETE)
@DeleteMapping("/{periodsIds}")
public AjaxResult remove(@PathVariable Long[] periodsIds)
{
return toAjax(tbBorrowerPeriodsService.deleteTbBorrowerPeriodsByPeriodsIds(periodsIds));
}
@Log(title = "周期详细", businessType = BusinessType.UPDATE)
@PostMapping("/detail")
public AjaxResult detail(@RequestBody PeriodDetailVo periodDetailVo)
{
return tbBorrowerPeriodsService.detail(periodDetailVo);
}
}

@ -0,0 +1,102 @@
package com.ruoyi.potenza.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.potenza.domain.TbBorrowerPlan;
import com.ruoyi.potenza.service.TbBorrowerPlanService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/13 16:01
*/
@RequestMapping("plan")
@RestController
@Slf4j
public class BorrowerPlanController extends BaseController{
@Autowired
private TbBorrowerPlanService tbBorrowerPlanService;
/**
*
*/
@RequiresPermissions("potenza:plan:list")
@GetMapping("/list")
public TableDataInfo list(TbBorrowerPlan tbBorrowerPlan)
{
startPage();
List<TbBorrowerPlan> list = tbBorrowerPlanService.selectTbBorrowerPlanList(tbBorrowerPlan);
return getDataTable(list);
}
/**
*
*/
@Log(title = "计划", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbBorrowerPlan tbBorrowerPlan)
{
List<TbBorrowerPlan> list = tbBorrowerPlanService.selectTbBorrowerPlanList(tbBorrowerPlan);
ExcelUtil<TbBorrowerPlan> util = new ExcelUtil<TbBorrowerPlan>(TbBorrowerPlan.class);
util.exportExcel(response, list, "计划数据");
}
/**
*
*/
@GetMapping(value = "/{planById}")
public AjaxResult getInfo(@PathVariable("planId") Long planId)
{
return success(tbBorrowerPlanService.selectTbBorrowerPlanByPlanId(planId));
}
/**
*
*/
@Log(title = "计划", businessType = BusinessType.INSERT)
@PostMapping("planInsert")
public AjaxResult add(@RequestBody TbBorrowerPlan tbBorrowerPlan)
{
return toAjax(tbBorrowerPlanService.insertTbBorrowerPlan(tbBorrowerPlan));
}
/**
*
*/
@Log(title = "计划", businessType = BusinessType.UPDATE)
@PutMapping("planUpdate")
public AjaxResult edit(@RequestBody TbBorrowerPlan tbBorrowerPlan)
{
return toAjax(tbBorrowerPlanService.updateTbBorrowerPlan(tbBorrowerPlan));
}
/**
*
*/
@Log(title = "计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{planIds}")
public AjaxResult remove(@PathVariable Long[] planIds)
{
return toAjax(tbBorrowerPlanService.deleteTbBorrowerPlanByPlanIds(planIds));
}
}

@ -0,0 +1,96 @@
package com.ruoyi.potenza.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName tb_borrower
*/
@TableName(value ="tb_borrower")
@Data
public class TbBorrower implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Integer borrowerId;
/**
* ID
*/
private Integer userId;
/**
*
*/
private String userName;
/**
* ID
*/
private Integer productId;
/**
*
*/
private Double borrowerMoney;
/**
* ID
*/
private Integer periodsId;
/**
* ID 0: 6000 1: 6000 1000 60000* 5000*
*/
private Integer wayId;
/**
*
*/
private String borrowerPurpose;
/**
* 1 2 3:
*/
private Integer borrowerState;
/**
*
*/
private Integer loanerId;
/**
*
*/
private String createBy;
/**
*
*/
private String updateBy;
/**
* 02
*/
private Integer delFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,58 @@
package com.ruoyi.potenza.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName tb_borrower_periods
*/
@TableName(value ="tb_borrower_periods")
@Data
public class TbBorrowerPeriods implements Serializable {
/**
* ID
*/
@TableId(type = IdType.AUTO)
private Integer periodsId;
/**
* :3 6 9 12 24
*/
private Integer periodsName;
/**
*
*/
private String createBy;
/**
*
*/
private String updateBy;
private Double rateInterest;
/**
* 02
*/
private Integer delFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,81 @@
package com.ruoyi.potenza.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName tb_borrower_plan
*/
@TableName(value ="tb_borrower_plan")
@Data
public class TbBorrowerPlan implements Serializable {
/**
* ID
*/
@TableId(type = IdType.AUTO)
private Integer planId;
/**
* ID
*/
private Integer userId;
/**
*
*/
private String userName;
/**
*
*/
private Integer borrowerPeriods;
/**
*
*/
private Double periodsMoney;
/**
*
*/
private Double periodsCapital;
/**
*
*/
private Double periodsInterests;
/**
*
*/
private Date planDate;
/**
* 0: 1: 2: 3:
*/
private Integer planState;
/**
* 02
*/
private Integer delFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,17 @@
package com.ruoyi.potenza.domain.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/13 16:45
*/
@Data
public class IdVo implements Serializable {
private Integer id;
}

@ -0,0 +1,20 @@
package com.ruoyi.potenza.domain.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/15 20:39
*/
@Data
public class PeriodDetailVo implements Serializable {
private Double borrowerMoney;
private Integer wayId;
private Integer periodsId;
}

@ -0,0 +1,94 @@
package com.ruoyi.potenza.domain.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/15 19:26
*/
@Data
public class TbBorrowerVo implements Serializable {
private Integer borrowerId;
/**
* ID
*/
private Integer userId;
/**
*
*/
private String userName;
/**
* ID
*/
private Integer productId;
/**
*
*/
private Double borrowerMoney;
/**
* ID
*/
private Integer periodsId;
/**
* ID 0: 6000 1: 6000 1000 60000* 5000*
*/
private Integer wayId;
/**
*
*/
private String borrowerPurpose;
/**
* 1 2 3:
*/
private Integer borrowerState;
/**
*
*/
private Integer loanerId;
/**
*
*/
private String createBy;
/**
*
*/
private String updateBy;
/**
* 02
*/
private Integer delFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
}

@ -0,0 +1,60 @@
package com.ruoyi.potenza.mapper;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.potenza.domain.TbBorrower;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* @author 86155
* @description tb_borrower()Mapper
* @createDate 2023-01-13 15:56:37
* @Entity com.ruoyi.potenza.domain.TbBorrower
*/
public interface TbBorrowerMapper extends BaseMapper<TbBorrower> {
List<TbBorrower> pageList();
/**
*
*
* @param borrowerId
* @return
*/
public TbBorrower selectTbBorrowerByBorrowerId(Long borrowerId);
/**
*
*
* @param tbBorrower
* @return
*/
public List<TbBorrower> selectTbBorrowerList(TbBorrower tbBorrower);
/**
*
*
* @param tbBorrower
* @return
*/
public int insertTbBorrower(TbBorrower tbBorrower);
/**
*
*
* @param tbBorrower
* @return
*/
public int updateTbBorrower(TbBorrower tbBorrower);
}

@ -0,0 +1,66 @@
package com.ruoyi.potenza.mapper;
import com.ruoyi.potenza.domain.TbBorrowerPeriods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* @author 86155
* @description tb_borrower_periods()Mapper
* @createDate 2023-01-13 15:56:37
* @Entity com.ruoyi.potenza.domain.TbBorrowerPeriods
*/
public interface TbBorrowerPeriodsMapper extends BaseMapper<TbBorrowerPeriods> {
/**
*
*
* @param periodsId
* @return
*/
public TbBorrowerPeriods selectTbBorrowerPeriodsByPeriodsId(Long periodsId);
/**
*
*
* @param tbBorrowerPeriods
* @return
*/
public List<TbBorrowerPeriods> selectTbBorrowerPeriodsList(TbBorrowerPeriods tbBorrowerPeriods);
/**
*
*
* @param tbBorrowerPeriods
* @return
*/
public int insertTbBorrowerPeriods(TbBorrowerPeriods tbBorrowerPeriods);
/**
*
*
* @param tbBorrowerPeriods
* @return
*/
public int updateTbBorrowerPeriods(TbBorrowerPeriods tbBorrowerPeriods);
/**
*
*
* @param periodsId
* @return
*/
public int deleteTbBorrowerPeriodsByPeriodsId(Long periodsId);
/**
*
*
* @param periodsIds
* @return
*/
public int deleteTbBorrowerPeriodsByPeriodsIds(Long[] periodsIds);
}

@ -0,0 +1,66 @@
package com.ruoyi.potenza.mapper;
import com.ruoyi.potenza.domain.TbBorrowerPlan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* @author 86155
* @description tb_borrower_plan()Mapper
* @createDate 2023-01-13 15:56:37
* @Entity com.ruoyi.potenza.domain.TbBorrowerPlan
*/
public interface TbBorrowerPlanMapper extends BaseMapper<TbBorrowerPlan> {
/**
*
*
* @param planId
* @return
*/
public TbBorrowerPlan selectTbBorrowerPlanByPlanId(Long planId);
/**
*
*
* @param tbBorrowerPlan
* @return
*/
public List<TbBorrowerPlan> selectTbBorrowerPlanList(TbBorrowerPlan tbBorrowerPlan);
/**
*
*
* @param tbBorrowerPlan
* @return
*/
public int insertTbBorrowerPlan(TbBorrowerPlan tbBorrowerPlan);
/**
*
*
* @param tbBorrowerPlan
* @return
*/
public int updateTbBorrowerPlan(TbBorrowerPlan tbBorrowerPlan);
/**
*
*
* @param planId
* @return
*/
public int deleteTbBorrowerPlanByPlanId(Long planId);
/**
*
*
* @param planIds
* @return
*/
public int deleteTbBorrowerPlanByPlanIds(Long[] planIds);
}

@ -0,0 +1,65 @@
package com.ruoyi.potenza.service;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.potenza.domain.TbBorrowerPeriods;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.potenza.domain.vo.PeriodDetailVo;
import java.util.List;
/**
* @author 86155
* @description tb_borrower_periods()Service
* @createDate 2023-01-13 15:56:37
*/
public interface TbBorrowerPeriodsService extends IService<TbBorrowerPeriods> {
/**
*
*
* @param periodsId
* @return
*/
public TbBorrowerPeriods selectTbBorrowerPeriodsByPeriodsId(Long periodsId);
/**
*
*
* @param tbBorrowerPeriods
* @return
*/
public List<TbBorrowerPeriods> selectTbBorrowerPeriodsList(TbBorrowerPeriods tbBorrowerPeriods);
/**
*
*
* @param tbBorrowerPeriods
* @return
*/
public int insertTbBorrowerPeriods(TbBorrowerPeriods tbBorrowerPeriods);
/**
*
*
* @param tbBorrowerPeriods
* @return
*/
public int updateTbBorrowerPeriods(TbBorrowerPeriods tbBorrowerPeriods);
/**
*
*
* @param periodsIds
* @return
*/
public int deleteTbBorrowerPeriodsByPeriodsIds(Long[] periodsIds);
/**
*
*
* @param periodsId
* @return
*/
public int deleteTbBorrowerPeriodsByPeriodsId(Long periodsId);
AjaxResult detail(PeriodDetailVo periodDetailVo);
}

@ -0,0 +1,61 @@
package com.ruoyi.potenza.service;
import com.ruoyi.potenza.domain.TbBorrowerPlan;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @author 86155
* @description tb_borrower_plan()Service
* @createDate 2023-01-13 15:56:37
*/
public interface TbBorrowerPlanService extends IService<TbBorrowerPlan> {
/**
*
*
* @param planId
* @return
*/
public TbBorrowerPlan selectTbBorrowerPlanByPlanId(Long planId);
/**
*
*
* @param tbBorrowerPlan
* @return
*/
public List<TbBorrowerPlan> selectTbBorrowerPlanList(TbBorrowerPlan tbBorrowerPlan);
/**
*
*
* @param tbBorrowerPlan
* @return
*/
public int insertTbBorrowerPlan(TbBorrowerPlan tbBorrowerPlan);
/**
*
*
* @param tbBorrowerPlan
* @return
*/
public int updateTbBorrowerPlan(TbBorrowerPlan tbBorrowerPlan);
/**
*
*
* @param planIds
* @return
*/
public int deleteTbBorrowerPlanByPlanIds(Long[] planIds);
/**
*
*
* @param planId
* @return
*/
public int deleteTbBorrowerPlanByPlanId(Long planId);
}

@ -0,0 +1,57 @@
package com.ruoyi.potenza.service;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.potenza.domain.TbBorrower;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.potenza.domain.vo.IdVo;
import java.util.List;
/**
* @author 86155
* @description tb_borrower()Service
* @createDate 2023-01-13 15:56:37
*/
public interface TbBorrowerService extends IService<TbBorrower> {
List<?> pageList(TbBorrower tbBorrower);
AjaxResult borrowerDele(IdVo idVo);
/**
*
*
* @param borrowerId
* @return
*/
public TbBorrower selectTbBorrowerByBorrowerId(Long borrowerId);
/**
*
*
* @param tbBorrower
* @return
*/
public List<TbBorrower> selectTbBorrowerList(TbBorrower tbBorrower);
/**
*
*
* @param tbBorrower
* @return
*/
public int insertTbBorrower(TbBorrower tbBorrower);
/**
*
*
* @param tbBorrower
* @return
*/
public int updateTbBorrower(TbBorrower tbBorrower);
int borrowerInserts(TbBorrower tbBorrower);
AjaxResult loans(TbBorrower tbBorrower);
}

@ -0,0 +1,139 @@
package com.ruoyi.potenza.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.potenza.domain.TbBorrowerPeriods;
import com.ruoyi.potenza.domain.vo.PeriodDetailVo;
import com.ruoyi.potenza.service.TbBorrowerPeriodsService;
import com.ruoyi.potenza.mapper.TbBorrowerPeriodsMapper;
import com.ruoyi.potenza.utils.AverageCapitalPlusInterestUtils;
import com.ruoyi.potenza.utils.AverageCapitalUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* @author 86155
* @description tb_borrower_periods()Service
* @createDate 2023-01-13 15:56:37
*/
@Service
public class TbBorrowerPeriodsServiceImpl extends ServiceImpl<TbBorrowerPeriodsMapper, TbBorrowerPeriods>
implements TbBorrowerPeriodsService{
@Autowired
private TbBorrowerPeriodsMapper tbBorrowerPeriodsMapper;
/**
*
*
* @param periodsId
* @return
*/
@Override
public TbBorrowerPeriods selectTbBorrowerPeriodsByPeriodsId(Long periodsId)
{
return tbBorrowerPeriodsMapper.selectTbBorrowerPeriodsByPeriodsId(periodsId);
}
/**
*
*
* @param tbBorrowerPeriods
* @return
*/
@Override
public List<TbBorrowerPeriods> selectTbBorrowerPeriodsList(TbBorrowerPeriods tbBorrowerPeriods)
{
return tbBorrowerPeriodsMapper.selectTbBorrowerPeriodsList(tbBorrowerPeriods);
}
/**
*
*
* @param tbBorrowerPeriods
* @return
*/
@Override
public int insertTbBorrowerPeriods(TbBorrowerPeriods tbBorrowerPeriods)
{
tbBorrowerPeriods.setCreateTime(DateUtils.getNowDate());
return tbBorrowerPeriodsMapper.insertTbBorrowerPeriods(tbBorrowerPeriods);
}
/**
*
*
* @param tbBorrowerPeriods
* @return
*/
@Override
public int updateTbBorrowerPeriods(TbBorrowerPeriods tbBorrowerPeriods)
{
tbBorrowerPeriods.setUpdateTime(DateUtils.getNowDate());
return tbBorrowerPeriodsMapper.updateTbBorrowerPeriods(tbBorrowerPeriods);
}
/**
*
*
* @param periodsIds
* @return
*/
@Override
public int deleteTbBorrowerPeriodsByPeriodsIds(Long[] periodsIds)
{
return tbBorrowerPeriodsMapper.deleteTbBorrowerPeriodsByPeriodsIds(periodsIds);
}
/**
*
*
* @param periodsId
* @return
*/
@Override
public int deleteTbBorrowerPeriodsByPeriodsId(Long periodsId)
{
return tbBorrowerPeriodsMapper.deleteTbBorrowerPeriodsByPeriodsId(periodsId);
}
@Override
public AjaxResult detail(PeriodDetailVo periodDetailVo) {
//查询利率
Integer periodsId = periodDetailVo.getPeriodsId();
long periodsid = periodsId.longValue();
TbBorrowerPeriods tbBorrowerPeriods = tbBorrowerPeriodsMapper.selectTbBorrowerPeriodsByPeriodsId(periodsid);
if(tbBorrowerPeriods==null){
return AjaxResult.error();
}
Integer wayId = periodDetailVo.getWayId();
//等额本息
if(wayId==0){
double principalInterestCount = AverageCapitalPlusInterestUtils.
getPrincipalInterestCount(periodDetailVo.getBorrowerMoney(),
tbBorrowerPeriods.getRateInterest()/100,
tbBorrowerPeriods.getPeriodsName());
return AjaxResult.success(principalInterestCount);
}
//等额本金
// double principalInterestCount = AverageCapitalUtils.
// getPrincipalInterestCount(periodDetailVo.getBorrowerMoney(),
// tbBorrowerPeriods.getRateInterest()/100,
// tbBorrowerPeriods.getPeriodsName());
// return AjaxResult.success(principalInterestCount);
return AjaxResult.error();
}
}

@ -0,0 +1,103 @@
package com.ruoyi.potenza.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.potenza.domain.TbBorrowerPlan;
import com.ruoyi.potenza.mapper.TbBorrowerPeriodsMapper;
import com.ruoyi.potenza.service.TbBorrowerPlanService;
import com.ruoyi.potenza.mapper.TbBorrowerPlanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author 86155
* @description tb_borrower_plan()Service
* @createDate 2023-01-13 15:56:37
*/
@Service
public class TbBorrowerPlanServiceImpl extends ServiceImpl<TbBorrowerPlanMapper, TbBorrowerPlan>
implements TbBorrowerPlanService{
@Autowired
private TbBorrowerPlanMapper tbBorrowerPlanMapper;
/**
*
*
* @param planId
* @return
*/
@Override
public TbBorrowerPlan selectTbBorrowerPlanByPlanId(Long planId)
{
return tbBorrowerPlanMapper.selectTbBorrowerPlanByPlanId(planId);
}
/**
*
*
* @param tbBorrowerPlan
* @return
*/
@Override
public List<TbBorrowerPlan> selectTbBorrowerPlanList(TbBorrowerPlan tbBorrowerPlan)
{
return tbBorrowerPlanMapper.selectTbBorrowerPlanList(tbBorrowerPlan);
}
/**
*
*
* @param tbBorrowerPlan
* @return
*/
@Override
public int insertTbBorrowerPlan(TbBorrowerPlan tbBorrowerPlan)
{
tbBorrowerPlan.setCreateTime(DateUtils.getNowDate());
return tbBorrowerPlanMapper.insertTbBorrowerPlan(tbBorrowerPlan);
}
/**
*
*
* @param tbBorrowerPlan
* @return
*/
@Override
public int updateTbBorrowerPlan(TbBorrowerPlan tbBorrowerPlan)
{
tbBorrowerPlan.setUpdateTime(DateUtils.getNowDate());
return tbBorrowerPlanMapper.updateTbBorrowerPlan(tbBorrowerPlan);
}
/**
*
*
* @param planIds
* @return
*/
@Override
public int deleteTbBorrowerPlanByPlanIds(Long[] planIds)
{
return tbBorrowerPlanMapper.deleteTbBorrowerPlanByPlanIds(planIds);
}
/**
*
*
* @param planId
* @return
*/
@Override
public int deleteTbBorrowerPlanByPlanId(Long planId)
{
return tbBorrowerPlanMapper.deleteTbBorrowerPlanByPlanId(planId);
}
}

@ -0,0 +1,138 @@
package com.ruoyi.potenza.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.potenza.domain.TbBorrower;
import com.ruoyi.potenza.domain.TbBorrowerPeriods;
import com.ruoyi.potenza.domain.vo.IdVo;
import com.ruoyi.potenza.domain.vo.TbBorrowerVo;
import com.ruoyi.potenza.mapper.TbBorrowerPeriodsMapper;
import com.ruoyi.potenza.service.TbBorrowerService;
import com.ruoyi.potenza.mapper.TbBorrowerMapper;
import com.ruoyi.potenza.utils.AverageCapitalPlusInterestUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author 86155
* @description tb_borrower()Service
* @createDate 2023-01-13 15:56:37
*/
@Service
@Slf4j
public class TbBorrowerServiceImpl extends ServiceImpl<TbBorrowerMapper, TbBorrower>
implements TbBorrowerService{
@Autowired
private TbBorrowerMapper tbBorrowerMapper;
@Autowired
private TbBorrowerPeriodsMapper tbBorrowerPeriodsMapper;
@Override
public List<?> pageList(TbBorrower tbBorrower) {
List<TbBorrower> list= tbBorrowerMapper.pageList();
return list;
}
@Override
public AjaxResult borrowerDele(IdVo idVo) {
tbBorrowerMapper.deleteById(idVo.getId());
return AjaxResult.success("删除成功");
}
@Override
public TbBorrower selectTbBorrowerByBorrowerId(Long borrowerId)
{
return tbBorrowerMapper.selectTbBorrowerByBorrowerId(borrowerId);
}
/**
*
*
* @param tbBorrower
* @return
*/
@Override
public List<TbBorrower> selectTbBorrowerList(TbBorrower tbBorrower)
{
return tbBorrowerMapper.selectTbBorrowerList(tbBorrower);
}
/**
*
*
* @param tbBorrower
* @return
*/
@Override
public int insertTbBorrower(TbBorrower tbBorrower)
{
tbBorrower.setCreateTime(DateUtils.getNowDate());
return tbBorrowerMapper.insertTbBorrower(tbBorrower);
}
/**
*
*
* @param tbBorrower
* @return
*/
@Override
public int updateTbBorrower(TbBorrower tbBorrower)
{
tbBorrower.setUpdateTime(DateUtils.getNowDate());
return tbBorrowerMapper.updateTbBorrower(tbBorrower);
}
@Override
public int borrowerInserts(TbBorrower tbBorrower) {
return 0;
}
@Override
public AjaxResult loans(TbBorrower tbBorrower) {
//判断 用户 能否借款
//判断同一个人 只能借一个产品
LambdaQueryWrapper<TbBorrower> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(TbBorrower::getUserId,tbBorrower.getUserId());
wrapper.eq(TbBorrower::getProductId,tbBorrower.getProductId());
TbBorrower tbBorrower1 = tbBorrowerMapper.selectOne(wrapper);
if(tbBorrower1!=null){
return AjaxResult.error("请先还款");
}
Integer periodsId = tbBorrower.getPeriodsId();
long periodsid = periodsId.longValue();
//查询利率
TbBorrowerPeriods tbBorrowerPeriods = tbBorrowerPeriodsMapper.selectTbBorrowerPeriodsByPeriodsId(periodsid);
// double perMonthPrincipalInterest = AverageCapitalPlusInterestUtils.
// getPerMonthPrincipalInterest(tbBorrower.getBorrowerMoney(),
// tbBorrowerPeriods.getRateInterest()/100,
// tbBorrowerPeriods.getPeriodsName());
double principalInterestCount = AverageCapitalPlusInterestUtils.
getPrincipalInterestCount(tbBorrower.getBorrowerMoney(),
tbBorrowerPeriods.getRateInterest() / 100,
tbBorrowerPeriods.getPeriodsName());
log.info("---------"+principalInterestCount);
return AjaxResult.success("添加成功");
}
}

@ -0,0 +1,285 @@
package com.ruoyi.potenza.utils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
* @description: TODO
* @author
* @date 2023/1/15 19:17
* @version 1.0
*/
public class AverageCapitalPlusInterestUtils {
// /**
// * 等额本息计算获取还款方式为等额本息的每月偿还本金和利息
// * <p>
// * 公式:每月偿还本息=〔贷款本金×月利率×(1月利率)^还款月数〕÷〔(1月利率)^还款月数-1
// *
// * @param invest 总借款额(贷款本金)
// * @param yearRate 年利率
// * @param month 还款总月数
// * @return 每月偿还本金和利息, 不四舍五入,直接截取小数点最后两位
// */
// public static double getPerMonthPrincipalInterest(double invest, double yearRate, int totalmonth) {
// double monthRate = yearRate / 12;
// BigDecimal monthIncome = new BigDecimal(invest)
// .multiply(new BigDecimal(monthRate * Math.pow(1 + monthRate, totalmonth)))
// .divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2, BigDecimal.ROUND_DOWN);
// return monthIncome.doubleValue();
// }
//
// /**
// * 等额本息计算获取还款方式为等额本息的每月偿还利息
// * <p>
// * 公式:每月偿还利息=贷款本金×月利率×〔(1+月利率)^还款月数-(1+月利率)^(还款月序号-1)〕÷〔(1+月利率)^还款月数-1
// *
// * @param invest 总借款额(贷款本金)
// * @param yearRate 年利率
// * @param month 还款总月数
// * @return 每月偿还利息
// */
// public static Map<Integer, BigDecimal> getPerMonthInterest(double invest, double yearRate, int totalmonth) {
// Map<Integer, BigDecimal> map = new HashMap<Integer, BigDecimal>();
// double monthRate = yearRate / 12;
// BigDecimal monthInterest;
// for (int i = 1; i < totalmonth + 1; i++) {
// BigDecimal multiply = new BigDecimal(invest).multiply(new BigDecimal(monthRate));
// BigDecimal sub = new BigDecimal(Math.pow(1 + monthRate, totalmonth)).subtract(new BigDecimal(Math.pow(1 + monthRate, i - 1)));
// monthInterest = multiply.multiply(sub).divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 6, BigDecimal.ROUND_DOWN);
// monthInterest = monthInterest.setScale(2, BigDecimal.ROUND_DOWN);
// map.put(i, monthInterest);
// }
// return map;
// }
//
// /**
// * 等额本息计算获取还款方式为等额本息的每月偿还本金
// *
// * @param invest 总借款额(贷款本金)
// * @param yearRate 年利率
// * @param month 还款总月数
// * @return 每月偿还本金
// */
// public static Map<Integer, BigDecimal> getPerMonthPrincipal(double invest, double yearRate, int totalmonth) {
// double monthRate = yearRate / 12;
// BigDecimal monthIncome = new BigDecimal(invest)
// .multiply(new BigDecimal(monthRate * Math.pow(1 + monthRate, totalmonth)))
// .divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2, BigDecimal.ROUND_DOWN);
// Map<Integer, BigDecimal> mapInterest = getPerMonthInterest(invest, yearRate, totalmonth);
// Map<Integer, BigDecimal> mapPrincipal = new HashMap<Integer, BigDecimal>();
//
// for (Map.Entry<Integer, BigDecimal> entry : mapInterest.entrySet()) {
// mapPrincipal.put(entry.getKey(), monthIncome.subtract(entry.getValue()));
// }
// return mapPrincipal;
// }
//
// /**
// * 等额本息计算获取还款方式为等额本息的总利息
// *
// * @param invest 总借款额(贷款本金)
// * @param yearRate 年利率
// * @param month 还款总月数
// * @return 总利息
// */
// public static double getInterestCount(double invest, double yearRate, int totalmonth) {
// BigDecimal count = new BigDecimal(0);
// Map<Integer, BigDecimal> mapInterest = getPerMonthInterest(invest, yearRate, totalmonth);
//
// for (Map.Entry<Integer, BigDecimal> entry : mapInterest.entrySet()) {
// count = count.add(entry.getValue());
// }
// return count.doubleValue();
// }
//
// /**
// * 应还本金总和
// *
// * @param invest 总借款额(贷款本金)
// * @param yearRate 年利率
// * @param month 还款总月数
// * @return 应还本金总和
// */
// public static double getPrincipalInterestCount(double invest, double yearRate, int totalmonth) {
// double monthRate = yearRate / 12;
// BigDecimal perMonthInterest = new BigDecimal(invest)
// .multiply(new BigDecimal(monthRate * Math.pow(1 + monthRate, totalmonth)))
// .divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2, BigDecimal.ROUND_DOWN);
// BigDecimal count = perMonthInterest.multiply(new BigDecimal(totalmonth));
// count = count.setScale(2, BigDecimal.ROUND_DOWN);
// return count.doubleValue();
// }
//
//
// /**
// * @param args
// */
// public static void main(String[] args) {
// double invest = 20000; // 本金
// int month = 12;
// double yearRate = 0.15; // 年利率
// double perMonthPrincipalInterest = getPerMonthPrincipalInterest(invest, yearRate, month);
// System.out.println("等额本息---每月还款本息:" + perMonthPrincipalInterest);
// Map<Integer, BigDecimal> mapInterest = getPerMonthInterest(invest, yearRate, month);
// System.out.println("等额本息---每月还款利息:" + mapInterest);
// Map<Integer, BigDecimal> mapPrincipal = getPerMonthPrincipal(invest, yearRate, month);
// System.out.println("等额本息---每月还款本金:" + mapPrincipal);
// double count = getInterestCount(invest, yearRate, month);
// System.out.println("等额本息---总利息:" + count);
// double principalInterestCount = getPrincipalInterestCount(invest, yearRate, month);
// System.out.println("等额本息---应还本息总和:" + principalInterestCount);
//
// }
/**
*
*
* =××(1)÷(1)-1
*
* @param invest
*
* @param yearRate
*
* @param month
*
* @return ,
*/
public static BigDecimal getPerMonthPrincipalInterest(double invest, double yearRate, int totalmonth) {
double monthRate = yearRate / 12;
BigDecimal monthIncome = new BigDecimal(invest)
.multiply(new BigDecimal(monthRate * Math.pow(1 + monthRate, totalmonth)))
.divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2, BigDecimal.ROUND_UP);
//return monthIncome.doubleValue();
return monthIncome;
}
/**
*
*
* =××(1+)^-(1+)^(-1)÷(1+)^-1
*
* @param invest
*
* @param yearRate
*
* @param month
*
* @return
*/
public static Map<Integer, BigDecimal> getPerMonthInterest(double invest, double yearRate, int totalmonth) {
Map<Integer, BigDecimal> map = new HashMap<Integer, BigDecimal>();
double monthRate = yearRate / 12;
BigDecimal monthInterest;
for (int i = 1; i < totalmonth + 1; i++) {
BigDecimal multiply = new BigDecimal(invest).multiply(new BigDecimal(monthRate));
BigDecimal sub = new BigDecimal(Math.pow(1 + monthRate, totalmonth))
.subtract(new BigDecimal(Math.pow(1 + monthRate, i - 1)));
monthInterest = multiply.multiply(sub).divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2,
BigDecimal.ROUND_DOWN);
monthInterest = monthInterest.setScale(2, BigDecimal.ROUND_DOWN);
map.put(i, monthInterest);
}
return map;
}
/**
*
*
* @param invest
*
* @param yearRate
*
* @param month
*
* @return
*/
public static Map<Integer, BigDecimal> getPerMonthPrincipal(double invest, double yearRate, int totalmonth) {
double monthRate = yearRate / 12;
BigDecimal monthIncome = new BigDecimal(invest)
.multiply(new BigDecimal(monthRate * Math.pow(1 + monthRate, totalmonth)))
.divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2, BigDecimal.ROUND_DOWN);
Map<Integer, BigDecimal> mapInterest = getPerMonthInterest(invest, yearRate, totalmonth);
Map<Integer, BigDecimal> mapPrincipal = new HashMap<Integer, BigDecimal>();
for (Map.Entry<Integer, BigDecimal> entry : mapInterest.entrySet()) {
mapPrincipal.put(entry.getKey(), monthIncome.subtract(entry.getValue()));
}
return mapPrincipal;
}
/**
*
*
* @param invest
*
* @param yearRate
*
* @param month
*
* @return
*/
public static double getInterestCount(double invest, double yearRate, int totalmonth) {
BigDecimal count = new BigDecimal(0);
Map<Integer, BigDecimal> mapInterest = getPerMonthInterest(invest, yearRate, totalmonth);
for (Map.Entry<Integer, BigDecimal> entry : mapInterest.entrySet()) {
count = count.add(entry.getValue());
}
return count.doubleValue();
}
/**
*
*
* @param invest
*
* @param yearRate
*
* @param month
*
* @return
*/
public static double getPrincipalInterestCount(double invest, double yearRate, int totalmonth) {
double monthRate = yearRate / 12;
BigDecimal perMonthInterest = new BigDecimal(invest)
.multiply(new BigDecimal(monthRate * Math.pow(1 + monthRate, totalmonth)))
.divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2, BigDecimal.ROUND_DOWN);
BigDecimal count = perMonthInterest.multiply(new BigDecimal(totalmonth));
count = count.setScale(2, BigDecimal.ROUND_DOWN);
return count.doubleValue();
}
/**
* @param args
*/
public static void main() {
double invest = 10000; // 本金
int month = 12;
double yearRate = 0.015; // 年利率
BigDecimal perMonthPrincipalInterest = getPerMonthPrincipalInterest(invest, yearRate, month);
System.out.println("等额本息---每月还款本息:" + perMonthPrincipalInterest);
System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 3));
System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 6));
System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 9));
System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 12));
System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 15));
System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 18));
Map<Integer, BigDecimal> mapInterest = getPerMonthInterest(invest, yearRate, month);
System.out.println("等额本息---每月还款利息:" + mapInterest);
Map<Integer, BigDecimal> mapPrincipal = getPerMonthPrincipal(invest, yearRate, month);
System.out.println("等额本息---每月还款本金:" + mapPrincipal);
double count = getInterestCount(invest, yearRate, month);
System.out.println("等额本息---总利息:" + count);
double principalInterestCount = getPrincipalInterestCount(invest, yearRate, month);
System.out.println("等额本息---应还本息总和:" + principalInterestCount);
}
}

@ -0,0 +1,279 @@
package com.ruoyi.potenza.utils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/15 20:49
*/
public class AverageCapitalUtils {
// /**
// * 等额本息计算获取还款方式为等额本息的每月偿还本金和利息
// *
// * 公式:每月偿还本息=〔贷款本金×月利率×(1月利率)^还款月数〕÷〔(1月利率)^还款月数-1
// *
// * @param invest
// * 总借款额(贷款本金)
// * @param yearRate
// * 年利率
// * @param month
// * 还款总月数
// * @return 每月偿还本金和利息,不四舍五入,直接截取小数点最后两位
// */
// public static BigDecimal getPerMonthPrincipalInterest(double invest, double yearRate, int totalmonth) {
// double monthRate = yearRate / 12;
// BigDecimal monthIncome = new BigDecimal(invest)
// .multiply(new BigDecimal(monthRate * Math.pow(1 + monthRate, totalmonth)))
// .divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2, BigDecimal.ROUND_UP);
// //return monthIncome.doubleValue();
// return monthIncome;
// }
//
// /**
// * 等额本息计算获取还款方式为等额本息的每月偿还利息
// *
// * 公式:每月偿还利息=贷款本金×月利率×〔(1+月利率)^还款月数-(1+月利率)^(还款月序号-1)〕÷〔(1+月利率)^还款月数-1
// *
// * @param invest
// * 总借款额(贷款本金)
// * @param yearRate
// * 年利率
// * @param month
// * 还款总月数
// * @return 每月偿还利息
// */
// public static Map<Integer, BigDecimal> getPerMonthInterest(double invest, double yearRate, int totalmonth) {
// Map<Integer, BigDecimal> map = new HashMap<Integer, BigDecimal>();
// double monthRate = yearRate / 12;
// BigDecimal monthInterest;
// for (int i = 1; i < totalmonth + 1; i++) {
// BigDecimal multiply = new BigDecimal(invest).multiply(new BigDecimal(monthRate));
// BigDecimal sub = new BigDecimal(Math.pow(1 + monthRate, totalmonth))
// .subtract(new BigDecimal(Math.pow(1 + monthRate, i - 1)));
// monthInterest = multiply.multiply(sub).divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2,
// BigDecimal.ROUND_DOWN);
// monthInterest = monthInterest.setScale(2, BigDecimal.ROUND_DOWN);
// map.put(i, monthInterest);
// }
// return map;
// }
//
// /**
// * 等额本息计算获取还款方式为等额本息的每月偿还本金
// *
// * @param invest
// * 总借款额(贷款本金)
// * @param yearRate
// * 年利率
// * @param month
// * 还款总月数
// * @return 每月偿还本金
// */
// public static Map<Integer, BigDecimal> getPerMonthPrincipal(double invest, double yearRate, int totalmonth) {
// double monthRate = yearRate / 12;
// BigDecimal monthIncome = new BigDecimal(invest)
// .multiply(new BigDecimal(monthRate * Math.pow(1 + monthRate, totalmonth)))
// .divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2, BigDecimal.ROUND_DOWN);
// Map<Integer, BigDecimal> mapInterest = getPerMonthInterest(invest, yearRate, totalmonth);
// Map<Integer, BigDecimal> mapPrincipal = new HashMap<Integer, BigDecimal>();
//
// for (Map.Entry<Integer, BigDecimal> entry : mapInterest.entrySet()) {
// mapPrincipal.put(entry.getKey(), monthIncome.subtract(entry.getValue()));
// }
// return mapPrincipal;
// }
//
// /**
// * 等额本息计算获取还款方式为等额本息的总利息
// *
// * @param invest
// * 总借款额(贷款本金)
// * @param yearRate
// * 年利率
// * @param month
// * 还款总月数
// * @return 总利息
// */
// public static double getInterestCount(double invest, double yearRate, int totalmonth) {
// BigDecimal count = new BigDecimal(0);
// Map<Integer, BigDecimal> mapInterest = getPerMonthInterest(invest, yearRate, totalmonth);
//
// for (Map.Entry<Integer, BigDecimal> entry : mapInterest.entrySet()) {
// count = count.add(entry.getValue());
// }
// return count.doubleValue();
// }
//
// /**
// * 应还本金总和
// *
// * @param invest
// * 总借款额(贷款本金)
// * @param yearRate
// * 年利率
// * @param month
// * 还款总月数
// * @return 应还本金总和
// */
// public static double getPrincipalInterestCount(double invest, double yearRate, int totalmonth) {
// double monthRate = yearRate / 12;
// BigDecimal perMonthInterest = new BigDecimal(invest)
// .multiply(new BigDecimal(monthRate * Math.pow(1 + monthRate, totalmonth)))
// .divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2, BigDecimal.ROUND_DOWN);
// BigDecimal count = perMonthInterest.multiply(new BigDecimal(totalmonth));
// count = count.setScale(2, BigDecimal.ROUND_DOWN);
// return count.doubleValue();
// }
//
// /**
// * @param args
// */
// public static void main(String[] args) {
// double invest = 38988; // 本金
// int month = 12;
// double yearRate = 0.15; // 年利率
// BigDecimal perMonthPrincipalInterest = getPerMonthPrincipalInterest(invest, yearRate, month);
// System.out.println("等额本息---每月还款本息:" + perMonthPrincipalInterest);
// System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 3));
// System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 6));
// System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 9));
// System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 12));
// System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 15));
// System.out.println("等额本息---每月还款本息:" + getPerMonthPrincipalInterest(invest, yearRate, 18));
// /*Map<Integer, BigDecimal> mapInterest = getPerMonthInterest(invest, yearRate, month);
// System.out.println("等额本息---每月还款利息:" + mapInterest);
// Map<Integer, BigDecimal> mapPrincipal = getPerMonthPrincipal(invest, yearRate, month);
// System.out.println("等额本息---每月还款本金:" + mapPrincipal);
// double count = getInterestCount(invest, yearRate, month);
// System.out.println("等额本息---总利息:" + count);
// double principalInterestCount = getPrincipalInterestCount(invest, yearRate, month);
// System.out.println("等额本息---应还本息总和:" + principalInterestCount);*/
// }
/**
*
*
* =(÷)+(-)×
*
* @param invest
*
* @param yearRate
*
* @param month
*
* @return ,
*/
public static Map<Integer, Double> getPerMonthPrincipalInterest(double invest, double yearRate, int totalMonth) {
Map<Integer, Double> map = new HashMap<Integer, Double>();
// 每月本金
double monthPri = getPerMonthPrincipal(invest, totalMonth);
// 获取月利率
double monthRate = yearRate / 12;
monthRate = new BigDecimal(monthRate).setScale(6, BigDecimal.ROUND_DOWN).doubleValue();
for (int i = 1; i <= totalMonth; i++) {
double monthRes = monthPri + (invest - monthPri * (i - 1)) * monthRate;
monthRes = new BigDecimal(monthRes).setScale(2, BigDecimal.ROUND_DOWN).doubleValue();
map.put(i, monthRes);
}
return map;
}
/**
*
*
* =×=(-)×
*
* @param invest
*
* @param yearRate
*
* @param month
*
* @return
*/
public static Map<Integer, Double> getPerMonthInterest(double invest, double yearRate, int totalMonth) {
Map<Integer, Double> inMap = new HashMap<Integer, Double>();
double principal = getPerMonthPrincipal(invest, totalMonth);
Map<Integer, Double> map = getPerMonthPrincipalInterest(invest, yearRate, totalMonth);
for (Map.Entry<Integer, Double> entry : map.entrySet()) {
BigDecimal principalBigDecimal = new BigDecimal(principal);
BigDecimal principalInterestBigDecimal = new BigDecimal(entry.getValue());
BigDecimal interestBigDecimal = principalInterestBigDecimal.subtract(principalBigDecimal);
interestBigDecimal = interestBigDecimal.setScale(2, BigDecimal.ROUND_DOWN);
inMap.put(entry.getKey(), interestBigDecimal.doubleValue());
}
return inMap;
}
/**
*
*
* =÷
*
* @param invest
*
* @param yearRate
*
* @param month
*
* @return
*/
public static double getPerMonthPrincipal(double invest, int totalMonth) {
BigDecimal monthIncome = new BigDecimal(invest).divide(new BigDecimal(totalMonth), 2, BigDecimal.ROUND_DOWN);
return monthIncome.doubleValue();
}
/**
*
*
* @param invest
*
* @param yearRate
*
* @param month
*
* @return
*/
public static double getInterestCount(double invest, double yearRate, int totalMonth) {
BigDecimal count = new BigDecimal(0);
Map<Integer, Double> mapInterest = getPerMonthInterest(invest, yearRate, totalMonth);
for (Map.Entry<Integer, Double> entry : mapInterest.entrySet()) {
count = count.add(new BigDecimal(entry.getValue()));
}
return count.doubleValue();
}
public static double getPrincipalInterestCount(double invest, double yearRate, int totalmonth) {
double monthRate = yearRate / 12;
BigDecimal perMonthInterest = new BigDecimal(invest)
.multiply(new BigDecimal(monthRate * Math.pow(1 + monthRate, totalmonth)))
.divide(new BigDecimal(Math.pow(1 + monthRate, totalmonth) - 1), 2, BigDecimal.ROUND_DOWN);
BigDecimal count = perMonthInterest.multiply(new BigDecimal(totalmonth));
count = count.setScale(2, BigDecimal.ROUND_DOWN);
return count.doubleValue();
}
/**
* @param args
*/
public static void main() {
double invest = 10000; // 本金
int month = 12;
double yearRate = 0.015; // 年利率
Map<Integer, Double> getPerMonthPrincipalInterest = getPerMonthPrincipalInterest(invest, yearRate, month);
System.out.println("等额本金---每月本息:" + getPerMonthPrincipalInterest);
double benjin = getPerMonthPrincipal(invest, month);
System.out.println("等额本金---每月本金:" + benjin);
Map<Integer, Double> mapInterest = getPerMonthInterest(invest, yearRate, month);
System.out.println("等额本金---每月利息:" + mapInterest);
double count = getInterestCount(invest, yearRate, month);
System.out.println("等额本金---总利息:" + count);
double principalInterestCount = getPrincipalInterestCount(invest, yearRate, month);
System.out.println("等额本金---应还本息总和:"+principalInterestCount);
}
}

@ -0,0 +1,25 @@
# Tomcat
server:
port: 9401
# Spring
spring:
application:
# 应用名称
name: ruoyi-potenza
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/ruoyi-potenza" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
</configuration>

@ -0,0 +1,108 @@
<?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.ruoyi.potenza.mapper.TbBorrowerMapper">
<resultMap type="com.ruoyi.potenza.domain.TbBorrower" id="TbBorrowerResult">
<result property="borrowerId" column="borrower_id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="productId" column="product_id" />
<result property="borrowerMoney" column="borrower_money" />
<result property="periodsId" column="periods_id" />
<result property="wayId" column="way_id" />
<result property="borrowerPurpose" column="borrower_purpose" />
<result property="borrowerState" column="borrower_state" />
<result property="loanerId" column="loaner_id" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="delFlag" column="del_flag" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTbBorrowerVo">
select borrower_id, user_id, user_name, product_id, borrower_money, periods_id, way_id, borrower_purpose, borrower_state, loaner_id, create_by, update_by, del_flag, create_time, update_time from tb_borrower where del_flag=0
</sql>
<select id="pageList" resultType="com.ruoyi.potenza.domain.TbBorrower">
select * from tb_borrower where del_flag=0
</select>
<select id="selectTbBorrowerList" parameterType="com.ruoyi.potenza.domain.TbBorrower" resultMap="TbBorrowerResult">
<include refid="selectTbBorrowerVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="borrowerMoney != null "> and borrower_money = #{borrowerMoney}</if>
<if test="periodsId != null "> and periods_id = #{periodsId}</if>
<if test="wayId != null "> and way_id = #{wayId}</if>
<if test="borrowerPurpose != null and borrowerPurpose != ''"> and borrower_purpose = #{borrowerPurpose}</if>
<if test="borrowerState != null "> and borrower_state = #{borrowerState}</if>
<if test="loanerId != null "> and loaner_id = #{loanerId}</if>
</where>
</select>
<select id="selectTbBorrowerByBorrowerId" parameterType="Long" resultMap="TbBorrowerResult">
<include refid="selectTbBorrowerVo"/>
where borrower_id = #{borrowerId}
</select>
<insert id="insertTbBorrower" parameterType="com.ruoyi.potenza.domain.TbBorrower" useGeneratedKeys="true" keyProperty="borrowerId">
insert into tb_borrower
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="productId != null">product_id,</if>
<if test="borrowerMoney != null">borrower_money,</if>
<if test="periodsId != null">periods_id,</if>
<if test="wayId != null">way_id,</if>
<if test="borrowerPurpose != null and borrowerPurpose != ''">borrower_purpose,</if>
<if test="borrowerState != null">borrower_state,</if>
<if test="loanerId != null">loaner_id,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="productId != null">#{productId},</if>
<if test="borrowerMoney != null">#{borrowerMoney},</if>
<if test="periodsId != null">#{periodsId},</if>
<if test="wayId != null">#{wayId},</if>
<if test="borrowerPurpose != null and borrowerPurpose != ''">#{borrowerPurpose},</if>
<if test="borrowerState != null">#{borrowerState},</if>
<if test="loanerId != null">#{loanerId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTbBorrower" parameterType="com.ruoyi.potenza.domain.TbBorrower">
update tb_borrower
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="borrowerMoney != null">borrower_money = #{borrowerMoney},</if>
<if test="periodsId != null">periods_id = #{periodsId},</if>
<if test="wayId != null">way_id = #{wayId},</if>
<if test="borrowerPurpose != null and borrowerPurpose != ''">borrower_purpose = #{borrowerPurpose},</if>
<if test="borrowerState != null">borrower_state = #{borrowerState},</if>
<if test="loanerId != null">loaner_id = #{loanerId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where borrower_id = #{borrowerId}
</update>
</mapper>

@ -0,0 +1,80 @@
<?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.ruoyi.potenza.mapper.TbBorrowerPeriodsMapper">
<resultMap type="com.ruoyi.potenza.domain.TbBorrowerPeriods" id="TbBorrowerPeriodsResult">
<result property="periodsId" column="periods_id" />
<result property="periodsName" column="periods_name" />
<result property="rateInterest" column="rate_interest" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="delFlag" column="del_flag" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTbBorrowerPeriodsVo">
select periods_id, periods_name,rate_interest, create_by, update_by, del_flag, create_time, update_time from tb_borrower_periods
</sql>
<select id="selectTbBorrowerPeriodsList" parameterType="com.ruoyi.potenza.domain.TbBorrowerPeriods" resultMap="TbBorrowerPeriodsResult">
<include refid="selectTbBorrowerPeriodsVo"/>
<where>
<if test="periodsName != null "> and periods_name like concat('%', #{periodsName}, '%')</if>
</where>
</select>
<select id="selectTbBorrowerPeriodsByPeriodsId" parameterType="Long" resultMap="TbBorrowerPeriodsResult">
<include refid="selectTbBorrowerPeriodsVo"/>
where periods_id = #{periodsId}
</select>
<insert id="insertTbBorrowerPeriods" parameterType="com.ruoyi.potenza.domain.TbBorrowerPeriods" useGeneratedKeys="true" keyProperty="periodsId">
insert into tb_borrower_periods
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="periodsName != null">periods_name,</if>
<if test="rateInterest != null">rate_interest,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="periodsName != null">#{periodsName},</if>
<if test="rateInterest != null">#{rateInterest},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTbBorrowerPeriods" parameterType="com.ruoyi.potenza.domain.TbBorrowerPeriods">
update tb_borrower_periods
<trim prefix="SET" suffixOverrides=",">
<if test="periodsName != null">periods_name = #{periodsName},</if>
<if test="rateInterest != null">rate_interest = #{rateInterest},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where periods_id = #{periodsId}
</update>
<delete id="deleteTbBorrowerPeriodsByPeriodsId" parameterType="Long">
delete from tb_borrower_periods where periods_id = #{periodsId}
</delete>
<delete id="deleteTbBorrowerPeriodsByPeriodsIds" parameterType="String">
delete from tb_borrower_periods where periods_id in
<foreach item="periodsId" collection="array" open="(" separator="," close=")">
#{periodsId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,104 @@
<?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.ruoyi.potenza.mapper.TbBorrowerPlanMapper">
<resultMap type="com.ruoyi.potenza.domain.TbBorrowerPlan" id="TbBorrowerPlanResult">
<result property="planId" column="plan_id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="borrowerPeriods" column="borrower_periods" />
<result property="periodsMoney" column="periods_money" />
<result property="periodsCapital" column="periods_capital" />
<result property="periodsInterests" column="periods_interests" />
<result property="planDate" column="plan_date" />
<result property="planState" column="plan_state" />
<result property="delFlag" column="del_flag" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTbBorrowerPlanVo">
select plan_id, user_id, user_name, borrower_periods, periods_money, periods_capital, periods_interests, plan_date, plan_state, del_flag, create_time, update_time from tb_borrower_plan
</sql>
<select id="selectTbBorrowerPlanList" parameterType="com.ruoyi.potenza.domain.TbBorrowerPlan" resultMap="TbBorrowerPlanResult">
<include refid="selectTbBorrowerPlanVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="borrowerPeriods != null "> and borrower_periods = #{borrowerPeriods}</if>
<if test="periodsMoney != null "> and periods_money = #{periodsMoney}</if>
<if test="periodsCapital != null "> and periods_capital = #{periodsCapital}</if>
<if test="periodsInterests != null "> and periods_interests = #{periodsInterests}</if>
<if test="planDate != null "> and plan_date = #{planDate}</if>
<if test="planState != null "> and plan_state = #{planState}</if>
</where>
</select>
<select id="selectTbBorrowerPlanByPlanId" parameterType="Long" resultMap="TbBorrowerPlanResult">
<include refid="selectTbBorrowerPlanVo"/>
where plan_id = #{planId}
</select>
<insert id="insertTbBorrowerPlan" parameterType="com.ruoyi.potenza.domain.TbBorrowerPlan" useGeneratedKeys="true" keyProperty="planId">
insert into tb_borrower_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="borrowerPeriods != null">borrower_periods,</if>
<if test="periodsMoney != null">periods_money,</if>
<if test="periodsCapital != null">periods_capital,</if>
<if test="periodsInterests != null">periods_interests,</if>
<if test="planDate != null">plan_date,</if>
<if test="planState != null">plan_state,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="borrowerPeriods != null">#{borrowerPeriods},</if>
<if test="periodsMoney != null">#{periodsMoney},</if>
<if test="periodsCapital != null">#{periodsCapital},</if>
<if test="periodsInterests != null">#{periodsInterests},</if>
<if test="planDate != null">#{planDate},</if>
<if test="planState != null">#{planState},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTbBorrowerPlan" parameterType="com.ruoyi.potenza.domain.TbBorrowerPlan">
update tb_borrower_plan
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="borrowerPeriods != null">borrower_periods = #{borrowerPeriods},</if>
<if test="periodsMoney != null">periods_money = #{periodsMoney},</if>
<if test="periodsCapital != null">periods_capital = #{periodsCapital},</if>
<if test="periodsInterests != null">periods_interests = #{periodsInterests},</if>
<if test="planDate != null">plan_date = #{planDate},</if>
<if test="planState != null">plan_state = #{planState},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where plan_id = #{planId}
</update>
<delete id="deleteTbBorrowerPlanByPlanId" parameterType="Long">
delete from tb_borrower_plan where plan_id = #{planId}
</delete>
<delete id="deleteTbBorrowerPlanByPlanIds" parameterType="String">
delete from tb_borrower_plan where plan_id in
<foreach item="planId" collection="array" open="(" separator="," close=")">
#{planId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,120 @@
<?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>ruoyi-modules</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.ruoyi.product</groupId>
<artifactId>ruoyi-product</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.2</version>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,36 @@
package com.ruoyi.product;
import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
*
*
* @author ruoyi
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
@EnableScheduling //定时任务
public class RuoYiProductApplication
{
public static void main(String[] args)
{
SpringApplication.run(RuoYiProductApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

@ -0,0 +1,25 @@
package com.ruoyi.product.config;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.RestClients;
@Configuration
public class ElasticsearchConfig {
@Bean
RestHighLevelClient elasticsearchClient() {
ClientConfiguration configuration = ClientConfiguration.builder()
.connectedTo("localhost:9200")
//.withConnectTimeout(Duration.ofSeconds(5))
//.withSocketTimeout(Duration.ofSeconds(3))
//.useSsl()
//.withDefaultHeaders(defaultHeaders)
//.withBasicAuth(username, password)
// ... other options
.build();
RestHighLevelClient client = RestClients.create(configuration).rest();
return client;
}
}

@ -0,0 +1,36 @@
package com.ruoyi.product.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class Knife4jConfiguration {
@Bean(value = "defaultApi2")
public Docket defaultApi2() {
String groupName="3.X版本";
Docket docket=new Docket(DocumentationType.OAS_30)
.apiInfo(new ApiInfoBuilder()
.title("产品中心 API详细描述 ")
.description("# 这里记录服务端所有的接口的入参,出参等等信息")
.termsOfServiceUrl("https://www.shenmazong.com")
.contact(new Contact("杨杨","http://yangzongli.com","337296894@qq.com"))
.version("3.0")
.build())
//分组名称
.groupName(groupName)
.select()
//这里指定Controller扫描包路径
.apis(RequestHandlerSelectors.basePackage("com.ruoyi.product.controller"))
.paths(PathSelectors.any())
.build();
return docket;
}
}

@ -0,0 +1,24 @@
package com.ruoyi.product.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisPlusConfig {
/**
* ,mybatis,
* MybatisConfiguration#useDeprecatedExecutor = false
* ()
*/
// 最新版
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
}

@ -0,0 +1,83 @@
package com.ruoyi.product.controller;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.product.pojo.vo.IdVo;
import com.ruoyi.product.pojo.vo.PageInfoVo;
import com.ruoyi.product.service.TbFinancialProductService;
import com.ruoyi.product.pojo.vo.ProductInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @version 1.0
* @description: TODO
* @author
* @date 2023/1/15 16:34
*/
@RestController
@RequestMapping(value = "/product")
public class ProductController {
@Autowired
private TbFinancialProductService tbFinancialProductService;
/**
*
* @param pageInfoVo
* @return
*/
@PostMapping(value = "/list")
public AjaxResult list(@RequestBody PageInfoVo pageInfoVo){
return tbFinancialProductService.listPage(pageInfoVo);
}
/**
*
* @param productInfoVo
* @return
*/
@PostMapping(value = "/add")
public AjaxResult add(@RequestBody ProductInfoVo productInfoVo){
return tbFinancialProductService.add(productInfoVo);
}
/**
*
* @param idVo
* @return
*/
@PostMapping(value = "/delete")
public AjaxResult delete(@RequestBody IdVo idVo){
return tbFinancialProductService.deleteById(idVo);
}
/**
*Id
* @param productInfoVo
* @return
*/
@PostMapping(value = "/update")
public AjaxResult update(@RequestBody ProductInfoVo productInfoVo){
return tbFinancialProductService.updateId(productInfoVo);
}
/**
* id
* @param productInfoVo
* @return
*/
@PostMapping(value = "/selectProduct")
public AjaxResult selectProduct(@RequestBody ProductInfoVo productInfoVo){
return tbFinancialProductService.selectProduct(productInfoVo);
}
}

@ -0,0 +1,17 @@
package com.ruoyi.product.mapper;
import com.ruoyi.product.pojo.TbFinancialProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ruoyi.product.pojo.TbFinancialProduct
*/
@Mapper
public interface TbFinancialProductMapper extends BaseMapper<TbFinancialProduct> {
}

@ -0,0 +1,17 @@
package com.ruoyi.product.mapper;
import com.ruoyi.product.pojo.TbProductType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ruoyi.product.pojo.TbProductType
*/
@Mapper
public interface TbProductTypeMapper extends BaseMapper<TbProductType> {
}

@ -0,0 +1,141 @@
package com.ruoyi.product.pojo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;
/**
*
* @TableName tb_financial_product
*/
@TableName(value ="tb_financial_product")
@Data
@Document(indexName = "tb_financial_product")
public class TbFinancialProduct implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Integer productId;
/**
* id
*/
private Integer firmId;
/**
*
*/
private String firmName;
/**
*
*/
@Field(type = FieldType.Text,analyzer = "ik_max_word")
private String productName;
/**
*
*/
private String productDesc;
/**
* ID
*/
private Integer userId;
/**
* ID
*/
private Integer typeId;
/**
*
*/
private Integer periods;
/**
*
*/
private Integer productRate;
/**
*
*/
private Integer produtCharge;
/**
*
*/
private Integer maxPrice;
/**
*
*/
private Integer minPrice;
/**
*
*/
private Integer termsForLate;
/**
*
*/
private String termsProductLate;
/**
* 0: 1: 2:
*/
private Integer modeProduct;
/**
* LOGO
*/
private String productPhoto;
/**
* 0 2
*/
private Integer delFlag;
/**
*
*/
private String createBy;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@Field(type = FieldType.Date,format = DateFormat. custom,pattern = "yyy-MM-dd HH:mm: ss")
private Date createTime;
/**
*
*/
private String updateBy;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@Field(type = FieldType.Date,format = DateFormat. custom,pattern = "yyy-MM-dd HH:mm: ss")
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,56 @@
package com.ruoyi.product.pojo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName tb_product_type
*/
@TableName(value ="tb_product_type")
@Data
public class TbProductType implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Integer typeId;
/**
*
*/
private String typeName;
/**
* 0 2
*/
private Integer delFlag;
/**
*
*/
private String createBy;
/**
*
*/
private Date createTime;
/**
*
*/
private String updateBy;
/**
*
*/
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,17 @@
package com.ruoyi.product.pojo.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @version 1.0
* @description: TODO
* @author
* @date 2023/1/15 20:16
*/
@Data
public class IdVo implements Serializable {
private Integer ProductId;
}

@ -0,0 +1,19 @@
package com.ruoyi.product.pojo.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @version 1.0
* @description: TODO
* @author
* @date 2023/1/15 16:46
*/
@Data
public class PageInfoVo implements Serializable {
private Integer pageNum;
private Integer pageSize;
//模糊查询数据
private String keyword;
}

@ -0,0 +1,118 @@
package com.ruoyi.product.pojo.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @version 1.0
* @description: TODO
* @author
* @date 2023/1/16 16:02
*/
@Data
public class ProductInfoVo implements Serializable {
private Integer productId;
/**
* id
*/
private Integer firmId;
/**
*
*/
private String firmName;
/**
*
*/
private String productName;
/**
*
*/
private String productDesc;
/**
* ID
*/
private Integer userId;
/**
* ID
*/
private Integer typeId;
/**
*
*/
private Integer periods;
/**
*
*/
private Integer productRate;
/**
*
*/
private Integer produtCharge;
/**
*
*/
private Integer maxPrice;
/**
*
*/
private Integer minPrice;
/**
*
*/
private Integer termsForLate;
/**
*
*/
private String termsProductLate;
/**
* 0: 1: 2:
*/
private Integer modeProduct;
/**
* LOGO
*/
private String productPhoto;
/**
* 0 2
*/
private Integer delFlag;
/**
*
*/
private String createBy;
/**
*
*/
private Date createTime;
/**
*
*/
private String updateBy;
/**
*
*/
private Date updateTime;
}

@ -0,0 +1,26 @@
package com.ruoyi.product.service;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.product.pojo.TbFinancialProduct;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.product.pojo.vo.IdVo;
import com.ruoyi.product.pojo.vo.PageInfoVo;
import com.ruoyi.product.pojo.vo.ProductInfoVo;
/**
*
*/
public interface TbFinancialProductService extends IService<TbFinancialProduct> {
AjaxResult listPage(PageInfoVo pageInfoVo);
AjaxResult add(ProductInfoVo productInfoVo);
AjaxResult deleteById(IdVo idVo);
AjaxResult updateId(ProductInfoVo productInfoVo);
AjaxResult selectProduct(ProductInfoVo productInfoVo);
}

@ -0,0 +1,11 @@
package com.ruoyi.product.service;
import com.ruoyi.product.pojo.TbProductType;
import com.baomidou.mybatisplus.extension.service.IService;
/**
*
*/
public interface TbProductTypeService extends IService<TbProductType> {
}

@ -0,0 +1,189 @@
package com.ruoyi.product.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.product.pojo.TbFinancialProduct;
import com.ruoyi.product.pojo.vo.IdVo;
import com.ruoyi.product.pojo.vo.PageInfoVo;
import com.ruoyi.product.pojo.vo.ProductInfoVo;
import com.ruoyi.product.service.TbFinancialProductService;
import com.ruoyi.product.mapper.TbFinancialProductMapper;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermQueryBuilder;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
import org.elasticsearch.search.sort.FieldSortBuilder;
import org.elasticsearch.search.sort.SortBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
/**
*
*/
@Service
public class TbFinancialProductServiceImpl extends ServiceImpl<TbFinancialProductMapper, TbFinancialProduct>
implements TbFinancialProductService{
@Autowired
private TbFinancialProductMapper tbFinancialProductMapper;
@Autowired
private ElasticsearchRestTemplate elasticsearchRestTemplate;
/**
*
* @param pageInfoVo
* @return
*/
@Override
public AjaxResult listPage(PageInfoVo pageInfoVo) {
if(pageInfoVo.getKeyword()==null){
Page<TbFinancialProduct> page = new Page<>(pageInfoVo.getPageNum(), pageInfoVo.getPageSize());
//.lambda().eq(TbFinancialProduct::getFirmName, pageInfoVo.getKeyword()).last("limit 1")
Page<TbFinancialProduct> financialProductPage = page(page, new QueryWrapper<>());
List<ProductInfoVo> collect = financialProductPage.getRecords().stream().map((item) -> {
ProductInfoVo productInfoVo = new ProductInfoVo();
BeanUtils.copyProperties(item, productInfoVo);
return productInfoVo;
}).collect(Collectors.toList());
Page<ProductInfoVo> infoVoPage = new Page<>();
infoVoPage.setRecords(collect);
infoVoPage.setCurrent(financialProductPage.getCurrent());
infoVoPage.setSize(financialProductPage.getSize());
infoVoPage.setTotal(financialProductPage.getTotal());
return AjaxResult.success(infoVoPage);
}
//获取分页数据
Pageable page = PageRequest.of(pageInfoVo.getPageNum() - 1, pageInfoVo.getPageSize());
TermQueryBuilder termQuery = QueryBuilders.termQuery("productName", pageInfoVo.getKeyword());
SortBuilder sortBuilder = new FieldSortBuilder("createTime").order(SortOrder.DESC);
//高亮查询数据
HighlightBuilder highlightBuilder = new HighlightBuilder();
highlightBuilder.preTags("<strong style='color:red'>")
.postTags("</strong>")
.field("productName");
NativeSearchQuery searchQuery = new NativeSearchQueryBuilder()
.withQuery(termQuery)
.withPageable(page)
.withSort(sortBuilder)
.withHighlightBuilder(highlightBuilder)
// .withQuery(queryBuilder)
.build();
long total = elasticsearchRestTemplate.count(searchQuery, TbFinancialProduct.class);
SearchHits<TbFinancialProduct> search = elasticsearchRestTemplate.search(searchQuery, TbFinancialProduct.class);
List<ProductInfoVo> productInfoVoList = search.getSearchHits().stream().map((item) -> {
TbFinancialProduct content = item.getContent();
List<String> productName = item.getHighlightField("productName");
if (productName != null && productName.size() > 0) {
String name = productName.get(0);
//设置高亮查询
content.setProductName(name);
}
ProductInfoVo productInfoVo = new ProductInfoVo();
BeanUtils.copyProperties(content, productInfoVo);
return productInfoVo;
}).collect(Collectors.toList());
Page<ProductInfoVo> infoVoPage = new Page<>();
infoVoPage.setRecords(productInfoVoList);
infoVoPage.setCurrent(pageInfoVo.getPageNum()-1);
infoVoPage.setSize(pageInfoVo.getPageSize());
infoVoPage.setTotal(total);
return AjaxResult.success(infoVoPage);
}
/**
*
* @param productInfoVo
* @return
*/
@Override
@Transactional //分布式事务
public AjaxResult add(ProductInfoVo productInfoVo) {
String firmName = productInfoVo.getFirmName();
TbFinancialProduct one = getOne(new QueryWrapper<TbFinancialProduct>().lambda().eq(TbFinancialProduct::getFirmName, firmName));
if(one!=null){
return AjaxResult.error(302,"产品名称重复");
}
TbFinancialProduct financialProduct = new TbFinancialProduct();
BeanUtils.copyProperties(productInfoVo,financialProduct);
save(financialProduct);
elasticsearchRestTemplate.save(financialProduct);
return AjaxResult.success();
}
/**
* id
* @param idVo
* @return
*/
@Override
public AjaxResult deleteById(IdVo idVo) {
Integer productId = idVo.getProductId();
TbFinancialProduct one = getOne(new QueryWrapper<TbFinancialProduct>().lambda().eq(TbFinancialProduct::getProductId, productId));
if(one==null){
return AjaxResult.error(402,"产品Id不存在");
}
Integer oneProductId = one.getProductId();
BeanUtils.copyProperties(idVo,one);
int i = tbFinancialProductMapper.deleteById(oneProductId);
if(i>0){
return AjaxResult.success("删除成功");
}else {
return AjaxResult.error(302,"删除失败");
}
}
/**
* id
* @param productInfoVo
* @return
*/
@Override
public AjaxResult updateId(ProductInfoVo productInfoVo) {
Integer productId = productInfoVo.getProductId();
TbFinancialProduct one = getOne(new QueryWrapper<TbFinancialProduct>().lambda().eq(TbFinancialProduct::getProductId, productId));
if(one==null){
return AjaxResult.error(402,"产品Id不存在");
}
TbFinancialProduct product = new TbFinancialProduct();
//
BeanUtils.copyProperties(productInfoVo,product);
tbFinancialProductMapper.updateById(product);
return AjaxResult.success("修改成功");
}
@Override
public AjaxResult selectProduct(ProductInfoVo productInfoVo) {
Integer productId = productInfoVo.getProductId();
TbFinancialProduct one = getOne(new QueryWrapper<TbFinancialProduct>().lambda().eq(TbFinancialProduct::getProductId, productId));
if(one==null){
return AjaxResult.error(402,"产品Id不存在");
}
TbFinancialProduct financialProduct = tbFinancialProductMapper.selectById(productId);
return AjaxResult.success(financialProduct);
}
}

@ -0,0 +1,20 @@
package com.ruoyi.product.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.product.pojo.TbProductType;
import com.ruoyi.product.service.TbProductTypeService;
import com.ruoyi.product.mapper.TbProductTypeMapper;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class TbProductTypeServiceImpl extends ServiceImpl<TbProductTypeMapper, TbProductType>
implements TbProductTypeService{
}

@ -0,0 +1,85 @@
package com.ruoyi.product.task;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.product.mapper.TbFinancialProductMapper;
import com.ruoyi.product.pojo.TbFinancialProduct;
import com.ruoyi.product.var.ConstantVars;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.document.Document;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @version 1.0
* @description: TODO
* @author
* @date 2023/1/18 15:16
*/
@Component
@Slf4j
public class TaskQuartz {
@Autowired
ElasticsearchRestTemplate elasticsearchTemplate;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private TbFinancialProductMapper tbFinancialProductMapper;
@Scheduled(fixedDelay = 1000*60)
public void ProductQuartz(){
//判断索引
if(!elasticsearchTemplate.indexOps(TbFinancialProduct.class).exists()){
elasticsearchTemplate.indexOps(TbFinancialProduct.class).create();
Document mapping = elasticsearchTemplate.indexOps(TbFinancialProduct.class).createMapping();
elasticsearchTemplate.indexOps(TbFinancialProduct.class).putMapping(mapping);
}
String strTime = (String) redisTemplate.opsForValue().get(ConstantVars.SYNC_PRODUCT_KEY);
if(strTime==null){
//全量同步
List<TbFinancialProduct> list = tbFinancialProductMapper.selectList(new QueryWrapper<TbFinancialProduct>().lambda().orderByDesc(TbFinancialProduct::getCreateTime));
if(list!=null && list.size()>0){
elasticsearchTemplate.save(list);
TbFinancialProduct product = list.get(0);
Date updateTime = product.getUpdateTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = sdf.format(updateTime);
//存入redis中
redisTemplate.opsForValue().set(ConstantVars.SYNC_PRODUCT_KEY,format);
}
return;
}
//增量同步
//全量同步
List<TbFinancialProduct> list = tbFinancialProductMapper.selectList(new QueryWrapper<TbFinancialProduct>().lambda().gt(TbFinancialProduct::getUpdateTime,strTime)
.orderByDesc(TbFinancialProduct::getCreateTime));
if(list!=null && list.size()>0){
elasticsearchTemplate.save(list);
TbFinancialProduct product = list.get(0);
Date updateTime = product.getUpdateTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = sdf.format(updateTime);
//存入redis中
redisTemplate.opsForValue().set(ConstantVars.SYNC_PRODUCT_KEY,format);
}
return;
}
}

@ -0,0 +1,12 @@
package com.ruoyi.product.var;
/**
* @version 1.0
* @description: TODO
* @author
* @date 2023/1/19 21:45
*/
public interface ConstantVars {
//作为Key值
final String SYNC_PRODUCT_KEY="SYNC_PRODUCT_KEY";
}

@ -0,0 +1,25 @@
# Tomcat
server:
port: 9600
# Spring
spring:
application:
# 应用名称
name: ruoyi-product
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/ruoyi-system" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
</configuration>

@ -0,0 +1,40 @@
<?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.ruoyi.product.mapper.TbFinancialProductMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.product.pojo.TbFinancialProduct">
<id property="productId" column="product_id" jdbcType="INTEGER"/>
<result property="firmId" column="firm_id" jdbcType="INTEGER"/>
<result property="firmName" column="firm_name" jdbcType="VARCHAR"/>
<result property="productName" column="product_name" jdbcType="VARCHAR"/>
<result property="productDesc" column="product_desc" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="typeId" column="type_id" jdbcType="INTEGER"/>
<result property="periods" column="periods" jdbcType="INTEGER"/>
<result property="productRate" column="product_rate" jdbcType="INTEGER"/>
<result property="produtCharge" column="produt_charge" jdbcType="INTEGER"/>
<result property="maxPrice" column="max_price" jdbcType="INTEGER"/>
<result property="minPrice" column="min_price" jdbcType="INTEGER"/>
<result property="termsForLate" column="terms_for_late" jdbcType="INTEGER"/>
<result property="termsProductLate" column="terms_product_late" jdbcType="VARCHAR"/>
<result property="modeProduct" column="mode_product" jdbcType="INTEGER"/>
<result property="productPhoto" column="product_photo" jdbcType="VARCHAR"/>
<result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
product_id,firm_id,firm_name,
product_name,product_desc,user_id,
type_id,periods,product_rate,
produt_charge,max_price,min_price,
terms_for_late,terms_product_late,mode_product,
product_photo,del_flag,create_by,
create_time,update_by,update_time
</sql>
</mapper>

@ -0,0 +1,22 @@
<?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.ruoyi.product.mapper.TbProductTypeMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.product.pojo.TbProductType">
<id property="typeId" column="type_id" jdbcType="INTEGER"/>
<result property="typeName" column="type_name" jdbcType="VARCHAR"/>
<result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
type_id,type_name,del_flag,
create_by,create_time,update_by,
update_time
</sql>
</mapper>

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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">
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-modules</artifactId>
<version>3.6.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-modules-system</artifactId>
<description>
ruoyi-modules-system系统模块
</description>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,151 @@
<?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>ruoyi-modules</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-user</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!-- 短信发送的依赖 5个-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.15</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.5.16</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.7</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,36 @@
package com.bwie.user;
import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
*
*
* @author ruoyi
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
@MapperScan("com.bwie.user.mapper")
public class RuoYiUserApplication
{
public static void main(String[] args)
{
SpringApplication.run(RuoYiUserApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

@ -0,0 +1,43 @@
package com.bwie.user.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* @Description //TODO
* @Author
* @Date 2022/11/13 19:53
*/
@Configuration
@EnableSwagger2
public class Knife4jConfiguration {
@Bean(value = "defaultApi2")
public Docket defaultApi2() {
String groupName="3.X版本";
Docket docket=new Docket(DocumentationType.OAS_30)
.apiInfo(new ApiInfoBuilder()
.title("这是User API ")
.description("# 这里记录服务端所有的接口的入参,出参等等信息")
.termsOfServiceUrl("https://www.shenmazong.com")
.contact(new Contact("shl","http://bwie.com","1447562585@qq.com"))
.version("3.0")
.build())
//分组名称
.groupName(groupName)
.select()
//这里指定Controller扫描包路径
.apis(RequestHandlerSelectors.basePackage("com.bwie.user"))
.paths(PathSelectors.any())
.build();
return docket;
}
}

@ -0,0 +1,30 @@
package com.bwie.user.controller;
import com.bwie.user.service.TbUserService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.model.PhoneVo;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/14 7:49
*/
@RestController
@CrossOrigin
@Api(tags = "aaa-api")
@RequestMapping("duanxin")
public class DuanXinSend {
@Resource
private TbUserService tbUserService;
//1.发送验证码
@PostMapping("phoneSend")
public AjaxResult phoneSend(@RequestBody(required=false) PhoneVo phoneVo){
return tbUserService.phoneSend(phoneVo);
}
}

@ -0,0 +1,105 @@
package com.bwie.user.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.bwie.user.domain.TbMyrole;
import com.bwie.user.service.ITbMyroleService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author xs
* @date 2023-01-15
*/
@RestController
@RequestMapping("/myrole")
public class TbMyroleController extends BaseController
{
@Autowired
private ITbMyroleService tbMyroleService;
/**
*
*/
@RequiresPermissions("myrole:myrole:list")
@GetMapping("/list")
public TableDataInfo list(TbMyrole tbMyrole)
{
startPage();
List<TbMyrole> list = tbMyroleService.selectTbMyroleList(tbMyrole);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("myrole:myrole:export")
@Log(title = "角色", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbMyrole tbMyrole)
{
List<TbMyrole> list = tbMyroleService.selectTbMyroleList(tbMyrole);
ExcelUtil<TbMyrole> util = new ExcelUtil<TbMyrole>(TbMyrole.class);
util.exportExcel(response, list, "角色数据");
}
/**
*
*/
@RequiresPermissions("myrole:myrole:query")
@GetMapping(value = "/{roleId}")
public AjaxResult getInfo(@PathVariable("roleId") Long roleId)
{
return success(tbMyroleService.selectTbMyroleByRoleId(roleId));
}
/**
*
*/
@RequiresPermissions("myrole:myrole:add")
@Log(title = "角色", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TbMyrole tbMyrole)
{
return toAjax(tbMyroleService.insertTbMyrole(tbMyrole));
}
/**
*
*/
@RequiresPermissions("myrole:myrole:edit")
@Log(title = "角色", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TbMyrole tbMyrole)
{
return toAjax(tbMyroleService.updateTbMyrole(tbMyrole));
}
/**
*
*/
@RequiresPermissions("myrole:myrole:remove")
@Log(title = "角色", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}")
public AjaxResult remove(@PathVariable Long[] roleIds)
{
return toAjax(tbMyroleService.deleteTbMyroleByRoleIds(roleIds));
}
}

@ -0,0 +1,105 @@
package com.bwie.user.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.bwie.user.domain.TbPerm;
import com.bwie.user.service.ITbPermService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-01-15
*/
@RestController
@RequestMapping("/perm")
public class TbPermController extends BaseController
{
@Autowired
private ITbPermService tbPermService;
/**
*
*/
@RequiresPermissions("perm:perm:list")
@GetMapping("/list")
public TableDataInfo list(TbPerm tbPerm)
{
startPage();
List<TbPerm> list = tbPermService.selectTbPermList(tbPerm);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("perm:perm:export")
@Log(title = "权限", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbPerm tbPerm)
{
List<TbPerm> list = tbPermService.selectTbPermList(tbPerm);
ExcelUtil<TbPerm> util = new ExcelUtil<TbPerm>(TbPerm.class);
util.exportExcel(response, list, "权限数据");
}
/**
*
*/
@RequiresPermissions("perm:perm:query")
@GetMapping(value = "/{permId}")
public AjaxResult getInfo(@PathVariable("permId") Long permId)
{
return success(tbPermService.selectTbPermByPermId(permId));
}
/**
*
*/
@RequiresPermissions("perm:perm:add")
@Log(title = "权限", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TbPerm tbPerm)
{
return toAjax(tbPermService.insertTbPerm(tbPerm));
}
/**
*
*/
@RequiresPermissions("perm:perm:edit")
@Log(title = "权限", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TbPerm tbPerm)
{
return toAjax(tbPermService.updateTbPerm(tbPerm));
}
/**
*
*/
@RequiresPermissions("perm:perm:remove")
@Log(title = "权限", businessType = BusinessType.DELETE)
@DeleteMapping("/{permIds}")
public AjaxResult remove(@PathVariable Long[] permIds)
{
return toAjax(tbPermService.deleteTbPermByPermIds(permIds));
}
}

@ -0,0 +1,105 @@
package com.bwie.user.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.bwie.user.domain.TbRolePerm;
import com.bwie.user.service.ITbRolePermService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author xs
* @date 2023-01-15
*/
@RestController
@RequestMapping("/roleperm")
public class TbRolePermController extends BaseController
{
@Autowired
private ITbRolePermService tbRolePermService;
/**
*
*/
@RequiresPermissions("roleperm:roleperm:list")
@GetMapping("/list")
public TableDataInfo list(TbRolePerm tbRolePerm)
{
startPage();
List<TbRolePerm> list = tbRolePermService.selectTbRolePermList(tbRolePerm);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("roleperm:roleperm:export")
@Log(title = "角色权限", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbRolePerm tbRolePerm)
{
List<TbRolePerm> list = tbRolePermService.selectTbRolePermList(tbRolePerm);
ExcelUtil<TbRolePerm> util = new ExcelUtil<TbRolePerm>(TbRolePerm.class);
util.exportExcel(response, list, "角色权限数据");
}
/**
*
*/
@RequiresPermissions("roleperm:roleperm:query")
@GetMapping(value = "/{rolePermId}")
public AjaxResult getInfo(@PathVariable("rolePermId") Long rolePermId)
{
return success(tbRolePermService.selectTbRolePermByRolePermId(rolePermId));
}
/**
*
*/
@RequiresPermissions("roleperm:roleperm:add")
@Log(title = "角色权限", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TbRolePerm tbRolePerm)
{
return toAjax(tbRolePermService.insertTbRolePerm(tbRolePerm));
}
/**
*
*/
@RequiresPermissions("roleperm:roleperm:edit")
@Log(title = "角色权限", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TbRolePerm tbRolePerm)
{
return toAjax(tbRolePermService.updateTbRolePerm(tbRolePerm));
}
/**
*
*/
@RequiresPermissions("roleperm:roleperm:remove")
@Log(title = "角色权限", businessType = BusinessType.DELETE)
@DeleteMapping("/{rolePermIds}")
public AjaxResult remove(@PathVariable Long[] rolePermIds)
{
return toAjax(tbRolePermService.deleteTbRolePermByRolePermIds(rolePermIds));
}
}

@ -0,0 +1,105 @@
package com.bwie.user.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.bwie.user.domain.TbUserRole;
import com.bwie.user.service.ITbUserRoleService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author xs
* @date 2023-01-15
*/
@RestController
@RequestMapping("/userrole")
public class TbUserRoleController extends BaseController
{
@Autowired
private ITbUserRoleService tbUserRoleService;
/**
*
*/
@RequiresPermissions("userrole:userrole:list")
@GetMapping("/list")
public TableDataInfo list(TbUserRole tbUserRole)
{
startPage();
List<TbUserRole> list = tbUserRoleService.selectTbUserRoleList(tbUserRole);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("userrole:userrole:export")
@Log(title = "用户类型", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbUserRole tbUserRole)
{
List<TbUserRole> list = tbUserRoleService.selectTbUserRoleList(tbUserRole);
ExcelUtil<TbUserRole> util = new ExcelUtil<TbUserRole>(TbUserRole.class);
util.exportExcel(response, list, "用户类型数据");
}
/**
*
*/
@RequiresPermissions("userrole:userrole:query")
@GetMapping(value = "/{userRoleId}")
public AjaxResult getInfo(@PathVariable("userRoleId") Long userRoleId)
{
return success(tbUserRoleService.selectTbUserRoleByUserRoleId(userRoleId));
}
/**
*
*/
@RequiresPermissions("userrole:userrole:add")
@Log(title = "用户类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TbUserRole tbUserRole)
{
return toAjax(tbUserRoleService.insertTbUserRole(tbUserRole));
}
/**
*
*/
@RequiresPermissions("userrole:userrole:edit")
@Log(title = "用户类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TbUserRole tbUserRole)
{
return toAjax(tbUserRoleService.updateTbUserRole(tbUserRole));
}
/**
*
*/
@RequiresPermissions("userrole:userrole:remove")
@Log(title = "用户类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{userRoleIds}")
public AjaxResult remove(@PathVariable Long[] userRoleIds)
{
return toAjax(tbUserRoleService.deleteTbUserRoleByUserRoleIds(userRoleIds));
}
}

@ -0,0 +1,60 @@
package com.bwie.user.controller;
import com.bwie.user.service.TbUserService;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.system.api.model.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2023/1/13 14:40
*/
@RestController
@RequestMapping("user")
@Slf4j
public class UserController extends BaseController {
@Resource
private TbUserService tbUserServicet;
@PostMapping("getuser")
private TableDataInfo getuser(@RequestBody PageInfoVo pageInfoVo){
PageHelper.startPage(pageInfoVo.getPageNum(),pageInfoVo.getPageSize());
List<TbUserVo> list=tbUserServicet.getuser();
return getDataTable(list);
}
@PostMapping("deluser")
private AjaxResult deluser(@RequestBody IdVo idVo) {
return tbUserServicet.deluser(idVo);
}
@PostMapping("adduser")
private AjaxResult adduser(@RequestBody PhoneVo phoneVo){
return tbUserServicet.adduser(phoneVo);
}
@PostMapping("updateuser")
private AjaxResult updateuser(@RequestBody TbUserVo tbUserVo){
return tbUserServicet.updateuser(tbUserVo);
}
//修改密码
@PostMapping("uppassword")
private AjaxResult uppassword(@RequestBody PassWordCode passWordCode){
return tbUserServicet.uppassword(passWordCode);
}
//登录
@PostMapping("loginUser")
private AjaxResult loginuser(@RequestBody LoginVo loginVo){
return tbUserServicet.loginuser(loginVo);
}
}

@ -0,0 +1,67 @@
package com.bwie.user.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* tb_myrole
*
* @author xs
* @date 2023-01-15
*/
public class TbMyrole extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 角色id */
private Long roleId;
/** 角色名称 */
@Excel(name = "角色名称")
private String roleName;
/** 删除状态0未删除1已删除 */
@Excel(name = "删除状态0未删除1已删除")
private Integer deleted;
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
public Long getRoleId()
{
return roleId;
}
public void setRoleName(String roleName)
{
this.roleName = roleName;
}
public String getRoleName()
{
return roleName;
}
public void setDeleted(Integer deleted)
{
this.deleted = deleted;
}
public Integer getDeleted()
{
return deleted;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("roleName", getRoleName())
.append("deleted", getDeleted())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,81 @@
package com.bwie.user.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* tb_perm
*
* @author ruoyi
* @date 2023-01-15
*/
public class TbPerm extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long permId;
/** 权限名称 */
@Excel(name = "权限名称")
private String permName;
/** 权限编码 */
@Excel(name = "权限编码")
private String permCode;
/** 删除状态0未删除1已删除 */
@Excel(name = "删除状态0未删除1已删除")
private Integer deleted;
public void setPermId(Long permId)
{
this.permId = permId;
}
public Long getPermId()
{
return permId;
}
public void setPermName(String permName)
{
this.permName = permName;
}
public String getPermName()
{
return permName;
}
public void setPermCode(String permCode)
{
this.permCode = permCode;
}
public String getPermCode()
{
return permCode;
}
public void setDeleted(Integer deleted)
{
this.deleted = deleted;
}
public Integer getDeleted()
{
return deleted;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("permId", getPermId())
.append("permName", getPermName())
.append("permCode", getPermCode())
.append("deleted", getDeleted())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,81 @@
package com.bwie.user.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* tb_role_perm
*
* @author xs
* @date 2023-01-15
*/
public class TbRolePerm extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 角色权限id */
private Long rolePermId;
/** 角色ID */
@Excel(name = "角色ID")
private Long roleId;
/** 权限ID */
@Excel(name = "权限ID")
private Long permId;
/** 删除状态0未删除1已删除 */
@Excel(name = "删除状态0未删除1已删除")
private Integer deleted;
public void setRolePermId(Long rolePermId)
{
this.rolePermId = rolePermId;
}
public Long getRolePermId()
{
return rolePermId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
public Long getRoleId()
{
return roleId;
}
public void setPermId(Long permId)
{
this.permId = permId;
}
public Long getPermId()
{
return permId;
}
public void setDeleted(Integer deleted)
{
this.deleted = deleted;
}
public Integer getDeleted()
{
return deleted;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("rolePermId", getRolePermId())
.append("roleId", getRoleId())
.append("permId", getPermId())
.append("deleted", getDeleted())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,140 @@
package com.bwie.user.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
/**
*
* @TableName tb_user
*/
@TableName(value ="tb_user")
@Data
public class TbUser implements Serializable {
/**
* ID
*/
@TableId(type = IdType.AUTO)
private Long userId;
/**
*
*/
private String userName;
/**
*
*/
private String nickName;
/**
*
*/
private String email;
/**
*
*/
private String phonenumber;
/**
*
*/
private Integer age;
/**
* 0 1 2
*/
private Integer sex;
/**
*
*/
private String avatar;
/**
* ()
*/
private String userCard;
/**
*
*/
private String password;
/**
* 0 1
*/
private Integer status;
/**
* 0 2
*/
private Integer delFlag;
/**
* IP
*/
private String loginIp;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date loginDate;
/**
*
*/
private String createBy;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date createTime;
/**
*
*/
private String updateBy;
/**
* ()
*/
private Double userPrice;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date updateTime;
/**
*
*/
private String remark;
/**
* (0,1)
*/
private Integer realnameState;
/**
*
*/
private Integer honorIntegral;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,73 @@
package com.bwie.user.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
/**
*
* @TableName tb_user_bankcard
*/
@TableName(value ="tb_user_bankcard")
@Data
public class TbUserBankcard implements Serializable {
/**
* ID
*/
@TableId(type = IdType.AUTO)
private Integer bankcardId;
/**
*
*/
private String brankcardName;
/**
* ID
*/
private Integer userId;
/**
*
*/
private Integer bankcardMoney;
/**
*
*/
private String createBy;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date createTime;
/**
* 02
*/
private Integer delFlag;
/**
*
*/
private String updateBy;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,69 @@
package com.bwie.user.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* tb_user_role
*
* @author xs
* @date 2023-01-15
*/
public class TbUserRole extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 类型ID */
private Long userRoleId;
/** 用户角色类型 */
@Excel(name = "用户角色类型")
private String userRoleName;
/** 用户角色有哪些功能 */
@Excel(name = "用户角色有哪些功能")
private String roleFunction;
public void setUserRoleId(Long userRoleId)
{
this.userRoleId = userRoleId;
}
public Long getUserRoleId()
{
return userRoleId;
}
public void setUserRoleName(String userRoleName)
{
this.userRoleName = userRoleName;
}
public String getUserRoleName()
{
return userRoleName;
}
public void setRoleFunction(String roleFunction)
{
this.roleFunction = roleFunction;
}
public String getRoleFunction()
{
return roleFunction;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userRoleId", getUserRoleId())
.append("userRoleName", getUserRoleName())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("roleFunction", getRoleFunction())
.toString();
}
}

@ -0,0 +1,61 @@
package com.bwie.user.mapper;
import java.util.List;
import com.bwie.user.domain.TbMyrole;
/**
* Mapper
*
* @author xs
* @date 2023-01-15
*/
public interface TbMyroleMapper
{
/**
*
*
* @param roleId
* @return
*/
public TbMyrole selectTbMyroleByRoleId(Long roleId);
/**
*
*
* @param tbMyrole
* @return
*/
public List<TbMyrole> selectTbMyroleList(TbMyrole tbMyrole);
/**
*
*
* @param tbMyrole
* @return
*/
public int insertTbMyrole(TbMyrole tbMyrole);
/**
*
*
* @param tbMyrole
* @return
*/
public int updateTbMyrole(TbMyrole tbMyrole);
/**
*
*
* @param roleId
* @return
*/
public int deleteTbMyroleByRoleId(Long roleId);
/**
*
*
* @param roleIds
* @return
*/
public int deleteTbMyroleByRoleIds(Long[] roleIds);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save