Revert "1123"

This reverts commit 9ec8efec12.
This commit is contained in:
77
2024-05-05 16:20:28 +08:00
parent 9ec8efec12
commit d0684dcaa5
14 changed files with 20 additions and 125 deletions

View File

@@ -12,9 +12,9 @@ spring:
# 主库数据源 # 主库数据源
master: master:
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://124.222.254.188:4306/dk?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true url: jdbc:mysql://localhost:4306/dk?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
username: root username: dk
password: 383200134 password: dk123.com
# 从库数据源 # 从库数据源
slave: slave:
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
@@ -66,13 +66,13 @@ spring:
# redis 配置 # redis 配置
redis: redis:
# 地址 # 地址
host: 124.222.254.188 host: localhost
# 端口,默认为 6379 # 端口,默认为 6379
port: 9379 port: 6379
# 数据库索引 # 数据库索引
database: 3 database: 1
# 密码 # 密码
password: 383200134 password:
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
# 是否开启ssl # 是否开启ssl

View File

@@ -99,9 +99,6 @@ public class Customer implements Serializable {
@ApiModelProperty("最后登陆IP") @ApiModelProperty("最后登陆IP")
private String lastLoginIp; private String lastLoginIp;
@ApiModelProperty("当前登录时间")
private LocalDateTime createTime;
@JsonDeserialize(using = LocalDateTimeDeserializer.class) @JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class) @JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonFormat(pattern = DateConstant.PATTERN_DATETIME) @JsonFormat(pattern = DateConstant.PATTERN_DATETIME)

View File

@@ -1,46 +0,0 @@
package com.bashi.dk.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bashi.common.core.domain.AjaxResult;
import com.bashi.common.core.domain.entity.Customer;
import com.bashi.dk.domain.Borrow;
import com.bashi.dk.service.BorrowService;
import com.bashi.dk.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/dk/home")
public class HomeController {
@Autowired
private CustomerService customerService;
@Autowired
private BorrowService borrowService;
@GetMapping("/index")
public AjaxResult<Map<String,Long>> index() {
Map<String,Long> map = new HashMap<>();
LocalDate now = LocalDate.now();
// 今日注册, 总注册
long todayRegister = customerService.count(Wrappers.lambdaQuery(Customer.class).between(Customer::getCreateTime,
now.atTime(LocalTime.MIN), now.atTime(LocalTime.MAX)));
long totalRegister = customerService.count();
// 今日订单, 总订单
long todayBorrow = borrowService.count(Wrappers.lambdaQuery(Borrow.class).between(Borrow::getCreateTime,
now.atTime(LocalTime.MIN), now.atTime(LocalTime.MAX)));
long totalBorrow = borrowService.count();
map.put("todayRegister",todayRegister);
map.put("totalRegister",totalRegister);
map.put("todayBorrow",todayBorrow);
map.put("totalBorrow",totalBorrow);
return AjaxResult.success(map);
}
}

View File

@@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.bashi.common.constant.DateConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -36,6 +34,7 @@ public class Borrow implements Serializable {
@TableId(value = "id") @TableId(value = "id")
@ApiModelProperty("ID") @ApiModelProperty("ID")
private Long id; private Long id;
@ApiModelProperty("用途说明") @ApiModelProperty("用途说明")
private String noteRemark; private String noteRemark;
@@ -93,10 +92,6 @@ public class Borrow implements Serializable {
@ApiModelProperty("借款状态") @ApiModelProperty("借款状态")
private String borrowName; private String borrowName;
/** 借款状态编码 **/
@ApiModelProperty("借款状态ID")
private Long borrowStatusId;
@ApiModelProperty("借款状态样式") @ApiModelProperty("借款状态样式")
private String borrowNameStyle; private String borrowNameStyle;
@@ -206,7 +201,6 @@ public class Borrow implements Serializable {
/** 创建时间 */ /** 创建时间 */
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
@JsonFormat(pattern = DateConstant.PATTERN_DATETIME)
private LocalDateTime createTime; private LocalDateTime createTime;
/** 修改时间 */ /** 修改时间 */

View File

@@ -1,17 +1,14 @@
package com.bashi.dk.domain; package com.bashi.dk.domain;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal;
/** /**
* 借款状态对象 dk_borrow_status * 借款状态对象 dk_borrow_status
@@ -38,12 +35,6 @@ public class BorrowStatus implements Serializable {
@ApiModelProperty("是否可以打款") @ApiModelProperty("是否可以打款")
private Integer usedRemit; private Integer usedRemit;
@ApiModelProperty("借款状态编码")
private String borrowCode;
@ApiModelProperty("是否允许提现")
private Boolean withdrawFlag;
/** 借款状态 */ /** 借款状态 */
@ApiModelProperty("借款状态") @ApiModelProperty("借款状态")
private String borrowName; private String borrowName;

View File

@@ -7,7 +7,6 @@ public class BorrowUpdateStatusReq {
private Long id; private Long id;
private Integer usedRemit; private Integer usedRemit;
private String borrowName; private String borrowName;
private Long borrowStatusId;
private String borrowRemark; private String borrowRemark;
private String borrowNameStyle; private String borrowNameStyle;

View File

@@ -1,14 +1,10 @@
package com.bashi.dk.dto.admin.resp; package com.bashi.dk.dto.admin.resp;
import com.bashi.dk.domain.Borrow; import com.bashi.dk.domain.Borrow;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class BorrowResp extends Borrow { public class BorrowResp extends Borrow {
private String customerLoginName; private String customerLoginName;
@ApiModelProperty("是否允许提现")
private Boolean withdrawFlag;
} }

View File

@@ -22,8 +22,6 @@ public interface BorrowService extends IService<Borrow> {
void withdraw(Double withdrawAmount, Long customerId); void withdraw(Double withdrawAmount, Long customerId);
Borrow getByCustomerId(Long customerId);
LoanProcessResp getStepBorrow(Long customerId); LoanProcessResp getStepBorrow(Long customerId);
LoanProcessResp parseStepBorrow(Borrow one); LoanProcessResp parseStepBorrow(Borrow one);

View File

@@ -4,5 +4,4 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.bashi.dk.domain.BorrowStatus; import com.bashi.dk.domain.BorrowStatus;
public interface BorrowStatusService extends IService<BorrowStatus> { public interface BorrowStatusService extends IService<BorrowStatus> {
BorrowStatus getByCode(String borrowStatusCode);
} }

View File

@@ -1,6 +1,6 @@
package com.bashi.dk.service.impl; package com.bashi.dk.service.impl;
import com.aliyun.oss.ServiceException; import cn.hutool.core.annotation.MirroredAnnotationAttribute;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -12,7 +12,10 @@ import com.bashi.common.exception.CustomException;
import com.bashi.common.utils.BeanConvertUtil; import com.bashi.common.utils.BeanConvertUtil;
import com.bashi.common.utils.JsonUtils; import com.bashi.common.utils.JsonUtils;
import com.bashi.common.utils.MessageUtils; import com.bashi.common.utils.MessageUtils;
import com.bashi.dk.domain.*; import com.bashi.dk.domain.AgreementSetting;
import com.bashi.dk.domain.Borrow;
import com.bashi.dk.domain.CustomerInfo;
import com.bashi.dk.domain.LoansSetting;
import com.bashi.dk.dto.admin.req.BorrowUpdateStatusReq; import com.bashi.dk.dto.admin.req.BorrowUpdateStatusReq;
import com.bashi.dk.dto.admin.resp.BorrowResp; import com.bashi.dk.dto.admin.resp.BorrowResp;
import com.bashi.dk.dto.app.req.BorrowStartReq; import com.bashi.dk.dto.app.req.BorrowStartReq;
@@ -34,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
@@ -55,10 +59,6 @@ public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> impleme
private LoansSettingService loansSettingService; private LoansSettingService loansSettingService;
@Autowired @Autowired
private RedissonClient redissonClient; private RedissonClient redissonClient;
@Autowired
private AgreementSettingService agreementSettingService;
@Autowired
private BorrowStatusService borrowStatusService;
@Override @Override
public Borrow borrow(BorrowStartReq req) { public Borrow borrow(BorrowStartReq req) {
@@ -161,7 +161,6 @@ public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> impleme
if(remit){ if(remit){
update.setRemitFlag(1); update.setRemitFlag(1);
} }
update.setBorrowStatusId(bo.getBorrowStatusId());
boolean bool = this.updateById(update); boolean bool = this.updateById(update);
if(bool && remit){ if(bool && remit){
customerService.borrowAmount(borrow.getCustomerId(), borrow.getTotalLoanMoney(),borrow.getTotalRepayment()); customerService.borrowAmount(borrow.getCustomerId(), borrow.getTotalLoanMoney(),borrow.getTotalRepayment());
@@ -192,18 +191,6 @@ public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> impleme
@Override @Override
public void withdraw(Double withdrawAmount, Long customerId) { public void withdraw(Double withdrawAmount, Long customerId) {
Borrow borrow = this.getByCustomerId(customerId);
if(borrow == null){
throw new CustomException(MessageUtils.message("dk.withdraw.account.error"));
}
if(borrow.getBorrowStatusId() != null){
BorrowStatus borrowStatus = borrowStatusService.getById(borrow.getBorrowStatusId());
if(borrowStatus != null){
if(BooleanUtils.isFalse(borrowStatus.getWithdrawFlag())){
throw new CustomException(MessageUtils.message("dk.withdraw.account.error"));
}
}
}
Customer customer = customerService.getById(customerId); Customer customer = customerService.getById(customerId);
if(BooleanUtils.isNotTrue(customer.getAllowWithdrawFlag())){ if(BooleanUtils.isNotTrue(customer.getAllowWithdrawFlag())){
throw new CustomException(MessageUtils.message("dk.withdraw.account.error")); throw new CustomException(MessageUtils.message("dk.withdraw.account.error"));
@@ -227,12 +214,6 @@ public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> impleme
this.updateById(update); this.updateById(update);
} }
@Override
public Borrow getByCustomerId(Long customerId) {
return this.getOne(Wrappers.lambdaQuery(Borrow.class).eq(Borrow::getCustomerId, customerId)
.last("limit 1"));
}
@Override @Override
public LoanProcessResp getStepBorrow(Long customerId){ public LoanProcessResp getStepBorrow(Long customerId){
Borrow one = this.getOne(Wrappers.lambdaQuery(Borrow.class).eq(Borrow::getCustomerId,customerId)); Borrow one = this.getOne(Wrappers.lambdaQuery(Borrow.class).eq(Borrow::getCustomerId,customerId));
@@ -271,6 +252,9 @@ public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> impleme
return baseMapper.pageAdmin(Condition.getPage(pageParams),bo); return baseMapper.pageAdmin(Condition.getPage(pageParams),bo);
} }
@Autowired
private AgreementSettingService agreementSettingService;
@Override @Override
public String getContract(String tradeNo) { public String getContract(String tradeNo) {
Borrow borrow = this.getByTradeNo(tradeNo); Borrow borrow = this.getByTradeNo(tradeNo);

View File

@@ -1,6 +1,5 @@
package com.bashi.dk.service.impl; package com.bashi.dk.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bashi.dk.domain.BorrowStatus; import com.bashi.dk.domain.BorrowStatus;
import com.bashi.dk.mapper.BorrowStatusMapper; import com.bashi.dk.mapper.BorrowStatusMapper;
@@ -9,9 +8,4 @@ import org.springframework.stereotype.Service;
@Service @Service
public class BorrowStatusServiceImpl extends ServiceImpl<BorrowStatusMapper, BorrowStatus> implements BorrowStatusService { public class BorrowStatusServiceImpl extends ServiceImpl<BorrowStatusMapper, BorrowStatus> implements BorrowStatusService {
@Override
public BorrowStatus getByCode(String borrowStatusCode) {
return this.getOne(Wrappers.lambdaQuery(BorrowStatus.class).eq(BorrowStatus::getBorrowCode, borrowStatusCode)
.last("limit 1"));
}
} }

View File

@@ -2,11 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.bashi.dk.mapper.BorrowMapper"> <mapper namespace="com.bashi.dk.mapper.BorrowMapper">
<select id="pageAdmin" resultType="com.bashi.dk.dto.admin.resp.BorrowResp"> <select id="pageAdmin" resultType="com.bashi.dk.dto.admin.resp.BorrowResp">
select t1.*,t2.phone_number as customer_login_name, select t1.*,t2.phone_number as customer_login_name
ifnull(t3.withdraw_flag,1) as withdraw_flag
from dk_borrow t1 from dk_borrow t1
left join dk_customer t2 on t1.customer_id = t2.id left join dk_customer t2 on t1.customer_id = t2.id
left join dk_borrow_status t3 on t1.borrow_status_id = t3.id
<where> <where>
<if test="bo.tradeNo != null and bo.tradeNo != ''"> <if test="bo.tradeNo != null and bo.tradeNo != ''">
and t1.trade_no = #{bo.tradeNo} and t1.trade_no = #{bo.tradeNo}

View File

@@ -1,9 +0,0 @@
ALTER TABLE `dk_borrow`
ADD COLUMN `borrow_status_id` bigint(20) NULL COMMENT '借款编码' AFTER `borrow_name`;
ALTER TABLE `dk_borrow_status`
ADD COLUMN `borrow_code` varchar(60) NULL COMMENT '借款编码' AFTER `used_remit`,
ADD COLUMN `withdraw_flag` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否允许提现' AFTER `borrow_code`;
ALTER TABLE `dk_customer`
ADD COLUMN `create_time` datetime NOT NULL DEFAULT now() COMMENT '新增时间' AFTER `update_time`;