Commit fd189a5a authored by wujiang's avatar wujiang

提交代码

parent ff1ee801
......@@ -30,6 +30,11 @@
<version>1.70</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.16</version>
</dependency>-->
<!-- <dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.70</version>
......@@ -47,7 +52,7 @@
</dependency>
</dependencies>
<!-- <dependencyManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
......@@ -60,5 +65,5 @@
<version>1.70</version>
</dependency>
</dependencies>
</dependencyManagement>-->
</dependencyManagement>
</project>
......@@ -60,6 +60,7 @@ public class HygfIcbcRecordExportDTO {
@ApiModelProperty (value = "聚富通电子账户账号")
private String mediumId;
/**
* 开户状态, 00-初始,01-开户中,02-开户成功,03-开户失败
*/
......@@ -87,5 +88,11 @@ public class HygfIcbcRecordExportDTO {
@ApiModelProperty (value = "最后扣款成功时间")
private String paymentTime;
@ExcelProperty(value = "银行卡类型", index = 9)
@ApiModelProperty (value = "银行卡类型")
private String type;
@ExcelProperty(value = "可用余额", index = 10)
@ApiModelProperty (value = "可用余额")
private String holdBalance;
}
\ No newline at end of file
......@@ -305,7 +305,8 @@
END
) AS openAccountStatus,
pa.paymentAmount AS paymentAmount,
MAX(pa.payTime) paymentTime
MAX(pa.payTime) paymentTime,
MAX(re.type) AS type
FROM
`hygf_peasant_household` ph
LEFT JOIN
......
......@@ -188,13 +188,13 @@
SELECT
COUNT( * ) AS total,
CASE WHEN grid_status = '1' THEN '待登记'
WHEN grid_status = '2' THEN '审核中'
WHEN grid_status = '2' THEN '经销商管理员待审核'
WHEN grid_status = '3' THEN '已完成'
WHEN grid_status = '4' THEN '未通过'
WHEN grid_status = '5' THEN '审核中'
WHEN grid_status = '6' THEN '审核中'
WHEN grid_status = '7' THEN '审核中'
WHEN grid_status = '8' THEN '审核中'
WHEN grid_status = '5' THEN '设计待审核'
WHEN grid_status = '6' THEN '设计待审核/工程待审核'
WHEN grid_status = '7' THEN '片区运营待审核'
WHEN grid_status = '8' THEN '工程待审核'
WHEN grid_status = '9' THEN '整改待审核'
ELSE '待整改' END AS statusText,
ROUND(COALESCE(SUM(ei.real_scale), 0), 2) AS realScale
......@@ -229,15 +229,15 @@
COUNT(*) AS total,
CASE
WHEN acceptance_check_status = '15' THEN '待提交'
WHEN acceptance_check_status = '2' THEN '审核中'
WHEN acceptance_check_status = '2' THEN '经销商管理员待审核'
WHEN acceptance_check_status = '3' THEN '已完成'
WHEN acceptance_check_status = '4' THEN '未通过'
WHEN acceptance_check_status = '7' THEN '审核中'
WHEN acceptance_check_status = '7' THEN '片区运营待审核'
WHEN acceptance_check_status = '9' THEN '整改待审核'
WHEN acceptance_check_status = '11' THEN '审核中'
WHEN acceptance_check_status = '12' THEN '审核中'
WHEN acceptance_check_status = '13' THEN '审核中'
WHEN acceptance_check_status = '14' THEN '审核中'
WHEN acceptance_check_status = '11' THEN '投融待审核/法务待审核'
WHEN acceptance_check_status = '12' THEN '投融待审核'
WHEN acceptance_check_status = '13' THEN '资产待审核'
WHEN acceptance_check_status = '14' THEN '法务待审核'
ELSE '待整改'
END AS statusText,
ROUND(COALESCE(SUM(ei.real_scale), 0), 2) AS realScale
......
......@@ -142,12 +142,6 @@
<artifactId>easypoi-annotation</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.16</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
......
......@@ -19,8 +19,11 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
/**
......@@ -153,7 +156,7 @@ public class HygfIcbcController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "聚富通信息", notes = "聚富通信息")
@GetMapping(value = "/exportExcel")
@UserLimits
public void exportData( HttpServletResponse response,HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) {
public void exportData( HttpServletResponse response,HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) throws ExecutionException, InterruptedException {
hygfIcbcService.exportExcel(response,hygfIcbcRecordQueryDTO);
}
......@@ -181,7 +184,18 @@ public class HygfIcbcController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "余额查询", notes = "余额查询")
@GetMapping(value = "/balanceQuery")
public ResponseModel<Object> balanceQuery(@RequestParam(required = true)String mediumId){
public ResponseModel<Object> balanceQuery(@RequestParam(required = true)String mediumId) throws ExecutionException, InterruptedException {
// List<CompletableFuture<Void>> futures = new ArrayList<>();
// for(int i =0;i<=1000;i++)
// {
// CompletableFuture<Void> fan = CompletableFuture.supplyAsync(() -> {
// hygfIcbcService.balanceQuery(mediumId);
// return null;
// });
// futures.add(fan);
// }
// CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get();
return ResponseHelper.buildResponse(hygfIcbcService.balanceQuery(mediumId));
}
......
......@@ -8,16 +8,10 @@ import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Base64;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
......@@ -110,10 +104,7 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
private String OUT_VENDOR_ID;
@Value("${hygf.icbc.projectId}")
private String PROJECT_ID;
@Value("${hygf.icbc.sm2PublicKey}")
private String SM2_PUBLIC_KEY;
@Value("${hygf.icbc.sm2PrivateKey}")
private String SM2_PRIVATE_KEY;
/**
* 协议总限额
*/
......@@ -695,8 +686,25 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
}
public void exportExcel(HttpServletResponse response, HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) {
public void exportExcel(HttpServletResponse response, HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) throws ExecutionException, InterruptedException {
List<HygfIcbcRecordExportDTO> hygfIcbcRecordExportDTOS = hygfIcbcRecordMapper.paymentAmountExport(hygfIcbcRecordQueryDTO);
List<CompletableFuture<Void>> futures = new ArrayList<>();
for(HygfIcbcRecordExportDTO dto : hygfIcbcRecordExportDTOS)
{
if(dto.getMediumId()!=null&&"二类卡".equals(dto.getType()))
{
CompletableFuture<Void> fan = CompletableFuture.supplyAsync(() -> {
SettlementAccountBalanceQueryResponseV1 res= (SettlementAccountBalanceQueryResponseV1) this.balanceQuery(dto.getMediumId());
if(res.isSuccess())
{
dto.setHoldBalance(res.getHoldBalance());
}
return null;
});
futures.add(fan);
}
}
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get();
if (CollectionUtil.isNotEmpty(hygfIcbcRecordExportDTOS)) {
ExcelUtil.createTemplate(response, "账号信息", "账号信息", hygfIcbcRecordExportDTOS, HygfIcbcRecordExportDTO.class, null, false);
}
......@@ -909,11 +917,14 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
}
public Object balanceQuery(String mediumId) {
DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY,
IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, APIGW_PUBLIC_KEY, IcbcConstants.ENCRYPT_TYPE_AES,
AES_Key, "", "");
SettlementAccountBalanceQueryRequestV1 request = new SettlementAccountBalanceQueryRequestV1();
String apiUrl = serviceUrl + "/api/settlement/account/balance/V1/query";
// String apiUrl = serviceUrl + "/api/settlement/ /balance/query/V2";
request.setServiceUrl(apiUrl);
SettlementAccountBalanceQueryRequestV1.SettlementAccountBalanceQueryRequestV1Biz bizContent = new SettlementAccountBalanceQueryRequestV1.SettlementAccountBalanceQueryRequestV1Biz();
bizContent.setCorpNo(corpNo);//合作方机构编号
......@@ -929,7 +940,8 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
bizContent.setOutServiceCode("querybalance");//外部服务代码
//String encodedString = Base64.getEncoder().encodeToString(mediumId.getBytes());
//生成sm4密钥
String origSecretKey = UtilIcbc.getNonceStr(16);
//String origSecretKey = UtilIcbc.getNonceStr(16);
String origSecretKey ="1234567890123456";
String secretKey = UtilIcbc.getHexString(origSecretKey.getBytes());
SM4Utils.secretKey = secretKey;
SM4Utils.hexString = true;
......@@ -937,14 +949,18 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
//生成sm2加密后的sm4公钥
String sm4SecretKey = null;
try {
sm4SecretKey = SM2Utils.encrypt(UtilIcbc.hexToByte(SM2_PUBLIC_KEY), origSecretKey.getBytes());
sm4SecretKey = SM2Utils.encrypt(UtilIcbc.hexToByte("04"+CAMS_PUBLIC_KEY), origSecretKey.getBytes());
// sm4SecretKey = SM2Utils.encrypt(UtilIcbc.hexToByte(SM2_PUBLIC_KEY), origSecretKey.getBytes());
} catch (IOException e) {
throw new RuntimeException(e);
}
// sm4SecretKey= Sm2Util.encryptBase64(origSecretKey,"04"+CAMS_PUBLIC_KEY);
//私钥解密
//String des = Sm2Util.decryptBase64(sm4SecretKey,SM2_PRIVATE_KEY);
//涉密信息如身份证号,姓名,卡号都需要用sm4密钥进行加密
bizContent.setMediumId(SM4Utils.encryptData_CBC(mediumId)); //工行联名卡号
bizContent.setCcy(1); //币种,1
bizContent.setSecretKey(sm4SecretKey); // sm4对称密钥(对敏感信息加密时必送)
bizContent.setSecretKey(sm4SecretKey);
request.setBizContent(bizContent);
SettlementAccountBalanceQueryResponseV1 response = null;
try {
......
......@@ -272,8 +272,6 @@ hygf.icbc.camsPublicKey=655CE8706E6ED9A30B92E57D8D645ADDE8C541C27C5C5AFD529C610C
hygf.icbc.apigwPublicKey=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB
hygf.icbc.outVendorId=gxjr
hygf.icbc.projectId=PJ140014023565102203
hygf.icbc.sm2PublicKey=04724755085cda47d161e4e1db0b4699521dcc0411fd34957457e9175b193ae6bf339e4c7a27e96d448f59073130c80efe1c6c0722c0f8c996567b31ead9f0f06e
hygf.icbc.sm2PrivateKey=807e5dcea2bb31f7846aa2bcc5211ed5903bfb718f4817abab3590058a71a915
icbc.Withhold.projectId=PJ140014023565102203
......
......@@ -49,11 +49,11 @@
<version>5.7.22</version>
</dependency>
<dependency>
<!-- <dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15to18</artifactId>
<version>1.69</version>
</dependency>
</dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.influxdb</groupId>-->
<!-- <artifactId>influxdb-java</artifactId>-->
......
......@@ -5,14 +5,14 @@ import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.asn1.gm.GMNamedCurves;
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.crypto.engines.SM2Engine;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.bouncycastle.crypto.params.ParametersWithRandom;
import org.bouncycastle.math.ec.ECPoint;
import org.bouncycastle.util.encoders.Hex;
//import org.bouncycastle.asn1.gm.GMNamedCurves;
//import org.bouncycastle.asn1.x9.X9ECParameters;
//import org.bouncycastle.crypto.engines.SM2Engine;
//import org.bouncycastle.crypto.params.ECDomainParameters;
//import org.bouncycastle.crypto.params.ECPublicKeyParameters;
//import org.bouncycastle.crypto.params.ParametersWithRandom;
//import org.bouncycastle.math.ec.ECPoint;
//import org.bouncycastle.util.encoders.Hex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
......@@ -49,24 +49,25 @@ public class JXDZUtils {
public static String GF_CODE="PPC17063608260011";
private String dataEncrypt(String obj, String publicKey) {
X9ECParameters sm2ECParameters = GMNamedCurves.getByName("sm2p256v1");
ECDomainParameters domainParameters = new ECDomainParameters(sm2ECParameters.getCurve(), sm2ECParameters.getG(),
sm2ECParameters.getN(), sm2ECParameters.getH());
ECPoint pukPoint = sm2ECParameters.getCurve()
.decodePoint(Hex.decode(publicKey));
ECPublicKeyParameters publicKeyParameters = new ECPublicKeyParameters(pukPoint, domainParameters);
SM2Engine.Mode mode = SM2Engine.Mode.C1C3C2;
SM2Engine sm2Engine = new SM2Engine(mode);
// 设置sm2为加密模式
sm2Engine.init(true, new ParametersWithRandom(publicKeyParameters, new SecureRandom()));
byte[] arrayOfBytes = null;
byte[] in = obj.getBytes(StandardCharsets.UTF_8);
try {
arrayOfBytes = sm2Engine.processBlock(in, 0, in.length);
} catch (Exception e) {
e.printStackTrace();
}
return Base64.encode(arrayOfBytes);
// X9ECParameters sm2ECParameters = GMNamedCurves.getByName("sm2p256v1");
// ECDomainParameters domainParameters = new ECDomainParameters(sm2ECParameters.getCurve(), sm2ECParameters.getG(),
// sm2ECParameters.getN(), sm2ECParameters.getH());
// ECPoint pukPoint = sm2ECParameters.getCurve()
// .decodePoint(Hex.decode(publicKey));
// ECPublicKeyParameters publicKeyParameters = new ECPublicKeyParameters(pukPoint, domainParameters);
// SM2Engine.Mode mode = SM2Engine.Mode.C1C3C2;
// SM2Engine sm2Engine = new SM2Engine(mode);
// // 设置sm2为加密模式
// sm2Engine.init(true, new ParametersWithRandom(publicKeyParameters, new SecureRandom()));
// byte[] arrayOfBytes = null;
// byte[] in = obj.getBytes(StandardCharsets.UTF_8);
// try {
// arrayOfBytes = sm2Engine.processBlock(in, 0, in.length);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return Base64.encode(arrayOfBytes);
return null;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment