init
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
package com.bashi.dk.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bashi.common.annotation.Log;
|
||||
import com.bashi.common.annotation.RepeatSubmit;
|
||||
import com.bashi.common.com.Condition;
|
||||
import com.bashi.common.com.PageParams;
|
||||
import com.bashi.common.core.controller.BaseController;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.core.page.TableDataInfo;
|
||||
import com.bashi.common.enums.BusinessType;
|
||||
import com.bashi.common.utils.PageUtils;
|
||||
import com.bashi.dk.domain.BorrowStatus;
|
||||
import com.bashi.dk.enums.BankTypeEnums;
|
||||
import com.bashi.dk.service.BorrowStatusService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/dk/BorrowStatus")
|
||||
public class BorrowStatusController extends BaseController {
|
||||
|
||||
private final BorrowStatusService borrowStatusService;
|
||||
|
||||
/**
|
||||
* 查询借款状态列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:BorrowStatus:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BorrowStatus> list(PageParams pageParams, @Validated BorrowStatus bo) {
|
||||
IPage<BorrowStatus> page = borrowStatusService.page(Condition.getPage(pageParams), Wrappers.query(bo));
|
||||
return PageUtils.buildDataInfo(page);
|
||||
}
|
||||
|
||||
@GetMapping("/bankType")
|
||||
public AjaxResult<List<String>> bankType(){
|
||||
List<String> list = Arrays.stream(BankTypeEnums.values()).map(BankTypeEnums::getName).collect(Collectors.toList());
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public AjaxResult<List<BorrowStatus>> all(){
|
||||
List<BorrowStatus> list = borrowStatusService.list();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取借款状态详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:BorrowStatus:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult<BorrowStatus> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(borrowStatusService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增借款状态
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:BorrowStatus:add')")
|
||||
@Log(title = "借款状态", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated @RequestBody BorrowStatus bo) {
|
||||
return toAjax(borrowStatusService.save(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改借款状态
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:BorrowStatus:edit')")
|
||||
@Log(title = "借款状态", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody BorrowStatus bo) {
|
||||
return toAjax(borrowStatusService.updateById(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除借款状态
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:BorrowStatus:remove')")
|
||||
@Log(title = "借款状态" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable String ids) {
|
||||
List<String> idList = Stream.of(ids.split(",")).collect(Collectors.toList());
|
||||
return toAjax(borrowStatusService.removeByIds(idList) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.bashi.dk.controller;
|
||||
|
||||
import com.bashi.common.annotation.Log;
|
||||
import com.bashi.common.annotation.RepeatSubmit;
|
||||
import com.bashi.common.core.controller.BaseController;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.enums.BusinessType;
|
||||
import com.bashi.dk.domain.AgreementSetting;
|
||||
import com.bashi.dk.service.AgreementSettingService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/dk/AgreementSetting")
|
||||
public class DkAgreementSettingController extends BaseController {
|
||||
|
||||
private final AgreementSettingService agreementSettingService;
|
||||
|
||||
/**
|
||||
* 获取协议设置详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:AgreementSetting:query')")
|
||||
@GetMapping("/info")
|
||||
public AjaxResult<AgreementSetting> getInfo() {
|
||||
return AjaxResult.success(agreementSettingService.getAgreementSetting());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改协议设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:AgreementSetting:edit')")
|
||||
@Log(title = "协议设置", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody AgreementSetting bo) {
|
||||
return toAjax(agreementSettingService.updateById(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.bashi.dk.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bashi.common.annotation.Log;
|
||||
import com.bashi.common.annotation.RepeatSubmit;
|
||||
import com.bashi.common.com.Condition;
|
||||
import com.bashi.common.com.PageParams;
|
||||
import com.bashi.common.core.controller.BaseController;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.core.page.TableDataInfo;
|
||||
import com.bashi.common.enums.BusinessType;
|
||||
import com.bashi.common.utils.PageUtils;
|
||||
import com.bashi.dk.domain.Borrow;
|
||||
import com.bashi.dk.dto.admin.req.BorrowUpdateStatusReq;
|
||||
import com.bashi.dk.dto.admin.resp.BorrowResp;
|
||||
import com.bashi.dk.service.BorrowService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/dk/borrow")
|
||||
public class DkBorrowController extends BaseController {
|
||||
|
||||
private final BorrowService borrowService;
|
||||
|
||||
/**
|
||||
* 查询借款计划列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:borrow:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BorrowResp> list(PageParams pageParams, @Validated Borrow bo) {
|
||||
IPage<BorrowResp> page = borrowService.pageAdmin(pageParams, bo);
|
||||
return PageUtils.buildDataInfo(page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取借款计划详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:borrow:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult<Borrow> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(borrowService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增借款计划
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:borrow:add')")
|
||||
@Log(title = "借款计划", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated @RequestBody Borrow bo) {
|
||||
return toAjax(borrowService.save(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改借款计划
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:borrow:edit')")
|
||||
@Log(title = "借款计划", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody Borrow bo) {
|
||||
return toAjax(borrowService.updateById(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
@Log(title = "修改接口银行卡", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("updateBank")
|
||||
public AjaxResult<Void> updateBank(@RequestBody Borrow bo) {
|
||||
return toAjax(borrowService.updateBank(bo));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('dk:borrow:edit')")
|
||||
@Log(title = "修改借款", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PostMapping("/updateLoan")
|
||||
public AjaxResult<Void> updateLoan(@Validated @RequestBody Borrow bo) {
|
||||
return toAjax(borrowService.updateLoan(bo));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('dk:borrow:edit')")
|
||||
@Log(title = "修改借款状态", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PostMapping("/updateStatus")
|
||||
public AjaxResult<Void> updateStatus(@Validated @RequestBody BorrowUpdateStatusReq bo) {
|
||||
return toAjax(borrowService.updateStatus(bo));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除借款计划
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:borrow:remove')")
|
||||
@Log(title = "借款计划" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable String ids) {
|
||||
List<String> idList = Stream.of(ids.split(",")).collect(Collectors.toList());
|
||||
return toAjax(borrowService.removeByIds(idList) ? 1 : 0);
|
||||
}
|
||||
|
||||
@GetMapping("/getContract")
|
||||
public AjaxResult<String> getContract(String tradeNo){
|
||||
String contract = borrowService.getContract(tradeNo);
|
||||
AjaxResult<String> success = AjaxResult.success();
|
||||
success.setData(contract);
|
||||
return success;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.bashi.dk.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.bashi.common.annotation.Log;
|
||||
import com.bashi.common.annotation.RepeatSubmit;
|
||||
import com.bashi.common.com.PageParams;
|
||||
import com.bashi.common.core.controller.BaseController;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.common.core.page.TableDataInfo;
|
||||
import com.bashi.common.enums.BusinessType;
|
||||
import com.bashi.common.utils.PageUtils;
|
||||
import com.bashi.common.utils.poi.ExcelUtil;
|
||||
import com.bashi.dk.dto.admin.req.UpdatePwdCustomerReq;
|
||||
import com.bashi.dk.dto.admin.resp.CustomerAdminResp;
|
||||
import com.bashi.dk.dto.admin.resp.CustomerExportVo;
|
||||
import com.bashi.dk.mapper.CustomerMapper;
|
||||
import com.bashi.dk.service.CustomerService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/dk/dkCustomer")
|
||||
public class DkCustomerController extends BaseController {
|
||||
|
||||
private final CustomerService customerService;
|
||||
@Resource
|
||||
private CustomerMapper customerMapper;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('dk:dkCustomer:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CustomerAdminResp> list(PageParams pageParams, @Validated CustomerAdminResp bo) {
|
||||
IPage<CustomerAdminResp> page = customerService.pageAdmin(pageParams, bo);
|
||||
return PageUtils.buildDataInfo(page);
|
||||
}
|
||||
|
||||
@ApiOperation("导出客户列表")
|
||||
@PreAuthorize("@ss.hasPermi('dk:dkCustomer:export')")
|
||||
@Log(title = "客户", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<CustomerExportVo> export(@Validated CustomerAdminResp bo) {
|
||||
List<CustomerExportVo> list = customerMapper.exportAdmin(bo);
|
||||
ExcelUtil<CustomerExportVo> util = new ExcelUtil<>(CustomerExportVo.class);
|
||||
return util.exportExcel(list, "客户");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('dk:dkCustomer:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult<Customer> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(customerService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('dk:dkCustomer:edit')")
|
||||
@Log(title = "客户", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody Customer bo) {
|
||||
return toAjax(customerService.updateById(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable String ids) {
|
||||
List<String> idList = Stream.of(ids.split(",")).collect(Collectors.toList());
|
||||
return toAjax(customerService.removeByIds(idList) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "修改密码" , businessType = BusinessType.DELETE)
|
||||
@PostMapping("/resetPwd")
|
||||
public AjaxResult<Void> resetPwd(@RequestBody UpdatePwdCustomerReq customer) {
|
||||
return toAjax(customerService.updatePwd(customer.getCustomerId(),customer.getPassword()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.bashi.dk.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bashi.common.annotation.Log;
|
||||
import com.bashi.common.annotation.RepeatSubmit;
|
||||
import com.bashi.common.com.Condition;
|
||||
import com.bashi.common.com.PageParams;
|
||||
import com.bashi.common.core.controller.BaseController;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.core.page.TableDataInfo;
|
||||
import com.bashi.common.enums.BusinessType;
|
||||
import com.bashi.common.utils.PageUtils;
|
||||
import com.bashi.dk.domain.CustomerInfo;
|
||||
import com.bashi.dk.service.CustomerInfoService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/dk/dkCustomerInfo")
|
||||
public class DkCustomerInfoController extends BaseController {
|
||||
|
||||
private final CustomerInfoService customerInfoService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('dk:dkCustomerInfo:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CustomerInfo> list(PageParams pageParams, @Validated CustomerInfo bo) {
|
||||
IPage<CustomerInfo> page = customerInfoService.page(Condition.getPage(pageParams), Wrappers.query(bo));
|
||||
return PageUtils.buildDataInfo(page);
|
||||
}
|
||||
|
||||
@GetMapping("/getInfoByCustomerId")
|
||||
public AjaxResult<CustomerInfo> getInfoByCustomer(Long customerId) {
|
||||
return AjaxResult.success(customerInfoService.getByCustomerId(customerId));
|
||||
}
|
||||
|
||||
@PostMapping("/updateAllowSignature")
|
||||
public AjaxResult<Void> updateAllowSignature(@RequestBody CustomerInfo bo) {
|
||||
customerInfoService.updateAllowSignature(bo);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('dk:dkCustomerInfo:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult<CustomerInfo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(customerInfoService.getById(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('dk:dkCustomerInfo:edit')")
|
||||
@Log(title = "客户资料", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody CustomerInfo bo) {
|
||||
return toAjax(customerInfoService.updateById(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.bashi.dk.controller;
|
||||
|
||||
import com.bashi.common.annotation.Log;
|
||||
import com.bashi.common.annotation.RepeatSubmit;
|
||||
import com.bashi.common.core.controller.BaseController;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.enums.BusinessType;
|
||||
import com.bashi.dk.domain.HomeSetting;
|
||||
import com.bashi.dk.service.HomeSettingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 常规设置Controller
|
||||
*
|
||||
* @author duteliang
|
||||
* @date 2023-11-29
|
||||
*/
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/dk/HomeSetting")
|
||||
public class DkHomeSettingController extends BaseController {
|
||||
|
||||
private final HomeSettingService homeSettingService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取常规设置详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:HomeSetting:query')")
|
||||
@GetMapping("/info")
|
||||
public AjaxResult<HomeSetting> getInfo() {
|
||||
return AjaxResult.success(homeSettingService.getHomeSetting());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常规设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:HomeSetting:edit')")
|
||||
@Log(title = "常规设置", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody HomeSetting bo) {
|
||||
return toAjax(homeSettingService.updateById(bo) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.bashi.dk.controller;
|
||||
|
||||
import com.bashi.common.annotation.Log;
|
||||
import com.bashi.common.annotation.RepeatSubmit;
|
||||
import com.bashi.common.core.controller.BaseController;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.enums.BusinessType;
|
||||
import com.bashi.dk.domain.LoansSetting;
|
||||
import com.bashi.dk.service.LoansSettingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 贷款设置Controller
|
||||
*
|
||||
* @author duteliang
|
||||
* @date 2023-11-29
|
||||
*/
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/dk/LoansSetting")
|
||||
public class DkLoansSettingController extends BaseController {
|
||||
|
||||
private final LoansSettingService loansSettingService;
|
||||
|
||||
/**
|
||||
* 获取贷款设置详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:LoansSetting:query')")
|
||||
@GetMapping("/info")
|
||||
public AjaxResult<LoansSetting> getInfo() {
|
||||
return AjaxResult.success(loansSettingService.getLoansSetting());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改贷款设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dk:LoansSetting:edit')")
|
||||
@Log(title = "贷款设置", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody LoansSetting bo) {
|
||||
return toAjax(loansSettingService.updateById(bo) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.bashi.dk.controller.app;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bashi.common.com.Condition;
|
||||
import com.bashi.common.com.PageParams;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.core.page.TableDataInfo;
|
||||
import com.bashi.common.utils.BeanConvertUtil;
|
||||
import com.bashi.common.utils.PageUtils;
|
||||
import com.bashi.common.utils.SecurityUtils;
|
||||
import com.bashi.dk.domain.Borrow;
|
||||
import com.bashi.dk.dto.app.req.BorrowStartReq;
|
||||
import com.bashi.dk.dto.app.resp.BorrowInfo;
|
||||
import com.bashi.dk.dto.app.resp.LoanProcessResp;
|
||||
import com.bashi.dk.service.BorrowService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/borrow")
|
||||
@Api(value = "贷款相关的接口", tags = {"贷款相关的接口"})
|
||||
public class AppBorrowController {
|
||||
|
||||
@Autowired
|
||||
private BorrowService borrowService;
|
||||
|
||||
@PostMapping("/start")
|
||||
@ApiOperation(value = "发起贷款")
|
||||
public AjaxResult<Borrow> start(@RequestBody BorrowStartReq req){
|
||||
req.setCustomerId(SecurityUtils.getLoginUser().getCustomer().getId());
|
||||
Borrow borrow = borrowService.borrow(req);
|
||||
return AjaxResult.success(borrow);
|
||||
}
|
||||
|
||||
@GetMapping("/withdraw")
|
||||
@ApiOperation(value = "提现")
|
||||
public AjaxResult<Void> withdraw(@ApiParam("提现金额") Double withdrawAmount){
|
||||
Long customerId = SecurityUtils.getLoginUser().getCustomer().getId();
|
||||
borrowService.withdraw(withdrawAmount,customerId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getStepBorrow")
|
||||
@ApiOperation(value = "获取贷款进度")
|
||||
public AjaxResult<LoanProcessResp> getStepBorrow(){
|
||||
Long customerId = SecurityUtils.getLoginUser().getCustomer().getId();
|
||||
LoanProcessResp stepBorrow = borrowService.getStepBorrow(customerId);
|
||||
return AjaxResult.success(stepBorrow);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/info")
|
||||
@ApiOperation(value = "查看贷款详情")
|
||||
public AjaxResult<BorrowInfo> info(String tradeNo){
|
||||
Borrow borrow = borrowService.getByTradeNo(tradeNo);
|
||||
BorrowInfo borrowInfo = BeanConvertUtil.convertTo(borrow, BorrowInfo::new);
|
||||
LoanProcessResp stepBorrow = borrowService.parseStepBorrow(borrow);
|
||||
borrowInfo.setLoanProcessResp(stepBorrow);
|
||||
return AjaxResult.success(borrowInfo);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation(value = "分页查询贷款我的贷款")
|
||||
public TableDataInfo<Borrow> page(PageParams pageParams){
|
||||
Long customerId = SecurityUtils.getLoginUser().getCustomer().getId();
|
||||
LambdaQueryWrapper<Borrow> query = Wrappers.lambdaQuery(Borrow.class)
|
||||
.eq(Borrow::getCustomerId,customerId)
|
||||
.orderByDesc(Borrow::getCreateTime);
|
||||
IPage<Borrow> page = borrowService.page(Condition.getPage(pageParams), query);
|
||||
return PageUtils.buildDataInfo(page);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getContract")
|
||||
public AjaxResult<String> getContract(String tradeNo){
|
||||
String contract = borrowService.getContract(tradeNo);
|
||||
AjaxResult<String> success = AjaxResult.success();
|
||||
success.setData(contract);
|
||||
return success;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.bashi.dk.controller.app;
|
||||
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.common.utils.SecurityUtils;
|
||||
import com.bashi.dk.domain.CustomerInfo;
|
||||
import com.bashi.dk.service.CustomerInfoService;
|
||||
import com.bashi.dk.service.CustomerService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/customer")
|
||||
@Api(value = "客户接口", tags = {"客户接口"})
|
||||
public class AppCustomerController {
|
||||
|
||||
@Autowired
|
||||
private CustomerInfoService customerInfoService;
|
||||
@Autowired
|
||||
private CustomerService customerService;
|
||||
|
||||
@GetMapping("/info")
|
||||
@ApiOperation(value = "客户信息")
|
||||
public AjaxResult<Customer> info(){
|
||||
Customer customer = SecurityUtils.getLoginUser().getCustomer();
|
||||
customer = customerService.getById(customer.getId());
|
||||
return AjaxResult.success(customer);
|
||||
}
|
||||
|
||||
@GetMapping("/card/info")
|
||||
@ApiOperation(value = "客户资料信息")
|
||||
public AjaxResult<CustomerInfo> cardInfo(){
|
||||
Customer customer = SecurityUtils.getLoginUser().getCustomer();
|
||||
CustomerInfo customerInfo = customerInfoService.getByCustomerId(customer.getId());
|
||||
return AjaxResult.success(customerInfo);
|
||||
}
|
||||
|
||||
@PostMapping("/updateCustomerCard")
|
||||
@ApiOperation(value = "修改客户资料信息")
|
||||
public AjaxResult<Void> updateCustomerCard(@RequestBody CustomerInfo customerInfo){
|
||||
Customer customer = SecurityUtils.getLoginUser().getCustomer();
|
||||
customerInfo.setCustomerId(customer.getId());
|
||||
customerInfoService.updateCustomerInfo(customerInfo);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.bashi.dk.controller.app;
|
||||
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.common.core.redis.RedisCache;
|
||||
import com.bashi.common.exception.CustomException;
|
||||
import com.bashi.dk.dto.app.req.CustomerRegisterReq;
|
||||
import com.bashi.dk.dto.app.req.UpdatePwdOpenReq;
|
||||
import com.bashi.dk.service.CustomerService;
|
||||
import com.bashi.framework.constant.CodeType;
|
||||
import com.bashi.framework.web.service.CodeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RequestMapping("/customer/open")
|
||||
@RestController
|
||||
@Api(value = "用户开放接口", tags = {"用户开放接口"})
|
||||
public class AppCustomerOpenController {
|
||||
@Autowired
|
||||
private CodeService codeService;
|
||||
@Autowired
|
||||
private CustomerService customerService;
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@GetMapping("/sms/register")
|
||||
@ApiOperation("用户注册-验证码")
|
||||
public AjaxResult<String> customerRegister(String phoneNumber) {
|
||||
String numbers = RandomUtil.randomNumbers(6);
|
||||
codeService.put(phoneNumber, CodeType.CUSTOMER_REGISTER,numbers);
|
||||
AjaxResult<String> success = AjaxResult.success();
|
||||
success.setData(numbers);
|
||||
return success;
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
@ApiOperation("用户注册")
|
||||
public AjaxResult<Void> customerRegister(@RequestBody CustomerRegisterReq register) {
|
||||
if(!codeService.check(register.getPhoneNumber(), CodeType.CUSTOMER_REGISTER,register.getCode())){
|
||||
throw new CustomException("验证码错误");
|
||||
}
|
||||
customerService.register(register);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/sms/forget")
|
||||
@ApiOperation("忘记密码-验证码")
|
||||
public AjaxResult<String> customerForgetPassword(String phoneNumber) {
|
||||
String numbers = RandomUtil.randomNumbers(6);
|
||||
codeService.put(phoneNumber, CodeType.CUSTOMER_FORGET_PASSWORD,numbers);
|
||||
AjaxResult<String> success = AjaxResult.success();
|
||||
success.setData(numbers);
|
||||
return success;
|
||||
}
|
||||
|
||||
@GetMapping("/sms/forget/check")
|
||||
@ApiOperation("忘记密码-验证码-校验")
|
||||
public AjaxResult<String> customerForgetPasswordCheck(String phoneNumber,String code) {
|
||||
if(!codeService.check(phoneNumber, CodeType.CUSTOMER_REGISTER,code)){
|
||||
throw new CustomException("验证码错误");
|
||||
}
|
||||
Customer customer = customerService.getCustomerByName(phoneNumber);
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
redisCache.setCacheObject(uuid,customer);
|
||||
AjaxResult<String> success = AjaxResult.success();
|
||||
success.setData(uuid);
|
||||
return success;
|
||||
}
|
||||
|
||||
@PostMapping("/updatePwd")
|
||||
@ApiOperation("修改密码")
|
||||
public AjaxResult<String> customerForgetPasswordCheck(@RequestBody UpdatePwdOpenReq updatePwdOpenReq) {
|
||||
Customer customer = redisCache.getCacheObject(updatePwdOpenReq.getCheckCode());
|
||||
if(customer == null){
|
||||
throw new CustomException("密码修改失败,请重新获取验证码操作");
|
||||
}
|
||||
if(!updatePwdOpenReq.getPassword().equals(updatePwdOpenReq.getConfirmPassword())){
|
||||
throw new CustomException("密码不一致");
|
||||
}
|
||||
customerService.updatePwd(customer.getId(),updatePwdOpenReq.getPassword());
|
||||
AjaxResult<String> success = AjaxResult.success();
|
||||
return success;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
package com.bashi.dk.controller.app;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.utils.BeanConvertUtil;
|
||||
import com.bashi.dk.domain.LoansSetting;
|
||||
import com.bashi.dk.dto.app.req.CalLoanReq;
|
||||
import com.bashi.dk.dto.app.resp.CalLoanResp;
|
||||
import com.bashi.dk.dto.app.resp.LoanUser;
|
||||
import com.bashi.dk.kit.CalLoanManager;
|
||||
import com.bashi.dk.service.LoansSettingService;
|
||||
import com.bashi.dk.util.Loan;
|
||||
import com.bashi.dk.util.PhoneRandomUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Random;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/home/loans")
|
||||
@Api(value = "首页开放", tags = {"首页开放"})
|
||||
public class AppHomeController {
|
||||
|
||||
@Autowired
|
||||
private CalLoanManager calLoanManager;
|
||||
@Autowired
|
||||
private LoansSettingService loansSettingService;
|
||||
|
||||
@PostMapping("/calLoan")
|
||||
@ApiOperation(value = "计算每月还款")
|
||||
public AjaxResult<CalLoanResp> calLoan(@RequestBody CalLoanReq calLoanReq) {
|
||||
if(calLoanReq.getTotalLoanMoney() == null || calLoanReq.getTotalMonth() == null){
|
||||
LoansSetting loansSetting = loansSettingService.getLoansSetting();
|
||||
if(calLoanReq.getTotalLoanMoney() == null){
|
||||
calLoanReq.setTotalLoanMoney(loansSetting.getLoansInitAccount());
|
||||
}
|
||||
if(calLoanReq.getTotalMonth() == null){
|
||||
calLoanReq.setTotalMonth(Integer.valueOf(loansSetting.getLoansInitMonth()));
|
||||
}
|
||||
}
|
||||
Loan loan = calLoanManager.calLoan(calLoanReq);
|
||||
CalLoanResp calLoanResp = BeanConvertUtil.convertTo(loan, CalLoanResp::new);
|
||||
return AjaxResult.success(calLoanResp);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/loansUser")
|
||||
@ApiOperation(value = "获取贷款用户")
|
||||
public AjaxResult<LoanUser> loansUser() {
|
||||
Random random = new Random();
|
||||
LoanUser loanUser = new LoanUser();
|
||||
loanUser.setPhone(PhoneRandomUtil.gen());
|
||||
loanUser.setAmount(RandomUtil.randomInt(10,100)+"000");
|
||||
loanUser.setTime(LocalDate.now().plusDays(-random.nextInt(7)).format(DateTimeFormatter.ofPattern("yyyy/MM/dd")));
|
||||
return AjaxResult.success(loanUser);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.bashi.dk.controller.app;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.utils.BeanConvertUtil;
|
||||
import com.bashi.dk.domain.AgreementSetting;
|
||||
import com.bashi.dk.domain.HomeSetting;
|
||||
import com.bashi.dk.domain.LoansSetting;
|
||||
import com.bashi.dk.dto.app.resp.LoansSettingVO;
|
||||
import com.bashi.dk.enums.BankTypeEnums;
|
||||
import com.bashi.dk.service.AgreementSettingService;
|
||||
import com.bashi.dk.service.HomeSettingService;
|
||||
import com.bashi.dk.service.LoansSettingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/home/setting")
|
||||
@Api(value = "设置信息", tags = {"设置信息"})
|
||||
public class AppSettingController {
|
||||
|
||||
@Autowired
|
||||
private AgreementSettingService agreementSettingService;
|
||||
@Autowired
|
||||
private HomeSettingService homeSettingService;
|
||||
@Autowired
|
||||
private LoansSettingService loansSettingService;
|
||||
|
||||
@GetMapping("/agreement")
|
||||
@ApiOperation(value = "协议内容")
|
||||
public AjaxResult<AgreementSetting> agreement() {
|
||||
AgreementSetting setting = agreementSettingService.getAgreementSetting();
|
||||
return AjaxResult.success(setting);
|
||||
}
|
||||
|
||||
@GetMapping("/home")
|
||||
@ApiOperation(value = "常规内容")
|
||||
public AjaxResult<HomeSetting> home() {
|
||||
HomeSetting setting = homeSettingService.getHomeSetting();
|
||||
return AjaxResult.success(setting);
|
||||
}
|
||||
|
||||
@GetMapping("/bankType")
|
||||
@ApiOperation(value = "获取银行列表")
|
||||
public AjaxResult<List<String>> bankType(){
|
||||
List<String> list = Arrays.stream(BankTypeEnums.values()).map(BankTypeEnums::getName).collect(Collectors.toList());
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/loans")
|
||||
@ApiOperation(value = "贷款信息")
|
||||
public AjaxResult<LoansSetting> loans() {
|
||||
LoansSetting setting = loansSettingService.getLoansSetting();
|
||||
LoansSettingVO vo = BeanConvertUtil.convertTo(setting, LoansSettingVO::new);
|
||||
Double minDayServiceRate = Arrays.stream(setting.getServiceRate().split(","))
|
||||
.map(Double::valueOf).min(Double::compareTo).orElse(null);
|
||||
if(minDayServiceRate != null){
|
||||
minDayServiceRate = NumberUtil.div(minDayServiceRate, new Double(30D), 4);
|
||||
}else{
|
||||
minDayServiceRate = 0D;
|
||||
}
|
||||
vo.setMinDayServiceRate(minDayServiceRate);
|
||||
return AjaxResult.success(setting);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.bashi.dk.controller.app;
|
||||
|
||||
import com.bashi.common.constant.Constants;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.common.core.domain.model.LoginPhoneBody;
|
||||
import com.bashi.dk.kit.DkLoginKit;
|
||||
import com.bashi.framework.security.sms.LoginTypeEnums;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
public class LoginV2Controller {
|
||||
@Autowired
|
||||
private DkLoginKit dkLoginKit;
|
||||
|
||||
@PostMapping("/customer/login")
|
||||
@ApiOperation("用户登陆")
|
||||
public AjaxResult loginCustomer(@RequestBody LoginPhoneBody loginBody) {
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
loginBody.setLoginRole(LoginTypeEnums.CUSTOMER_PASSWORD.getCode());
|
||||
// 生成令牌
|
||||
String token = dkLoginKit.login(loginBody);
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return AjaxResult.success(ajax);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.bashi.dk.controller.app;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.bashi.common.core.domain.AjaxResult;
|
||||
import com.bashi.dk.manager.FileUploadManager;
|
||||
import com.bashi.dk.manager.FileUploadRes;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.x.file.storage.core.FileInfo;
|
||||
import org.dromara.x.file.storage.core.FileStorageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* <p>created on 2021/7/13</p>
|
||||
*
|
||||
* @author zhangliang
|
||||
*/
|
||||
@RestController
|
||||
@Api(value = "通用接口", tags = {"通用接口"})
|
||||
@Slf4j
|
||||
public class V2CommonController {
|
||||
@Autowired
|
||||
private FileStorageService fileStorageService;
|
||||
|
||||
@PostMapping("/v2/common/upload")
|
||||
@ApiOperation("文件上传")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
||||
try {
|
||||
FileInfo upload = fileStorageService.of(file).setPath("upload/").upload();
|
||||
FileUploadRes fileUploadRes = new FileUploadRes();
|
||||
fileUploadRes.setUrl(upload.getUrl());
|
||||
fileUploadRes.setFileName(upload.getOriginalFilename());
|
||||
log.info("sss={}", JSON.toJSONString(upload));
|
||||
return AjaxResult.success(fileUploadRes);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.bashi.dk.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 协议设置
|
||||
* @TableName dk_agreement_setting
|
||||
*/
|
||||
@TableName(value ="dk_agreement_setting")
|
||||
@Data
|
||||
@ApiModel("协议设置对象")
|
||||
public class AgreementSetting implements Serializable {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 借款协议
|
||||
*/
|
||||
@ApiModelProperty("借款协议")
|
||||
private String loansAgreement;
|
||||
|
||||
/**
|
||||
* 服务协议
|
||||
*/
|
||||
@ApiModelProperty("服务协议")
|
||||
private String serviceAgreement;
|
||||
|
||||
/**
|
||||
* 授权协议
|
||||
*/
|
||||
@ApiModelProperty("授权协议")
|
||||
private String authAgreement;
|
||||
|
||||
/**
|
||||
* 法律责任
|
||||
*/
|
||||
@ApiModelProperty("法律责任")
|
||||
private String lawAgreement;
|
||||
|
||||
private String contractTemplate;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
210
bashi-dk/src/main/java/com/bashi/dk/domain/Borrow.java
Normal file
210
bashi-dk/src/main/java/com/bashi/dk/domain/Borrow.java
Normal file
@@ -0,0 +1,210 @@
|
||||
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.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 借款计划对象 dk_borrow
|
||||
*
|
||||
* @author duteliang
|
||||
* @date 2023-11-29
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("dk_borrow")
|
||||
@ApiModel("借款计划")
|
||||
public class Borrow implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/** ID */
|
||||
@TableId(value = "id")
|
||||
@ApiModelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("用途说明")
|
||||
private String noteRemark;
|
||||
|
||||
|
||||
private Boolean auditFlag;
|
||||
|
||||
/** 订单编号 */
|
||||
@ApiModelProperty("订单编号")
|
||||
private String tradeNo;
|
||||
|
||||
/** 总贷款额 */
|
||||
@ApiModelProperty("总贷款额")
|
||||
private BigDecimal totalLoanMoney;
|
||||
|
||||
/** 还款月数 */
|
||||
@ApiModelProperty("还款月数")
|
||||
private Integer totalMonth;
|
||||
|
||||
/** 月利率 */
|
||||
@ApiModelProperty("月利率")
|
||||
private Double loanMonthRate;
|
||||
|
||||
/** 年利率 */
|
||||
@ApiModelProperty("年利率")
|
||||
private Double loanYearRate;
|
||||
|
||||
/** 总利息数 */
|
||||
@ApiModelProperty("总利息数")
|
||||
private BigDecimal totalInterest;
|
||||
|
||||
/** 还款总额 */
|
||||
@ApiModelProperty("还款总额")
|
||||
private BigDecimal totalRepayment;
|
||||
|
||||
/** 首月还款额 */
|
||||
@ApiModelProperty("首月还款额")
|
||||
private BigDecimal firstRepayment;
|
||||
|
||||
/** 每月还款额 */
|
||||
@ApiModelProperty("每月还款额")
|
||||
private BigDecimal avgRepayment;
|
||||
|
||||
/** 每月还款日 */
|
||||
@ApiModelProperty("每月还款日")
|
||||
private Integer dueDate;
|
||||
|
||||
/** 是否打款 */
|
||||
@ApiModelProperty("是否打款")
|
||||
private Integer remitFlag;
|
||||
|
||||
@ApiModelProperty("客户电话")
|
||||
private String customerPhone;
|
||||
|
||||
/** 借款状态 */
|
||||
@ApiModelProperty("借款状态")
|
||||
private String borrowName;
|
||||
|
||||
@ApiModelProperty("借款状态样式")
|
||||
private String borrowNameStyle;
|
||||
|
||||
/** 借款说明 */
|
||||
@ApiModelProperty("借款说明")
|
||||
private String borrowRemark;
|
||||
|
||||
/** 还款说明 */
|
||||
@ApiModelProperty("还款说明")
|
||||
private String repayRemark;
|
||||
|
||||
/** 计划 */
|
||||
@ApiModelProperty("计划")
|
||||
private String infoJson;
|
||||
|
||||
/** 客户ID */
|
||||
@ApiModelProperty("客户ID")
|
||||
private Long customerId;
|
||||
|
||||
/** 真实姓名 */
|
||||
@ApiModelProperty("真实姓名")
|
||||
private String realName;
|
||||
|
||||
/** 身份证照片 */
|
||||
@ApiModelProperty("身份证照片")
|
||||
private String cardNum;
|
||||
|
||||
/** 身份证正面 */
|
||||
@ApiModelProperty("身份证正面")
|
||||
private String cardFrontPicture;
|
||||
|
||||
private String handCardPicture;
|
||||
|
||||
/** 身份证背面 */
|
||||
@ApiModelProperty("身份证背面")
|
||||
private String cardBackPicture;
|
||||
|
||||
/** 单位名称 */
|
||||
@ApiModelProperty("单位名称")
|
||||
private String companyName;
|
||||
|
||||
/** 职位 */
|
||||
@ApiModelProperty("职位")
|
||||
private String companyTitle;
|
||||
|
||||
/** 单位电话 */
|
||||
@ApiModelProperty("单位电话")
|
||||
private String companyPhone;
|
||||
|
||||
/** 工作年龄 */
|
||||
@ApiModelProperty("工作年龄")
|
||||
private String companyYear;
|
||||
|
||||
/** 单位地址 */
|
||||
@ApiModelProperty("单位地址")
|
||||
private String companyAddress;
|
||||
|
||||
/** 详细地址 */
|
||||
@ApiModelProperty("详细地址")
|
||||
private String companyAddressInfo;
|
||||
|
||||
/** 现居住地址 */
|
||||
@ApiModelProperty("现居住地址")
|
||||
private String customerAddress;
|
||||
|
||||
/** 详细地址 */
|
||||
@ApiModelProperty("详细地址")
|
||||
private String customerAddressInfo;
|
||||
|
||||
/** 亲属姓名 */
|
||||
@ApiModelProperty("亲属姓名")
|
||||
private String kinsfolkName;
|
||||
|
||||
/** 亲属电话 */
|
||||
@ApiModelProperty("亲属电话")
|
||||
private String kinsfolkPhone;
|
||||
|
||||
/** 亲属关系 1-父母、2-配偶、3-子女,4-祖父母 */
|
||||
@ApiModelProperty("亲属关系 1-父母、2-配偶、3-子女,4-祖父母")
|
||||
private String kinsfolkRef;
|
||||
|
||||
@ApiModelProperty("转账备注")
|
||||
private String transRemark;
|
||||
|
||||
/** $column.columnComment */
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
private String bankType;
|
||||
|
||||
/** $column.columnComment */
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
private String backCardNum;
|
||||
|
||||
/** $column.columnComment */
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
private String firstBankType;
|
||||
|
||||
/** $column.columnComment */
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
private String firstBackCardNum;
|
||||
|
||||
/** 修改银行卡次数 */
|
||||
@ApiModelProperty("修改银行卡次数")
|
||||
private Integer updateBackNum;
|
||||
|
||||
@ApiModelProperty("收入(万)")
|
||||
private BigDecimal incomeWan;
|
||||
|
||||
/** 创建时间 */
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/** 修改时间 */
|
||||
@ApiModelProperty("修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
21
bashi-dk/src/main/java/com/bashi/dk/domain/BorrowLog.java
Normal file
21
bashi-dk/src/main/java/com/bashi/dk/domain/BorrowLog.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.bashi.dk.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("dk_borrow_log")
|
||||
public class BorrowLog {
|
||||
|
||||
/** ID */
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
private Double withdrawAccount;
|
||||
private Long customerId;
|
||||
|
||||
}
|
||||
59
bashi-dk/src/main/java/com/bashi/dk/domain/BorrowStatus.java
Normal file
59
bashi-dk/src/main/java/com/bashi/dk/domain/BorrowStatus.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.bashi.dk.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 借款状态对象 dk_borrow_status
|
||||
*
|
||||
* @author duteliang
|
||||
* @date 2023-11-29
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("dk_borrow_status")
|
||||
@ApiModel("借款状态添加对象")
|
||||
public class BorrowStatus implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/** ID */
|
||||
@TableId(value = "id")
|
||||
@ApiModelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
/** 是否可以打款 */
|
||||
@ApiModelProperty("是否可以打款")
|
||||
private Integer usedRemit;
|
||||
|
||||
/** 借款状态 */
|
||||
@ApiModelProperty("借款状态")
|
||||
private String borrowName;
|
||||
|
||||
/** 借款说明 */
|
||||
@ApiModelProperty("借款说明")
|
||||
private String borrowRemark;
|
||||
|
||||
@ApiModelProperty("借款样式")
|
||||
private String borrowNameStyle;
|
||||
|
||||
/** 创建时间 */
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/** 修改时间 */
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@ApiModelProperty("修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
162
bashi-dk/src/main/java/com/bashi/dk/domain/CustomerInfo.java
Normal file
162
bashi-dk/src/main/java/com/bashi/dk/domain/CustomerInfo.java
Normal file
@@ -0,0 +1,162 @@
|
||||
package com.bashi.dk.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 客户资料
|
||||
* @TableName dk_customer_info
|
||||
*/
|
||||
@TableName(value ="dk_customer_info")
|
||||
@Data
|
||||
@ApiModel("客户资料")
|
||||
public class CustomerInfo implements Serializable {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("身份信息完整度")
|
||||
private Boolean cardFlag = false;
|
||||
@ApiModelProperty("资料信息完整度")
|
||||
private Boolean infoFlag = false;
|
||||
@ApiModelProperty("银行卡信息完整度")
|
||||
private Boolean bankFlag = false;
|
||||
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
@ApiModelProperty("客户ID")
|
||||
private Long customerId;
|
||||
|
||||
@ApiModelProperty("客户电话")
|
||||
private String customerPhone;
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@ApiModelProperty("真实姓名")
|
||||
private String realName;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
@ApiModelProperty("身份证号码")
|
||||
private String cardNum;
|
||||
|
||||
/**
|
||||
* 身份证正面
|
||||
*/
|
||||
@ApiModelProperty("身份证正面")
|
||||
private String cardFrontPicture;
|
||||
|
||||
/**
|
||||
* 手持身份证照片
|
||||
*/
|
||||
@ApiModelProperty("手持身份证照片")
|
||||
private String handCardPicture;
|
||||
|
||||
/**
|
||||
* 身份证背面
|
||||
*/
|
||||
@ApiModelProperty("身份证背面")
|
||||
private String cardBackPicture;
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
@ApiModelProperty("单位名称")
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 职位
|
||||
*/
|
||||
@ApiModelProperty("职位")
|
||||
private String companyTitle;
|
||||
|
||||
/**
|
||||
* 单位电话
|
||||
*/
|
||||
@ApiModelProperty("单位电话")
|
||||
private String companyPhone;
|
||||
|
||||
/**
|
||||
* 工作年龄
|
||||
*/
|
||||
@ApiModelProperty("工作年龄")
|
||||
private String companyYear;
|
||||
|
||||
/**
|
||||
* 单位地址
|
||||
*/
|
||||
@ApiModelProperty("单位地址")
|
||||
private String companyAddress;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@ApiModelProperty("详细地址")
|
||||
private String companyAddressInfo;
|
||||
|
||||
/**
|
||||
* 现居住地址
|
||||
*/
|
||||
@ApiModelProperty("现居住地址")
|
||||
private String customerAddress;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@ApiModelProperty("详细地址")
|
||||
private String customerAddressInfo;
|
||||
|
||||
@ApiModelProperty("收入(万)")
|
||||
private BigDecimal incomeWan;
|
||||
|
||||
/**
|
||||
* 亲属姓名
|
||||
*/
|
||||
@ApiModelProperty("亲属姓名")
|
||||
private String kinsfolkName;
|
||||
|
||||
/**
|
||||
* 亲属电话
|
||||
*/
|
||||
@ApiModelProperty("亲属电话")
|
||||
private String kinsfolkPhone;
|
||||
|
||||
/**
|
||||
* 亲属关系 1-父母、2-配偶、3-子女,4-祖父母
|
||||
*/
|
||||
@ApiModelProperty("亲属关系 1-父母、2-配偶、3-子女,4-祖父母")
|
||||
private String kinsfolkRef;
|
||||
|
||||
/**
|
||||
* 开户银行
|
||||
*/
|
||||
@ApiModelProperty("开户银行")
|
||||
private String bankType;
|
||||
|
||||
/**
|
||||
* 银行卡号
|
||||
*/
|
||||
@ApiModelProperty("银行卡号")
|
||||
private String backCardNum;
|
||||
|
||||
@ApiModelProperty("签名")
|
||||
private String signature;
|
||||
|
||||
private Boolean allowSignature = true;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
42
bashi-dk/src/main/java/com/bashi/dk/domain/HomeSetting.java
Normal file
42
bashi-dk/src/main/java/com/bashi/dk/domain/HomeSetting.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.bashi.dk.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 常规设置
|
||||
* @TableName dk_home_setting
|
||||
*/
|
||||
@TableName(value ="dk_home_setting")
|
||||
@Data
|
||||
public class HomeSetting implements Serializable {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 站点标题
|
||||
*/
|
||||
private String homeTitle;
|
||||
|
||||
/**
|
||||
* banner图
|
||||
*/
|
||||
private String bannerOne;
|
||||
|
||||
/**
|
||||
* 公章
|
||||
*/
|
||||
private String commonSeal;
|
||||
|
||||
|
||||
private String chatUrl;
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
61
bashi-dk/src/main/java/com/bashi/dk/domain/LoansSetting.java
Normal file
61
bashi-dk/src/main/java/com/bashi/dk/domain/LoansSetting.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package com.bashi.dk.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 贷款设置
|
||||
* @TableName dk_loans_setting
|
||||
*/
|
||||
@TableName(value ="dk_loans_setting")
|
||||
@Data
|
||||
public class LoansSetting implements Serializable {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 贷款最小金额(元)
|
||||
*/
|
||||
private BigDecimal loansMinAccount;
|
||||
|
||||
/**
|
||||
* 贷款最大金额(元)
|
||||
*/
|
||||
private BigDecimal loansMaxAccount;
|
||||
|
||||
/**
|
||||
* 贷款初始金额(元)
|
||||
*/
|
||||
private BigDecimal loansInitAccount;
|
||||
|
||||
/**
|
||||
* 允许选择月份
|
||||
*/
|
||||
private String loansMonth;
|
||||
|
||||
/**
|
||||
* 初始选择月份
|
||||
*/
|
||||
private String loansInitMonth;
|
||||
|
||||
/**
|
||||
* 每月还款日
|
||||
*/
|
||||
private Integer dueDate;
|
||||
|
||||
/**
|
||||
* 服务费率
|
||||
*/
|
||||
private String serviceRate;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.bashi.dk.dto.admin.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BorrowUpdateStatusReq {
|
||||
private Long id;
|
||||
private Integer usedRemit;
|
||||
private String borrowName;
|
||||
private String borrowRemark;
|
||||
private String borrowNameStyle;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.bashi.dk.dto.admin.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdatePwdCustomerReq {
|
||||
private Long customerId;
|
||||
private String password;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.bashi.dk.dto.admin.resp;
|
||||
|
||||
import com.bashi.dk.domain.Borrow;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BorrowResp extends Borrow {
|
||||
|
||||
private String customerLoginName;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.bashi.dk.dto.admin.resp;
|
||||
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CustomerAdminResp extends Customer {
|
||||
private String realName;
|
||||
|
||||
private Boolean allowSignature = true;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.bashi.dk.dto.admin.resp;
|
||||
|
||||
import com.bashi.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CustomerExportVo {
|
||||
|
||||
@Excel(name = "登陆手机号")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
@Excel(name = "登陆手机号")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 是否实名
|
||||
*/
|
||||
@Excel(name = "是否实名",readConverterExp = "0=否,1=是")
|
||||
private Integer realNameAuth;
|
||||
|
||||
/**
|
||||
* 是否贷款
|
||||
*/
|
||||
@Excel(name = "是否贷款",readConverterExp = "0=否,1=是")
|
||||
private Integer loansFlag;
|
||||
|
||||
/**
|
||||
* 是否提现
|
||||
*/
|
||||
@Excel(name = "是否提现",readConverterExp = "0=否,1=是")
|
||||
private Integer withdrawFlag;
|
||||
|
||||
@Excel(name = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
@Excel(name = "身份证号码")
|
||||
private String cardNum;
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
@Excel(name = "单位名称")
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 职位
|
||||
*/
|
||||
@Excel(name = "职位")
|
||||
private String companyTitle;
|
||||
|
||||
/**
|
||||
* 单位电话
|
||||
*/
|
||||
@Excel(name = "单位电话")
|
||||
private String companyPhone;
|
||||
|
||||
/**
|
||||
* 工作年龄
|
||||
*/
|
||||
@Excel(name = "工作年龄")
|
||||
private String companyYear;
|
||||
|
||||
/**
|
||||
* 单位地址
|
||||
*/
|
||||
@Excel(name = "单位地址")
|
||||
private String companyAddress;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@Excel(name = "详细地址")
|
||||
private String companyAddressInfo;
|
||||
|
||||
/**
|
||||
* 现居住地址
|
||||
*/
|
||||
@Excel(name = "现居住地址")
|
||||
private String customerAddress;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@Excel(name = "详细地址")
|
||||
private String customerAddressInfo;
|
||||
|
||||
@Excel(name = "亲属关系",readConverterExp = "1=父母,2=配偶,3=子女,4=祖父母")
|
||||
private String kinsfolkRef;
|
||||
/**
|
||||
* 亲属姓名
|
||||
*/
|
||||
@Excel(name = "亲属姓名")
|
||||
private String kinsfolkName;
|
||||
|
||||
/**
|
||||
* 亲属电话
|
||||
*/
|
||||
@Excel(name = "亲属电话")
|
||||
private String kinsfolkPhone;
|
||||
|
||||
|
||||
/**
|
||||
* 开户银行
|
||||
*/
|
||||
@Excel(name = "开户银行")
|
||||
private String bankType;
|
||||
|
||||
/**
|
||||
* 银行卡号
|
||||
*/
|
||||
@Excel(name = "银行卡号")
|
||||
private String backCardNum;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.bashi.dk.dto.admin.resp;
|
||||
|
||||
import com.bashi.common.constant.DateConstant;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class CustomerInfo {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 手机
|
||||
*/
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 是否实名
|
||||
*/
|
||||
private Integer realNameAuth;
|
||||
|
||||
/**
|
||||
* 是否贷款
|
||||
*/
|
||||
private Integer loansFlag;
|
||||
|
||||
/**
|
||||
* 是否提现
|
||||
*/
|
||||
private Integer withdrawFlag;
|
||||
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
private Long account;
|
||||
|
||||
/**
|
||||
* 可提现金额
|
||||
*/
|
||||
private Long withdrawAccount;
|
||||
|
||||
/**
|
||||
* 状态 0-正常 1-封禁
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
@JsonFormat(pattern = DateConstant.PATTERN_DATETIME)
|
||||
private LocalDateTime lastLoginTime;
|
||||
|
||||
private String lastLoginIp;
|
||||
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
@JsonFormat(pattern = DateConstant.PATTERN_DATETIME)
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.bashi.dk.dto.app.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel("发起贷款入参")
|
||||
public class BorrowStartReq {
|
||||
|
||||
@ApiModelProperty("客户ID")
|
||||
private Long customerId;
|
||||
|
||||
@ApiModelProperty("用途说明")
|
||||
private String noteRemark;
|
||||
|
||||
@ApiModelProperty("总贷款额")
|
||||
private BigDecimal totalLoanMoney;
|
||||
|
||||
@ApiModelProperty("还款月数")
|
||||
private Integer totalMonth;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.bashi.dk.dto.app.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel("贷款计算器")
|
||||
public class CalLoanReq {
|
||||
|
||||
@ApiModelProperty("总贷款额")
|
||||
private BigDecimal totalLoanMoney;
|
||||
|
||||
@ApiModelProperty("还款月数")
|
||||
private Integer totalMonth;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.bashi.dk.dto.app.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("用户注册-入参")
|
||||
public class CustomerRegisterReq {
|
||||
|
||||
/**
|
||||
* 手机
|
||||
*/
|
||||
@ApiModelProperty("手机号")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* code
|
||||
*/
|
||||
@ApiModelProperty("验证码")
|
||||
private String code;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.bashi.dk.dto.app.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("用户忘记密码-修改密码入参")
|
||||
public class UpdatePwdOpenReq {
|
||||
|
||||
@ApiModelProperty("校验码")
|
||||
private String checkCode;
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
@ApiModelProperty("确认密码")
|
||||
private String confirmPassword;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.bashi.dk.dto.app.resp;
|
||||
|
||||
import com.bashi.dk.domain.Borrow;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("贷款详情DTO")
|
||||
public class BorrowInfo extends Borrow {
|
||||
|
||||
@ApiModelProperty("贷款进度条")
|
||||
private LoanProcessResp loanProcessResp;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.bashi.dk.dto.app.resp;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("贷款进度")
|
||||
@Data
|
||||
public class BorrowStepResp {
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("是否完成")
|
||||
private boolean over = false;
|
||||
|
||||
public BorrowStepResp(String name, boolean over) {
|
||||
this.name = name;
|
||||
this.over = over;
|
||||
}
|
||||
|
||||
public BorrowStepResp() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.bashi.dk.dto.app.resp;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel("计算利息返回数据")
|
||||
public class CalLoanResp {
|
||||
|
||||
@ApiModelProperty("贷款总额")
|
||||
private BigDecimal totalLoanMoney; //
|
||||
@ApiModelProperty("还款月份")
|
||||
private int totalMonth; //
|
||||
@ApiModelProperty("贷款年利率")
|
||||
private double loanRate; //
|
||||
|
||||
@ApiModelProperty("总利息数")
|
||||
private BigDecimal totalInterest; //
|
||||
@ApiModelProperty("还款总额")
|
||||
private BigDecimal totalRepayment; //
|
||||
@ApiModelProperty("首月还款额")
|
||||
private BigDecimal firstRepayment; //
|
||||
@ApiModelProperty("月均还款额")
|
||||
private BigDecimal avgRepayment; //
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.bashi.dk.dto.app.resp;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("贷款进度说明")
|
||||
public class LoanProcessResp {
|
||||
|
||||
@ApiModelProperty("贷款进度条")
|
||||
private List<BorrowStepResp> borrowStep;
|
||||
|
||||
@ApiModelProperty("借款状态样式")
|
||||
private String borrowNameStyle;
|
||||
|
||||
/** 借款说明 */
|
||||
@ApiModelProperty("借款说明")
|
||||
private String borrowRemark;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.bashi.dk.dto.app.resp;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("贷款用户")
|
||||
public class LoanUser {
|
||||
/**
|
||||
* 手机
|
||||
*/
|
||||
@ApiModelProperty("手机号")
|
||||
private String phone;
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
@ApiModelProperty("金额")
|
||||
private String amount;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
@ApiModelProperty("贷款时间")
|
||||
private String time;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.bashi.dk.dto.app.resp;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel("费率设置-出参")
|
||||
public class LoansSettingVO {
|
||||
/**
|
||||
* 贷款最小金额(元)
|
||||
*/
|
||||
@ApiModelProperty("贷款最小金额(元)")
|
||||
private BigDecimal loansMinAccount;
|
||||
|
||||
/**
|
||||
* 贷款最大金额(元)
|
||||
*/
|
||||
@ApiModelProperty("贷款最大金额(元)")
|
||||
private BigDecimal loansMaxAccount;
|
||||
|
||||
/**
|
||||
* 贷款初始金额(元)
|
||||
*/
|
||||
@ApiModelProperty("贷款初始金额(元)")
|
||||
private BigDecimal loansInitAccount;
|
||||
|
||||
/**
|
||||
* 允许选择月份
|
||||
*/
|
||||
@ApiModelProperty("允许选择月份")
|
||||
private String loansMonth;
|
||||
|
||||
/**
|
||||
* 初始选择月份
|
||||
*/
|
||||
@ApiModelProperty("初始选择月份")
|
||||
private String loansInitMonth;
|
||||
|
||||
/**
|
||||
* 每月还款日
|
||||
*/
|
||||
@ApiModelProperty("每月还款日")
|
||||
private Integer dueDate;
|
||||
|
||||
/**
|
||||
* 最小 日息
|
||||
*/
|
||||
@ApiModelProperty("最小 日息")
|
||||
private Double minDayServiceRate;
|
||||
}
|
||||
25
bashi-dk/src/main/java/com/bashi/dk/enums/BankTypeEnums.java
Normal file
25
bashi-dk/src/main/java/com/bashi/dk/enums/BankTypeEnums.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.bashi.dk.enums;
|
||||
|
||||
public enum BankTypeEnums {
|
||||
PBC("中国人民银行"),
|
||||
ICBC("中国工商银行"),
|
||||
CCB("中国建设银行"),
|
||||
HSBC("汇丰银行"),
|
||||
BOC("中国银行"),
|
||||
ABC("中国农业银行"),
|
||||
BC("交通银行"),
|
||||
ZS_CMB("招商银行"),
|
||||
CMB("中国民生银行"),
|
||||
CITIC("中信银行"),
|
||||
;
|
||||
|
||||
private final String name;
|
||||
|
||||
BankTypeEnums(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
42
bashi-dk/src/main/java/com/bashi/dk/kit/CalLoanManager.java
Normal file
42
bashi-dk/src/main/java/com/bashi/dk/kit/CalLoanManager.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.bashi.dk.kit;
|
||||
|
||||
import com.bashi.dk.domain.LoansSetting;
|
||||
import com.bashi.dk.dto.app.req.CalLoanReq;
|
||||
import com.bashi.dk.service.LoansSettingService;
|
||||
import com.bashi.dk.util.ACPIMLoanCalculator;
|
||||
import com.bashi.dk.util.Loan;
|
||||
import com.bashi.dk.util.LoanUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Component
|
||||
public class CalLoanManager {
|
||||
@Autowired
|
||||
private LoansSettingService loansSettingService;
|
||||
|
||||
public Loan calLoan(BigDecimal totalLoanMoney,Integer totalMonth, Double loanRate){
|
||||
ACPIMLoanCalculator calculator = new ACPIMLoanCalculator();
|
||||
Loan loan = calculator.calLoan(totalLoanMoney, totalMonth, loanRate, LoanUtil.RATE_TYPE_MONTH);
|
||||
loan.setLoanRateMonth(loanRate);
|
||||
return loan;
|
||||
}
|
||||
|
||||
public Loan calLoan(CalLoanReq calLoanReq){
|
||||
Double loanRate = getLoanRate(calLoanReq.getTotalMonth());
|
||||
return this.calLoan(calLoanReq.getTotalLoanMoney(), calLoanReq.getTotalMonth(), loanRate);
|
||||
}
|
||||
|
||||
public Double getLoanRate(Integer mouth){
|
||||
LoansSetting loansSetting = loansSettingService.getLoansSetting();
|
||||
String serviceRate = loansSetting.getServiceRate();
|
||||
String[] split = serviceRate.split(",");
|
||||
if(split.length < mouth){
|
||||
return Double.valueOf(split[split.length-1]);
|
||||
}else{
|
||||
return Double.valueOf(split[mouth-1]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
80
bashi-dk/src/main/java/com/bashi/dk/kit/DkLoginKit.java
Normal file
80
bashi-dk/src/main/java/com/bashi/dk/kit/DkLoginKit.java
Normal file
@@ -0,0 +1,80 @@
|
||||
package com.bashi.dk.kit;
|
||||
|
||||
import com.bashi.common.constant.Constants;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.common.core.domain.entity.SysUser;
|
||||
import com.bashi.common.core.domain.model.LoginPhoneBody;
|
||||
import com.bashi.common.core.domain.model.LoginUser;
|
||||
import com.bashi.common.exception.CustomException;
|
||||
import com.bashi.common.utils.DateUtils;
|
||||
import com.bashi.common.utils.ServletUtils;
|
||||
import com.bashi.dk.service.CustomerService;
|
||||
import com.bashi.framework.security.sms.LoginTypeEnums;
|
||||
import com.bashi.framework.security.sms.SmsAuthenticationToken;
|
||||
import com.bashi.framework.web.service.AsyncService;
|
||||
import com.bashi.framework.web.service.TokenService;
|
||||
import com.bashi.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
public class DkLoginKit {
|
||||
|
||||
@Resource
|
||||
private AuthenticationManager authenticationManager;
|
||||
@Autowired
|
||||
private AsyncService asyncService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
@Autowired
|
||||
private CustomerService customerService;
|
||||
|
||||
public String login(LoginPhoneBody mobile) {
|
||||
HttpServletRequest request = ServletUtils.getRequest();
|
||||
// 用户验证
|
||||
Authentication authentication;
|
||||
try {
|
||||
authentication = authenticationManager
|
||||
.authenticate(new SmsAuthenticationToken(mobile));
|
||||
} catch (Exception e) {
|
||||
asyncService.recordLogininfor(mobile.getMobile(), Constants.LOGIN_FAIL, e.getMessage(), request);
|
||||
throw new CustomException(e.getMessage());
|
||||
}
|
||||
asyncService.recordLogininfor(mobile.getMobile(), Constants.LOGIN_SUCCESS, LoginTypeEnums.getMsgByCode(mobile.getLoginRole()) + "登陆成功", request);
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
recordLoginInfo(loginUser);
|
||||
// 生成token
|
||||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 记录登录信息
|
||||
*/
|
||||
public void recordLoginInfo(LoginUser user) {
|
||||
if(user.getType() == 1){
|
||||
Customer customer = user.getCustomer();
|
||||
Customer update = new Customer();
|
||||
update.setId(customer.getId());
|
||||
update.setLastLoginIp(ServletUtils.getClientIP());
|
||||
update.setLastLoginTime(LocalDateTime.now());
|
||||
customerService.updateById(update);
|
||||
}else{
|
||||
SysUser sysUser = user.getUser();
|
||||
sysUser.setLoginIp(ServletUtils.getClientIP());
|
||||
sysUser.setLoginDate(DateUtils.getNowDate());
|
||||
sysUser.setUpdateBy(sysUser.getUserName());
|
||||
userService.updateUserProfile(sysUser);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.bashi.dk.manager;
|
||||
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import com.bashi.common.config.BsConfig;
|
||||
import com.bashi.common.utils.file.FileUploadUtils;
|
||||
import com.bashi.dk.oss.ali.AliOssKit;
|
||||
import com.bashi.dk.oss.ali.CosKit;
|
||||
import com.bashi.framework.config.ServerConfig;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Component
|
||||
public class FileUploadManager {
|
||||
@Autowired
|
||||
private AliOssKit aliOssKit;
|
||||
@Autowired
|
||||
private CosKit cosKit;
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
|
||||
public FileUploadRes uploadFile(MultipartFile file) throws Exception {
|
||||
if(aliOssKit.getOssClient() != null){
|
||||
String filename = file.getOriginalFilename();
|
||||
String extension = FilenameUtils.getExtension(filename);
|
||||
String uuid = UUID.fastUUID().toString();
|
||||
String ossUrl = aliOssKit.upload(file.getInputStream(), AliOssKit.OSS_KEY_COMMON + uuid + "." + extension);
|
||||
FileUploadRes fileUploadRes = new FileUploadRes();
|
||||
fileUploadRes.setUrl(ossUrl);
|
||||
fileUploadRes.setFileName(filename);
|
||||
return fileUploadRes;
|
||||
}else if(cosKit.isEnable()){
|
||||
String filename = file.getOriginalFilename();
|
||||
String extension = FilenameUtils.getExtension(filename);
|
||||
String uuid = UUID.fastUUID().toString();
|
||||
String ossUrl = cosKit.upload(file, AliOssKit.OSS_KEY_COMMON + uuid + "." + extension);
|
||||
FileUploadRes fileUploadRes = new FileUploadRes();
|
||||
fileUploadRes.setUrl(ossUrl);
|
||||
fileUploadRes.setFileName(filename);
|
||||
return fileUploadRes;
|
||||
}else {
|
||||
// 上传文件路径
|
||||
String filePath = BsConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + "/api/" + fileName;
|
||||
FileUploadRes fileUploadRes = new FileUploadRes();
|
||||
fileUploadRes.setUrl(url);
|
||||
fileUploadRes.setFileName(fileName);
|
||||
return fileUploadRes;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.bashi.dk.manager;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FileUploadRes {
|
||||
|
||||
private String url;
|
||||
private String fileName;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.bashi.dk.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bashi.dk.domain.AgreementSetting;
|
||||
|
||||
public interface AgreementSettingMapper extends BaseMapper<AgreementSetting> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.bashi.dk.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bashi.dk.domain.BorrowLog;
|
||||
|
||||
public interface BorrowLogMapper extends BaseMapper<BorrowLog> {
|
||||
}
|
||||
11
bashi-dk/src/main/java/com/bashi/dk/mapper/BorrowMapper.java
Normal file
11
bashi-dk/src/main/java/com/bashi/dk/mapper/BorrowMapper.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.bashi.dk.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.bashi.dk.domain.Borrow;
|
||||
import com.bashi.dk.dto.admin.resp.BorrowResp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface BorrowMapper extends BaseMapper<Borrow> {
|
||||
IPage<BorrowResp> pageAdmin(@Param("page") IPage<Object> page, @Param("bo") Borrow bo);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.bashi.dk.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bashi.dk.domain.BorrowStatus;
|
||||
|
||||
public interface BorrowStatusMapper extends BaseMapper<BorrowStatus> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.bashi.dk.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bashi.dk.domain.CustomerInfo;
|
||||
|
||||
public interface CustomerInfoMapper extends BaseMapper<CustomerInfo> {
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.bashi.dk.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.dk.dto.admin.resp.CustomerAdminResp;
|
||||
import com.bashi.dk.dto.admin.resp.CustomerExportVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public interface CustomerMapper extends BaseMapper<Customer> {
|
||||
|
||||
void incsAmount(@Param("customerId") Long customerId, @Param("totalLoanMoney") BigDecimal totalLoanMoney,
|
||||
@Param("totalRepayment") BigDecimal totalRepayment);
|
||||
|
||||
void withdraw(@Param("customerId") Long customerId, @Param("withdrawAmount") Double withdrawAmount);
|
||||
|
||||
IPage<CustomerAdminResp> pageAdmin(@Param("page") IPage<Object> page, @Param("bo") CustomerAdminResp bo);
|
||||
|
||||
List<CustomerExportVo> exportAdmin(@Param("bo") CustomerAdminResp bo);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.bashi.dk.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bashi.dk.domain.HomeSetting;
|
||||
|
||||
public interface HomeSettingMapper extends BaseMapper<HomeSetting> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.bashi.dk.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bashi.dk.domain.LoansSetting;
|
||||
|
||||
public interface LoansSettingMapper extends BaseMapper<LoansSetting> {
|
||||
}
|
||||
79
bashi-dk/src/main/java/com/bashi/dk/oss/ali/AliOssKit.java
Normal file
79
bashi-dk/src/main/java/com/bashi/dk/oss/ali/AliOssKit.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package com.bashi.dk.oss.ali;
|
||||
|
||||
import com.aliyun.oss.ClientConfiguration;
|
||||
import com.aliyun.oss.OSSClient;
|
||||
import com.aliyun.oss.common.auth.CredentialsProvider;
|
||||
import com.aliyun.oss.common.auth.DefaultCredentialProvider;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* <p>created on 2021/3/3</p>
|
||||
*
|
||||
* @author zhangliang
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AliOssKit {
|
||||
|
||||
@Autowired
|
||||
@Setter
|
||||
@Getter
|
||||
private OssConfig ossConfig;
|
||||
|
||||
@Getter
|
||||
public OSSClient ossClient = null;
|
||||
|
||||
public final static String OSS_KEY_COMMON = "dk/common/";
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
if(!ossConfig.isEnable()){
|
||||
log.error("未开启阿里云OSS配置");
|
||||
return;
|
||||
}
|
||||
// 创建ClientConfiguration。ClientConfiguration是OSSClient的配置类,可配置代理、连接超时、最大连接数等参数。
|
||||
ClientConfiguration conf = new ClientConfiguration();
|
||||
// 设置OSSClient允许打开的最大HTTP连接数,默认为1024个。
|
||||
conf.setMaxConnections(1024);
|
||||
// 设置Socket层传输数据的超时时间,默认为50000毫秒。
|
||||
conf.setSocketTimeout(50000);
|
||||
// 设置建立连接的超时时间,默认为50000毫秒。
|
||||
conf.setConnectionTimeout(50000);
|
||||
// 设置从连接池中获取连接的超时时间(单位:毫秒),默认不超时。
|
||||
conf.setConnectionRequestTimeout(1000);
|
||||
// 设置连接空闲超时时间。超时则关闭连接,默认为60000毫秒。
|
||||
conf.setIdleConnectionTime(60000);
|
||||
// 设置失败请求重试次数,默认为3次。
|
||||
conf.setMaxErrorRetry(5);
|
||||
CredentialsProvider credentialsProvider = new DefaultCredentialProvider(ossConfig.getAccessKeyId(), ossConfig.getAccessKeySecret());
|
||||
// 创建客户端
|
||||
ossClient = new OSSClient(ossConfig.getEndpoint(), credentialsProvider, conf);
|
||||
}
|
||||
|
||||
public String upload(InputStream inputStream,String fileName){
|
||||
ossClient.putObject(ossConfig.getBucketName(), fileName, inputStream);
|
||||
return getUrl(fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传单个文件 公开文件
|
||||
* @param inputStream
|
||||
* @param key
|
||||
*/
|
||||
public String uploadByKey(InputStream inputStream,String key){
|
||||
ossClient.putObject(ossConfig.getBucketName(), key, inputStream);
|
||||
return getUrl(key);
|
||||
}
|
||||
|
||||
public String getUrl(String key){
|
||||
return ossConfig.getCdnDomain()+"/"+key;
|
||||
}
|
||||
|
||||
}
|
||||
23
bashi-dk/src/main/java/com/bashi/dk/oss/ali/CosConfig.java
Normal file
23
bashi-dk/src/main/java/com/bashi/dk/oss/ali/CosConfig.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.bashi.dk.oss.ali;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Data
|
||||
@ToString(exclude={"secretId","secretKey"})
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "tencent.cos")
|
||||
public class CosConfig {
|
||||
|
||||
private boolean enable = false;
|
||||
private String appId;
|
||||
private String region; // 连接区域地址
|
||||
private String cdnDomain; // cdn 域名
|
||||
private String secretId; // 连接keyId
|
||||
private String secretKey; // 连接秘钥
|
||||
private String bucketName; // 需要存储的bucketName
|
||||
|
||||
}
|
||||
105
bashi-dk/src/main/java/com/bashi/dk/oss/ali/CosKit.java
Normal file
105
bashi-dk/src/main/java/com/bashi/dk/oss/ali/CosKit.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package com.bashi.dk.oss.ali;
|
||||
|
||||
import com.qcloud.cos.COSClient;
|
||||
import com.qcloud.cos.ClientConfig;
|
||||
import com.qcloud.cos.auth.BasicCOSCredentials;
|
||||
import com.qcloud.cos.auth.COSCredentials;
|
||||
import com.qcloud.cos.http.HttpProtocol;
|
||||
import com.qcloud.cos.model.ObjectMetadata;
|
||||
import com.qcloud.cos.model.PutObjectRequest;
|
||||
import com.qcloud.cos.model.UploadResult;
|
||||
import com.qcloud.cos.region.Region;
|
||||
import com.qcloud.cos.transfer.TransferManager;
|
||||
import com.qcloud.cos.transfer.TransferManagerConfiguration;
|
||||
import com.qcloud.cos.transfer.Upload;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CosKit {
|
||||
|
||||
@Autowired
|
||||
private CosConfig cosConfig;
|
||||
private COSClient cosClient = null;
|
||||
|
||||
private TransferManager transferManager = null;
|
||||
|
||||
|
||||
public TransferManager createTransferManager(COSClient cosClient){
|
||||
// 自定义线程池大小,建议在客户端与 COS 网络充足(例如使用腾讯云的 CVM,同地域上传 COS)的情况下,设置成16或32即可,可较充分的利用网络资源
|
||||
// 对于使用公网传输且网络带宽质量不高的情况,建议减小该值,避免因网速过慢,造成请求超时。
|
||||
ExecutorService threadPool = Executors.newFixedThreadPool(4);
|
||||
// 传入一个 threadpool, 若不传入线程池,默认 TransferManager 中会生成一个单线程的线程池。
|
||||
TransferManager transferManager = new TransferManager(cosClient, threadPool);
|
||||
// 设置高级接口的配置项
|
||||
// 分块上传阈值和分块大小分别为 5MB 和 1MB
|
||||
TransferManagerConfiguration transferManagerConfiguration = new TransferManagerConfiguration();
|
||||
transferManagerConfiguration.setMultipartUploadThreshold(5*1024*1024);
|
||||
transferManagerConfiguration.setMinimumUploadPartSize(1*1024*1024);
|
||||
transferManager.setConfiguration(transferManagerConfiguration);
|
||||
return transferManager;
|
||||
}
|
||||
|
||||
public COSClient createCosClient(){
|
||||
// SECRETID 和 SECRETKEY 请登录访问管理控制台 https://console.cloud.tencent.com/cam/capi 进行查看和管理
|
||||
String secretId = cosConfig.getSecretId();
|
||||
String secretKey = cosConfig.getSecretKey();
|
||||
COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
|
||||
// ClientConfig 中包含了后续请求 COS 的客户端设置:
|
||||
ClientConfig clientConfig = new ClientConfig();
|
||||
// 设置 bucket 的地域
|
||||
// COS_REGION 请参照 https://cloud.tencent.com/document/product/436/6224
|
||||
clientConfig.setRegion(new Region(cosConfig.getRegion()));
|
||||
// 设置请求协议, http 或者 https
|
||||
// 5.6.53 及更低的版本,建议设置使用 https 协议
|
||||
// 5.6.54 及更高版本,默认使用了 https
|
||||
clientConfig.setHttpProtocol(HttpProtocol.https);
|
||||
// 以下的设置,是可选的:
|
||||
// 设置 socket 读取超时,默认 30s
|
||||
clientConfig.setSocketTimeout(30*1000);
|
||||
// 设置建立连接超时,默认 30s
|
||||
clientConfig.setConnectionTimeout(30*1000);
|
||||
// 如果需要的话,设置 http 代理,ip 以及 port
|
||||
// clientConfig.setHttpProxyIp("httpProxyIp");
|
||||
// clientConfig.setHttpProxyPort(80);
|
||||
// 生成 cos 客户端。
|
||||
return new COSClient(cred, clientConfig);
|
||||
}
|
||||
|
||||
public boolean isEnable(){
|
||||
return cosConfig.isEnable();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
if(!cosConfig.isEnable()){
|
||||
log.error("未开启腾讯云COS配置");
|
||||
return;
|
||||
}
|
||||
cosClient = createCosClient();
|
||||
transferManager = createTransferManager(cosClient);
|
||||
}
|
||||
|
||||
public String upload(MultipartFile file, String fileName) throws Exception {
|
||||
ObjectMetadata metadata = new ObjectMetadata();
|
||||
metadata.setContentLength(file.getSize());
|
||||
PutObjectRequest putObjectRequest = new PutObjectRequest(cosConfig.getBucketName(), fileName, file.getInputStream(),metadata);
|
||||
Upload upload = transferManager.upload(putObjectRequest);
|
||||
UploadResult uploadResult = upload.waitForUploadResult();
|
||||
return getUrl(uploadResult.getKey());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getUrl(String key){
|
||||
return cosConfig.getCdnDomain()+"/"+key;
|
||||
}
|
||||
|
||||
}
|
||||
24
bashi-dk/src/main/java/com/bashi/dk/oss/ali/OssConfig.java
Normal file
24
bashi-dk/src/main/java/com/bashi/dk/oss/ali/OssConfig.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.bashi.dk.oss.ali;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* <p>created on 2021/3/3</p>
|
||||
*
|
||||
* @author zhangliang
|
||||
*/
|
||||
@Data
|
||||
@ToString(exclude={"accessKeyId","accessKeySecret"})
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "ali.oss")
|
||||
public class OssConfig {
|
||||
private boolean enable = false;
|
||||
private String endpoint; // 连接区域地址
|
||||
private String cdnDomain; // cdn 域名
|
||||
private String accessKeyId; // 连接keyId
|
||||
private String accessKeySecret; // 连接秘钥
|
||||
private String bucketName; // 需要存储的bucketName
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.bashi.dk.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bashi.dk.domain.AgreementSetting;
|
||||
|
||||
public interface AgreementSettingService extends IService<AgreementSetting> {
|
||||
AgreementSetting getAgreementSetting();
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.bashi.dk.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bashi.common.com.PageParams;
|
||||
import com.bashi.dk.domain.Borrow;
|
||||
import com.bashi.dk.dto.admin.req.BorrowUpdateStatusReq;
|
||||
import com.bashi.dk.dto.admin.resp.BorrowResp;
|
||||
import com.bashi.dk.dto.app.req.BorrowStartReq;
|
||||
import com.bashi.dk.dto.app.resp.LoanProcessResp;
|
||||
|
||||
public interface BorrowService extends IService<Borrow> {
|
||||
Borrow borrow(BorrowStartReq req);
|
||||
|
||||
Borrow getByTradeNo(String tradeNo);
|
||||
|
||||
boolean updateLoan(Borrow bo);
|
||||
|
||||
boolean updateStatus(BorrowUpdateStatusReq bo);
|
||||
|
||||
boolean updateBank(Borrow bo);
|
||||
|
||||
void withdraw(Double withdrawAmount, Long customerId);
|
||||
|
||||
LoanProcessResp getStepBorrow(Long customerId);
|
||||
|
||||
LoanProcessResp parseStepBorrow(Borrow one);
|
||||
|
||||
IPage<BorrowResp> pageAdmin(PageParams pageParams, Borrow bo);
|
||||
|
||||
String getContract(String tradeNo);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.bashi.dk.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bashi.dk.domain.BorrowStatus;
|
||||
|
||||
public interface BorrowStatusService extends IService<BorrowStatus> {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.bashi.dk.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bashi.dk.domain.CustomerInfo;
|
||||
|
||||
public interface CustomerInfoService extends IService<CustomerInfo> {
|
||||
void updateCustomerInfo(CustomerInfo customerInfo);
|
||||
|
||||
CustomerInfo getByCustomerId(Long customerId);
|
||||
|
||||
boolean updateAllowSignature(CustomerInfo bo);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.bashi.dk.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bashi.common.com.PageParams;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.dk.dto.admin.resp.CustomerAdminResp;
|
||||
import com.bashi.dk.dto.app.req.CustomerRegisterReq;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public interface CustomerService extends IService<Customer> {
|
||||
Customer getCustomerByName(String mobile);
|
||||
|
||||
void register(CustomerRegisterReq register);
|
||||
|
||||
boolean updatePwd(Long id, String password);
|
||||
|
||||
void borrowAmount(Long customerId, BigDecimal totalLoanMoney,BigDecimal totalRepayment);
|
||||
|
||||
boolean withdraw(Long customerId, Double withdrawAmount);
|
||||
|
||||
void dk(Long customerId);
|
||||
|
||||
IPage<CustomerAdminResp> pageAdmin(PageParams pageParams, CustomerAdminResp bo);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.bashi.dk.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bashi.dk.domain.HomeSetting;
|
||||
|
||||
public interface HomeSettingService extends IService<HomeSetting> {
|
||||
HomeSetting getHomeSetting();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.bashi.dk.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bashi.dk.domain.LoansSetting;
|
||||
|
||||
public interface LoansSettingService extends IService<LoansSetting> {
|
||||
LoansSetting getLoansSetting();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.bashi.dk.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bashi.dk.domain.AgreementSetting;
|
||||
import com.bashi.dk.mapper.AgreementSettingMapper;
|
||||
import com.bashi.dk.service.AgreementSettingService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AgreementSettingServiceImpl extends ServiceImpl<AgreementSettingMapper, AgreementSetting> implements AgreementSettingService {
|
||||
|
||||
@Override
|
||||
public AgreementSetting getAgreementSetting(){
|
||||
return this.getOne(Wrappers.lambdaQuery(AgreementSetting.class).last("limit 1"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
package com.bashi.dk.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.hash.Hash;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bashi.common.com.Condition;
|
||||
import com.bashi.common.com.PageParams;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.common.exception.CustomException;
|
||||
import com.bashi.common.utils.BeanConvertUtil;
|
||||
import com.bashi.common.utils.JsonUtils;
|
||||
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.resp.BorrowResp;
|
||||
import com.bashi.dk.dto.app.req.BorrowStartReq;
|
||||
import com.bashi.dk.dto.app.req.CalLoanReq;
|
||||
import com.bashi.dk.dto.app.resp.BorrowStepResp;
|
||||
import com.bashi.dk.dto.app.resp.LoanProcessResp;
|
||||
import com.bashi.dk.kit.CalLoanManager;
|
||||
import com.bashi.dk.mapper.BorrowMapper;
|
||||
import com.bashi.dk.service.*;
|
||||
import com.bashi.dk.util.ContentReplaceUtil;
|
||||
import com.bashi.dk.util.Loan;
|
||||
import com.bashi.dk.util.MoneyUtil;
|
||||
import com.bashi.dk.util.OrderTradeNoUtil;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> implements BorrowService {
|
||||
|
||||
@Autowired
|
||||
private CustomerService customerService;
|
||||
@Autowired
|
||||
private CustomerInfoService customerInfoService;
|
||||
@Autowired
|
||||
private CalLoanManager calLoanManager;
|
||||
@Autowired
|
||||
private LoansSettingService loansSettingService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Borrow borrow(BorrowStartReq req) {
|
||||
Customer customer = customerService.getById(req.getCustomerId());
|
||||
CustomerInfo customerInfo = customerInfoService.getByCustomerId(req.getCustomerId());
|
||||
if(customerInfo == null || customer == null){
|
||||
throw new CustomException("用户不存在");
|
||||
}
|
||||
if(customer.getLoansFlag() == 1){
|
||||
throw new CustomException("请等待上一次贷款完结后在发起贷款");
|
||||
}
|
||||
if(customer.getRealNameAuth() != 1){
|
||||
throw new CustomException("请补全个人资料后在发起贷款");
|
||||
}
|
||||
LoansSetting loansSetting = loansSettingService.getLoansSetting();
|
||||
CalLoanReq calLoanReq = new CalLoanReq();
|
||||
calLoanReq.setTotalLoanMoney(req.getTotalLoanMoney());
|
||||
calLoanReq.setTotalMonth(req.getTotalMonth());
|
||||
Loan loan = calLoanManager.calLoan(calLoanReq);
|
||||
Borrow borrow = BeanConvertUtil.convertTo(customerInfo, Borrow::new);
|
||||
borrow.setId(null);
|
||||
borrow.setTradeNo(OrderTradeNoUtil.createOrder(OrderTradeNoUtil.BORROW));
|
||||
borrow.setTotalLoanMoney(loan.getTotalLoanMoney());
|
||||
borrow.setTotalMonth(loan.getTotalMonth());
|
||||
borrow.setLoanMonthRate(loan.getLoanRateMonth());
|
||||
borrow.setLoanYearRate(loan.getLoanRate());
|
||||
borrow.setTotalInterest(loan.getTotalInterest());
|
||||
borrow.setTotalRepayment(loan.getTotalRepayment());
|
||||
borrow.setFirstRepayment(loan.getFirstRepayment());
|
||||
borrow.setAvgRepayment(loan.getAvgRepayment());
|
||||
borrow.setDueDate(loansSetting.getDueDate());
|
||||
borrow.setNoteRemark(req.getNoteRemark());
|
||||
borrow.setBorrowName("审核中");
|
||||
borrow.setBorrowNameStyle("black");
|
||||
borrow.setBorrowRemark("审核中...");
|
||||
borrow.setInfoJson(JsonUtils.toJsonString(loan));
|
||||
borrow.setFirstBankType(borrow.getBankType());
|
||||
borrow.setFirstBackCardNum(borrow.getBackCardNum());
|
||||
this.save(borrow);
|
||||
customerService.dk(customer.getId());
|
||||
return borrow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Borrow getByTradeNo(String tradeNo) {
|
||||
return this.getOne(Wrappers.lambdaQuery(Borrow.class)
|
||||
.eq(Borrow::getTradeNo,tradeNo).last("limit 1"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateLoan(Borrow bo) {
|
||||
Loan loan = calLoanManager.calLoan(bo.getTotalLoanMoney(),bo.getTotalMonth(),bo.getLoanMonthRate());
|
||||
Borrow update = new Borrow();
|
||||
update.setId(bo.getId());
|
||||
update.setTotalLoanMoney(loan.getTotalLoanMoney());
|
||||
update.setTotalMonth(loan.getTotalMonth());
|
||||
update.setLoanMonthRate(loan.getLoanRateMonth());
|
||||
update.setLoanYearRate(loan.getLoanRate());
|
||||
update.setTotalInterest(loan.getTotalInterest());
|
||||
update.setTotalRepayment(loan.getTotalRepayment());
|
||||
update.setFirstRepayment(loan.getFirstRepayment());
|
||||
update.setAvgRepayment(loan.getAvgRepayment());
|
||||
update.setInfoJson(JsonUtils.toJsonString(loan));
|
||||
return this.updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateStatus(BorrowUpdateStatusReq bo) {
|
||||
Borrow borrow = this.getById(bo.getId());
|
||||
boolean remit = false;
|
||||
if(borrow.getRemitFlag() == 0 && bo.getUsedRemit() != null && bo.getUsedRemit() == 1){
|
||||
remit = true;
|
||||
}
|
||||
Borrow update = new Borrow();
|
||||
update.setId(bo.getId());
|
||||
update.setBorrowName(bo.getBorrowName());
|
||||
update.setBorrowRemark(bo.getBorrowRemark());
|
||||
update.setBorrowNameStyle(bo.getBorrowNameStyle());
|
||||
update.setAuditFlag(true);
|
||||
if(remit){
|
||||
update.setRemitFlag(1);
|
||||
}
|
||||
boolean bool = this.updateById(update);
|
||||
if(bool && remit){
|
||||
customerService.borrowAmount(borrow.getCustomerId(), borrow.getTotalLoanMoney(),borrow.getTotalRepayment());
|
||||
return true;
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateBank(Borrow bo) {
|
||||
this.updateById(bo);
|
||||
Borrow borrow = this.getById(bo.getId());
|
||||
LambdaUpdateWrapper<CustomerInfo> update = Wrappers.lambdaUpdate(CustomerInfo.class).eq(CustomerInfo::getCustomerId, borrow.getCustomerId());
|
||||
boolean updateFlag = false;
|
||||
if(StringUtils.isNotEmpty(bo.getBankType())){
|
||||
update.set(CustomerInfo::getBankType,bo.getBankType());
|
||||
updateFlag = true;
|
||||
}
|
||||
if(StringUtils.isNotEmpty(bo.getBackCardNum())){
|
||||
update.set(CustomerInfo::getBackCardNum,bo.getBackCardNum());
|
||||
updateFlag = true;
|
||||
}
|
||||
if(updateFlag){
|
||||
customerInfoService.update(update);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withdraw(Double withdrawAmount, Long customerId) {
|
||||
Customer customer = customerService.getById(customerId);
|
||||
if(BooleanUtils.isNotTrue(customer.getAllowWithdrawFlag())){
|
||||
throw new CustomException("提现失败,账号异常");
|
||||
}
|
||||
if(customer.getAccount().doubleValue() < withdrawAmount){
|
||||
throw new CustomException("余额不足");
|
||||
}
|
||||
Borrow one = this.getOne(Wrappers.lambdaQuery(Borrow.class).eq(Borrow::getCustomerId,customerId));
|
||||
if(one == null){
|
||||
throw new CustomException("提现失败");
|
||||
}
|
||||
if(!"审核通过".equals(one.getBorrowName())){
|
||||
throw new CustomException(one.getBorrowName());
|
||||
}
|
||||
boolean result = customerService.withdraw(customerId,withdrawAmount);
|
||||
Borrow update = new Borrow();
|
||||
update.setId(one.getId());
|
||||
update.setBorrowName("提现中");
|
||||
update.setBorrowRemark("提现中...");
|
||||
update.setBorrowNameStyle("red");
|
||||
this.updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoanProcessResp getStepBorrow(Long customerId){
|
||||
Borrow one = this.getOne(Wrappers.lambdaQuery(Borrow.class).eq(Borrow::getCustomerId,customerId));
|
||||
return parseStepBorrow(one);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoanProcessResp parseStepBorrow(Borrow one){
|
||||
LoanProcessResp resp = new LoanProcessResp();
|
||||
List<BorrowStepResp> borrowStep = new ArrayList<>();
|
||||
if(one == null){
|
||||
borrowStep.add(new BorrowStepResp("提交成功",false));
|
||||
borrowStep.add(new BorrowStepResp("正在审核",false));
|
||||
borrowStep.add(new BorrowStepResp("到账成功",false));
|
||||
resp.setBorrowStep(borrowStep);
|
||||
resp.setBorrowNameStyle("red");
|
||||
resp.setBorrowRemark("您的个人信用贷款正在审核,请留意您的审核状态!如有疑问,请联系业务员咨询…");
|
||||
return resp;
|
||||
}
|
||||
borrowStep.add(new BorrowStepResp("提交成功",true));
|
||||
if("审核通过".equals(one.getBorrowName())){
|
||||
borrowStep.add(new BorrowStepResp(one.getBorrowName(),true));
|
||||
borrowStep.add(new BorrowStepResp("到账成功",true));
|
||||
}else{
|
||||
borrowStep.add(new BorrowStepResp(one.getBorrowName(),true));
|
||||
borrowStep.add(new BorrowStepResp("到账成功",false));
|
||||
}
|
||||
resp.setBorrowStep(borrowStep);
|
||||
resp.setBorrowNameStyle(one.getBorrowNameStyle());
|
||||
resp.setBorrowRemark(one.getBorrowRemark());
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<BorrowResp> pageAdmin(PageParams pageParams, Borrow bo) {
|
||||
return baseMapper.pageAdmin(Condition.getPage(pageParams),bo);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AgreementSettingService agreementSettingService;
|
||||
|
||||
@Override
|
||||
public String getContract(String tradeNo) {
|
||||
Borrow borrow = this.getByTradeNo(tradeNo);
|
||||
if(borrow == null){
|
||||
throw new CustomException("借款不存在");
|
||||
}
|
||||
CustomerInfo customerInfo = customerInfoService.getByCustomerId(borrow.getCustomerId());
|
||||
Customer customer = customerService.getById(borrow.getCustomerId());
|
||||
LocalDate startDate = borrow.getCreateTime().toLocalDate();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("合同编号",borrow.getTradeNo());
|
||||
map.put("签订日期",startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
map.put("借款人用户名",StringUtils.isEmpty(customer.getPhoneNumber())?"":customer.getPhoneNumber());
|
||||
map.put("借款人身份证号",StringUtils.isEmpty(borrow.getCardNum())?"":borrow.getCardNum());
|
||||
map.put("借款人手机号",StringUtils.isEmpty(customer.getPhoneNumber())?"":customer.getPhoneNumber());
|
||||
String signatureImage = "<div>签名:</div>";
|
||||
if(StringUtils.isNotEmpty(customerInfo.getSignature())){
|
||||
// signatureImage = "<img src=\"data:image/png;base64,"+customerInfo.getSignature()+"\" alt=\"无效\" />";
|
||||
signatureImage = "<div style='display: flex;align-items: center;'>签名:<img style='width:100px;height:50px' src=\""+customerInfo.getSignature()+"\" alt=\"无效\" /></div>";
|
||||
}
|
||||
map.put("借款人签名",signatureImage);
|
||||
map.put("借款金额大写", MoneyUtil.toChinese(borrow.getTotalLoanMoney().toString()));
|
||||
map.put("借款金额小写",borrow.getTotalLoanMoney().toString());
|
||||
map.put("借款期限",borrow.getTotalMonth());
|
||||
map.put("借款开始日",startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
map.put("借款结束日",startDate.plusMonths(borrow.getTotalMonth()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
map.put("借款人名称",StringUtils.isEmpty(borrow.getRealName())?"":borrow.getRealName());
|
||||
AgreementSetting agreementSetting = agreementSettingService.getAgreementSetting();
|
||||
String contractTemplate = agreementSetting.getContractTemplate();
|
||||
return ContentReplaceUtil.replaceWord(contractTemplate, map);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.bashi.dk.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bashi.dk.domain.BorrowStatus;
|
||||
import com.bashi.dk.mapper.BorrowStatusMapper;
|
||||
import com.bashi.dk.service.BorrowStatusService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class BorrowStatusServiceImpl extends ServiceImpl<BorrowStatusMapper, BorrowStatus> implements BorrowStatusService {
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.bashi.dk.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.dk.domain.CustomerInfo;
|
||||
import com.bashi.dk.mapper.CustomerInfoMapper;
|
||||
import com.bashi.dk.service.CustomerInfoService;
|
||||
import com.bashi.dk.service.CustomerService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, CustomerInfo> implements CustomerInfoService {
|
||||
@Autowired
|
||||
private CustomerService customerService;
|
||||
@Override
|
||||
public void updateCustomerInfo(CustomerInfo customerInfo) {
|
||||
Long customerId = customerInfo.getCustomerId();
|
||||
this.update(customerInfo,Wrappers.lambdaQuery(CustomerInfo.class)
|
||||
.eq(CustomerInfo::getCustomerId, customerId));
|
||||
CustomerInfo one = this.getOne(Wrappers.lambdaQuery(CustomerInfo.class)
|
||||
.eq(CustomerInfo::getCustomerId, customerId));
|
||||
checkCustomerInfoFlag(one);
|
||||
}
|
||||
|
||||
private void checkCustomerInfoFlag(CustomerInfo one){
|
||||
Long customerId = one.getCustomerId();
|
||||
int realNameAuth = 0;
|
||||
boolean infoFlag = false;
|
||||
boolean cardFlag = false;
|
||||
boolean bankFlag = false;
|
||||
boolean signFlag = false;
|
||||
// 身份信息
|
||||
if(StringUtils.isNotEmpty(one.getRealName()) && StringUtils.isNotEmpty(one.getCardNum()) &&
|
||||
StringUtils.isNotEmpty(one.getCardFrontPicture()) && StringUtils.isNotEmpty(one.getCardBackPicture()) &&
|
||||
StringUtils.isNotEmpty(one.getHandCardPicture())){
|
||||
cardFlag = true;
|
||||
}
|
||||
// 资料信息
|
||||
if(StringUtils.isNotEmpty(one.getCompanyName()) && StringUtils.isNotEmpty(one.getCompanyTitle()) &&
|
||||
StringUtils.isNotEmpty(one.getCompanyPhone()) && StringUtils.isNotEmpty(one.getCompanyYear()) &&
|
||||
StringUtils.isNotEmpty(one.getCompanyAddress()) && StringUtils.isNotEmpty(one.getCompanyAddressInfo()) &&
|
||||
StringUtils.isNotEmpty(one.getKinsfolkName()) && StringUtils.isNotEmpty(one.getKinsfolkRef()) &&
|
||||
StringUtils.isNotEmpty(one.getKinsfolkPhone()) && one.getIncomeWan() != null){
|
||||
infoFlag = true;
|
||||
}
|
||||
// 收款银行卡
|
||||
if(StringUtils.isNotEmpty(one.getBankType()) && StringUtils.isNotEmpty(one.getBackCardNum())){
|
||||
bankFlag = true;
|
||||
}
|
||||
if(!one.getAllowSignature()){
|
||||
signFlag = true;
|
||||
} else {
|
||||
signFlag = StringUtils.isNotEmpty(one.getSignature());
|
||||
}
|
||||
if(infoFlag && cardFlag && bankFlag && signFlag){
|
||||
realNameAuth = 1;
|
||||
}
|
||||
this.update(Wrappers.lambdaUpdate(CustomerInfo.class)
|
||||
.eq(CustomerInfo::getId, customerId)
|
||||
.set(CustomerInfo::getInfoFlag,infoFlag)
|
||||
.set(CustomerInfo::getCardFlag,cardFlag)
|
||||
.set(CustomerInfo::getBankFlag,bankFlag));
|
||||
customerService.update(Wrappers.lambdaUpdate(Customer.class)
|
||||
.eq(Customer::getId, customerId)
|
||||
.set(Customer::getRealNameAuth,realNameAuth));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomerInfo getByCustomerId(Long customerId) {
|
||||
return this.getOne(Wrappers.lambdaQuery(CustomerInfo.class)
|
||||
.eq(CustomerInfo::getCustomerId,customerId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateAllowSignature(CustomerInfo bo) {
|
||||
this.update(Wrappers.lambdaUpdate(CustomerInfo.class)
|
||||
.eq(CustomerInfo::getCustomerId,bo.getCustomerId())
|
||||
.set(CustomerInfo::getAllowSignature,bo.getAllowSignature()));
|
||||
CustomerInfo customerInfo = this.getByCustomerId(bo.getCustomerId());
|
||||
checkCustomerInfoFlag(customerInfo);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.bashi.dk.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bashi.common.com.Condition;
|
||||
import com.bashi.common.com.PageParams;
|
||||
import com.bashi.common.core.domain.entity.Customer;
|
||||
import com.bashi.common.exception.CustomException;
|
||||
import com.bashi.dk.domain.BorrowLog;
|
||||
import com.bashi.dk.domain.CustomerInfo;
|
||||
import com.bashi.dk.dto.admin.resp.CustomerAdminResp;
|
||||
import com.bashi.dk.dto.app.req.CustomerRegisterReq;
|
||||
import com.bashi.dk.mapper.BorrowLogMapper;
|
||||
import com.bashi.dk.mapper.CustomerMapper;
|
||||
import com.bashi.dk.service.CustomerInfoService;
|
||||
import com.bashi.dk.service.CustomerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Service
|
||||
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {
|
||||
@Autowired
|
||||
private BCryptPasswordEncoder passwordEncoder;
|
||||
@Autowired
|
||||
private CustomerInfoService customerInfoService;
|
||||
@Resource
|
||||
private BorrowLogMapper borrowLogMapper;
|
||||
@Override
|
||||
public Customer getCustomerByName(String mobile) {
|
||||
return this.getOne(Wrappers.lambdaQuery(Customer.class)
|
||||
.eq(Customer::getPhoneNumber,mobile)
|
||||
.last("limit 1"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(CustomerRegisterReq register) {
|
||||
String phoneNumber = register.getPhoneNumber();
|
||||
Customer customer = this.getCustomerByName(phoneNumber);
|
||||
if(customer != null){
|
||||
throw new CustomException("用户已存在");
|
||||
}
|
||||
customer = new Customer();
|
||||
customer.setPhoneNumber(phoneNumber);
|
||||
customer.setNickName("VIP用户"+phoneNumber.substring(phoneNumber.length() - 4));
|
||||
customer.setPassword(passwordEncoder.encode(register.getPassword()));
|
||||
this.save(customer);
|
||||
CustomerInfo customerInfo = new CustomerInfo();
|
||||
customerInfo.setCustomerId(customer.getId());
|
||||
customerInfoService.save(customerInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updatePwd(Long id, String password) {
|
||||
return this.update(Wrappers.lambdaUpdate(Customer.class)
|
||||
.eq(Customer::getId,id)
|
||||
.set(Customer::getPassword,passwordEncoder.encode(password)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void borrowAmount(Long customerId, BigDecimal totalLoanMoney,BigDecimal totalRepayment) {
|
||||
baseMapper.incsAmount(customerId,totalLoanMoney,totalRepayment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean withdraw(Long customerId, Double withdrawAmount) {
|
||||
baseMapper.withdraw(customerId,withdrawAmount);
|
||||
BorrowLog borrowLog = new BorrowLog();
|
||||
borrowLog.setWithdrawAccount(withdrawAmount);
|
||||
borrowLog.setCustomerId(customerId);
|
||||
borrowLogMapper.insert(borrowLog);
|
||||
this.update(Wrappers.lambdaUpdate(Customer.class)
|
||||
.eq(Customer::getId,customerId)
|
||||
.set(Customer::getWithdrawFlag,1));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dk(Long customerId){
|
||||
this.update(Wrappers.lambdaUpdate(Customer.class)
|
||||
.eq(Customer::getId,customerId)
|
||||
.set(Customer::getLoansFlag,1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CustomerAdminResp> pageAdmin(PageParams pageParams, CustomerAdminResp bo) {
|
||||
return baseMapper.pageAdmin(Condition.getPage(pageParams),bo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.bashi.dk.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bashi.dk.domain.HomeSetting;
|
||||
import com.bashi.dk.mapper.HomeSettingMapper;
|
||||
import com.bashi.dk.service.HomeSettingService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class HomeSettingServiceImpl extends ServiceImpl<HomeSettingMapper, HomeSetting> implements HomeSettingService {
|
||||
@Override
|
||||
public HomeSetting getHomeSetting(){
|
||||
return this.getOne(Wrappers.lambdaQuery(HomeSetting.class).last("limit 1"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.bashi.dk.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bashi.dk.domain.LoansSetting;
|
||||
import com.bashi.dk.mapper.LoansSettingMapper;
|
||||
import com.bashi.dk.service.LoansSettingService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class LoansSettingServiceImpl extends ServiceImpl<LoansSettingMapper, LoansSetting> implements LoansSettingService {
|
||||
@Override
|
||||
public LoansSetting getLoansSetting(){
|
||||
return this.getOne(Wrappers.lambdaQuery(LoansSetting.class).last("limit 1"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 等额本金还款法
|
||||
*
|
||||
* Created by WangGenshen on 1/23/16.
|
||||
*/
|
||||
public class ACMLoanCalculator extends LoanCalculatorAdapter {
|
||||
|
||||
@Override
|
||||
public Loan calLoan(BigDecimal totalLoanMoney, int totalMonth, double loanRate, int rateType) {
|
||||
Loan loan = new Loan();
|
||||
BigDecimal loanRateMonth = rateType == LoanUtil.RATE_TYPE_YEAR ? new BigDecimal(loanRate / 100 / 12) : new BigDecimal(loanRate / 100);
|
||||
loan.setTotalMonth(totalMonth);
|
||||
loan.setTotalLoanMoney(totalLoanMoney);
|
||||
BigDecimal payPrincipal = totalLoanMoney.divide(new BigDecimal(totalMonth), 2, BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
BigDecimal totalPayedPrincipal = new BigDecimal(0);//累积所还本金
|
||||
BigDecimal totalInterest = new BigDecimal(0); //总利息
|
||||
BigDecimal totalRepayment = new BigDecimal(0); // 已还款总数
|
||||
List<LoanByMonth> loanByMonthList = new ArrayList<>();
|
||||
int year = 0;
|
||||
int monthInYear = 0;
|
||||
for (int i = 0; i < totalMonth; i++) {
|
||||
LoanByMonth loanByMonth = new LoanByMonth();
|
||||
loanByMonth.setMonth(i + 1);
|
||||
loanByMonth.setYear(year + 1);
|
||||
loanByMonth.setMonthInYear(++monthInYear);
|
||||
if ((i + 1) % 12 == 0) {
|
||||
year++;
|
||||
monthInYear = 0;
|
||||
}
|
||||
totalPayedPrincipal = totalPayedPrincipal.add(payPrincipal);
|
||||
loanByMonth.setPayPrincipal(payPrincipal);
|
||||
BigDecimal interest = totalLoanMoney.subtract(totalPayedPrincipal).multiply(loanRateMonth).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
loanByMonth.setInterest(interest);
|
||||
totalInterest = totalInterest.add(interest);
|
||||
loanByMonth.setRepayment(payPrincipal.add(interest));
|
||||
if (i == 0) {
|
||||
loan.setFirstRepayment(loanByMonth.getRepayment());
|
||||
}
|
||||
totalRepayment = totalRepayment.add(loanByMonth.getRepayment());
|
||||
loanByMonth.setRemainPrincipal(totalLoanMoney.subtract(totalPayedPrincipal));
|
||||
loanByMonthList.add(loanByMonth);
|
||||
}
|
||||
loan.setTotalRepayment(totalRepayment);
|
||||
loan.setAvgRepayment(totalRepayment.divide(new BigDecimal(totalMonth), 2, BigDecimal.ROUND_HALF_UP));
|
||||
loan.setTotalInterest(totalInterest);
|
||||
BigDecimal totalPayedRepayment = new BigDecimal(0);
|
||||
for (LoanByMonth loanByMonth : loanByMonthList) {
|
||||
totalPayedRepayment = totalPayedRepayment.add(loanByMonth.getRepayment());
|
||||
loanByMonth.setRemainTotal(totalRepayment.subtract(totalPayedRepayment));
|
||||
}
|
||||
loan.setAllLoans(loanByMonthList);
|
||||
return loan;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 等额本息还款法
|
||||
* Created by WangGenshen on 1/23/16.
|
||||
*/
|
||||
public class ACPIMLoanCalculator extends LoanCalculatorAdapter {
|
||||
|
||||
@Override
|
||||
public Loan calLoan(BigDecimal totalLoanMoney, int totalMonth, double loanRate, int rateType) {
|
||||
Loan loan = new Loan();
|
||||
BigDecimal loanRateMonth = rateType == LoanUtil.RATE_TYPE_YEAR ? new BigDecimal(loanRate / 100 / 12) : new BigDecimal(loanRate / 100);
|
||||
BigDecimal factor = new BigDecimal(Math.pow(1 + loanRateMonth.doubleValue(), totalMonth));
|
||||
BigDecimal avgRepayment = totalLoanMoney.multiply(loanRateMonth).multiply(factor).divide(factor.subtract(new BigDecimal(1)), 2, BigDecimal.ROUND_HALF_UP);
|
||||
loan.setLoanRate(loanRate);
|
||||
loan.setTotalLoanMoney(totalLoanMoney);
|
||||
loan.setTotalMonth(totalMonth);
|
||||
loan.setAvgRepayment(avgRepayment);
|
||||
loan.setTotalRepayment(avgRepayment.multiply(new BigDecimal(totalMonth)));
|
||||
loan.setFirstRepayment(avgRepayment);
|
||||
|
||||
BigDecimal totalPayedPrincipal = new BigDecimal(0);//累积所还本金
|
||||
BigDecimal totalInterest = new BigDecimal(0); //总利息
|
||||
BigDecimal totalRepayment = new BigDecimal(0); // 已还款总数
|
||||
List<LoanByMonth> loanByMonthList = new ArrayList<>();
|
||||
int year = 0;
|
||||
int monthInYear = 0;
|
||||
for (int i = 0; i < totalMonth; i++) {
|
||||
LoanByMonth loanByMonth = new LoanByMonth();
|
||||
BigDecimal remainPrincipal = totalLoanMoney.subtract(totalPayedPrincipal);
|
||||
BigDecimal interest = remainPrincipal.multiply(loanRateMonth).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
totalInterest = totalInterest.add(interest);
|
||||
BigDecimal principal = loan.getAvgRepayment().subtract(interest);
|
||||
totalPayedPrincipal = totalPayedPrincipal.add(principal);
|
||||
loanByMonth.setMonth(i + 1);
|
||||
loanByMonth.setYear(year + 1);
|
||||
loanByMonth.setMonthInYear(++monthInYear);
|
||||
if ((i + 1) % 12 == 0) {
|
||||
year++;
|
||||
monthInYear = 0;
|
||||
}
|
||||
loanByMonth.setInterest(interest);
|
||||
loanByMonth.setPayPrincipal(principal);
|
||||
loanByMonth.setRepayment(loan.getAvgRepayment());
|
||||
totalRepayment = totalRepayment.add(loanByMonth.getRepayment());
|
||||
loanByMonth.setRemainPrincipal(remainPrincipal);
|
||||
loanByMonth.setRemainTotal(loan.getTotalRepayment().subtract(totalRepayment));
|
||||
loanByMonthList.add(loanByMonth);
|
||||
}
|
||||
loan.setTotalInterest(totalInterest);
|
||||
loan.setAllLoans(loanByMonthList);
|
||||
return loan;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import freemarker.cache.StringTemplateLoader;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 使用说明 ${name!12312312} 代表默认值
|
||||
* 支持自定义日期格式newDate为约定 ${newDate?string("yyyy-MM-dd HH:mm:ss")
|
||||
* 普通字符直接替换${code}
|
||||
* @author zlf
|
||||
* @date 2023/6/19 6:56 PM
|
||||
* @desc
|
||||
*/
|
||||
public class ContentReplaceUtil {
|
||||
|
||||
public static String NOW_DATE = "newDate";
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
public static String replaceWord(String content, Map<String, Object> params) {
|
||||
if (StrUtil.isEmpty(content)){
|
||||
return null;
|
||||
}
|
||||
if (content.contains(NOW_DATE)){
|
||||
params.put("newDate",new Date());
|
||||
}
|
||||
StringTemplateLoader stringTemplateLoader = new StringTemplateLoader();
|
||||
stringTemplateLoader.putTemplate("test.ftl", content);
|
||||
Configuration cfg = new Configuration(Configuration.VERSION_2_3_22);
|
||||
cfg.setTemplateLoader(stringTemplateLoader);
|
||||
Template template = cfg.getTemplate("test.ftl");
|
||||
String finalContent = FreeMarkerTemplateUtils.processTemplateIntoString(template, params);
|
||||
return finalContent;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Created by WangGenshen on 1/14/16.
|
||||
*/
|
||||
public interface ILoanCalculator {
|
||||
|
||||
/**
|
||||
* 贷款计算
|
||||
*
|
||||
* @param totalLoanMoney 总贷款额
|
||||
* @param totalMonth 还款月数
|
||||
* @param loanRate 贷款利率
|
||||
* @param rateType 可选择年利率或月利率
|
||||
* @return
|
||||
*/
|
||||
public Loan calLoan(BigDecimal totalLoanMoney, int totalMonth, double loanRate, int rateType);
|
||||
|
||||
}
|
||||
154
bashi-dk/src/main/java/com/bashi/dk/util/ImageUtil.java
Normal file
154
bashi-dk/src/main/java/com/bashi/dk/util/ImageUtil.java
Normal file
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import com.sun.image.codec.jpeg.JPEGCodec;
|
||||
import com.sun.image.codec.jpeg.JPEGEncodeParam;
|
||||
import com.sun.image.codec.jpeg.JPEGImageEncoder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import sun.font.FontDesignMetrics;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class ImageUtil {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String filePath = "d:\\Users\\004796\\桌面\\123\\hd_bg.png";
|
||||
Map<String,String> content = new LinkedHashMap<>();
|
||||
content.put(" 转账批次号","542838541");
|
||||
content.put(" 转出单位","招商银行股份有限公司");
|
||||
content.put(" 转出账户","2361293892173872198");
|
||||
content.put("转出账号地区","深圳市福田区深南大道708");
|
||||
content.put(" 收款人姓名","马中华");
|
||||
content.put(" 收款账户","1273891273897123718");
|
||||
content.put(" 币种","人民币元");
|
||||
content.put(" 转出金额","100000.00");
|
||||
content.put(" 转出时间","2023-11-27 09:30:12");
|
||||
content.put(" 转账类型","签约金融企业--网贷放款预约到账");
|
||||
content.put(" 执行方式","点击选择执行方式");
|
||||
content.put(" 状态","点击选择状态");
|
||||
content.put(" 银行备注","点击选择银行备注");
|
||||
content.put(" 处理结果","点击选择处理结果");
|
||||
content.put(" 用户备注","点击选择用户备注");
|
||||
String putPath = "d:\\Users\\004796\\桌面\\123\\1233.jpg";
|
||||
createStringMark(filePath,content,putPath);
|
||||
}
|
||||
|
||||
|
||||
//给jpg添加文字
|
||||
public static boolean createStringMark(String filePath, Map<String,String> content, String outPath) {
|
||||
ImageIcon imgIcon = new ImageIcon(filePath);
|
||||
Image theImg = imgIcon.getImage();
|
||||
int width = theImg.getWidth(null) == -1 ? 200 : theImg.getWidth(null);
|
||||
int height = theImg.getHeight(null) == -1 ? 200 : theImg.getHeight(null);
|
||||
int fontSize = 16;
|
||||
BufferedImage bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics2D g = bimage.createGraphics();
|
||||
Color mycolor = Color.black;
|
||||
g.setColor(mycolor);
|
||||
g.setBackground(Color.black);
|
||||
g.drawImage(theImg, 0, 0, null);
|
||||
g.setFont(new Font("宋体", Font.PLAIN, fontSize)); //字体、字型、字号
|
||||
RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
g.setRenderingHints(hints);
|
||||
Graphics2D g1 = bimage.createGraphics();
|
||||
g1.setColor(mycolor);
|
||||
g1.setBackground(Color.black);
|
||||
g1.drawImage(theImg, 0, 0, null);
|
||||
g1.setFont(new Font("黑体", Font.PLAIN, fontSize)); //字体、字型、字号
|
||||
g1.setRenderingHints(hints);
|
||||
int widthFlag = 500;
|
||||
int heightFlag = 335;
|
||||
for (Map.Entry<String, String> entry : content.entrySet()) {
|
||||
g1.drawString(entry.getKey()+": "+entry.getValue(), widthFlag, heightFlag); //画文字
|
||||
heightFlag += 29;
|
||||
}
|
||||
g1.dispose();
|
||||
g.dispose();
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
out = new FileOutputStream(outPath); //先用一个特定的输出文件名
|
||||
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
|
||||
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bimage);
|
||||
param.setQuality(100, true); //
|
||||
encoder.encode(bimage, param);
|
||||
} catch (Exception e) {
|
||||
log.error("图片生成失败", e);
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
if(out != null) out.close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static void gogo(){
|
||||
int fontSize = 14;
|
||||
// 获取当前系统所有字体
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
String[] fontNames = ge.getAvailableFontFamilyNames();
|
||||
String str = "转账批次号: 1231231";
|
||||
int height = 0;
|
||||
int width = 0;
|
||||
// 根据字体获取需要生成的图片的宽和高
|
||||
for (String fontName : fontNames) {
|
||||
Font font = new Font(fontName, Font.PLAIN, fontSize);
|
||||
FontDesignMetrics metrics = FontDesignMetrics.getMetrics(font);
|
||||
height += metrics.getHeight();
|
||||
int tmpWidth = metrics.stringWidth(fontName + " : " + str);
|
||||
if (tmpWidth > width) {
|
||||
width = tmpWidth;
|
||||
}
|
||||
}
|
||||
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
|
||||
Graphics2D g2d = null;
|
||||
try {
|
||||
//创建画笔
|
||||
g2d = image.createGraphics();
|
||||
//设置背景颜色为白色
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.fillRect(0, 0, image.getWidth(), image.getHeight());
|
||||
//设置画笔颜色为黑色
|
||||
g2d.setColor(Color.BLACK);
|
||||
RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
// 开启文字抗锯齿
|
||||
hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
g2d.setRenderingHints(hints);
|
||||
int startY = 0;
|
||||
for (String fontName : fontNames) {
|
||||
Font font = new Font(fontName, Font.PLAIN, fontSize);
|
||||
System.out.println(fontName);
|
||||
g2d.setFont(font);
|
||||
g2d.drawString(fontName + " : " + str, 0, startY);
|
||||
// 下一行文字的左上角纵坐标
|
||||
FontDesignMetrics metrics = FontDesignMetrics.getMetrics(font);
|
||||
startY += metrics.getHeight();
|
||||
}
|
||||
String savePath = "d:\\Users\\004796\\桌面\\123\\1111.jpg";
|
||||
ImageIO.write(image, "PNG", new File(savePath));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (g2d != null) {
|
||||
g2d.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
115
bashi-dk/src/main/java/com/bashi/dk/util/Loan.java
Normal file
115
bashi-dk/src/main/java/com/bashi/dk/util/Loan.java
Normal file
@@ -0,0 +1,115 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by WangGenshen on 1/14/16.
|
||||
*/
|
||||
public class Loan {
|
||||
|
||||
private BigDecimal totalLoanMoney; //贷款总额
|
||||
private int totalMonth; //还款月份
|
||||
private double loanRate; //贷款年利率
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private double loanRateMonth;
|
||||
|
||||
private BigDecimal totalInterest; // 总利息数
|
||||
private BigDecimal totalRepayment; // 还款总额
|
||||
private BigDecimal firstRepayment; // 首月还款额
|
||||
private BigDecimal avgRepayment; // 月均还款额
|
||||
|
||||
private List<LoanByMonth> allLoans; // 所有月份的还款情况
|
||||
|
||||
|
||||
|
||||
|
||||
public BigDecimal getTotalLoanMoney() {
|
||||
return totalLoanMoney;
|
||||
}
|
||||
|
||||
public void setTotalLoanMoney(BigDecimal totalLoanMoney) {
|
||||
this.totalLoanMoney = totalLoanMoney;
|
||||
}
|
||||
|
||||
public int getTotalMonth() {
|
||||
return totalMonth;
|
||||
}
|
||||
|
||||
public void setTotalMonth(int totalMonth) {
|
||||
this.totalMonth = totalMonth;
|
||||
}
|
||||
|
||||
public double getLoanRate() {
|
||||
return loanRate;
|
||||
}
|
||||
|
||||
public void setLoanRate(double loanRate) {
|
||||
this.loanRate = loanRate;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalInterest() {
|
||||
return totalInterest;
|
||||
}
|
||||
|
||||
public void setTotalInterest(BigDecimal totalInterest) {
|
||||
this.totalInterest = totalInterest;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalRepayment() {
|
||||
return totalRepayment;
|
||||
}
|
||||
|
||||
public void setTotalRepayment(BigDecimal totalRepayment) {
|
||||
this.totalRepayment = totalRepayment;
|
||||
}
|
||||
|
||||
public BigDecimal getFirstRepayment() {
|
||||
return firstRepayment;
|
||||
}
|
||||
|
||||
public void setFirstRepayment(BigDecimal firstRepayment) {
|
||||
this.firstRepayment = firstRepayment;
|
||||
}
|
||||
|
||||
public BigDecimal getAvgRepayment() {
|
||||
return avgRepayment;
|
||||
}
|
||||
|
||||
public void setAvgRepayment(BigDecimal avgRepayment) {
|
||||
this.avgRepayment = avgRepayment;
|
||||
}
|
||||
|
||||
public List<LoanByMonth> getAllLoans() {
|
||||
return allLoans;
|
||||
}
|
||||
|
||||
public void setAllLoans(List<LoanByMonth> allLoans) {
|
||||
this.allLoans = allLoans;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String allLoansStr = "";
|
||||
if (allLoans != null) {
|
||||
for (LoanByMonth loanByMonth : allLoans) {
|
||||
String lbmStr = "月份: " + loanByMonth.getMonth() + "\t第" + loanByMonth.getYear() + "年\t第" +
|
||||
loanByMonth.getMonthInYear() + "月\t" + "月供: " + loanByMonth.getRepayment() +
|
||||
"\t本金: " + loanByMonth.getPayPrincipal() + "\t利息: " + loanByMonth.getInterest() +
|
||||
"\t剩余贷款: " + loanByMonth.getRemainTotal();
|
||||
if (allLoansStr.equals("")) {
|
||||
allLoansStr = lbmStr;
|
||||
} else {
|
||||
allLoansStr += "\n" + lbmStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "每月还款: " + getAvgRepayment() + "\t总利息: " + getTotalInterest() +
|
||||
"\t还款总额:" + getTotalRepayment() + "\t首月还款: " + getFirstRepayment() + "\n" + allLoansStr;
|
||||
}
|
||||
}
|
||||
83
bashi-dk/src/main/java/com/bashi/dk/util/LoanByMonth.java
Normal file
83
bashi-dk/src/main/java/com/bashi/dk/util/LoanByMonth.java
Normal file
@@ -0,0 +1,83 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Created by WangGenshen on 1/14/16.
|
||||
*/
|
||||
public class LoanByMonth {
|
||||
|
||||
private int month; // 第几个月份
|
||||
private BigDecimal repayment; // 该月还款额
|
||||
private BigDecimal payPrincipal; // 该月所还本金
|
||||
private BigDecimal interest; // 该月利息
|
||||
private BigDecimal remainTotal; // 剩余贷款
|
||||
private BigDecimal remainPrincipal; // 剩余总本金
|
||||
|
||||
private int year; // 第几年
|
||||
private int monthInYear; // 年里的第几月
|
||||
|
||||
public int getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(int month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public BigDecimal getRepayment() {
|
||||
return repayment;
|
||||
}
|
||||
|
||||
public void setRepayment(BigDecimal repayment) {
|
||||
this.repayment = repayment;
|
||||
}
|
||||
|
||||
public BigDecimal getPayPrincipal() {
|
||||
return payPrincipal;
|
||||
}
|
||||
|
||||
public void setPayPrincipal(BigDecimal payPrincipal) {
|
||||
this.payPrincipal = payPrincipal;
|
||||
}
|
||||
|
||||
public BigDecimal getInterest() {
|
||||
return interest;
|
||||
}
|
||||
|
||||
public void setInterest(BigDecimal interest) {
|
||||
this.interest = interest;
|
||||
}
|
||||
|
||||
public BigDecimal getRemainTotal() {
|
||||
return remainTotal;
|
||||
}
|
||||
|
||||
public void setRemainTotal(BigDecimal remainTotal) {
|
||||
this.remainTotal = remainTotal;
|
||||
}
|
||||
|
||||
public BigDecimal getRemainPrincipal() {
|
||||
return remainPrincipal;
|
||||
}
|
||||
|
||||
public void setRemainPrincipal(BigDecimal remainPrincipal) {
|
||||
this.remainPrincipal = remainPrincipal;
|
||||
}
|
||||
|
||||
public int getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(int year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public int getMonthInYear() {
|
||||
return monthInYear;
|
||||
}
|
||||
|
||||
public void setMonthInYear(int monthInYear) {
|
||||
this.monthInYear = monthInYear;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by WangGenshen on 1/14/16.
|
||||
*/
|
||||
public class LoanCalculatorAdapter implements ILoanCalculator {
|
||||
|
||||
@Override
|
||||
public Loan calLoan(BigDecimal totalLoanMoney, int totalMonth, double loanRate, int rateType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import org.xnio.channels.SuspendableAcceptChannel;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Created by WangGenshen on 1/14/16.
|
||||
*/
|
||||
public class LoanCalculatorTest {
|
||||
|
||||
private int totalMonth;
|
||||
private BigDecimal totalMoney;
|
||||
private double percent;
|
||||
private double rate;
|
||||
private double rateDiscount;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
totalMonth = 36;
|
||||
totalMoney = new BigDecimal(50000);
|
||||
percent = 0;
|
||||
rate = 10.8;
|
||||
rateDiscount = 1;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
ACPIMLoanCalculator calculator = new ACPIMLoanCalculator();
|
||||
Loan loan = calculator.calLoan(
|
||||
LoanUtil.totalLoanMoney(new BigDecimal(50000), 2),
|
||||
36,
|
||||
0.6,
|
||||
LoanUtil.RATE_TYPE_MONTH);
|
||||
System.out.println("asd");
|
||||
}
|
||||
|
||||
|
||||
public void testACPIMCalculate() {
|
||||
ACPIMLoanCalculator calculator = new ACPIMLoanCalculator();
|
||||
Loan loan = calculator.calLoan(
|
||||
LoanUtil.totalLoanMoney(totalMoney, percent),
|
||||
totalMonth,
|
||||
LoanUtil.rate(rate, rateDiscount),
|
||||
LoanUtil.RATE_TYPE_YEAR);
|
||||
System.out.println(loan);
|
||||
}
|
||||
|
||||
public void testACMCalculate() {
|
||||
ACMLoanCalculator calculator = new ACMLoanCalculator();
|
||||
Loan loan = calculator.calLoan(
|
||||
LoanUtil.totalLoanMoney(totalMoney, percent),
|
||||
totalMonth,
|
||||
LoanUtil.rate(rate, rateDiscount),
|
||||
LoanUtil.RATE_TYPE_YEAR);
|
||||
System.out.println(loan);
|
||||
}
|
||||
|
||||
}
|
||||
33
bashi-dk/src/main/java/com/bashi/dk/util/LoanUtil.java
Normal file
33
bashi-dk/src/main/java/com/bashi/dk/util/LoanUtil.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Created by WangGenshen on 1/23/16.
|
||||
*/
|
||||
public class LoanUtil {
|
||||
|
||||
public static final int RATE_TYPE_YEAR = 10;
|
||||
public static final int RATE_TYPE_MONTH = 11;
|
||||
|
||||
public static BigDecimal totalMoney(double area, BigDecimal price, double discount) {
|
||||
return price.multiply(new BigDecimal(area)).multiply(new BigDecimal(discount)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
public static BigDecimal totalLoanMoney(BigDecimal totalMoney, double percent) {
|
||||
return totalMoney.multiply(new BigDecimal(1 - percent)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
public static BigDecimal totalLoanMoney(double area, BigDecimal price, double discount, double percent) {
|
||||
return totalLoanMoney(totalMoney(area, price, discount), percent);
|
||||
}
|
||||
|
||||
public static double rate(double rate, double discount) {
|
||||
return rate * discount;
|
||||
}
|
||||
|
||||
public static int totalMonth(int year) {
|
||||
return 12 * year;
|
||||
}
|
||||
|
||||
}
|
||||
141
bashi-dk/src/main/java/com/bashi/dk/util/MoneyUtil.java
Normal file
141
bashi-dk/src/main/java/com/bashi/dk/util/MoneyUtil.java
Normal file
@@ -0,0 +1,141 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
public class MoneyUtil {
|
||||
|
||||
/** 大写数字 */
|
||||
private static final String[] NUMBERS = { "零", "壹", "贰", "叁", "肆", "伍", "陆",
|
||||
"柒", "捌", "玖" };
|
||||
/** 整数部分的单位 */
|
||||
private static final String[] IUNIT = { "元", "拾", "佰", "仟", "万", "拾", "佰",
|
||||
"仟", "亿", "拾", "佰", "仟", "万", "拾", "佰", "仟" };
|
||||
/** 小数部分的单位 */
|
||||
private static final String[] DUNIT = { "角", "分", "厘" };
|
||||
|
||||
/**
|
||||
* 得到大写金额。
|
||||
*/
|
||||
public static String toChinese(String str) {
|
||||
str = str.replaceAll(",", "");// 去掉","
|
||||
String integerStr;// 整数部分数字
|
||||
String decimalStr;// 小数部分数字
|
||||
|
||||
// 初始化:分离整数部分和小数部分
|
||||
if (str.indexOf(".") > 0) {
|
||||
integerStr = str.substring(0, str.indexOf("."));
|
||||
decimalStr = str.substring(str.indexOf(".") + 1);
|
||||
} else if (str.indexOf(".") == 0) {
|
||||
integerStr = "";
|
||||
decimalStr = str.substring(1);
|
||||
} else {
|
||||
integerStr = str;
|
||||
decimalStr = "";
|
||||
}
|
||||
// integerStr去掉首0,不必去掉decimalStr的尾0(超出部分舍去)
|
||||
if (!integerStr.equals("")) {
|
||||
integerStr = Long.toString(Long.parseLong(integerStr));
|
||||
if (integerStr.equals("0")) {
|
||||
integerStr = "";
|
||||
}
|
||||
}
|
||||
// overflow超出处理能力,直接返回
|
||||
if (integerStr.length() > IUNIT.length) {
|
||||
System.out.println(str + ":超出处理能力");
|
||||
return str;
|
||||
}
|
||||
|
||||
int[] integers = toArray(integerStr);// 整数部分数字
|
||||
boolean isMust5 = isMust5(integerStr);// 设置万单位
|
||||
int[] decimals = toArray(decimalStr);// 小数部分数字
|
||||
return getChineseInteger(integers, isMust5) + getChineseDecimal(decimals);
|
||||
}
|
||||
|
||||
/**
|
||||
* 整数部分和小数部分转换为数组,从高位至低位
|
||||
*/
|
||||
private static int[] toArray(String number) {
|
||||
int[] array = new int[number.length()];
|
||||
for (int i = 0; i < number.length(); i++) {
|
||||
array[i] = Integer.parseInt(number.substring(i, i + 1));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到中文金额的整数部分。
|
||||
*/
|
||||
private static String getChineseInteger(int[] integers, boolean isMust5) {
|
||||
StringBuffer chineseInteger = new StringBuffer("");
|
||||
int length = integers.length;
|
||||
for (int i = 0; i < length; i++) {
|
||||
// 0出现在关键位置:1234(万)5678(亿)9012(万)3456(元)
|
||||
// 特殊情况:10(拾元、壹拾元、壹拾万元、拾万元)
|
||||
String key = "";
|
||||
if (integers[i] == 0) {
|
||||
if ((length - i) == 13)// 万(亿)(必填)
|
||||
key = IUNIT[4];
|
||||
else if ((length - i) == 9)// 亿(必填)
|
||||
key = IUNIT[8];
|
||||
else if ((length - i) == 5 && isMust5)// 万(不必填)
|
||||
key = IUNIT[4];
|
||||
else if ((length - i) == 1)// 元(必填)
|
||||
key = IUNIT[0];
|
||||
// 0遇非0时补零,不包含最后一位
|
||||
if ((length - i) > 1 && integers[i + 1] != 0)
|
||||
key += NUMBERS[0];
|
||||
}
|
||||
chineseInteger.append(integers[i] == 0 ? key
|
||||
: (NUMBERS[integers[i]] + IUNIT[length - i - 1]));
|
||||
}
|
||||
return chineseInteger.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到中文金额的小数部分。
|
||||
*/
|
||||
private static String getChineseDecimal(int[] decimals) {
|
||||
StringBuffer chineseDecimal = new StringBuffer("");
|
||||
for (int i = 0; i < decimals.length; i++) {
|
||||
// 舍去3位小数之后的
|
||||
if (i == 3)
|
||||
break;
|
||||
chineseDecimal.append(decimals[i] == 0 ? ""
|
||||
: (NUMBERS[decimals[i]] + DUNIT[i]));
|
||||
}
|
||||
return chineseDecimal.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断第5位数字的单位"万"是否应加。
|
||||
*/
|
||||
private static boolean isMust5(String integerStr) {
|
||||
int length = integerStr.length();
|
||||
if (length > 4) {
|
||||
String subInteger = "";
|
||||
if (length > 8) {
|
||||
// 取得从低位数,第5到第8位的字串
|
||||
subInteger = integerStr.substring(length - 8, length - 4);
|
||||
} else {
|
||||
subInteger = integerStr.substring(0, length - 4);
|
||||
}
|
||||
return Integer.parseInt(subInteger) > 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String number = "1.23";
|
||||
System.out.println(number + " " + MoneyUtil.toChinese(number));
|
||||
number = "1234567890123456.123";
|
||||
System.out.println(number + " " + MoneyUtil.toChinese(number));
|
||||
number = "0.0798";
|
||||
System.out.println(number + " " + MoneyUtil.toChinese(number));
|
||||
number = "10,001,000.09";
|
||||
System.out.println(number + " " + MoneyUtil.toChinese(number));
|
||||
number = "01.107700";
|
||||
System.out.println(number + " " + MoneyUtil.toChinese(number));
|
||||
number = "01.107700";
|
||||
System.out.println(number + " " + MoneyUtil.toChinese(number));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
|
||||
/**
|
||||
* <p>created on 2021/8/23</p>
|
||||
*
|
||||
* @author zhangliang
|
||||
*/
|
||||
public class OrderTradeNoUtil {
|
||||
|
||||
public static final String BORROW = "B";
|
||||
|
||||
private static final SnowFlake snowFlake = new SnowFlake(2, 3);
|
||||
|
||||
public static String createOrder(String orderType){
|
||||
return orderType + snowFlake.nextId();
|
||||
}
|
||||
|
||||
public static String getOrderType(String tradeNo){
|
||||
if(StringUtils.isBlank(tradeNo)){
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(tradeNo.charAt(0));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class PhoneRandomUtil {
|
||||
|
||||
public static String gen() {
|
||||
Random random = new Random();
|
||||
StringBuilder phoneNumber = new StringBuilder();
|
||||
phoneNumber.append("1");
|
||||
for (int i = 0; i < 2; i++) {
|
||||
phoneNumber.append(random.nextInt(10));
|
||||
}
|
||||
phoneNumber.append("****");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
phoneNumber.append(random.nextInt(10));
|
||||
}
|
||||
return phoneNumber.toString();
|
||||
}
|
||||
|
||||
}
|
||||
100
bashi-dk/src/main/java/com/bashi/dk/util/SnowFlake.java
Normal file
100
bashi-dk/src/main/java/com/bashi/dk/util/SnowFlake.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package com.bashi.dk.util;
|
||||
|
||||
/**
|
||||
* 描述: Twitter的分布式自增ID雪花算法snowflake (Java版)
|
||||
*
|
||||
* @author yanpenglei
|
||||
* @create 2018-03-13 12:37
|
||||
**/
|
||||
public class SnowFlake {
|
||||
|
||||
/**
|
||||
* 起始的时间戳
|
||||
*/
|
||||
private final static long START_STMP = 1480166465631L;
|
||||
|
||||
/**
|
||||
* 每一部分占用的位数
|
||||
*/
|
||||
private final static long SEQUENCE_BIT = 12; //序列号占用的位数
|
||||
private final static long MACHINE_BIT = 5; //机器标识占用的位数
|
||||
private final static long DATACENTER_BIT = 5;//数据中心占用的位数
|
||||
|
||||
/**
|
||||
* 每一部分的最大值
|
||||
*/
|
||||
private final static long MAX_DATACENTER_NUM = -1L ^ (-1L << DATACENTER_BIT);
|
||||
private final static long MAX_MACHINE_NUM = -1L ^ (-1L << MACHINE_BIT);
|
||||
private final static long MAX_SEQUENCE = -1L ^ (-1L << SEQUENCE_BIT);
|
||||
|
||||
/**
|
||||
* 每一部分向左的位移
|
||||
*/
|
||||
private final static long MACHINE_LEFT = SEQUENCE_BIT;
|
||||
private final static long DATACENTER_LEFT = SEQUENCE_BIT + MACHINE_BIT;
|
||||
private final static long TIMESTMP_LEFT = DATACENTER_LEFT + DATACENTER_BIT;
|
||||
|
||||
private long datacenterId; //数据中心
|
||||
private long machineId; //机器标识
|
||||
private long sequence = 0L; //序列号
|
||||
private long lastStmp = -1L;//上一次时间戳
|
||||
|
||||
public SnowFlake(long datacenterId, long machineId) {
|
||||
if (datacenterId > MAX_DATACENTER_NUM || datacenterId < 0) {
|
||||
throw new IllegalArgumentException("datacenterId can't be greater than MAX_DATACENTER_NUM or less than 0");
|
||||
}
|
||||
if (machineId > MAX_MACHINE_NUM || machineId < 0) {
|
||||
throw new IllegalArgumentException("machineId can't be greater than MAX_MACHINE_NUM or less than 0");
|
||||
}
|
||||
this.datacenterId = datacenterId;
|
||||
this.machineId = machineId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 产生下一个ID
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public synchronized long nextId() {
|
||||
long currStmp = getNewstmp();
|
||||
if (currStmp < lastStmp) {
|
||||
throw new RuntimeException("Clock moved backwards. Refusing to generate id");
|
||||
}
|
||||
|
||||
if (currStmp == lastStmp) {
|
||||
//相同毫秒内,序列号自增
|
||||
sequence = (sequence + 1) & MAX_SEQUENCE;
|
||||
//同一毫秒的序列数已经达到最大
|
||||
if (sequence == 0L) {
|
||||
currStmp = getNextMill();
|
||||
}
|
||||
} else {
|
||||
//不同毫秒内,序列号置为0
|
||||
sequence = 0L;
|
||||
}
|
||||
|
||||
lastStmp = currStmp;
|
||||
|
||||
return (currStmp - START_STMP) << TIMESTMP_LEFT //时间戳部分
|
||||
| datacenterId << DATACENTER_LEFT //数据中心部分
|
||||
| machineId << MACHINE_LEFT //机器标识部分
|
||||
| sequence; //序列号部分
|
||||
}
|
||||
|
||||
private long getNextMill() {
|
||||
long mill = getNewstmp();
|
||||
while (mill <= lastStmp) {
|
||||
mill = getNewstmp();
|
||||
}
|
||||
return mill;
|
||||
}
|
||||
|
||||
private long getNewstmp() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
18
bashi-dk/src/main/resources/mapper/BorrowMapper.xml
Normal file
18
bashi-dk/src/main/resources/mapper/BorrowMapper.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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.bashi.dk.mapper.BorrowMapper">
|
||||
<select id="pageAdmin" resultType="com.bashi.dk.dto.admin.resp.BorrowResp">
|
||||
select t1.*,t2.phone_number as customer_login_name
|
||||
from dk_borrow t1
|
||||
left join dk_customer t2 on t1.customer_id = t2.id
|
||||
<where>
|
||||
<if test="bo.tradeNo != null and bo.tradeNo != ''">
|
||||
and t1.trade_no = #{bo.tradeNo}
|
||||
</if>
|
||||
<if test="bo.realName != null and bo.realName != ''">
|
||||
and (t1.real_name like concat('%',#{bo.realName},'%') or t2.phone_number like concat('%',#{bo.realName},'%'))
|
||||
</if>
|
||||
</where>
|
||||
order by t1.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
51
bashi-dk/src/main/resources/mapper/CustomerMapper.xml
Normal file
51
bashi-dk/src/main/resources/mapper/CustomerMapper.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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.bashi.dk.mapper.CustomerMapper">
|
||||
<update id="incsAmount">
|
||||
update dk_customer
|
||||
set account = account + #{totalLoanMoney},
|
||||
borrow_account = #{totalLoanMoney},
|
||||
repayment_account = repayment_account + #{totalRepayment}
|
||||
where id = #{customerId}
|
||||
</update>
|
||||
<update id="withdraw">
|
||||
update dk_customer
|
||||
set account = account - #{withdrawAmount}
|
||||
where id = #{customerId}
|
||||
</update>
|
||||
<select id="pageAdmin" resultType="com.bashi.dk.dto.admin.resp.CustomerAdminResp">
|
||||
select *,t2.allow_signature
|
||||
from dk_customer t1
|
||||
left join dk_customer_info t2 on t1.id = t2.customer_id
|
||||
<where>
|
||||
<if test="bo.phoneNumber != null and bo.phoneNumber != ''">
|
||||
and t1.phone_number like concat('%',#{bo.phoneNumber},'%')
|
||||
</if>
|
||||
<if test="bo.nickName != null and bo.nickName != ''">
|
||||
and (t1.nick_name like concat('%',#{bo.nickName},'%') or t2.real_name like concat('%',#{bo.nickName},'%'))
|
||||
</if>
|
||||
</where>
|
||||
order by t1.update_time desc
|
||||
</select>
|
||||
<select id="exportAdmin" resultType="com.bashi.dk.dto.admin.resp.CustomerExportVo">
|
||||
select phone_number, nick_name, real_name_auth, loans_flag, withdraw_flag,
|
||||
account, borrow_account, repayment_account, withdraw_account,
|
||||
status, last_login_ip, last_login_time, update_time,
|
||||
customer_id, real_name, card_num, card_front_picture,
|
||||
card_back_picture, company_name, company_title, company_phone,
|
||||
company_year, company_address, company_address_info,
|
||||
customer_address, customer_address_info, kinsfolk_name,
|
||||
kinsfolk_phone, kinsfolk_ref, bank_type, back_card_num
|
||||
from dk_customer t1
|
||||
left join dk_customer_info t2 on t1.id = t2.customer_id
|
||||
<where>
|
||||
<if test="bo.phoneNumber != null and bo.phoneNumber != ''">
|
||||
and t1.phone_number like concat('%',#{bo.phoneNumber},'%')
|
||||
</if>
|
||||
<if test="bo.nickName != null and bo.nickName != ''">
|
||||
and (t1.nick_name like concat('%',#{bo.nickName},'%') or t2.real_name like concat('%',#{bo.nickName},'%'))
|
||||
</if>
|
||||
</where>
|
||||
order by t1.update_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user