Merge remote-tracking branch 'origin/dev' into dev

pull/320/head
admin 3 years ago
commit 477a87f162

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

@ -0,0 +1,135 @@
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 static final long serialVersionUID = 1L;
private Long userId;
/**
*
*/
private String userName;
private String token;
/**
*
*/
private String nickName;
/**
*
*/
private String email;
/**
*
*/
private String phonenumber;
/**
*
*/
private Integer age;
/**
* 0 1 2
*/
private String sex;
/**
*
*/
private String avatar;
/**
* ()
*/
private String userCard;
/**
*
*/
private String password;
/**
* 0 1
*/
private String status;
/**
* 0 2
*/
private String 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 String 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));
}

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

@ -1,6 +1,7 @@
package com.ruoyi.common.swagger.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ -10,6 +11,7 @@ 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
{
/**

@ -14,6 +14,7 @@
<module>ruoyi-job</module>
<module>ruoyi-file</module>
<module>ruoyi-potenza</module>
<module>ruoyi-user</module>
</modules>
<artifactId>ruoyi-modules</artifactId>

@ -30,7 +30,7 @@ import com.ruoyi.common.core.utils.poi.ExcelUtil;
* @description: TODO
* @date 2023/1/13 16:00
*/
@RequestMapping("/Borrower")
@RequestMapping("/borrower")
@RestController
@Slf4j
public class BorrowerController extends BaseController {
@ -57,7 +57,7 @@ public class BorrowerController extends BaseController {
return tbBorrowerService.borrowerDele(idVo);
}
@RequiresPermissions("potenza:borrower:list")
@GetMapping("/list")
public TableDataInfo list(TbBorrower tbBorrower)
{
@ -69,7 +69,7 @@ public class BorrowerController extends BaseController {
/**
*
*/
@RequiresPermissions("potenza:borrower:export")
@Log(title = "贷款", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbBorrower tbBorrower)
@ -82,8 +82,8 @@ public class BorrowerController extends BaseController {
/**
*
*/
@RequiresPermissions("potenza:borrower:query")
@GetMapping(value = "/{borrowerId}")
@GetMapping(value = "/{borrowerById}")
public AjaxResult getInfo(@PathVariable("borrowerId") Long borrowerId)
{
return success(tbBorrowerService.selectTbBorrowerByBorrowerId(borrowerId));
@ -92,9 +92,9 @@ public class BorrowerController extends BaseController {
/**
*
*/
@RequiresPermissions("potenza:borrower:add")
@Log(title = "贷款", businessType = BusinessType.INSERT)
@PostMapping
@PostMapping("/borrowerInsert")
public AjaxResult add(@RequestBody TbBorrower tbBorrower)
{
return toAjax(tbBorrowerService.insertTbBorrower(tbBorrower));
@ -103,14 +103,30 @@ public class BorrowerController extends BaseController {
/**
*
*/
@RequiresPermissions("potenza:borrower:edit")
@Log(title = "贷款", businessType = BusinessType.UPDATE)
@PutMapping
@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);
}
}

@ -4,6 +4,7 @@ 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;
@ -52,7 +53,6 @@ public class BorrowerPeriodsController extends BaseController{
/**
*
*/
@RequiresPermissions("potenza:periods:export")
@Log(title = "贷款周期", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbBorrowerPeriods tbBorrowerPeriods)
@ -65,8 +65,7 @@ public class BorrowerPeriodsController extends BaseController{
/**
*
*/
@RequiresPermissions("potenza:periods:query")
@GetMapping(value = "/{periodsId}")
@GetMapping(value = "/{periodsById}")
public AjaxResult getInfo(@PathVariable("periodsId") Long periodsId)
{
return success(tbBorrowerPeriodsService.selectTbBorrowerPeriodsByPeriodsId(periodsId));
@ -75,9 +74,8 @@ public class BorrowerPeriodsController extends BaseController{
/**
*
*/
@RequiresPermissions("potenza:periods:add")
@Log(title = "贷款周期", businessType = BusinessType.INSERT)
@PostMapping
@PostMapping("periodsInsert")
public AjaxResult add(@RequestBody TbBorrowerPeriods tbBorrowerPeriods)
{
return toAjax(tbBorrowerPeriodsService.insertTbBorrowerPeriods(tbBorrowerPeriods));
@ -86,9 +84,8 @@ public class BorrowerPeriodsController extends BaseController{
/**
*
*/
@RequiresPermissions("potenza:periods:edit")
@Log(title = "贷款周期", businessType = BusinessType.UPDATE)
@PutMapping
@PutMapping("/periodsUpdate")
public AjaxResult edit(@RequestBody TbBorrowerPeriods tbBorrowerPeriods)
{
return toAjax(tbBorrowerPeriodsService.updateTbBorrowerPeriods(tbBorrowerPeriods));
@ -97,11 +94,18 @@ public class BorrowerPeriodsController extends BaseController{
/**
*
*/
@RequiresPermissions("potenza:periods:remove")
@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);
}
}

@ -52,7 +52,6 @@ public class BorrowerPlanController extends BaseController{
/**
*
*/
@RequiresPermissions("potenza:plan:export")
@Log(title = "计划", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TbBorrowerPlan tbBorrowerPlan)
@ -65,8 +64,7 @@ public class BorrowerPlanController extends BaseController{
/**
*
*/
@RequiresPermissions("potenza:plan:query")
@GetMapping(value = "/{planId}")
@GetMapping(value = "/{planById}")
public AjaxResult getInfo(@PathVariable("planId") Long planId)
{
return success(tbBorrowerPlanService.selectTbBorrowerPlanByPlanId(planId));
@ -75,9 +73,8 @@ public class BorrowerPlanController extends BaseController{
/**
*
*/
@RequiresPermissions("potenza:plan:add")
@Log(title = "计划", businessType = BusinessType.INSERT)
@PostMapping
@PostMapping("planInsert")
public AjaxResult add(@RequestBody TbBorrowerPlan tbBorrowerPlan)
{
return toAjax(tbBorrowerPlanService.insertTbBorrowerPlan(tbBorrowerPlan));
@ -86,9 +83,8 @@ public class BorrowerPlanController extends BaseController{
/**
*
*/
@RequiresPermissions("potenza:plan:edit")
@Log(title = "计划", businessType = BusinessType.UPDATE)
@PutMapping
@PutMapping("planUpdate")
public AjaxResult edit(@RequestBody TbBorrowerPlan tbBorrowerPlan)
{
return toAjax(tbBorrowerPlanService.updateTbBorrowerPlan(tbBorrowerPlan));
@ -97,7 +93,6 @@ public class BorrowerPlanController extends BaseController{
/**
*
*/
@RequiresPermissions("potenza:plan:remove")
@Log(title = "计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{planIds}")
public AjaxResult remove(@PathVariable Long[] planIds)

@ -36,6 +36,8 @@ public class TbBorrowerPeriods implements Serializable {
*/
private String updateBy;
private Double rateInterest;
/**
* 02
*/

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

@ -1,7 +1,9 @@
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;
@ -58,4 +60,6 @@ public interface TbBorrowerPeriodsService extends IService<TbBorrowerPeriods> {
* @return
*/
public int deleteTbBorrowerPeriodsByPeriodsId(Long periodsId);
AjaxResult detail(PeriodDetailVo periodDetailVo);
}

@ -51,5 +51,7 @@ public interface TbBorrowerService extends IService<TbBorrower> {
public int updateTbBorrower(TbBorrower tbBorrower);
int borrowerInserts(TbBorrower tbBorrower);
AjaxResult loans(TbBorrower tbBorrower);
}

@ -2,25 +2,31 @@ 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.util.List;
/**
* @author 86155
* @description tb_borrower_periods()Service
* @createDate 2023-01-13 15:56:37
*/
* @author 86155
* @description tb_borrower_periods()Service
* @createDate 2023-01-13 15:56:37
*/
@Service
public class TbBorrowerPeriodsServiceImpl extends ServiceImpl<TbBorrowerPeriodsMapper, TbBorrowerPeriods>
implements TbBorrowerPeriodsService{
implements TbBorrowerPeriodsService{
@Autowired
private TbBorrowerPeriodsMapper tbBorrowerPeriodsMapper;
/**
*
*
@ -95,6 +101,33 @@ public class TbBorrowerPeriodsServiceImpl extends ServiceImpl<TbBorrowerPeriodsM
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);
}
}

@ -3,6 +3,7 @@ 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;
@ -18,6 +19,7 @@ import java.util.List;
@Service
public class TbBorrowerPlanServiceImpl extends ServiceImpl<TbBorrowerPlanMapper, TbBorrowerPlan>
implements TbBorrowerPlanService{
@Autowired
private TbBorrowerPlanMapper tbBorrowerPlanMapper;

@ -1,12 +1,19 @@
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;
@ -18,12 +25,16 @@ import java.util.List;
* @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();
@ -36,14 +47,6 @@ public class TbBorrowerServiceImpl extends ServiceImpl<TbBorrowerMapper, TbBorro
return AjaxResult.success("删除成功");
}
/**
*
*
* @param borrowerId
* @return
*/
@Override
public TbBorrower selectTbBorrowerByBorrowerId(Long borrowerId)
{
@ -88,7 +91,44 @@ public class TbBorrowerServiceImpl extends ServiceImpl<TbBorrowerMapper, TbBorro
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,141 @@
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);
}
}

@ -0,0 +1,155 @@
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);*/
}
}

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9301
port: 9401
# Spring
spring:

@ -7,6 +7,7 @@
<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" />
@ -15,7 +16,7 @@
</resultMap>
<sql id="selectTbBorrowerPeriodsVo">
select periods_id, periods_name, create_by, update_by, del_flag, create_time, update_time from tb_borrower_periods
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">
@ -34,6 +35,7 @@
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>
@ -42,6 +44,7 @@
</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>
@ -54,6 +57,7 @@
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>

@ -0,0 +1,147 @@
<?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>
</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.bwie.ruoyi;
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 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,48 @@
package com.bwie.ruoyi.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.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
/**
* @author
* @version 1.0
* @description: TODO
* @date 2022/10/21 20:15
*/
@Configuration
@EnableSwagger2WebMvc
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.bwie"))
.paths(PathSelectors.any())
.build();
return docket;
}
private ApiInfo webApiInfo() {
return new ApiInfoBuilder()
//描述字段支持Markdown语法
.title("Weekly-API")
.contact(new Contact("苏海龙", "https://www.bwie.net/", "bwie@bwie.com"))
.description("考试服务端API-version1.0")
.version("1.0")
.build();
}
}

@ -0,0 +1,30 @@
package com.bwie.ruoyi.controller;
import com.bwie.ruoyi.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,61 @@
package com.bwie.ruoyi.controller;
import com.bwie.ruoyi.pojo.TbUser;
import com.bwie.ruoyi.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 TbUserVo tbUserVo){
return tbUserServicet.adduser(tbUserVo);
}
@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,18 @@
package com.bwie.ruoyi.mapper;
import com.bwie.ruoyi.pojo.TbPerm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author
* @description tb_perm()Mapper
* @createDate 2023-01-13 14:34:44
* @Entity com.bwie.ruoyi.pojo.TbPerm
*/
public interface TbPermMapper extends BaseMapper<TbPerm> {
}

@ -0,0 +1,18 @@
package com.bwie.ruoyi.mapper;
import com.bwie.ruoyi.pojo.TbRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author
* @description tb_role()Mapper
* @createDate 2023-01-13 14:34:44
* @Entity com.bwie.ruoyi.pojo.TbRole
*/
public interface TbRoleMapper extends BaseMapper<TbRole> {
}

@ -0,0 +1,18 @@
package com.bwie.ruoyi.mapper;
import com.bwie.ruoyi.pojo.TbRolePerm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author
* @description tb_role_perm()Mapper
* @createDate 2023-01-13 14:34:44
* @Entity com.bwie.ruoyi.pojo.TbRolePerm
*/
public interface TbRolePermMapper extends BaseMapper<TbRolePerm> {
}

@ -0,0 +1,18 @@
package com.bwie.ruoyi.mapper;
import com.bwie.ruoyi.pojo.TbUserBankcard;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author
* @description tb_user_bankcard()Mapper
* @createDate 2023-01-13 14:34:44
* @Entity com.bwie.ruoyi.pojo.TbUserBankcard
*/
public interface TbUserBankcardMapper extends BaseMapper<TbUserBankcard> {
}

@ -0,0 +1,18 @@
package com.bwie.ruoyi.mapper;
import com.bwie.ruoyi.pojo.TbUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author
* @description tb_user()Mapper
* @createDate 2023-01-13 14:34:44
* @Entity com.bwie.ruoyi.pojo.TbUser
*/
public interface TbUserMapper extends BaseMapper<TbUser> {
}

@ -0,0 +1,18 @@
package com.bwie.ruoyi.mapper;
import com.bwie.ruoyi.pojo.TbUserRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author
* @description tb_user_role()Mapper
* @createDate 2023-01-13 14:34:44
* @Entity com.bwie.ruoyi.pojo.TbUserRole
*/
public interface TbUserRoleMapper extends BaseMapper<TbUserRole> {
}

@ -0,0 +1,58 @@
package com.bwie.ruoyi.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.format.annotation.DateTimeFormat;
/**
*
* @TableName tb_perm
*/
@TableName(value ="tb_perm")
@Data
public class TbPerm implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Integer permId;
/**
*
*/
private String permName;
/**
*
*/
private String permCode;
/**
* 01
*/
private Integer deleted;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date createTime;
/**
*
*/
@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,53 @@
package com.bwie.ruoyi.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.format.annotation.DateTimeFormat;
/**
*
* @TableName tb_role
*/
@TableName(value ="tb_role")
@Data
public class TbRole implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Integer roleId;
/**
*
*/
private String roleName;
/**
* 01
*/
private Integer deleted;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date createTime;
/**
*
*/
@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,58 @@
package com.bwie.ruoyi.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.format.annotation.DateTimeFormat;
/**
*
* @TableName tb_role_perm
*/
@TableName(value ="tb_role_perm")
@Data
public class TbRolePerm implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Integer rolePermId;
/**
* ID
*/
private Integer roleId;
/**
* ID
*/
private Integer permId;
/**
* 01
*/
private Integer deleted;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date createTime;
/**
*
*/
@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,140 @@
package com.bwie.ruoyi.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.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 String sex;
/**
*
*/
private String avatar;
/**
* ()
*/
private String userCard;
/**
*
*/
private String password;
/**
* 0 1
*/
private String status;
/**
* 0 2
*/
private String 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 String realnameState;
/**
*
*/
private Integer honorIntegral;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,73 @@
package com.bwie.ruoyi.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.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,63 @@
package com.bwie.ruoyi.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.format.annotation.DateTimeFormat;
/**
*
* @TableName tb_user_role
*/
@TableName(value ="tb_user_role")
@Data
public class TbUserRole implements Serializable {
/**
* ID
*/
@TableId(type = IdType.AUTO)
private Long userRoleId;
/**
*
*/
private String userRoleName;
/**
*
*/
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;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date updateTime;
/**
*
*/
private String roleFunction;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,13 @@
package com.bwie.ruoyi.service;
import com.bwie.ruoyi.pojo.TbPerm;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author
* @description tb_perm()Service
* @createDate 2023-01-13 14:34:44
*/
public interface TbPermService extends IService<TbPerm> {
}

@ -0,0 +1,13 @@
package com.bwie.ruoyi.service;
import com.bwie.ruoyi.pojo.TbRolePerm;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author
* @description tb_role_perm()Service
* @createDate 2023-01-13 14:34:44
*/
public interface TbRolePermService extends IService<TbRolePerm> {
}

@ -0,0 +1,13 @@
package com.bwie.ruoyi.service;
import com.bwie.ruoyi.pojo.TbRole;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author
* @description tb_role()Service
* @createDate 2023-01-13 14:34:44
*/
public interface TbRoleService extends IService<TbRole> {
}

@ -0,0 +1,13 @@
package com.bwie.ruoyi.service;
import com.bwie.ruoyi.pojo.TbUserBankcard;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author
* @description tb_user_bankcard()Service
* @createDate 2023-01-13 14:34:44
*/
public interface TbUserBankcardService extends IService<TbUserBankcard> {
}

@ -0,0 +1,13 @@
package com.bwie.ruoyi.service;
import com.bwie.ruoyi.pojo.TbUserRole;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author
* @description tb_user_role()Service
* @createDate 2023-01-13 14:34:44
*/
public interface TbUserRoleService extends IService<TbUserRole> {
}

@ -0,0 +1,30 @@
package com.bwie.ruoyi.service;
import com.bwie.ruoyi.pojo.TbUser;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.model.*;
import java.util.List;
/**
* @author
* @description tb_user()Service
* @createDate 2023-01-13 14:34:44
*/
public interface TbUserService extends IService<TbUser> {
List<TbUserVo> getuser();
AjaxResult deluser(IdVo idVo);
AjaxResult adduser(TbUserVo tbUserVo);
AjaxResult phoneSend(PhoneVo phoneVo);
AjaxResult updateuser(TbUserVo tbUserVo);
AjaxResult uppassword(PassWordCode passWordCode);
AjaxResult loginuser(LoginVo loginVo);
}

@ -0,0 +1,22 @@
package com.bwie.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.ruoyi.pojo.TbPerm;
import com.bwie.ruoyi.service.TbPermService;
import com.bwie.ruoyi.mapper.TbPermMapper;
import org.springframework.stereotype.Service;
/**
* @author
* @description tb_perm()Service
* @createDate 2023-01-13 14:34:44
*/
@Service
public class TbPermServiceImpl extends ServiceImpl<TbPermMapper, TbPerm>
implements TbPermService{
}

@ -0,0 +1,22 @@
package com.bwie.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.ruoyi.pojo.TbRolePerm;
import com.bwie.ruoyi.service.TbRolePermService;
import com.bwie.ruoyi.mapper.TbRolePermMapper;
import org.springframework.stereotype.Service;
/**
* @author
* @description tb_role_perm()Service
* @createDate 2023-01-13 14:34:44
*/
@Service
public class TbRolePermServiceImpl extends ServiceImpl<TbRolePermMapper, TbRolePerm>
implements TbRolePermService{
}

@ -0,0 +1,22 @@
package com.bwie.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.ruoyi.pojo.TbRole;
import com.bwie.ruoyi.service.TbRoleService;
import com.bwie.ruoyi.mapper.TbRoleMapper;
import org.springframework.stereotype.Service;
/**
* @author
* @description tb_role()Service
* @createDate 2023-01-13 14:34:44
*/
@Service
public class TbRoleServiceImpl extends ServiceImpl<TbRoleMapper, TbRole>
implements TbRoleService{
}

@ -0,0 +1,22 @@
package com.bwie.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.ruoyi.pojo.TbUserBankcard;
import com.bwie.ruoyi.service.TbUserBankcardService;
import com.bwie.ruoyi.mapper.TbUserBankcardMapper;
import org.springframework.stereotype.Service;
/**
* @author
* @description tb_user_bankcard()Service
* @createDate 2023-01-13 14:34:44
*/
@Service
public class TbUserBankcardServiceImpl extends ServiceImpl<TbUserBankcardMapper, TbUserBankcard>
implements TbUserBankcardService{
}

@ -0,0 +1,22 @@
package com.bwie.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.ruoyi.pojo.TbUserRole;
import com.bwie.ruoyi.service.TbUserRoleService;
import com.bwie.ruoyi.mapper.TbUserRoleMapper;
import org.springframework.stereotype.Service;
/**
* @author
* @description tb_user_role()Service
* @createDate 2023-01-13 14:34:44
*/
@Service
public class TbUserRoleServiceImpl extends ServiceImpl<TbUserRoleMapper, TbUserRole>
implements TbUserRoleService{
}

@ -0,0 +1,155 @@
package com.bwie.ruoyi.service.impl;
import cn.hutool.core.util.RandomUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.ruoyi.pojo.TbUser;
import com.bwie.ruoyi.service.TbUserService;
import com.bwie.ruoyi.mapper.TbUserMapper;
import com.bwie.ruoyi.utils.DuanxinUtils;
import com.bwie.ruoyi.utils.TokenUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.model.*;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.crypto.bcrypt.BCrypt;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @author
* @description tb_user()Service
* @createDate 2023-01-13 14:34:44
*/
@Service
public class TbUserServiceImpl extends ServiceImpl<TbUserMapper, TbUser>
implements TbUserService{
@Resource
private TbUserMapper tbUserMapper;
@Resource
private RedisTemplate<String,Object> redisTemplate;
@Override
public List<TbUserVo> getuser() {
List<TbUser> tbUsers = tbUserMapper.selectList(null);
List<TbUserVo> collect = tbUsers.stream().map(item -> {
TbUserVo tbUserVo = new TbUserVo();
BeanUtils.copyProperties(item, tbUserVo);
return tbUserVo;
}).collect(Collectors.toList());
return collect;
}
@Override
public AjaxResult deluser(IdVo idVo) {
tbUserMapper.deleteById(idVo.getId());
return AjaxResult.success();
}
@Override
public AjaxResult adduser(TbUserVo tbUserVo) {
LambdaQueryWrapper<TbUser> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(TbUser::getPhonenumber,tbUserVo.getPhonenumber());
//判断手机号
if(tbUserMapper.selectOne(wrapper)!=null){
return AjaxResult.error("手机号已经注册请检查手机号");
}
//判断用户的昵称
LambdaQueryWrapper<TbUser> wrapper1=new LambdaQueryWrapper<>();
wrapper1.eq(TbUser::getNickName,tbUserVo.getNickName() );
if(tbUserMapper.selectOne(wrapper1)!=null){
return AjaxResult.error("用户昵称已经被注册请换一个");
}
//加密密码
String hashpw = BCrypt.hashpw(tbUserVo.getPassword(), BCrypt.gensalt());
TbUser tbUser = new TbUser();
BeanUtils.copyProperties(tbUserVo, tbUser);
//更换加密密码
tbUser.setPassword(hashpw);
tbUserMapper.insert(tbUser);
return AjaxResult.success(tbUser);
}
@Override
public AjaxResult phoneSend(PhoneVo phoneVo) {
//随机生成的四位数
String nums = RandomUtil.randomNumbers(6);
//存入redis用来做登录
redisTemplate.opsForValue().set(phoneVo.getPhone(), nums);
//向手机发送信息
DuanxinUtils.sendDuanxin(phoneVo.getPhone(), nums);
return AjaxResult.success("验证码已经发送是:"+nums+"请注意查收");
}
@Override
public AjaxResult updateuser(TbUserVo tbUserVo) {
LambdaQueryWrapper<TbUser> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(TbUser::getUserId,tbUserVo.getUserId());
if(tbUserMapper.selectOne(wrapper)==null){
return AjaxResult.error();
}
TbUser tbUser = new TbUser();
BeanUtils.copyProperties(tbUserVo, tbUser);
tbUserMapper.updateById(tbUser);
return AjaxResult.success("修改完成");
}
@Override
public AjaxResult uppassword(PassWordCode passWordCode) {
LambdaQueryWrapper<TbUser> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(TbUser::getUserId,passWordCode.getUserId());
if(tbUserMapper.selectOne(wrapper)==null){
return AjaxResult.error("用户不存在");
}
boolean b = BCrypt.checkpw(passWordCode.getOldPassword(), tbUserMapper.selectOne(wrapper).getPassword());
if(!b){
return AjaxResult.error("输入的老密码不正确请重新输入");
}
String hashpw = BCrypt.hashpw(passWordCode.getNewPassword(), BCrypt.gensalt());
TbUser tbUser = new TbUser();
BeanUtils.copyProperties(tbUserMapper.selectOne(wrapper), tbUser);
tbUser.setPassword(hashpw);
return AjaxResult.success();
}
@Override
public AjaxResult loginuser(LoginVo loginVo) {
//第一步判断账号
LambdaQueryWrapper<TbUser> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(TbUser::getNickName,loginVo.getNickName());
TbUser tbUser = tbUserMapper.selectOne(wrapper);
if(tbUser==null){
return AjaxResult.error("账号不存在");
}
boolean checkpw = BCrypt.checkpw(loginVo.getUserPass(), tbUser.getPassword());
if(!checkpw){
return AjaxResult.error("密码不正确");
}
//判断code
String o =(String) redisTemplate.opsForValue().get(loginVo.getPhone());
if(!loginVo.getCode().equals(o)){
return AjaxResult.error("验证码不正确");
}
//生成token
String token = TokenUtils.token().setKey("123456").setClaim("userId", tbUser.getUserId() + "").setClaim("nickName", tbUser.getNickName()).makeToken();
//存入redis
redisTemplate.opsForValue().set(token, token,1, TimeUnit.MINUTES);
//返回类
TbUserVo tbUserVo = new TbUserVo();
BeanUtils.copyProperties(tbUser, tbUserVo);
tbUserVo.setToken(token);
tbUserVo.setPassword(null);
tbUserVo.setUserCard(null);
return AjaxResult.success(tbUserVo);
}
}

@ -0,0 +1,46 @@
package com.bwie.ruoyi.utils;
import org.apache.http.HttpResponse;
import java.util.HashMap;
import java.util.Map;
public class DuanxinUtils {
public static Boolean sendDuanxin(String mobile,String code){
String host = "http://dingxin.market.alicloudapi.com";
String path = "/dx/sendSms";
String method = "POST";
String appcode = "42feffa4bb0b463ab03421a67ec79e0c";
Map<String, String> headers = new HashMap<String, String>();
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
headers.put("Authorization", "APPCODE " + appcode);
Map<String, String> querys = new HashMap<String, String>();
querys.put("mobile", mobile);
querys.put("param", "code:"+code);
querys.put("tpl_id", "TP20010711");
Map<String, String> bodys = new HashMap<String, String>();
try {
/**
* :
* HttpUtils
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
*
*
*
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
*/
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
System.out.println(response.toString());
//获取response的body
//System.out.println(EntityUtils.toString(response.getEntity()));
return true;
} catch (Exception e) {
//打印异常
e.printStackTrace();
return false;
}
}
}

@ -0,0 +1,311 @@
package com.bwie.ruoyi.utils;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HttpUtils {
/**
* get
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doGet(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpGet request = new HttpGet(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
/**
* post form
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param bodys
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
Map<String, String> bodys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (bodys != null) {
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
for (String key : bodys.keySet()) {
nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
}
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
request.setEntity(formEntity);
}
return httpClient.execute(request);
}
/**
* Post String
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (StringUtils.isNotBlank(body)) {
request.setEntity(new StringEntity(body, "utf-8"));
}
return httpClient.execute(request);
}
/**
* Post stream
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (body != null) {
request.setEntity(new ByteArrayEntity(body));
}
return httpClient.execute(request);
}
/**
* Put String
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (StringUtils.isNotBlank(body)) {
request.setEntity(new StringEntity(body, "utf-8"));
}
return httpClient.execute(request);
}
/**
* Put stream
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (body != null) {
request.setEntity(new ByteArrayEntity(body));
}
return httpClient.execute(request);
}
/**
* Delete
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doDelete(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
StringBuilder sbUrl = new StringBuilder();
sbUrl.append(host);
if (!StringUtils.isBlank(path)) {
sbUrl.append(path);
}
if (null != querys) {
StringBuilder sbQuery = new StringBuilder();
for (Map.Entry<String, String> query : querys.entrySet()) {
if (0 < sbQuery.length()) {
sbQuery.append("&");
}
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
sbQuery.append(query.getValue());
}
if (!StringUtils.isBlank(query.getKey())) {
sbQuery.append(query.getKey());
if (!StringUtils.isBlank(query.getValue())) {
sbQuery.append("=");
sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
}
}
}
if (0 < sbQuery.length()) {
sbUrl.append("?").append(sbQuery);
}
}
return sbUrl.toString();
}
private static HttpClient wrapClient(String host) {
HttpClient httpClient = new DefaultHttpClient();
if (host.startsWith("https://")) {
sslClient(httpClient);
}
return httpClient;
}
private static void sslClient(HttpClient httpClient) {
try {
SSLContext ctx = SSLContext.getInstance("TLS");
X509TrustManager tm = new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] xcs, String str) {
}
public void checkServerTrusted(X509Certificate[] xcs, String str) {
}
};
ctx.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
ClientConnectionManager ccm = httpClient.getConnectionManager();
SchemeRegistry registry = ccm.getSchemeRegistry();
registry.register(new Scheme("https", 443, ssf));
} catch (KeyManagementException ex) {
throw new RuntimeException(ex);
} catch (NoSuchAlgorithmException ex) {
throw new RuntimeException(ex);
}
}
}

@ -0,0 +1,178 @@
package com.bwie.ruoyi.utils;
import io.jsonwebtoken.*;
import java.util.ArrayList;
import java.util.Date;
public class TokenUtils {
public static int SUCCESS = 0;
public static int ERROR_SIGN = 1;
public static int ERROR_EXPIRE = 2;
public static int ERROR = 3;
private String key = "123456";
private Integer expireTime = 60;
private Claims claims = null;
JwtBuilder builder = null;
public TokenUtils() {
builder = Jwts.builder();
}
public static TokenUtils token() {
return new TokenUtils();
}
public TokenUtils setKey(String key) {
this.key = key;
return this;
}
public TokenUtils setExpire(Integer seconds) {
this.expireTime = seconds;
// 设置签发日期
builder.setIssuedAt(new Date());
// 设置过期时间
long now = System.currentTimeMillis();
long exp = now+1000*expireTime;
builder.setExpiration( new Date( exp ) );
return this;
}
public TokenUtils setClaim(String key, String value) {
builder.claim( key, value );
return this;
}
/**
* @description token
* @author
* @date 2022/6/22 15:44
* @version 1.0
*/
public String makeToken() {
// 设置签名 使用HS256算法并设置SecretKey(字符串)
builder.signWith(SignatureAlgorithm.HS256,key);
// 生成token
String token = builder.compact();
return token;
}
/**
* @description Key-Value
* @author
* @date 2022/6/22 15:47
* @version 1.0
*/
public TokenUtils putKeyValues(String... keyValues) {
if(keyValues.length > 0) {
// 添加数据
ArrayList<String> stringPair = new ArrayList<>();
for(String kv:keyValues) {
// 添加键值对
stringPair.add(kv);
//
if(stringPair.size()>=2) {
builder.claim( stringPair.get(0),stringPair.get(1) );
stringPair.clear();
continue;
}
}
}
return this;
}
/**
* @description token
* @author
* @date 2022/6/22 15:45
* @version 1.0
*/
public String createToken(String... keyValues) {
// 存放数据
if(keyValues.length > 0) {
// 添加数据
ArrayList<String> stringPair = new ArrayList<>();
for(String kv:keyValues) {
// 添加键值对
stringPair.add(kv);
//
if(stringPair.size()>=2) {
builder.claim( stringPair.get(0),stringPair.get(1) );
stringPair.clear();
continue;
}
}
}
//
// 设置签名 使用HS256算法并设置SecretKey(字符串)
builder.signWith(SignatureAlgorithm.HS256,key);
// 生成token
String token = builder.compact();
return token;
}
public int parseToken(String token) {
try {
claims = Jwts.parser()
.setSigningKey(key)
.parseClaimsJws(token)
.getBody();
return TokenUtils.SUCCESS;
}
catch (ExpiredJwtException e) {
System.out.println("token expired");
claims = e.getClaims();
return TokenUtils.ERROR_EXPIRE;
} catch (SignatureException e) {
System.out.println("token signature error");
return TokenUtils.ERROR_SIGN;
} catch (Exception e) {
System.out.println("token error");
return TokenUtils.ERROR;
}
}
public String getClaim(String key) {
if(claims == null) {
return null;
}
String value = (String)claims.get(key);
return value;
}
/**
* @description
* @author
* @date 2022/6/22 15:49
* @version 1.0
*/
public static void main(String[] args) {
String token = TokenUtils.token()
// 设置加密密码
.setKey("123456")
// 设置过期时间
.setExpire(60 * 30)
// 添加数据
.setClaim("id", "" + 666)
.setClaim("userName", "zhaoyun")
.putKeyValues("role", "admin", "permissions", "select,delete,insert")
// 生成token
.makeToken();
System.out.println("token="+token);
}
}

@ -0,0 +1,25 @@
# Tomcat
server:
port: 9302
# Spring
spring:
application:
# 应用名称
name: ruoyi-user
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,20 @@
<?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.bwie.ruoyi.mapper.TbPermMapper">
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbPerm">
<id property="permId" column="perm_id" jdbcType="INTEGER"/>
<result property="permName" column="perm_name" jdbcType="VARCHAR"/>
<result property="permCode" column="perm_code" jdbcType="VARCHAR"/>
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
perm_id,perm_name,perm_code,
deleted,create_time,update_time
</sql>
</mapper>

@ -0,0 +1,19 @@
<?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.bwie.ruoyi.mapper.TbRoleMapper">
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbRole">
<id property="roleId" column="role_id" jdbcType="INTEGER"/>
<result property="roleName" column="role_name" jdbcType="VARCHAR"/>
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
role_id,role_name,deleted,
create_time,update_time
</sql>
</mapper>

@ -0,0 +1,20 @@
<?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.bwie.ruoyi.mapper.TbRolePermMapper">
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbRolePerm">
<id property="rolePermId" column="role_perm_id" jdbcType="INTEGER"/>
<result property="roleId" column="role_id" jdbcType="INTEGER"/>
<result property="permId" column="perm_id" jdbcType="INTEGER"/>
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
role_perm_id,role_id,perm_id,
deleted,create_time,update_time
</sql>
</mapper>

@ -0,0 +1,24 @@
<?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.bwie.ruoyi.mapper.TbUserBankcardMapper">
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbUserBankcard">
<id property="bankcardId" column="bankcard_id" jdbcType="INTEGER"/>
<result property="brankcardName" column="brankcard_name" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="bankcardMoney" column="bankcard_money" jdbcType="INTEGER"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
bankcard_id,brankcard_name,user_id,
bankcard_money,create_by,create_time,
del_flag,update_by,update_time
</sql>
</mapper>

@ -0,0 +1,42 @@
<?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.bwie.ruoyi.mapper.TbUserMapper">
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbUser">
<id property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="nickName" column="nick_name" jdbcType="VARCHAR"/>
<result property="email" column="email" jdbcType="VARCHAR"/>
<result property="phonenumber" column="phonenumber" jdbcType="VARCHAR"/>
<result property="age" column="age" jdbcType="INTEGER"/>
<result property="sex" column="sex" jdbcType="CHAR"/>
<result property="avatar" column="avatar" jdbcType="VARCHAR"/>
<result property="userCard" column="user_card" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="CHAR"/>
<result property="delFlag" column="del_flag" jdbcType="CHAR"/>
<result property="loginIp" column="login_ip" jdbcType="VARCHAR"/>
<result property="loginDate" column="login_date" jdbcType="TIMESTAMP"/>
<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="userPrice" column="user_price" jdbcType="DOUBLE"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="realnameState" column="realname_state" jdbcType="CHAR"/>
<result property="honorIntegral" column="honor_integral" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
user_id,user_name,nick_name,
email,phonenumber,age,
sex,avatar,user_card,
password,status,del_flag,
login_ip,login_date,create_by,
create_time,update_by,user_price,
update_time,remark,realname_state,
honor_integral
</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.bwie.ruoyi.mapper.TbUserRoleMapper">
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbUserRole">
<id property="userRoleId" column="user_role_id" jdbcType="BIGINT"/>
<result property="userRoleName" column="user_role_name" jdbcType="VARCHAR"/>
<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"/>
<result property="roleFunction" column="role_function" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
user_role_id,user_role_name,create_by,
create_time,update_by,update_time,
role_function
</sql>
</mapper>

@ -0,0 +1,50 @@
import request from '@/utils/request'
// 查询贷款列表
export function listBorrower(query) {
return request({
url: '/potenza/borrower/list',
method: 'get',
params: query
})
}
// 查询贷款详细
export function getBorrower(borrowerId) {
return request({
url: '/potenza/borrower/borrowerById/' + borrowerId,
method: 'get'
})
}
// 新增贷款
export function addBorrower(data) {
return request({
url: '/potenza/borrower/borrowerInsert',
method: 'post',
data: data
})
}
// 修改贷款
export function updateBorrower(data) {
return request({
url: '/potenza/borrower/borrowerUpdate',
method: 'put',
data: data
})
}
// 添加贷款
export function insertBorrower(data) {
return request({
url: '/potenza/borrower/loans',
method: 'post',
data: data
})
}

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询贷款周期列表
export function listPeriods(query) {
return request({
url: '/potenza/periods/list',
method: 'get',
params: query
})
}
// 查询贷款周期详细
export function getPeriods(periodsId) {
return request({
url: '/potenza/periods/periodsById/' + periodsId,
method: 'get'
})
}
// 新增贷款周期
export function addPeriods(data) {
return request({
url: '/potenza/periods/periodsInsert',
method: 'post',
data: data
})
}
// 修改贷款周期
export function updatePeriods(data) {
return request({
url: '/potenza/periods/periodsUpdate',
method: 'put',
data: data
})
}
// 删除贷款周期
export function delPeriods(periodsId) {
return request({
url: '/potenza/periods/' + periodsId,
method: 'delete'
})
}
export function detail(data) {
return request({
url: '/potenza/periods/detail',
method: 'post',
data: data
})
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询计划列表
export function listPlan(query) {
return request({
url: '/potenza/plan/list',
method: 'get',
params: query
})
}
// 查询计划详细
export function getPlan(planId) {
return request({
url: '/potenza/plan/planById' + planId,
method: 'get'
})
}
// 新增计划
export function addPlan(data) {
return request({
url: '/potenza/plan/planInsert',
method: 'post',
data: data
})
}
// 修改计划
export function updatePlan(data) {
return request({
url: '/potenza/plan/planUpdate',
method: 'put',
data: data
})
}
// 删除计划
export function delPlan(planId) {
return request({
url: '/potenza/plan/planIds/' + planId,
method: 'delete'
})
}

@ -3,49 +3,29 @@
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">若依后台管理系统</h3>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
type="text"
auto-complete="off"
placeholder="账号"
>
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="password"
auto-complete="off"
placeholder="密码"
@keyup.enter.native="handleLogin"
>
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
@keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-input
v-model="loginForm.code"
auto-complete="off"
placeholder="验证码"
style="width: 63%"
@keyup.enter.native="handleLogin"
>
<el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
@keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
<img :src="codeUrl" @click="getCode" class="login-code-img" />
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;"></el-checkbox>
<el-form-item style="width:100%;">
<el-button
:loading="loading"
size="medium"
type="primary"
style="width:100%;"
@click.native.prevent="handleLogin"
>
<el-button :loading="loading" size="medium" type="primary" style="width:100%;"
@click.native.prevent="handleLogin">
<span v-if="!loading"> </span>
<span v-else> ...</span>
</el-button>
@ -97,7 +77,7 @@ export default {
},
watch: {
$route: {
handler: function(route) {
handler: function (route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true
@ -132,6 +112,7 @@ export default {
if (valid) {
this.loading = true;
if (this.loginForm.rememberMe) {
console.log(this.loginForm.rememberMe)
Cookies.set("username", this.loginForm.username, { expires: 30 });
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
@ -141,7 +122,7 @@ export default {
Cookies.remove('rememberMe');
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
this.$router.push({ path: this.redirect || "/" }).catch(() => { });
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
@ -164,6 +145,7 @@ export default {
background-image: url("../assets/images/login-background.jpg");
background-size: cover;
}
.title {
margin: 0px auto 30px auto;
text-align: center;
@ -175,32 +157,39 @@ export default {
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
.el-input {
height: 38px;
input {
height: 38px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
@ -213,6 +202,7 @@ export default {
font-size: 12px;
letter-spacing: 1px;
}
.login-code-img {
height: 38px;
}

@ -0,0 +1,286 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="用户名称" prop="userName">
<el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="贷款方式ID " prop="wayId">
<el-input v-model="queryParams.wayId" placeholder="请输入贷款方式ID " clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="借款用途" prop="borrowerPurpose">
<el-input v-model="queryParams.borrowerPurpose" placeholder="请输入借款用途" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label=" 1 待审核 2贷款成功 3:贷款失败" prop="borrowerState">
<el-input v-model="queryParams.borrowerState" placeholder="请输入 1 待审核 2贷款成功 3:贷款失败" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="放款人" prop="loanerId">
<el-input v-model="queryParams.loanerId" placeholder="请输入放款人" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['potenza:borrower:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['potenza:borrower:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['potenza:borrower:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="borrowerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="${comment}" align="center" prop="borrowerId" />
<el-table-column label="用户ID" align="center" prop="userId" />
<el-table-column label="用户名称" align="center" prop="userName" />
<el-table-column label="产品ID " align="center" prop="productId" />
<el-table-column label="默认为最高可以借款金额" align="center" prop="borrowerMoney" />
<el-table-column label="贷款周期ID" align="center" prop="periodsId" />
<el-table-column label="当款方式" align="center" prop="wayId" />
<el-table-column label="借款用途" align="center" prop="borrowerPurpose" />
<el-table-column label=" 1 待审核 2贷款成功 3:贷款失败" align="center" prop="borrowerState" />
<el-table-column label="放款人" align="center" prop="loanerId" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['potenza:borrower:edit']">修改</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" />
<!-- 添加或修改贷款对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" />
</el-form-item>
<el-form-item label="用户名称" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户名称" />
</el-form-item>
<el-form-item label="产品ID " prop="productId">
<el-input v-model="form.productId" placeholder="请输入产品ID " />
</el-form-item>
<el-form-item label="默认为最高可以借款金额" prop="borrowerMoney">
<el-input v-model="form.borrowerMoney" placeholder="请输入默认为最高可以借款金额" />
</el-form-item>
<el-form-item label="贷款周期ID" prop="periodsId">
<el-input v-model="form.periodsId" placeholder="请输入贷款周期ID" />
</el-form-item>
<el-form-item label="贷款方式ID " prop="wayId">
<el-input v-model="form.wayId" placeholder="请输入贷款方式ID" />
</el-form-item>
<el-form-item label="借款用途" prop="borrowerPurpose">
<el-input v-model="form.borrowerPurpose" placeholder="请输入借款用途" />
</el-form-item>
<el-form-item label=" 1 待审核 2贷款成功 3:贷款失败" prop="borrowerState">
<el-input v-model="form.borrowerState" placeholder="请输入 1 待审核 2贷款成功 3:贷款失败" />
</el-form-item>
<el-form-item label="放款人" prop="loanerId">
<el-input v-model="form.loanerId" placeholder="请输入放款人" />
</el-form-item>
<el-form-item label="删除状态0存在2删除" prop="delFlag">
<el-input v-model="form.delFlag" placeholder="请输入删除状态0存在2删除" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listBorrower, getBorrower, addBorrower, updateBorrower } from "@/api/potenza/borrower";
export default {
name: "Borrower",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
borrowerList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 5,
userId: null,
userName: null,
productId: null,
borrowerMoney: null,
periodsId: null,
wayId: null,
borrowerPurpose: null,
borrowerState: null,
loanerId: null,
},
//
form: {},
//
rules: {
userId: [
{ required: true, message: "用户ID不能为空", trigger: "blur" }
],
userName: [
{ required: true, message: "用户名称不能为空", trigger: "blur" }
],
productId: [
{ required: true, message: "产品ID 不能为空", trigger: "blur" }
],
periodsId: [
{ required: true, message: "贷款周期ID不能为空", trigger: "blur" }
],
wayId: [
{ required: true, message: "贷款方式ID 0:等额本息 6000 1:等额本金 6000 1000 第一个月60000*利率 第二个月 5000*利率不能为空", trigger: "blur" }
],
borrowerPurpose: [
{ required: true, message: "借款用途不能为空", trigger: "blur" }
],
loanerId: [
{ required: true, message: "放款人不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
const username = this.$store.state.user.name;
console.log(username)
},
methods: {
/** 查询贷款列表 */
getList() {
this.loading = true;
listBorrower(this.queryParams).then(response => {
this.borrowerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
borrowerId: null,
userId: null,
userName: null,
productId: null,
borrowerMoney: null,
periodsId: null,
wayId: null,
borrowerPurpose: null,
borrowerState: null,
loanerId: null,
createBy: null,
updateBy: null,
delFlag: null,
createTime: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.borrowerId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加贷款";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const borrowerId = row.borrowerId || this.ids
getBorrower(borrowerId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改贷款";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.borrowerId != null) {
updateBorrower(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addBorrower(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 导出按钮操作 */
handleExport() {
this.download('potenza/borrower/export', {
...this.queryParams
}, `borrower_${new Date().getTime()}.xlsx`)
}
}
};
</script>

@ -0,0 +1,123 @@
<template>
<div class="from">
<div>
</div>
<div>
<h1>贷款中心</h1>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="借款金额" prop="borrowerMoney">
<el-input v-model="ruleForm.borrowerMoney"></el-input>
</el-form-item>
<el-form-item label="借款周期" prop="periodsId">
<el-select v-model="ruleForm.periodsId" placeholder="请选择">
<el-option v-for="item in periods" :key="item.periodsId" :label="item.periodsName"
:value="item.periodsId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="借款方式" prop="wayId">
<el-select v-model="ruleForm.wayId" placeholder="请选择方式">
<el-option label="等额本息" value=0></el-option>
<el-option label="等额本金" value=1></el-option>
</el-select>
</el-form-item>
<el-form-item>
<h4>总还款金额:{{ borrowerMoney }}</h4>
</el-form-item>
<el-form-item label="借款用途" prop="borrowerPurpose">
<el-input v-model="ruleForm.borrowerPurpose"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm(ruleForm)"></el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import { listPeriods, insertBorrower } from "@/api/potenza/periods";
import { detail } from "@/api/potenza/periods";
export default {
data() {
return {
ruleForm: {
borrowerMoney: '',
periodsId: null,
borrowerPurpose: '',
wayId: null,
userName: '',
userId: null,
productId: null
},
periods: [],
timer: '',
borrowerMoney: '',
rules: {
borrowerMoney: [{ required: true, message: '请输入活动名称', trigger: 'blur' }],
periodsId: [{ required: true, message: '请输入借款周期', trigger: 'blur' }],
borrowerPurpose: [{ required: true, message: '请输入借款方式', trigger: 'blur' }],
wayId: [{ required: true, message: '请输入借款用途', trigger: 'blur' }],
}
}
},
methods: {
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
const username = this.$store.state.user.name;
this.ruleForm.userName = username
insertBorrower(this.ruleForm).then(respon => {
console.log(respon)
})
} else {
console.log('error submit!!');
return false;
}
});
},
listPeriods() {
listPeriods().then(response => {
console.log(response.rows)
this.periods = response.rows
});
},
valChange() {
if (this.ruleForm.borrowerMoney != '' && this.ruleForm.periodsId != null && this.ruleForm.wayId != null) {
let pram = {}
pram.borrowerMoney = this.ruleForm.borrowerMoney
pram.periodsId = this.ruleForm.periodsId
pram.wayId = this.ruleForm.wayId
console.log(pram)
detail(pram).then(respon => {
this.borrowerMoney = respon.data
})
}
}
},
created() {
this.listPeriods()
this.timer = setInterval(this.valChange, 2000);
},
}
</script>
<style>
.from {
margin: auto;
width: 40%;
}
</style>

@ -0,0 +1,210 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="周期:" prop="periodsName">
<el-input v-model="queryParams.periodsName" placeholder="请输入周期:" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['potenza:periods:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['potenza:periods:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['potenza:periods:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['potenza:periods:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="periodsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" align="center" prop="periodsId" />
<el-table-column label="周期:" align="center" prop="periodsName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['potenza:periods:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['potenza:periods:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 添加或修改贷款周期对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="周期:" prop="periodsName">
<el-input v-model="form.periodsName" placeholder="请输入周期:" />
</el-form-item>
<el-form-item label="删除状态0存在2删除" prop="delFlag">
<el-input v-model="form.delFlag" placeholder="请输入删除状态0存在2删除" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listPeriods, getPeriods, delPeriods, addPeriods, updatePeriods } from "@/api/potenza/periods";
export default {
name: "Periods",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
periodsList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 3,
periodsName: null,
},
//
form: {},
//
rules: {
periodsName: [
{ required: true, message: "周期:不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询贷款周期列表 */
getList() {
this.loading = true;
listPeriods(this.queryParams).then(response => {
this.periodsList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
periodsId: null,
periodsName: null,
createBy: null,
updateBy: null,
delFlag: null,
createTime: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.periodsId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加贷款周期";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const periodsId = row.periodsId || this.ids
getPeriods(periodsId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改贷款周期";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.periodsId != null) {
updatePeriods(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPeriods(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const periodsIds = row.periodsId || this.ids;
this.$modal.confirm('是否确认删除贷款周期编号为"' + periodsIds + '"的数据项?').then(function () {
return delPeriods(periodsIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
this.download('potenza/periods/export', {
...this.queryParams
}, `periods_${new Date().getTime()}.xlsx`)
}
}
};
</script>

@ -0,0 +1,379 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户ID" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户名称" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入用户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="共几期" prop="borrowerPeriods">
<el-input
v-model="queryParams.borrowerPeriods"
placeholder="请输入共几期"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="每期应还金额" prop="periodsMoney">
<el-input
v-model="queryParams.periodsMoney"
placeholder="请输入每期应还金额"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="月供本金" prop="periodsCapital">
<el-input
v-model="queryParams.periodsCapital"
placeholder="请输入月供本金"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="月供利息" prop="periodsInterests">
<el-input
v-model="queryParams.periodsInterests"
placeholder="请输入月供利息"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计划还款日期" prop="planDate">
<el-date-picker clearable
v-model="queryParams.planDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择计划还款日期">
</el-date-picker>
</el-form-item>
<el-form-item label="0:本月未还 1:提前还款 2:按时还款 3:逾期还款" prop="planState">
<el-input
v-model="queryParams.planState"
placeholder="请输入0:本月未还 1:提前还款 2:按时还款 3:逾期还款"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['potenza:plan:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['potenza:plan:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['potenza:plan:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['potenza:plan:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="还款结果ID" align="center" prop="planId" />
<el-table-column label="用户ID" align="center" prop="userId" />
<el-table-column label="用户名称" align="center" prop="userName" />
<el-table-column label="共几期" align="center" prop="borrowerPeriods" />
<el-table-column label="每期应还金额" align="center" prop="periodsMoney" />
<el-table-column label="月供本金" align="center" prop="periodsCapital" />
<el-table-column label="月供利息" align="center" prop="periodsInterests" />
<el-table-column label="计划还款日期" align="center" prop="planDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="0:本月未还 1:提前还款 2:按时还款 3:逾期还款" align="center" prop="planState" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['potenza:plan:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['potenza:plan:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改计划对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" />
</el-form-item>
<el-form-item label="用户名称" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户名称" />
</el-form-item>
<el-form-item label="共几期" prop="borrowerPeriods">
<el-input v-model="form.borrowerPeriods" placeholder="请输入共几期" />
</el-form-item>
<el-form-item label="每期应还金额" prop="periodsMoney">
<el-input v-model="form.periodsMoney" placeholder="请输入每期应还金额" />
</el-form-item>
<el-form-item label="月供本金" prop="periodsCapital">
<el-input v-model="form.periodsCapital" placeholder="请输入月供本金" />
</el-form-item>
<el-form-item label="月供利息" prop="periodsInterests">
<el-input v-model="form.periodsInterests" placeholder="请输入月供利息" />
</el-form-item>
<el-form-item label="计划还款日期" prop="planDate">
<el-date-picker clearable
v-model="form.planDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择计划还款日期">
</el-date-picker>
</el-form-item>
<el-form-item label="0:本月未还 1:提前还款 2:按时还款 3:逾期还款" prop="planState">
<el-input v-model="form.planState" placeholder="请输入0:本月未还 1:提前还款 2:按时还款 3:逾期还款" />
</el-form-item>
<el-form-item label="删除状态0存在2删除" prop="delFlag">
<el-input v-model="form.delFlag" placeholder="请输入删除状态0存在2删除" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from "@/api/potenza/plan";
export default {
name: "Plan",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
planList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
userName: null,
borrowerPeriods: null,
periodsMoney: null,
periodsCapital: null,
periodsInterests: null,
planDate: null,
planState: null,
},
//
form: {},
//
rules: {
userId: [
{ required: true, message: "用户ID不能为空", trigger: "blur" }
],
userName: [
{ required: true, message: "用户名称不能为空", trigger: "blur" }
],
borrowerPeriods: [
{ required: true, message: "共几期不能为空", trigger: "blur" }
],
periodsMoney: [
{ required: true, message: "每期应还金额不能为空", trigger: "blur" }
],
periodsCapital: [
{ required: true, message: "月供本金不能为空", trigger: "blur" }
],
periodsInterests: [
{ required: true, message: "月供利息不能为空", trigger: "blur" }
],
planDate: [
{ required: true, message: "计划还款日期不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询计划列表 */
getList() {
this.loading = true;
listPlan(this.queryParams).then(response => {
this.planList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
planId: null,
userId: null,
userName: null,
borrowerPeriods: null,
periodsMoney: null,
periodsCapital: null,
periodsInterests: null,
planDate: null,
planState: null,
delFlag: null,
createTime: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.planId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加计划";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const planId = row.planId || this.ids
getPlan(planId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改计划";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.planId != null) {
updatePlan(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPlan(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const planIds = row.planId || this.ids;
this.$modal.confirm('是否确认删除计划编号为"' + planIds + '"的数据项?').then(function() {
return delPlan(planIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('potenza/plan/export', {
...this.queryParams
}, `plan_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save