execl相关
This commit is contained in:
49
newadmin/Excel-api/pom.xml
Normal file
49
newadmin/Excel-api/pom.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.chaozhanggui.system</groupId>
|
||||
<artifactId>ysk-system</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Excel-api</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.38.37.ALL</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel-core</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>2.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.chaozhanggui.system.entity;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.metadata.BaseRowModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
@Data
|
||||
public class Promotion extends BaseRowModel{
|
||||
@ExcelProperty("商户号")
|
||||
private String merchantCode;
|
||||
@ExcelProperty("奖励金额")
|
||||
private String amount;
|
||||
@ExcelProperty("备注")
|
||||
private String remake;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.chaozhanggui.system.exception;
|
||||
|
||||
public class ExcelException extends RuntimeException {
|
||||
public ExcelException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.chaozhanggui.system.listener;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ExcelListener extends AnalysisEventListener {
|
||||
/**
|
||||
* 自定义用于暂时存储data。
|
||||
* 可以通过实例获取该值
|
||||
*/
|
||||
private List<Object> datas = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 通过 AnalysisContext 对象还可以获取当前 sheet,当前行等数据
|
||||
*/
|
||||
@Override
|
||||
public void invoke(Object object, AnalysisContext context) {
|
||||
//数据存储到list,供批量处理,或后续自己业务逻辑处理。
|
||||
datas.add(object);
|
||||
//根据业务自行 do something
|
||||
doSomething();
|
||||
/*
|
||||
如数据过大,可以进行定量分批处理
|
||||
if(datas.size()<=100){
|
||||
datas.add(object);
|
||||
}else {
|
||||
doSomething();
|
||||
datas = new ArrayList<Object>();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据业务自行实现该方法
|
||||
*/
|
||||
private void doSomething() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
/*
|
||||
datas.clear();
|
||||
解析结束销毁不用的资源
|
||||
*/
|
||||
}
|
||||
|
||||
public List<Object> getDatas() {
|
||||
return datas;
|
||||
}
|
||||
|
||||
public void setDatas(List<Object> datas) {
|
||||
this.datas = datas;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.chaozhanggui.system.listener;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.read.listener.ReadListener;
|
||||
import com.chaozhanggui.system.entity.Promotion;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
public class MyReadListener implements ReadListener<Promotion> {
|
||||
/**
|
||||
* 这个每一条数据解析都会来调用
|
||||
*
|
||||
* @param data one row value. Is is same as {@link AnalysisContext#readRowHolder()}
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void invoke(Promotion data, AnalysisContext context) {
|
||||
//log.info("解析到一条数据:{}", JSON.toJSONString(data));
|
||||
System.out.println(data.getMerchantCode() + " - " + data.getAmount() + " - " + data.getRemake());
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有数据解析完成了 都会来调用
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
log.info("所有数据解析完成!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
package com.chaozhanggui.system.util;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelReader;
|
||||
import com.alibaba.excel.metadata.BaseRowModel;
|
||||
import com.alibaba.excel.read.metadata.ReadSheet;
|
||||
import com.chaozhanggui.system.entity.Promotion;
|
||||
import com.chaozhanggui.system.listener.ExcelListener;
|
||||
import com.chaozhanggui.system.listener.MyReadListener;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import com.alibaba.excel.ExcelReader;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.excel.metadata.BaseRowModel;
|
||||
|
||||
|
||||
import static cn.hutool.poi.excel.ExcelUtil.getReader;
|
||||
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
|
||||
public class ExcelUtil {
|
||||
// @SneakyThrows
|
||||
// public static void simpleRead(MultipartFile excel){
|
||||
// // 有个很重要的点 MyReadListener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去
|
||||
// // 写法3:
|
||||
// ExcelListener excelListener = new ExcelListener();
|
||||
// String filename = excel.getOriginalFilename();
|
||||
// if (filename == null || (!filename.toLowerCase().endsWith(".xls") && !filename.toLowerCase().endsWith(".xlsx"))) {
|
||||
// throw new Exception("文件格式错误!");
|
||||
// }
|
||||
// InputStream inputStream;
|
||||
//
|
||||
// try {
|
||||
// inputStream = new BufferedInputStream(excel.getInputStream());
|
||||
// ExcelReader excelReader = new ExcelReader(inputStream);
|
||||
// excelReader.read();
|
||||
// // 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
|
||||
// EasyExcel.read(inputStream, Promotion.class, new ExcelListener())
|
||||
// .sheet()
|
||||
// .headRowNumber(1)
|
||||
// .doRead();
|
||||
//
|
||||
// return new ExcelReader(inputStream, null, excelListener, false);
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* 获取并解析excel文件,返回一个二维集合
|
||||
* @param file 上传的文件
|
||||
* @return 二维集合(第一重集合为行,第二重集合为列,每一行包含该行的列集合,列集合包含该行的全部单元格的值)
|
||||
*/
|
||||
public static ArrayList<ArrayList<String>> analysis(MultipartFile file) {
|
||||
ArrayList<ArrayList<String>> row = new ArrayList<>();
|
||||
//获取文件名称
|
||||
String fileName = file.getOriginalFilename();
|
||||
System.out.println(fileName);
|
||||
|
||||
try {
|
||||
//获取输入流
|
||||
InputStream in = file.getInputStream();
|
||||
//判断excel版本
|
||||
Workbook workbook = null;
|
||||
if (judegExcelEdition(fileName)) {
|
||||
workbook = new XSSFWorkbook(in);
|
||||
} else {
|
||||
workbook = new HSSFWorkbook(in);
|
||||
}
|
||||
|
||||
//获取第一张工作表
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
//从第二行开始获取
|
||||
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
|
||||
//循环获取工作表的每一行
|
||||
Row sheetRow = sheet.getRow(i);
|
||||
//循环获取每一列
|
||||
ArrayList<String> cell = new ArrayList<>();
|
||||
for (int j = 0; j < sheetRow.getPhysicalNumberOfCells(); j++) {
|
||||
//将每一个单元格的值装入列集合
|
||||
//设置单元格类型
|
||||
if (j != sheetRow.getPhysicalNumberOfCells()){
|
||||
sheetRow.getCell(j).setCellType(CellType.STRING);
|
||||
}
|
||||
cell.add(sheetRow.getCell(j).getStringCellValue());
|
||||
}
|
||||
//将装有每一列的集合装入大集合
|
||||
row.add(cell);
|
||||
|
||||
//关闭资源
|
||||
workbook.close();
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("===================未找到文件======================");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("===================上传失败======================");
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
/**
|
||||
* 判断上传的excel文件版本(xls为2003,xlsx为2017)
|
||||
* @param fileName 文件路径
|
||||
* @return excel2007及以上版本返回true,excel2007以下版本返回false
|
||||
*/
|
||||
private static boolean judegExcelEdition(String fileName){
|
||||
if (fileName.matches("^.+\\.(?i)(xls)$")){
|
||||
return false;
|
||||
}else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 读取 Excel(多个 sheet)
|
||||
// *
|
||||
// * @param excel 文件
|
||||
// * @param rowModel 实体类映射,继承 BaseRowModel 类
|
||||
// * @return Excel 数据 list
|
||||
// */
|
||||
// public static List<Object> readExcel(MultipartFile excel, BaseRowModel rowModel) throws Exception {
|
||||
// ExcelListener excelListener = new ExcelListener();
|
||||
// ExcelReader reader = getReader(excel, excelListener);
|
||||
//
|
||||
// if (reader == null) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// for (Sheet sheet : reader.getClass().getSheets()) {
|
||||
// if (rowModel != null) {
|
||||
// sheet.setClazz(rowModel.getClass());
|
||||
// }
|
||||
// reader.read(sheet);
|
||||
// }
|
||||
//
|
||||
// return excelListener.getDatas();
|
||||
// }
|
||||
// /**
|
||||
// * 读取某个 sheet 的 Excel
|
||||
// *
|
||||
// * @param excel 文件
|
||||
// * @param rowModel 实体类映射,继承 BaseRowModel 类
|
||||
// * @param sheetNo sheet 的序号 从1开始
|
||||
// * @param headLineNum 表头行数,默认为1
|
||||
// * @return Excel 数据 list
|
||||
// */
|
||||
// public static List<Object> readExcel(MultipartFile excel, BaseRowModel rowModel, int sheetNo, int headLineNum) throws Exception {
|
||||
// ExcelListener excelListener = new ExcelListener();
|
||||
// ExcelReader reader = getReader(excel, excelListener);
|
||||
//
|
||||
// if (reader == null) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// reader.read((List<ReadSheet>) new Sheet(sheetNo, headLineNum, rowModel.getClass()));
|
||||
//
|
||||
// return excelListener.getDatas();
|
||||
// }
|
||||
// /**
|
||||
// * 读取某个 sheet 的 Excel
|
||||
// *
|
||||
// * @param excel 文件
|
||||
// * @param rowModel 实体类映射,继承 BaseRowModel 类
|
||||
// * @param sheetNo sheet 的序号 从1开始
|
||||
// * @return Excel 数据 list
|
||||
// */
|
||||
// public static List<Object> readExcel(MultipartFile excel, BaseRowModel rowModel, int sheetNo) throws Exception {
|
||||
// return readExcel(excel, rowModel, sheetNo, 1);
|
||||
// }
|
||||
|
||||
|
||||
// /**
|
||||
// * 返回 ExcelReader
|
||||
// *
|
||||
// * @param excel 需要解析的 Excel 文件
|
||||
// * @param excelListener new ExcelListener()
|
||||
// */
|
||||
// private static ExcelReader getReader(MultipartFile excel, ExcelListener excelListener) throws Exception {
|
||||
// String filename = excel.getOriginalFilename();
|
||||
// if (filename == null || (!filename.toLowerCase().endsWith(".xls") && !filename.toLowerCase().endsWith(".xlsx"))) {
|
||||
// throw new Exception("文件格式错误!");
|
||||
// }
|
||||
// InputStream inputStream;
|
||||
//
|
||||
// try {
|
||||
// inputStream = new BufferedInputStream(excel.getInputStream());
|
||||
// ExcelReader excelReader = new ExcelReader(inputStream, null, excelListener,false);
|
||||
// return excelReader;
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// ExcelUtil.simpleRead();
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -54,6 +54,11 @@
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.chaozhanggui.system</groupId>
|
||||
<artifactId>Excel-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
|
||||
<dependency>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.chaozhanggui.admin.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.chaozhanggui.admin.system.service.MerchantInfoService;
|
||||
import com.chaozhanggui.common.system.config.RespBody;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussUserApp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -23,7 +24,6 @@ public class MerchantInfoController {
|
||||
|
||||
/**
|
||||
* 实名认证信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/detail/audit/{userId}")
|
||||
@@ -31,6 +31,22 @@ public class MerchantInfoController {
|
||||
return merchantInfoService.merchantReal(userId);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 更改实名认证信息
|
||||
// * @param userApp
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping("/updatePromoterInformation")
|
||||
// @Transactional
|
||||
// @ResponseBody
|
||||
// public RespBody updatePromoterInformation(TbPlussUserApp userApp){
|
||||
// if (userApp == null){
|
||||
// log.error("参数错误");
|
||||
// return new RespBody("000019");
|
||||
// }
|
||||
// return merchantInfoService.updatePromoterInformation(userApp);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 商户基本信息
|
||||
* @param userId
|
||||
@@ -47,7 +63,17 @@ public class MerchantInfoController {
|
||||
*/
|
||||
@GetMapping("/detail/merchBaseAccount/{userId}")
|
||||
public RespBody merchBaseAccount(@PathVariable("userId") Integer userId){
|
||||
return merchantInfoService.merchantBaseInfo(userId);
|
||||
return merchantInfoService.merchantAccount(userId);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 进件相关信息
|
||||
// * @param userId
|
||||
// * @return
|
||||
// */
|
||||
// @GetMapping("/detail/channelAuditInfo/{userId}")
|
||||
// public RespBody channelAuditInfo(@PathVariable("userId") Long userId) {
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.chaozhanggui.admin.system.controller;
|
||||
|
||||
import com.chaozhanggui.admin.system.service.PromotionService;
|
||||
import com.chaozhanggui.common.system.config.RespBody;
|
||||
import com.chaozhanggui.dao.system.dao.TbPlussCashMapper;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussCash;
|
||||
import com.chaozhanggui.system.entity.Promotion;
|
||||
import com.chaozhanggui.system.util.ExcelUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@RequestMapping("/promotion")
|
||||
@Slf4j
|
||||
public class PromotionController {
|
||||
@Resource
|
||||
private PromotionService promotionService;
|
||||
|
||||
//接受文件上传
|
||||
@PostMapping("/uploadExecl")
|
||||
@ResponseBody
|
||||
public RespBody uploadFile(MultipartFile file){
|
||||
//调用工具类解析excel文件
|
||||
List<ArrayList<String>> row = ExcelUtil.analysis(file);
|
||||
//打印信息
|
||||
for (int i = 0;i<row.size();i++){
|
||||
List<String> cell = row.get(i);
|
||||
for (int j = 0;j<cell.size();j++){
|
||||
System.out.print(cell.get(j)+" ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
//存入数据库
|
||||
return promotionService.uploadFile(row);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +1,24 @@
|
||||
package com.chaozhanggui.admin.system.service;
|
||||
|
||||
import com.alipay.api.domain.AccountDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.chaozhanggui.common.system.config.RespBody;
|
||||
import com.chaozhanggui.dao.system.dao.TbPlussBankCardMapper;
|
||||
import com.chaozhanggui.dao.system.dao.TbPlussIdCardMapper;
|
||||
import com.chaozhanggui.dao.system.dao.TbPlussMerchantBaseInfoMapper;
|
||||
import com.chaozhanggui.dao.system.dao.TbPlussMerchantImageMapper;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussBankCard;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussIdCard;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussMerchantBaseInfo;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussMerchantImage;
|
||||
import com.chaozhanggui.dao.system.dao.*;
|
||||
import com.chaozhanggui.dao.system.entity.*;
|
||||
import com.chaozhanggui.dao.system.entity.VO.AccountVO;
|
||||
import com.chaozhanggui.dao.system.entity.VO.MerchantBaseVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.chaozhanggui.dao.system.entity.TbPlussAccount.CHANNEL_TYPE_D0;
|
||||
import static com.chaozhanggui.dao.system.entity.TbPlussAccount.CHANNEL_TYPE_D1;
|
||||
import static com.chaozhanggui.dao.system.entity.TbPlussBankCard.ACCOUNT_TYPE_CERT;
|
||||
import static com.chaozhanggui.dao.system.entity.TbPlussIdCard.TYPE_CERT;
|
||||
|
||||
@@ -32,6 +35,15 @@ public class MerchantInfoService {
|
||||
private TbPlussMerchantBaseInfoMapper merchantBaseInfoMapper;
|
||||
@Resource
|
||||
private TbPlussMerchantImageMapper merchantImageMapper;
|
||||
@Resource
|
||||
private TbPlussAccountMapper accountMapper;
|
||||
@Resource
|
||||
private TbPlussMerchantChannelMapper merchantChannelMapper;
|
||||
@Resource
|
||||
private TbPlussUserInfoMapper userInfoMapper;
|
||||
@Resource
|
||||
private TbPlussUserAppMapper userAppMapper;
|
||||
|
||||
|
||||
public RespBody merchantReal(Integer userId){
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
@@ -61,4 +73,98 @@ public class MerchantInfoService {
|
||||
|
||||
return new RespBody("000000",merchantBaseVO);
|
||||
}
|
||||
|
||||
public RespBody merchantAccount(Integer userId){
|
||||
HashMap<String, Object> realAccount = getRealAccount(userId);
|
||||
return new RespBody("000000",realAccount);
|
||||
}
|
||||
|
||||
public HashMap<String,Object> getRealAccount(Integer userId) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
//D1
|
||||
TbPlussAccount accountD1 = accountMapper.selectByUser(userId, CHANNEL_TYPE_D1);
|
||||
if (accountD1 == null){
|
||||
map.put("D1",new AccountVO());
|
||||
}else {
|
||||
AccountVO accountVO = new AccountVO();
|
||||
// 获取身份证信息
|
||||
TbPlussIdCard idCard = idCardMapper.selectByPrimaryKey(Integer.valueOf(accountD1.getIdcardid()));
|
||||
accountVO.setIdCard(idCard);
|
||||
// 获取银行卡信息
|
||||
TbPlussBankCard bankCard = bankCardMapper.selectByPrimaryKey(Integer.valueOf(accountD1.getBankcardid()));
|
||||
accountVO.setBankCard(bankCard);
|
||||
map.put("D1",accountVO);
|
||||
}
|
||||
//D0
|
||||
TbPlussAccount accountD0 = accountMapper.selectByUser(userId, CHANNEL_TYPE_D0);
|
||||
if (accountD0 == null){
|
||||
map.put("D0",new AccountVO());
|
||||
}else {
|
||||
AccountVO accountVO = new AccountVO();
|
||||
// 获取身份证信息
|
||||
TbPlussIdCard idCard = idCardMapper.selectByPrimaryKey(Integer.valueOf(accountD0.getIdcardid()));
|
||||
accountVO.setIdCard(idCard);
|
||||
// 获取银行卡信息
|
||||
TbPlussBankCard bankCard = bankCardMapper.selectByPrimaryKey(Integer.valueOf(accountD0.getBankcardid()));
|
||||
accountVO.setBankCard(bankCard);
|
||||
map.put("D0",accountVO);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// public RespBody updatePromoterInformation(TbPlussUserApp userApp){
|
||||
// //修改推广员名称和登录账号
|
||||
// TbPlussUserApp appUser = new TbPlussUserApp();
|
||||
// TbPlussUserInfo userInfo = new TbPlussUserInfo();
|
||||
// userInfo.setLoginname(userApp.getLoginname());
|
||||
// userInfo.setPhone(userApp.getLoginname());
|
||||
// userInfo.setTruename(userApp.getUsername());
|
||||
// appUser.setLoginname(userApp.getLoginname());
|
||||
// appUser.setUsername(userApp.getUsername());
|
||||
// userAppMapper.updateByPrimaryKeySelective(appUser);
|
||||
// userInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||
//
|
||||
// if (Objects.equals(userApp.getStatus(), 3)) {
|
||||
// //判断实名人与结算人是否为同一人
|
||||
// AccountDTO accountDTO = this.getRealAccount(userApp.getBankCard().getUserid());
|
||||
// if (accountDTO == null || accountDTO.getIdcard() == null || !userApp.getIdCard().getCertNo().equals(accountDTO.getIdcard().getCertNo())) {
|
||||
// bankCardUpdateWrapper.eq("accountType", BankCard.ACCOUNT_TYPE_CERT);
|
||||
// }
|
||||
// if ("".equals(userApp.getBankCard().getImgUrl())) {
|
||||
// userApp.getBankCard().setImgUrl(null);
|
||||
// }
|
||||
// QueryWrapper<AreaCity> areaCityQueryWrapper = new QueryWrapper<AreaCity>().
|
||||
// in("areaCode", userApp.getBankCard().getBranchProvince(),
|
||||
// userApp.getBankCard().getBranchCity(), userApp.getBankCard().getBranchArea());
|
||||
// List<AreaCity> areaCityList = areaCityMapper.selectList(areaCityQueryWrapper);
|
||||
// for (AreaCity areaCity : areaCityList) {
|
||||
// if ("1".equals(areaCity.getType())) {
|
||||
// userApp.getBankCard().setBranchProvince(areaCity.getAreaName());
|
||||
// } else if ("2".equals(areaCity.getType())) {
|
||||
// userApp.getBankCard().setBranchCity(areaCity.getAreaName());
|
||||
// } else if ("3".equals(areaCity.getType()) || "4".equals(areaCity.getType())) {
|
||||
// userApp.getBankCard().setBranchArea(areaCity.getAreaName());
|
||||
// }
|
||||
// }
|
||||
// LambdaQueryWrapper<BankCodeSxf> sxfQueryWrapper = new LambdaQueryWrapper<BankCodeSxf>()
|
||||
// .eq(StringUtils.isNotEmpty(userApp.getBankCard().getContactLine()), BankCodeSxf::getCnapsCode, userApp.getBankCard().getContactLine())
|
||||
// .eq(StringUtils.isNotEmpty(userApp.getBankCard().getBranchName()), BankCodeSxf::getCnapsName, userApp.getBankCard().getBranchName())
|
||||
// .last("limit 1");
|
||||
// BankCodeSxf bankCodeSxf = bankCodeSxfMapper.selectOne(sxfQueryWrapper);
|
||||
// if (bankCodeSxf == null) {
|
||||
// throw new MsgException("未找到支行信息");
|
||||
// }
|
||||
// userApp.getBankCard().setContactLine(bankCodeSxf.getCnapsCode());
|
||||
// bankCardService.update(userApp.getBankCard(), bankCardUpdateWrapper);
|
||||
// UpdateWrapper<IdCard> idCardUpdateWrapper = new UpdateWrapper<IdCard>().eq("userId", userApp.getUserId()).eq("userType", IdCard.TYPE_CERT);
|
||||
// if ("".equals(userApp.getIdCard().getImgPositive())) {
|
||||
// userApp.getIdCard().setImgPositive(null);
|
||||
// }
|
||||
// if ("".equals(userApp.getIdCard().getImgNegative())) {
|
||||
// userApp.getIdCard().setImgNegative(null);
|
||||
// }
|
||||
// idCardService.update(userApp.getIdCard(), idCardUpdateWrapper);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.chaozhanggui.admin.system.service;
|
||||
|
||||
|
||||
import com.chaozhanggui.common.system.config.RespBody;
|
||||
import com.chaozhanggui.dao.system.dao.TbPlussMerchantProfitMapper;
|
||||
import com.chaozhanggui.dao.system.dao.TbPlussVoiceboxProfitMapper;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussMerchantProfit;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussVoiceboxProfit;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PromotionService {
|
||||
@Resource
|
||||
private TbPlussMerchantProfitMapper merchantProfitMapper;
|
||||
@Resource
|
||||
private TbPlussVoiceboxProfitMapper voiceBoxProfitMapper;
|
||||
|
||||
public RespBody uploadFile(List<ArrayList<String>> list){
|
||||
if (!list.isEmpty()){
|
||||
List<TbPlussVoiceboxProfit> voiceboxProfitList = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
List<String> arrayLists = list.get(i);
|
||||
//拿到二维数组里具体值
|
||||
TbPlussVoiceboxProfit voiceBoxProfit = new TbPlussVoiceboxProfit();
|
||||
voiceBoxProfit.setMerchantCode(arrayLists.get(0));
|
||||
voiceBoxProfit.setAmount(arrayLists.get(1));
|
||||
voiceBoxProfit.setRemarks(arrayLists.get(2));
|
||||
voiceboxProfitList.add(voiceBoxProfit);
|
||||
}
|
||||
Integer integer = voiceBoxProfitMapper.insertList(voiceboxProfitList);
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("row",list.size());
|
||||
map.put("success",integer);
|
||||
return new RespBody("000000",map);
|
||||
}
|
||||
return new RespBody("999950");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ spring:
|
||||
# redis数据库索引(默认为0),我们使用索引为3的数据库,避免和其他数据库冲突
|
||||
database: 0
|
||||
# redis服务器地址(默认为localhost)
|
||||
host: 101.37.12.135
|
||||
host: 127.0.0.1
|
||||
# redis端口(默认为6379)
|
||||
port: 6379
|
||||
# redis访问密码(默认为空)
|
||||
|
||||
@@ -14,6 +14,13 @@ public class DateUtils {
|
||||
|
||||
public final static String DEFAULT_FORMAT = "yyyy-MM-dd";
|
||||
|
||||
private final static SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
|
||||
private final static SimpleDateFormat sdfDay = new SimpleDateFormat("yyyy-MM-dd");
|
||||
private final static SimpleDateFormat sdfDays = new SimpleDateFormat("yyyyMMdd");
|
||||
private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private final static SimpleDateFormat sdfTimeSS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
private final static SimpleDateFormat times=new SimpleDateFormat("HH:mm:ss");
|
||||
|
||||
public static String formatDateDefault(Date date, String pattern) {
|
||||
if (date == null) {
|
||||
return "";
|
||||
@@ -679,5 +686,12 @@ public class DateUtils {
|
||||
yearList.add(prevYearMap);
|
||||
System.out.println(yearList);*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取YYYYMMDD格式
|
||||
* @return
|
||||
*/
|
||||
public static String getDays(){
|
||||
return sdfDays.format(new Date());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,8 @@ public class ExceptionUtil {
|
||||
map.put("999979","未知的错误");
|
||||
map.put("999978","签到异常");
|
||||
map.put("999977","赠送活动异常");
|
||||
map.put("999976","解析异常");
|
||||
map.put("999950","execl异常");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,483 +1,483 @@
|
||||
package com.chaozhanggui.common.system.util;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.Key;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.RSAPrivateKeySpec;
|
||||
import java.security.spec.RSAPublicKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.*;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import sun.misc.BASE64Decoder;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
/**
|
||||
* RSA私钥公钥字符串、对象生成工具
|
||||
*
|
||||
* 本工具类提供以下几种方法:
|
||||
*
|
||||
* 1、生成基于PublicKey 和PrivateKey对象的方法 initRSAKeys()
|
||||
* 2、将PrivateKey对象转为私钥字符串
|
||||
* 3、将PublicKey对象转为公钥字符串
|
||||
* 4、将私钥字符串转为PrivateKey对象
|
||||
* 5、将公钥字符串转为PublicKey对象
|
||||
* 6、将公钥和私钥以文件形式保存
|
||||
* 7、公钥加密、私钥解密
|
||||
* 8、私钥加密、公钥解密
|
||||
*
|
||||
* @author Guo pengFei
|
||||
*
|
||||
* @date 2017-7-27
|
||||
*
|
||||
* @version V1.0
|
||||
*
|
||||
* @compeny 深证风轮科技有限公司
|
||||
*
|
||||
* @site https://www.blog-china.cn
|
||||
*
|
||||
*/
|
||||
public class RSAUtils {
|
||||
/** 指定加密算法为RSA */
|
||||
private static final String ALGORITHM = "RSA";
|
||||
// /** 指定公钥存放文件 */
|
||||
// private static String PUBLIC_KEY_FILE = "D://key/PublicKey.txt";
|
||||
// /** 指定私钥存放文件 */
|
||||
// private static String PRIVATE_KEY_FILE = "D://key/PrivateKey.txt";
|
||||
//package com.chaozhanggui.common.system.util;
|
||||
//
|
||||
//import java.math.BigInteger;
|
||||
//import java.security.Key;
|
||||
//import java.security.KeyFactory;
|
||||
//import java.security.KeyPair;
|
||||
//import java.security.KeyPairGenerator;
|
||||
//import java.security.NoSuchAlgorithmException;
|
||||
//import java.security.PrivateKey;
|
||||
//import java.security.PublicKey;
|
||||
//import java.security.interfaces.RSAPrivateKey;
|
||||
//import java.security.interfaces.RSAPublicKey;
|
||||
//import java.security.spec.PKCS8EncodedKeySpec;
|
||||
//import java.security.spec.RSAPrivateKeySpec;
|
||||
//import java.security.spec.RSAPublicKeySpec;
|
||||
//import java.security.spec.X509EncodedKeySpec;
|
||||
//import java.util.*;
|
||||
//
|
||||
//import javax.crypto.Cipher;
|
||||
//
|
||||
//import org.apache.commons.codec.binary.Base64;
|
||||
//import sun.misc.BASE64Decoder;
|
||||
//import sun.misc.BASE64Encoder;
|
||||
//
|
||||
///**
|
||||
// * RSA私钥公钥字符串、对象生成工具
|
||||
// *
|
||||
// * 本工具类提供以下几种方法:
|
||||
// *
|
||||
// * 1、生成基于PublicKey 和PrivateKey对象的方法 initRSAKeys()
|
||||
// * 2、将PrivateKey对象转为私钥字符串
|
||||
// * 3、将PublicKey对象转为公钥字符串
|
||||
// * 4、将私钥字符串转为PrivateKey对象
|
||||
// * 5、将公钥字符串转为PublicKey对象
|
||||
// * 6、将公钥和私钥以文件形式保存
|
||||
// * 7、公钥加密、私钥解密
|
||||
// * 8、私钥加密、公钥解密
|
||||
// *
|
||||
// * @author Guo pengFei
|
||||
// *
|
||||
// * @date 2017-7-27
|
||||
// *
|
||||
// * @version V1.0
|
||||
// *
|
||||
// * @compeny 深证风轮科技有限公司
|
||||
// *
|
||||
// * @site https://www.blog-china.cn
|
||||
// *
|
||||
// */
|
||||
//public class RSAUtils {
|
||||
// /** 指定加密算法为RSA */
|
||||
// private static final String ALGORITHM = "RSA";
|
||||
//// /** 指定公钥存放文件 */
|
||||
//// private static String PUBLIC_KEY_FILE = "D://key/PublicKey.txt";
|
||||
//// /** 指定私钥存放文件 */
|
||||
//// private static String PRIVATE_KEY_FILE = "D://key/PrivateKey.txt";
|
||||
////
|
||||
//// /**
|
||||
//// * 以文件形式生成公钥和私钥,并保存
|
||||
//// *
|
||||
//// * @return
|
||||
//// * @throws Exception
|
||||
//// */
|
||||
//// public static boolean writeKeyFile() throws Exception {
|
||||
//// Map<String, Object> map = initRSAKeys();
|
||||
//// Key publicKey = (Key) map.get("pubKey");
|
||||
//// Key privateKey = (Key) map.get("priKey");
|
||||
////
|
||||
//// String pubKeyString = RSAUtils.getKeyString(publicKey);
|
||||
////
|
||||
//// String priKeyString = RSAUtils.getKeyString(privateKey);
|
||||
//// System.out.println(pubKeyString);
|
||||
//// System.out.println();
|
||||
//// System.out.println(priKeyString);
|
||||
////
|
||||
//// /** 用对象流将生成的密钥写入文件 */
|
||||
//// FileOutputStream oos1 = new FileOutputStream(PUBLIC_KEY_FILE);
|
||||
//// oos1.write(pubKeyString.getBytes("UTF-8")); // 可以指定编码
|
||||
////
|
||||
//// FileOutputStream oos2 = new FileOutputStream(PRIVATE_KEY_FILE);
|
||||
//// oos2.write(priKeyString.getBytes("UTF-8")); // 可以指定编码
|
||||
////
|
||||
//// /** 清空缓存,关闭文件输出流 */
|
||||
//// if (oos1 != null) {
|
||||
//// oos1.close();
|
||||
//// }
|
||||
//// if (oos2 != null) {
|
||||
//// oos2.close();
|
||||
//// }
|
||||
//// return true;
|
||||
//// }
|
||||
//
|
||||
// /**
|
||||
// * 以文件形式生成公钥和私钥,并保存
|
||||
// * 生产RSA的私钥和公钥
|
||||
// *
|
||||
// * @return
|
||||
// * @throws NoSuchAlgorithmException
|
||||
// */
|
||||
// public static Map<String, Object> initRSAKeys()
|
||||
// throws NoSuchAlgorithmException {
|
||||
// // TODO Auto-generated method stub
|
||||
// Map<String, Object> map = getKeys();
|
||||
// // 生成公钥和私钥
|
||||
// RSAPublicKey publicKey = (RSAPublicKey) map.get("public");
|
||||
// RSAPrivateKey privateKey = (RSAPrivateKey) map.get("private");
|
||||
//
|
||||
// // 模
|
||||
// String modulus = publicKey.getModulus().toString();
|
||||
// // 公钥指数
|
||||
// String public_exponent = publicKey.getPublicExponent().toString();
|
||||
// // 私钥指数
|
||||
// String private_exponent = privateKey.getPrivateExponent().toString();
|
||||
// // 使用模和指数生成公钥和私钥
|
||||
// RSAPublicKey pubKey = RSAUtils.getPublicKey(modulus, public_exponent);
|
||||
// RSAPrivateKey priKey = RSAUtils
|
||||
// .getPrivateKey(modulus, private_exponent);
|
||||
//
|
||||
// map.put("pubKey", Base64.encodeBase64String(pubKey.getEncoded()));
|
||||
// map.put("priKey",Base64.encodeBase64String(priKey.getEncoded()) );
|
||||
//
|
||||
// return map;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 把公钥字符串转为对象
|
||||
// *
|
||||
// * @param key
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static boolean writeKeyFile() throws Exception {
|
||||
// Map<String, Object> map = initRSAKeys();
|
||||
// Key publicKey = (Key) map.get("pubKey");
|
||||
// Key privateKey = (Key) map.get("priKey");
|
||||
//
|
||||
// String pubKeyString = RSAUtils.getKeyString(publicKey);
|
||||
//
|
||||
// String priKeyString = RSAUtils.getKeyString(privateKey);
|
||||
// System.out.println(pubKeyString);
|
||||
// System.out.println();
|
||||
// System.out.println(priKeyString);
|
||||
//
|
||||
// /** 用对象流将生成的密钥写入文件 */
|
||||
// FileOutputStream oos1 = new FileOutputStream(PUBLIC_KEY_FILE);
|
||||
// oos1.write(pubKeyString.getBytes("UTF-8")); // 可以指定编码
|
||||
//
|
||||
// FileOutputStream oos2 = new FileOutputStream(PRIVATE_KEY_FILE);
|
||||
// oos2.write(priKeyString.getBytes("UTF-8")); // 可以指定编码
|
||||
//
|
||||
// /** 清空缓存,关闭文件输出流 */
|
||||
// if (oos1 != null) {
|
||||
// oos1.close();
|
||||
// }
|
||||
// if (oos2 != null) {
|
||||
// oos2.close();
|
||||
// }
|
||||
// return true;
|
||||
// public static PublicKey getPublicKey(String key) throws Exception {
|
||||
// byte[] keyBytes;
|
||||
// keyBytes = (new BASE64Decoder()).decodeBuffer(key);
|
||||
// X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
|
||||
// KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
// PublicKey publicKey = keyFactory.generatePublic(keySpec);
|
||||
// return publicKey;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 生产RSA的私钥和公钥
|
||||
*
|
||||
* @return
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public static Map<String, Object> initRSAKeys()
|
||||
throws NoSuchAlgorithmException {
|
||||
// TODO Auto-generated method stub
|
||||
Map<String, Object> map = getKeys();
|
||||
// 生成公钥和私钥
|
||||
RSAPublicKey publicKey = (RSAPublicKey) map.get("public");
|
||||
RSAPrivateKey privateKey = (RSAPrivateKey) map.get("private");
|
||||
|
||||
// 模
|
||||
String modulus = publicKey.getModulus().toString();
|
||||
// 公钥指数
|
||||
String public_exponent = publicKey.getPublicExponent().toString();
|
||||
// 私钥指数
|
||||
String private_exponent = privateKey.getPrivateExponent().toString();
|
||||
// 使用模和指数生成公钥和私钥
|
||||
RSAPublicKey pubKey = RSAUtils.getPublicKey(modulus, public_exponent);
|
||||
RSAPrivateKey priKey = RSAUtils
|
||||
.getPrivateKey(modulus, private_exponent);
|
||||
|
||||
map.put("pubKey", Base64.encodeBase64String(pubKey.getEncoded()));
|
||||
map.put("priKey",Base64.encodeBase64String(priKey.getEncoded()) );
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把公钥字符串转为对象
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static PublicKey getPublicKey(String key) throws Exception {
|
||||
byte[] keyBytes;
|
||||
keyBytes = (new BASE64Decoder()).decodeBuffer(key);
|
||||
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PublicKey publicKey = keyFactory.generatePublic(keySpec);
|
||||
return publicKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把私钥字符串转为对象
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static PrivateKey getPrivateKey(String key) throws Exception {
|
||||
byte[] keyBytes;
|
||||
keyBytes = (new BASE64Decoder()).decodeBuffer(key);
|
||||
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
|
||||
return privateKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到密钥字符串(经过base64编码)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getKeyString(Key key) throws Exception {
|
||||
byte[] keyBytes = key.getEncoded();
|
||||
String s = (new BASE64Encoder()).encode(keyBytes);
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成公钥和私钥
|
||||
*
|
||||
* @throws NoSuchAlgorithmException
|
||||
*
|
||||
*/
|
||||
private static HashMap<String, Object> getKeys()
|
||||
throws NoSuchAlgorithmException {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(ALGORITHM);
|
||||
keyPairGen.initialize(1024);
|
||||
KeyPair keyPair = keyPairGen.generateKeyPair();
|
||||
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
|
||||
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||
map.put("public", publicKey);
|
||||
map.put("private", privateKey);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用模和指数生成RSA公钥
|
||||
* 注意:【此代码用了默认补位方式,为RSA/None/PKCS1Padding,不同JDK默认的补位方式可能不同,如Android默认是RSA
|
||||
* /None/NoPadding】
|
||||
*
|
||||
* @param modulus
|
||||
* 模
|
||||
* @param exponent
|
||||
* 指数
|
||||
* @return
|
||||
*/
|
||||
private static RSAPublicKey getPublicKey(String modulus, String exponent) {
|
||||
try {
|
||||
BigInteger b1 = new BigInteger(modulus);
|
||||
BigInteger b2 = new BigInteger(exponent);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
|
||||
RSAPublicKeySpec keySpec = new RSAPublicKeySpec(b1, b2);
|
||||
return (RSAPublicKey) keyFactory.generatePublic(keySpec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用模和指数生成RSA私钥
|
||||
* 注意:【此代码用了默认补位方式,为RSA/None/PKCS1Padding,不同JDK默认的补位方式可能不同,如Android默认是RSA
|
||||
* /None/NoPadding】
|
||||
*
|
||||
* @param modulus
|
||||
* 模
|
||||
* @param exponent
|
||||
* 指数
|
||||
* @return
|
||||
*/
|
||||
private static RSAPrivateKey getPrivateKey(String modulus, String exponent) {
|
||||
try {
|
||||
BigInteger b1 = new BigInteger(modulus);
|
||||
BigInteger b2 = new BigInteger(exponent);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
|
||||
RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(b1, b2);
|
||||
return (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 公钥加密
|
||||
*
|
||||
* @param data
|
||||
* @param publicKey
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encryptByPublicKey(Map<String, String> data, RSAPublicKey publicKey)
|
||||
throws Exception {
|
||||
if(data == null)
|
||||
return null;
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("{");
|
||||
Iterator<String> iterator = data.keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
String value = data.get(key);
|
||||
buffer.append("'").append(key).append("':'").append(value).append("',");
|
||||
}
|
||||
String result = buffer.substring(0,buffer.length()-1)+"}";
|
||||
System.out.println(result);
|
||||
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
// 模长
|
||||
int key_len = publicKey.getModulus().bitLength() / 8;
|
||||
// 加密数据长度 <= 模长-11
|
||||
String[] datas = splitString(result, key_len - 11);
|
||||
String mi = "";
|
||||
// 如果明文长度大于模长-11则要分组加密
|
||||
for (String s : datas) {
|
||||
mi += bcd2Str(cipher.doFinal(s.getBytes()));
|
||||
}
|
||||
return mi;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 公钥加密
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encryptByPublicKey(String data, String publicKeys)
|
||||
throws Exception {
|
||||
RSAPublicKey publicKey= (RSAPublicKey) getPublicKey(publicKeys);
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
// 模长
|
||||
int key_len = publicKey.getModulus().bitLength() / 8;
|
||||
// 加密数据长度 <= 模长-11
|
||||
String[] datas = splitString(data, key_len - 11);
|
||||
String mi = "";
|
||||
// 如果明文长度大于模长-11则要分组加密
|
||||
for (String s : datas) {
|
||||
mi += bcd2Str(cipher.doFinal(s.getBytes()));
|
||||
}
|
||||
return mi;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 私钥加密过程
|
||||
*
|
||||
* @param privateKey
|
||||
* 私钥
|
||||
* 明文数据
|
||||
* @return
|
||||
* @throws Exception
|
||||
* 加密过程中的异常信息
|
||||
*/
|
||||
public static String encryptByPrivateKey1(RSAPrivateKey privateKey,
|
||||
String data) throws Exception {
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
|
||||
// 模长
|
||||
int key_len = privateKey.getModulus().bitLength() / 8;
|
||||
// 加密数据长度 <= 模长-11
|
||||
String[] datas = splitString(data, key_len - 11);
|
||||
String mi = "";
|
||||
// 如果明文长度大于模长-11则要分组加密
|
||||
for (String s : datas) {
|
||||
mi += bcd2Str(cipher.doFinal(s.getBytes()));
|
||||
}
|
||||
return mi;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥解密过程
|
||||
*
|
||||
* @param publicKey
|
||||
* 公钥
|
||||
* 密文数据
|
||||
* @return 明文
|
||||
* @throws Exception
|
||||
* 解密过程中的异常信息
|
||||
*/
|
||||
public static String decryptByPublicKey(RSAPublicKey publicKey, String data)
|
||||
throws Exception {
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
cipher.init(Cipher.DECRYPT_MODE, publicKey);
|
||||
// 模长
|
||||
int key_len = publicKey.getModulus().bitLength() / 8;
|
||||
byte[] bytes = data.getBytes();
|
||||
byte[] bcd = ASCII_To_BCD(bytes, bytes.length);
|
||||
System.err.println(bcd.length);
|
||||
// 如果密文长度大于模长则要分组解密
|
||||
String ming = "";
|
||||
byte[][] arrays = splitArray(bcd, key_len);
|
||||
for (byte[] arr : arrays) {
|
||||
ming += new String(cipher.doFinal(arr));
|
||||
}
|
||||
return ming;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 私钥解密
|
||||
*
|
||||
* @param data
|
||||
* @param privateKey
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decryptByPrivateKey(String data,
|
||||
String privateKey) throws Exception {
|
||||
RSAPrivateKey publicKey= (RSAPrivateKey) getPrivateKey(privateKey);
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
cipher.init(Cipher.DECRYPT_MODE, publicKey);
|
||||
// 模长
|
||||
int key_len = publicKey.getModulus().bitLength() / 8;
|
||||
byte[] bytes = data.getBytes();
|
||||
byte[] bcd = ASCII_To_BCD(bytes, bytes.length);
|
||||
// 如果密文长度大于模长则要分组解密
|
||||
String ming = "";
|
||||
byte[][] arrays = splitArray(bcd, key_len);
|
||||
for (byte[] arr : arrays) {
|
||||
ming += new String(cipher.doFinal(arr));
|
||||
}
|
||||
return ming;
|
||||
}
|
||||
|
||||
/**
|
||||
* ASCII码转BCD码
|
||||
*
|
||||
*/
|
||||
private static byte[] ASCII_To_BCD(byte[] ascii, int asc_len) {
|
||||
byte[] bcd = new byte[asc_len / 2];
|
||||
int j = 0;
|
||||
for (int i = 0; i < (asc_len + 1) / 2; i++) {
|
||||
bcd[i] = asc_to_bcd(ascii[j++]);
|
||||
bcd[i] = (byte) (((j >= asc_len) ? 0x00 : asc_to_bcd(ascii[j++])) + (bcd[i] << 4));
|
||||
}
|
||||
return bcd;
|
||||
}
|
||||
|
||||
private static byte asc_to_bcd(byte asc) {
|
||||
byte bcd;
|
||||
|
||||
if ((asc >= '0') && (asc <= '9'))
|
||||
bcd = (byte) (asc - '0');
|
||||
else if ((asc >= 'A') && (asc <= 'F'))
|
||||
bcd = (byte) (asc - 'A' + 10);
|
||||
else if ((asc >= 'a') && (asc <= 'f'))
|
||||
bcd = (byte) (asc - 'a' + 10);
|
||||
else
|
||||
bcd = (byte) (asc - 48);
|
||||
return bcd;
|
||||
}
|
||||
|
||||
/**
|
||||
* BCD转字符串
|
||||
*/
|
||||
private static String bcd2Str(byte[] bytes) {
|
||||
char temp[] = new char[bytes.length * 2], val;
|
||||
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
val = (char) (((bytes[i] & 0xf0) >> 4) & 0x0f);
|
||||
temp[i * 2] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
|
||||
|
||||
val = (char) (bytes[i] & 0x0f);
|
||||
temp[i * 2 + 1] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
|
||||
}
|
||||
return new String(temp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拆分字符串
|
||||
*/
|
||||
private static String[] splitString(String string, int len) {
|
||||
int x = string.length() / len;
|
||||
int y = string.length() % len;
|
||||
int z = 0;
|
||||
if (y != 0) {
|
||||
z = 1;
|
||||
}
|
||||
String[] strings = new String[x + z];
|
||||
String str = "";
|
||||
for (int i = 0; i < x + z; i++) {
|
||||
if (i == x + z - 1 && y != 0) {
|
||||
str = string.substring(i * len, i * len + y);
|
||||
} else {
|
||||
str = string.substring(i * len, i * len + len);
|
||||
}
|
||||
strings[i] = str;
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拆分数组
|
||||
*/
|
||||
private static byte[][] splitArray(byte[] data, int len) {
|
||||
int x = data.length / len;
|
||||
int y = data.length % len;
|
||||
int z = 0;
|
||||
if (y != 0) {
|
||||
z = 1;
|
||||
}
|
||||
byte[][] arrays = new byte[x + z][];
|
||||
byte[] arr;
|
||||
for (int i = 0; i < x + z; i++) {
|
||||
arr = new byte[len];
|
||||
if (i == x + z - 1 && y != 0) {
|
||||
System.arraycopy(data, i * len, arr, 0, y);
|
||||
} else {
|
||||
System.arraycopy(data, i * len, arr, 0, len);
|
||||
}
|
||||
arrays[i] = arr;
|
||||
}
|
||||
return arrays;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Map<String, Object> map=initRSAKeys();
|
||||
System.out.println("publickey:"+map.get("pubKey"));
|
||||
System.out.println("privatekey:"+map.get("priKey"));
|
||||
|
||||
String code=encryptByPublicKey("16232c1f0459856a11d0d735d5ab7c632a82a2a625c67392ae00048b17075a03","MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDG0BwuxagDwPcWdeDn+tM/lxAICVpoj4fhKnlNYnZFN7HMjrgNjvN3Hf1yrVvnwb/4P04PP/Ck8KLBQJASGWVnSBNqbF2C03XsaEBDYUdaumBED9hxN1tWZs/vDAZB3CQwafPce4XsjffjZFx3K2t7MO4kBc8iB5AU2w96Jmjf/QIDAQAB");
|
||||
//
|
||||
System.out.println("加密数据:"+code);
|
||||
// /**
|
||||
// * 把私钥字符串转为对象
|
||||
// *
|
||||
// * @param key
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static PrivateKey getPrivateKey(String key) throws Exception {
|
||||
// byte[] keyBytes;
|
||||
// keyBytes = (new BASE64Decoder()).decodeBuffer(key);
|
||||
// PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
|
||||
// KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
|
||||
// PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
|
||||
// return privateKey;
|
||||
// }
|
||||
//
|
||||
// System.out.println(decryptByPrivateKey(code,"MIIBNwIBADANBgkqhkiG9w0BAQEFAASCASEwggEdAgEAAoGBAO6kUESLQMrDdnDbIqKikzpw94f1WKF5MWMWhNJDYaqHV99hW1YJMiKpqVxaEzNlNKiOI3VISEXSnK2LTfbBGNFOFtxjcy3WlJ0nVoAXMzvyebIX/1cr2nCnN9F73jjB3kxsOV5OCurPb+MJy3q4KAh1IMb/Pq6+oomhRSg2F9RPAgEAAoGBAKRyNCHXt9FBuldwmkBqOXxXJivZRLcY1ZCLjwF5j068ry/uXcs+0P6T3XIXXA3Zmtzf/c0u/yamSHNKgHIehCM6tlXWtuiDA4Ko5i8e2fQPLQgQ3EBJS51AxCW4H6AOnu9Usu27uC6ZA/C9p/TPGFtoLV+9/98JkpHDx6Xzc+SRAgEAAgEAAgEAAgEAAgEA"));
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// * 得到密钥字符串(经过base64编码)
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public static String getKeyString(Key key) throws Exception {
|
||||
// byte[] keyBytes = key.getEncoded();
|
||||
// String s = (new BASE64Encoder()).encode(keyBytes);
|
||||
// return s;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 生成公钥和私钥
|
||||
// *
|
||||
// * @throws NoSuchAlgorithmException
|
||||
// *
|
||||
// */
|
||||
// private static HashMap<String, Object> getKeys()
|
||||
// throws NoSuchAlgorithmException {
|
||||
// HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
// KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(ALGORITHM);
|
||||
// keyPairGen.initialize(1024);
|
||||
// KeyPair keyPair = keyPairGen.generateKeyPair();
|
||||
// RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
|
||||
// RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||
// map.put("public", publicKey);
|
||||
// map.put("private", privateKey);
|
||||
// return map;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 使用模和指数生成RSA公钥
|
||||
// * 注意:【此代码用了默认补位方式,为RSA/None/PKCS1Padding,不同JDK默认的补位方式可能不同,如Android默认是RSA
|
||||
// * /None/NoPadding】
|
||||
// *
|
||||
// * @param modulus
|
||||
// * 模
|
||||
// * @param exponent
|
||||
// * 指数
|
||||
// * @return
|
||||
// */
|
||||
// private static RSAPublicKey getPublicKey(String modulus, String exponent) {
|
||||
// try {
|
||||
// BigInteger b1 = new BigInteger(modulus);
|
||||
// BigInteger b2 = new BigInteger(exponent);
|
||||
// KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
|
||||
// RSAPublicKeySpec keySpec = new RSAPublicKeySpec(b1, b2);
|
||||
// return (RSAPublicKey) keyFactory.generatePublic(keySpec);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 使用模和指数生成RSA私钥
|
||||
// * 注意:【此代码用了默认补位方式,为RSA/None/PKCS1Padding,不同JDK默认的补位方式可能不同,如Android默认是RSA
|
||||
// * /None/NoPadding】
|
||||
// *
|
||||
// * @param modulus
|
||||
// * 模
|
||||
// * @param exponent
|
||||
// * 指数
|
||||
// * @return
|
||||
// */
|
||||
// private static RSAPrivateKey getPrivateKey(String modulus, String exponent) {
|
||||
// try {
|
||||
// BigInteger b1 = new BigInteger(modulus);
|
||||
// BigInteger b2 = new BigInteger(exponent);
|
||||
// KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
|
||||
// RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(b1, b2);
|
||||
// return (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// /**
|
||||
// * 公钥加密
|
||||
// *
|
||||
// * @param data
|
||||
// * @param publicKey
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static String encryptByPublicKey(Map<String, String> data, RSAPublicKey publicKey)
|
||||
// throws Exception {
|
||||
// if(data == null)
|
||||
// return null;
|
||||
// StringBuffer buffer = new StringBuffer();
|
||||
// buffer.append("{");
|
||||
// Iterator<String> iterator = data.keySet().iterator();
|
||||
// while (iterator.hasNext()) {
|
||||
// String key = iterator.next();
|
||||
// String value = data.get(key);
|
||||
// buffer.append("'").append(key).append("':'").append(value).append("',");
|
||||
// }
|
||||
// String result = buffer.substring(0,buffer.length()-1)+"}";
|
||||
// System.out.println(result);
|
||||
//
|
||||
// Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
// cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
// // 模长
|
||||
// int key_len = publicKey.getModulus().bitLength() / 8;
|
||||
// // 加密数据长度 <= 模长-11
|
||||
// String[] datas = splitString(result, key_len - 11);
|
||||
// String mi = "";
|
||||
// // 如果明文长度大于模长-11则要分组加密
|
||||
// for (String s : datas) {
|
||||
// mi += bcd2Str(cipher.doFinal(s.getBytes()));
|
||||
// }
|
||||
// return mi;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 公钥加密
|
||||
// *
|
||||
// * @param data
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static String encryptByPublicKey(String data, String publicKeys)
|
||||
// throws Exception {
|
||||
// RSAPublicKey publicKey= (RSAPublicKey) getPublicKey(publicKeys);
|
||||
// Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
// cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
// // 模长
|
||||
// int key_len = publicKey.getModulus().bitLength() / 8;
|
||||
// // 加密数据长度 <= 模长-11
|
||||
// String[] datas = splitString(data, key_len - 11);
|
||||
// String mi = "";
|
||||
// // 如果明文长度大于模长-11则要分组加密
|
||||
// for (String s : datas) {
|
||||
// mi += bcd2Str(cipher.doFinal(s.getBytes()));
|
||||
// }
|
||||
// return mi;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 私钥加密过程
|
||||
// *
|
||||
// * @param privateKey
|
||||
// * 私钥
|
||||
// * 明文数据
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// * 加密过程中的异常信息
|
||||
// */
|
||||
// public static String encryptByPrivateKey1(RSAPrivateKey privateKey,
|
||||
// String data) throws Exception {
|
||||
// Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
// cipher.init(Cipher.ENCRYPT_MODE, privateKey);
|
||||
// // 模长
|
||||
// int key_len = privateKey.getModulus().bitLength() / 8;
|
||||
// // 加密数据长度 <= 模长-11
|
||||
// String[] datas = splitString(data, key_len - 11);
|
||||
// String mi = "";
|
||||
// // 如果明文长度大于模长-11则要分组加密
|
||||
// for (String s : datas) {
|
||||
// mi += bcd2Str(cipher.doFinal(s.getBytes()));
|
||||
// }
|
||||
// return mi;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 公钥解密过程
|
||||
// *
|
||||
// * @param publicKey
|
||||
// * 公钥
|
||||
// * 密文数据
|
||||
// * @return 明文
|
||||
// * @throws Exception
|
||||
// * 解密过程中的异常信息
|
||||
// */
|
||||
// public static String decryptByPublicKey(RSAPublicKey publicKey, String data)
|
||||
// throws Exception {
|
||||
// Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
// cipher.init(Cipher.DECRYPT_MODE, publicKey);
|
||||
// // 模长
|
||||
// int key_len = publicKey.getModulus().bitLength() / 8;
|
||||
// byte[] bytes = data.getBytes();
|
||||
// byte[] bcd = ASCII_To_BCD(bytes, bytes.length);
|
||||
// System.err.println(bcd.length);
|
||||
// // 如果密文长度大于模长则要分组解密
|
||||
// String ming = "";
|
||||
// byte[][] arrays = splitArray(bcd, key_len);
|
||||
// for (byte[] arr : arrays) {
|
||||
// ming += new String(cipher.doFinal(arr));
|
||||
// }
|
||||
// return ming;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 私钥解密
|
||||
// *
|
||||
// * @param data
|
||||
// * @param privateKey
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static String decryptByPrivateKey(String data,
|
||||
// String privateKey) throws Exception {
|
||||
// RSAPrivateKey publicKey= (RSAPrivateKey) getPrivateKey(privateKey);
|
||||
// Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
// cipher.init(Cipher.DECRYPT_MODE, publicKey);
|
||||
// // 模长
|
||||
// int key_len = publicKey.getModulus().bitLength() / 8;
|
||||
// byte[] bytes = data.getBytes();
|
||||
// byte[] bcd = ASCII_To_BCD(bytes, bytes.length);
|
||||
// // 如果密文长度大于模长则要分组解密
|
||||
// String ming = "";
|
||||
// byte[][] arrays = splitArray(bcd, key_len);
|
||||
// for (byte[] arr : arrays) {
|
||||
// ming += new String(cipher.doFinal(arr));
|
||||
// }
|
||||
// return ming;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * ASCII码转BCD码
|
||||
// *
|
||||
// */
|
||||
// private static byte[] ASCII_To_BCD(byte[] ascii, int asc_len) {
|
||||
// byte[] bcd = new byte[asc_len / 2];
|
||||
// int j = 0;
|
||||
// for (int i = 0; i < (asc_len + 1) / 2; i++) {
|
||||
// bcd[i] = asc_to_bcd(ascii[j++]);
|
||||
// bcd[i] = (byte) (((j >= asc_len) ? 0x00 : asc_to_bcd(ascii[j++])) + (bcd[i] << 4));
|
||||
// }
|
||||
// return bcd;
|
||||
// }
|
||||
//
|
||||
// private static byte asc_to_bcd(byte asc) {
|
||||
// byte bcd;
|
||||
//
|
||||
// if ((asc >= '0') && (asc <= '9'))
|
||||
// bcd = (byte) (asc - '0');
|
||||
// else if ((asc >= 'A') && (asc <= 'F'))
|
||||
// bcd = (byte) (asc - 'A' + 10);
|
||||
// else if ((asc >= 'a') && (asc <= 'f'))
|
||||
// bcd = (byte) (asc - 'a' + 10);
|
||||
// else
|
||||
// bcd = (byte) (asc - 48);
|
||||
// return bcd;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * BCD转字符串
|
||||
// */
|
||||
// private static String bcd2Str(byte[] bytes) {
|
||||
// char temp[] = new char[bytes.length * 2], val;
|
||||
//
|
||||
// for (int i = 0; i < bytes.length; i++) {
|
||||
// val = (char) (((bytes[i] & 0xf0) >> 4) & 0x0f);
|
||||
// temp[i * 2] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
|
||||
//
|
||||
// val = (char) (bytes[i] & 0x0f);
|
||||
// temp[i * 2 + 1] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
|
||||
// }
|
||||
// return new String(temp);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 拆分字符串
|
||||
// */
|
||||
// private static String[] splitString(String string, int len) {
|
||||
// int x = string.length() / len;
|
||||
// int y = string.length() % len;
|
||||
// int z = 0;
|
||||
// if (y != 0) {
|
||||
// z = 1;
|
||||
// }
|
||||
// String[] strings = new String[x + z];
|
||||
// String str = "";
|
||||
// for (int i = 0; i < x + z; i++) {
|
||||
// if (i == x + z - 1 && y != 0) {
|
||||
// str = string.substring(i * len, i * len + y);
|
||||
// } else {
|
||||
// str = string.substring(i * len, i * len + len);
|
||||
// }
|
||||
// strings[i] = str;
|
||||
// }
|
||||
// return strings;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 拆分数组
|
||||
// */
|
||||
// private static byte[][] splitArray(byte[] data, int len) {
|
||||
// int x = data.length / len;
|
||||
// int y = data.length % len;
|
||||
// int z = 0;
|
||||
// if (y != 0) {
|
||||
// z = 1;
|
||||
// }
|
||||
// byte[][] arrays = new byte[x + z][];
|
||||
// byte[] arr;
|
||||
// for (int i = 0; i < x + z; i++) {
|
||||
// arr = new byte[len];
|
||||
// if (i == x + z - 1 && y != 0) {
|
||||
// System.arraycopy(data, i * len, arr, 0, y);
|
||||
// } else {
|
||||
// System.arraycopy(data, i * len, arr, 0, len);
|
||||
// }
|
||||
// arrays[i] = arr;
|
||||
// }
|
||||
// return arrays;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public static void main(String[] args) throws Exception {
|
||||
// Map<String, Object> map=initRSAKeys();
|
||||
// System.out.println("publickey:"+map.get("pubKey"));
|
||||
// System.out.println("privatekey:"+map.get("priKey"));
|
||||
//
|
||||
// String code=encryptByPublicKey("16232c1f0459856a11d0d735d5ab7c632a82a2a625c67392ae00048b17075a03","MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDG0BwuxagDwPcWdeDn+tM/lxAICVpoj4fhKnlNYnZFN7HMjrgNjvN3Hf1yrVvnwb/4P04PP/Ck8KLBQJASGWVnSBNqbF2C03XsaEBDYUdaumBED9hxN1tWZs/vDAZB3CQwafPce4XsjffjZFx3K2t7MO4kBc8iB5AU2w96Jmjf/QIDAQAB");
|
||||
////
|
||||
// System.out.println("加密数据:"+code);
|
||||
////
|
||||
//// System.out.println(decryptByPrivateKey(code,"MIIBNwIBADANBgkqhkiG9w0BAQEFAASCASEwggEdAgEAAoGBAO6kUESLQMrDdnDbIqKikzpw94f1WKF5MWMWhNJDYaqHV99hW1YJMiKpqVxaEzNlNKiOI3VISEXSnK2LTfbBGNFOFtxjcy3WlJ0nVoAXMzvyebIX/1cr2nCnN9F73jjB3kxsOV5OCurPb+MJy3q4KAh1IMb/Pq6+oomhRSg2F9RPAgEAAoGBAKRyNCHXt9FBuldwmkBqOXxXJivZRLcY1ZCLjwF5j068ry/uXcs+0P6T3XIXXA3Zmtzf/c0u/yamSHNKgHIehCM6tlXWtuiDA4Ko5i8e2fQPLQgQ3EBJS51AxCW4H6AOnu9Usu27uC6ZA/C9p/TPGFtoLV+9/98JkpHDx6Xzc+SRAgEAAgEAAgEAAgEAAgEA"));
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.chaozhanggui.dao.system.dao;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussAccount;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@@ -15,6 +16,7 @@ public interface TbPlussAccountMapper {
|
||||
int insertSelective(TbPlussAccount record);
|
||||
|
||||
TbPlussAccount selectByPrimaryKey(Integer id);
|
||||
TbPlussAccount selectByUser(@Param("userId") Integer userId, @Param("channelType")String channelType);
|
||||
|
||||
int updateByPrimaryKeySelective(TbPlussAccount record);
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.chaozhanggui.dao.system.dao;
|
||||
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussMerchantCashPayCode;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussVoiceboxProfit;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbPlussVoiceboxProfitMapper {
|
||||
|
||||
Integer insertList(List<TbPlussVoiceboxProfit> voiceboxProfitList);
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.chaozhanggui.dao.system.entity.DTO;
|
||||
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussAccount;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussBankCard;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussIdCard;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 结算信息
|
||||
* @author DJH
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class AccountDTO extends TbPlussAccount {
|
||||
//
|
||||
// /**
|
||||
// * 进件状态。0或无、待审核,1、审核中 2、审核失败
|
||||
// */
|
||||
// private String status;
|
||||
//
|
||||
// /**
|
||||
// * 结算人银行卡
|
||||
// */
|
||||
// @Valid
|
||||
// @NotNull(message = "请完善银行卡信息")
|
||||
// private TbPlussBankCard bankCard;
|
||||
//
|
||||
// /**
|
||||
// * 结算人身份信息
|
||||
// */
|
||||
// @Valid
|
||||
// private TbPlussIdCard idcard;
|
||||
//
|
||||
// /**
|
||||
// * 商户类型,-1则表示查询现有信息,其他类型则会过滤某些数据
|
||||
// */
|
||||
// private String merchantType;
|
||||
//
|
||||
// /**
|
||||
// * 通过数据获取进件类型
|
||||
// */
|
||||
// public static void initSettleType(AccountDTO accountDTO) {
|
||||
// TbPlussBankCard bankCard = accountDTO.getBankCard();
|
||||
// TbPlussIdCard idCard = accountDTO.getIdcard();
|
||||
//
|
||||
// // 对公
|
||||
// if (TbPlussBankCard.ACCOUNT_TYPE_CORPORATE.equals(bankCard.getAccountType())) {
|
||||
// accountDTO.setSettleType(Account.SETTLE_TYPE_CORPORATE);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // 法人-对私法人
|
||||
// if (BankCard.ACCOUNT_TYPE_PRIVATE.equals(bankCard.getAccountType()) && idCard == null) {
|
||||
// accountDTO.setSettleType(Account.LEGAL_PRIVATE_LEGAL);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// MsgException.check(idCard == null, "请传递身份证信息");
|
||||
//
|
||||
// accountDTO.setSettleType(Account.LEGAL_PRIVATE_ILLEGAL);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 请求数据校验
|
||||
// */
|
||||
// public void paramCheck() {
|
||||
// if (StringUtils.isBlank(getSettleType())) {
|
||||
// // 为空时候,默认为对公
|
||||
// setSettleType(Account.SETTLE_TYPE_CORPORATE);
|
||||
//// throw new MsgException("缺少结算类型参数");
|
||||
// }
|
||||
//
|
||||
// if (Objects.equals(getSettleType(), Account.SETTLE_TYPE_PRIVATE_LEGAL) || Objects.equals(getSettleType(), Account.SETTLE_TYPE_CORPORATE)) {
|
||||
// idcard = null;
|
||||
// }
|
||||
//
|
||||
// if (idcard != null && !Objects.equals(idcard.getUserId(), getUserId())) {
|
||||
// throw new MsgException("用户id应保持一致");
|
||||
// }
|
||||
//
|
||||
// if (bankCard != null && !bankCard.getUserId().equals(getUserId())) {
|
||||
// throw new MsgException("用户id应保持一致");
|
||||
// }
|
||||
//
|
||||
// if (bankCard == null) {
|
||||
// throw new MsgException("缺少银行卡信息");
|
||||
// }
|
||||
//
|
||||
// if (bankCard.getAccountType() == null) {
|
||||
// bankCard.setAccountType(BankCard.ACCOUNT_TYPE_PRIVATE);
|
||||
// }
|
||||
//
|
||||
// if (BankCard.ACCOUNT_TYPE_CORPORATE.equals(bankCard.getAccountType()) && StringUtils.isBlank(bankCard.getLicenseUrl())) {
|
||||
// throw new MsgException("对公账户需要传入开户许可证");
|
||||
// }
|
||||
//
|
||||
// if (BankCard.ACCOUNT_TYPE_CERT.equals(bankCard.getAccountType())) {
|
||||
// // 结算信息这里实名认证的类型作为对私账户来识别
|
||||
// bankCard.setAccountType(BankCard.ACCOUNT_TYPE_PRIVATE);
|
||||
// }
|
||||
//
|
||||
// if (!BankCard.ACCOUNT_TYPE_PRIVATE.equals(bankCard.getAccountType()) && !BankCard.ACCOUNT_TYPE_CORPORATE.equals(bankCard.getAccountType())) {
|
||||
// throw new MsgException("请传入正确的银行卡类型");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -4,6 +4,21 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class TbPlussAccount implements Serializable {
|
||||
public static final String CHANNEL_TYPE_D1 = "D1";
|
||||
public static final String CHANNEL_TYPE_D0 = "D0";
|
||||
|
||||
/** 小微 */
|
||||
public static final String SETTLE_TYPE_MICRO_STORE = "00";
|
||||
/** 对私法人结算 */
|
||||
public static final String SETTLE_TYPE_PRIVATE_LEGAL = "01";
|
||||
/** 我是法人 */
|
||||
public static final String IS_SELF_LEGAL = "1";
|
||||
/** 我不是法人 */
|
||||
public static final String NOT_SELF_LEGAL = "2";
|
||||
/** 对私非法人结算 */
|
||||
public static final String SETTLE_TYPE_PRIVATE_ILLEGAL = "02";
|
||||
/** 对公结算 */
|
||||
public static final String SETTLE_TYPE_CORPORATE = "03";
|
||||
private Integer id;
|
||||
|
||||
private String userid;
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.chaozhanggui.dao.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class TbPlussUserApp implements Serializable {
|
||||
private Integer id;
|
||||
@@ -90,6 +95,407 @@ public class TbPlussUserApp implements Serializable {
|
||||
|
||||
private String jfshopkey;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "企业类填写:营业执照名称,执照如无名称,可填“个体户XXX”(执照上姓名);小微商户填“商户_XXX”(身份证姓名)仅传参需要 无需添加字段")
|
||||
private String licenseFullName;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "")
|
||||
private List<TbPlussMerchantImage> merchantImagesList;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "")
|
||||
private String registUrl;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
@TableField(exist = false)
|
||||
private String password;
|
||||
@ApiModelProperty(value = "")
|
||||
@TableField(exist = false)
|
||||
private Integer merchantStatus;
|
||||
@ApiModelProperty(value = "")
|
||||
@TableField(exist = false)
|
||||
private String merchantReason;
|
||||
|
||||
public TbPlussIdCard getIdCard() {
|
||||
return idCard;
|
||||
}
|
||||
|
||||
public void setIdCard(TbPlussIdCard idCard) {
|
||||
this.idCard = idCard;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public String getThirdStatus() {
|
||||
return thirdStatus;
|
||||
}
|
||||
|
||||
public void setThirdStatus(String thirdStatus) {
|
||||
this.thirdStatus = thirdStatus;
|
||||
}
|
||||
|
||||
public String getStoreId2() {
|
||||
return storeId2;
|
||||
}
|
||||
|
||||
public void setStoreId2(String storeId2) {
|
||||
this.storeId2 = storeId2;
|
||||
}
|
||||
|
||||
public String getMcsStatus() {
|
||||
return mcsStatus;
|
||||
}
|
||||
|
||||
public void setMcsStatus(String mcsStatus) {
|
||||
this.mcsStatus = mcsStatus;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getPpStatus() {
|
||||
return ppStatus;
|
||||
}
|
||||
|
||||
public void setPpStatus(String ppStatus) {
|
||||
this.ppStatus = ppStatus;
|
||||
}
|
||||
|
||||
public String getPpThirdStatus() {
|
||||
return ppThirdStatus;
|
||||
}
|
||||
|
||||
public void setPpThirdStatus(String ppThirdStatus) {
|
||||
this.ppThirdStatus = ppThirdStatus;
|
||||
}
|
||||
|
||||
public String getPluginRemark() {
|
||||
return pluginRemark;
|
||||
}
|
||||
|
||||
public void setPluginRemark(String pluginRemark) {
|
||||
this.pluginRemark = pluginRemark;
|
||||
}
|
||||
|
||||
public String getPayPassword() {
|
||||
return payPassword;
|
||||
}
|
||||
|
||||
public void setPayPassword(String payPassword) {
|
||||
this.payPassword = payPassword;
|
||||
}
|
||||
|
||||
public String getPermissionBill() {
|
||||
return permissionBill;
|
||||
}
|
||||
|
||||
public void setPermissionBill(String permissionBill) {
|
||||
this.permissionBill = permissionBill;
|
||||
}
|
||||
|
||||
public String getFaceCert() {
|
||||
return faceCert;
|
||||
}
|
||||
|
||||
public void setFaceCert(String faceCert) {
|
||||
this.faceCert = faceCert;
|
||||
}
|
||||
|
||||
public String getFaceCompare() {
|
||||
return faceCompare;
|
||||
}
|
||||
|
||||
public void setFaceCompare(String faceCompare) {
|
||||
this.faceCompare = faceCompare;
|
||||
}
|
||||
|
||||
public String getLicenseFullName() {
|
||||
return licenseFullName;
|
||||
}
|
||||
|
||||
public void setLicenseFullName(String licenseFullName) {
|
||||
this.licenseFullName = licenseFullName;
|
||||
}
|
||||
|
||||
public List<TbPlussMerchantImage> getMerchantImagesList() {
|
||||
return merchantImagesList;
|
||||
}
|
||||
|
||||
public void setMerchantImagesList(List<TbPlussMerchantImage> merchantImagesList) {
|
||||
this.merchantImagesList = merchantImagesList;
|
||||
}
|
||||
|
||||
public String getRegistUrl() {
|
||||
return registUrl;
|
||||
}
|
||||
|
||||
public void setRegistUrl(String registUrl) {
|
||||
this.registUrl = registUrl;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Integer getMerchantStatus() {
|
||||
return merchantStatus;
|
||||
}
|
||||
|
||||
public void setMerchantStatus(Integer merchantStatus) {
|
||||
this.merchantStatus = merchantStatus;
|
||||
}
|
||||
|
||||
public String getMerchantReason() {
|
||||
return merchantReason;
|
||||
}
|
||||
|
||||
public void setMerchantReason(String merchantReason) {
|
||||
this.merchantReason = merchantReason;
|
||||
}
|
||||
|
||||
public String getMerchantType() {
|
||||
return merchantType;
|
||||
}
|
||||
|
||||
public void setMerchantType(String merchantType) {
|
||||
this.merchantType = merchantType;
|
||||
}
|
||||
|
||||
public String getBankCertName() {
|
||||
return bankCertName;
|
||||
}
|
||||
|
||||
public void setBankCertName(String bankCertName) {
|
||||
this.bankCertName = bankCertName;
|
||||
}
|
||||
|
||||
public List<String> getParentIdList() {
|
||||
return parentIdList;
|
||||
}
|
||||
|
||||
public void setParentIdList(List<String> parentIdList) {
|
||||
this.parentIdList = parentIdList;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
public Double getTotalMoney() {
|
||||
return totalMoney;
|
||||
}
|
||||
|
||||
public void setTotalMoney(Double totalMoney) {
|
||||
this.totalMoney = totalMoney;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public BigDecimal getRate() {
|
||||
return rate;
|
||||
}
|
||||
|
||||
public void setRate(BigDecimal rate) {
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
public Integer getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Integer size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Integer getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(Integer page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public Long getMercId() {
|
||||
return mercId;
|
||||
}
|
||||
|
||||
public void setMercId(Long mercId) {
|
||||
this.mercId = mercId;
|
||||
}
|
||||
|
||||
public String getMerchantId() {
|
||||
return merchantId;
|
||||
}
|
||||
|
||||
public void setMerchantId(String merchantId) {
|
||||
this.merchantId = merchantId;
|
||||
}
|
||||
|
||||
public String getMerchantAuditStatus() {
|
||||
return merchantAuditStatus;
|
||||
}
|
||||
|
||||
public void setMerchantAuditStatus(String merchantAuditStatus) {
|
||||
this.merchantAuditStatus = merchantAuditStatus;
|
||||
}
|
||||
|
||||
public TbPlussMerchantBaseInfo getMerchantBaseInfo() {
|
||||
return merchantBaseInfo;
|
||||
}
|
||||
|
||||
public void setMerchantBaseInfo(TbPlussMerchantBaseInfo merchantBaseInfo) {
|
||||
this.merchantBaseInfo = merchantBaseInfo;
|
||||
}
|
||||
|
||||
public TbPlussMerchantBankCard getMerchantBankCard() {
|
||||
return merchantBankCard;
|
||||
}
|
||||
|
||||
public void setMerchantBankCard(TbPlussMerchantBankCard merchantBankCard) {
|
||||
this.merchantBankCard = merchantBankCard;
|
||||
}
|
||||
|
||||
public TbPlussBankCard getBankCard() {
|
||||
return bankCard;
|
||||
}
|
||||
|
||||
public void setBankCard(TbPlussBankCard bankCard) {
|
||||
this.bankCard = bankCard;
|
||||
}
|
||||
|
||||
@TableField(exist = false)
|
||||
private String merchantType;
|
||||
@TableField(exist = false)
|
||||
private String bankCertName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> parentIdList;
|
||||
@TableField(exist = false)
|
||||
private String alias;
|
||||
@TableField(exist = false)
|
||||
private Double totalMoney;
|
||||
@TableField(exist = false)
|
||||
private String type;
|
||||
|
||||
/** 费率,只有服务商推广的商户有这个字段 */
|
||||
@TableField(exist = false)
|
||||
private BigDecimal rate;
|
||||
//查询数据
|
||||
@TableField(exist = false)
|
||||
private Integer size;
|
||||
@TableField(exist = false)
|
||||
private Integer page;
|
||||
/** 商户id */
|
||||
@TableField(exist = false)
|
||||
private Long mercId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String merchantId;
|
||||
|
||||
/** 当前渠道下商户的进件状态 */
|
||||
@TableField(exist = false)
|
||||
private String merchantAuditStatus;
|
||||
|
||||
/**
|
||||
* 商户信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private TbPlussMerchantBaseInfo merchantBaseInfo;
|
||||
/**
|
||||
* 结算信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private TbPlussMerchantBankCard merchantBankCard;
|
||||
|
||||
/**
|
||||
* 银行卡信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private TbPlussBankCard bankCard;
|
||||
|
||||
/**
|
||||
* 证件信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private TbPlussIdCard idCard;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date startDate;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date endDate;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String thirdStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String storeId2;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String mcsStatus;
|
||||
@TableField(exist = false)
|
||||
private String remark;
|
||||
@TableField(exist = false)
|
||||
private String updateTime;
|
||||
@TableField(exist = false)
|
||||
private String ppStatus;
|
||||
@TableField(exist = false)
|
||||
private String ppThirdStatus;
|
||||
@TableField(exist = false)
|
||||
private String pluginRemark;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String payPassword;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String permissionBill;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String faceCert;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String faceCompare;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.chaozhanggui.dao.system.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
public class TbPlussVoiceboxProfit {
|
||||
private Integer id;
|
||||
private String merchantCode;
|
||||
|
||||
private String amount;
|
||||
private String remarks;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMerchantCode() {
|
||||
return merchantCode;
|
||||
}
|
||||
|
||||
public void setMerchantCode(String merchantCode) {
|
||||
this.merchantCode = merchantCode;
|
||||
}
|
||||
|
||||
public String getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(String amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.chaozhanggui.dao.system.entity.VO;
|
||||
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussBankCard;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussIdCard;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
@Data
|
||||
public class AccountVO {
|
||||
/**
|
||||
* 结算人银行卡
|
||||
*/
|
||||
private TbPlussBankCard bankCard;
|
||||
|
||||
/**
|
||||
* 结算人身份信息
|
||||
*/
|
||||
private TbPlussIdCard idCard;
|
||||
}
|
||||
@@ -31,7 +31,16 @@
|
||||
from tb_pluss_account
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<select id="selectByUser" resultType="com.chaozhanggui.dao.system.entity.TbPlussAccount">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_pluss_account
|
||||
WHERE
|
||||
userId = #{userId}
|
||||
AND channelType = #{channelType}
|
||||
LIMIT 1
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from tb_pluss_account
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
|
||||
@@ -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.chaozhanggui.dao.system.dao.TbPlussVoiceboxProfitMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussVoiceboxProfit">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="merchantCode" jdbcType="VARCHAR" property="merchantCode" />
|
||||
<result column="amount" jdbcType="DECIMAL" property="amount" />
|
||||
<result column="remarks" jdbcType="VARCHAR" property="remarks" />
|
||||
</resultMap>
|
||||
<insert id="insertList" parameterType="java.util.List">
|
||||
INSERT INTO tb_pluss_voicebox_profit (`merchantCode`, `amount`, `remarks`)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.merchantCode}, #{item.amount}, #{item.remarks})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -22,6 +22,7 @@
|
||||
<module>lkl-service-api</module>
|
||||
<!-- <module>order-service</module>-->
|
||||
<module>aliPay-service-api</module>
|
||||
<module>Excel-api</module>
|
||||
</modules>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user