Browse Source

修复带啊

dev
主管理员 1 month ago
parent
commit
2063895122
12 changed files with 184 additions and 102 deletions
  1. +1
    -1
      admin-hanhai-vue/.env.development
  2. +1
    -1
      admin-hanhai-vue/.env.production
  3. +70
    -65
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/controller/HanHaiWaterController.java
  4. +9
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/entity/HanHaiWater.java
  5. +1
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/mapper/HanHaiWaterMapper.java
  6. +1
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/service/IHanHaiWaterService.java
  7. +1
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/service/impl/HanHaiWaterServiceImpl.java
  8. +24
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/vue/HanHaiWaterList.vue
  9. +10
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/vue/modules/HanHaiWaterForm.vue
  10. +32
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/vue3/HanHaiWater.data.ts
  11. +33
    -31
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiservice/impl/OrderApiServiceImpl.java
  12. +1
    -0
      jeecg-boot-module-system/src/main/resources/application-dev.yml

+ 1
- 1
admin-hanhai-vue/.env.development View File

@ -1,5 +1,5 @@
NODE_ENV=development
VUE_APP_API_BASE_URL=https://admin.ytonggao.com/a-notice-api/
VUE_APP_API_BASE_URL=http://localhost:8000/a-notice-api/
VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas
VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview


+ 1
- 1
admin-hanhai-vue/.env.production View File

@ -1,4 +1,4 @@
NODE_ENV=production
VUE_APP_API_BASE_URL=https://admin.ytonggao.com/a-notice-api/
VUE_APP_API_BASE_URL=http://localhost:8000/a-notice-api/
VUE_APP_CAS_BASE_URL=http://localhost:8888/cas
VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview

+ 70
- 65
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/controller/HanHaiWaterController.java View File

@ -88,6 +88,8 @@ public class HanHaiWaterController extends JeecgController<HanHaiWater, IHanHaiW
private String wxsSerialNo;
@Value("${wxpay.apiV3Key}")
private String apiV3Key;
@Value("${wxpay.withdrawalNotifyUrl}")
private String withdrawalNotifyUrl;
/**
* 分页列表查询
@ -155,7 +157,7 @@ public class HanHaiWaterController extends JeecgController<HanHaiWater, IHanHaiW
transferBatchesRequest.setTransferRemark("商家提现");
transferBatchesRequest.setOpenid(hanHaiMember.getAppletOpenid());
transferBatchesRequest.setTransferSceneId("1005");
transferBatchesRequest.setNotifyUrl(transferBatchUrl);
transferBatchesRequest.setNotifyUrl(withdrawalNotifyUrl);
String serialNo = null;
//加密真实姓名
try {
@ -202,6 +204,8 @@ public class HanHaiWaterController extends JeecgController<HanHaiWater, IHanHaiW
hanHaiWater1.setState(1);
hanHaiWater1.setSuccessTime(new Date());
hanHaiWater1.setPackageInfo(transferBatchesResp.getPackageInfo());
hanHaiWater1.setOutBatchNo(transferBatchesResp.getOutBillNo());
hanHaiWater1.setBatchId(transferBatchesResp.getTransferBillNo());
hanHaiWaterService.updateById(hanHaiWater1);
@ -279,69 +283,69 @@ public class HanHaiWaterController extends JeecgController<HanHaiWater, IHanHaiW
}
@PostMapping(value = "/withdrawal")
public Result<?> withdrawal (@RequestBody HanHaiWater hanHaiWater) {
HanHaiMember hanHaiMember = hanHaiMemberService.getById(hanHaiWater.getUserId());
Integer n = (Integer) redisUtil.get("WITHDRAWAL:" + hanHaiWater.getId());
if (n != null) {
throw new JeecgBootException("请勿重复点击,后果自负!");
}
redisUtil.set("WITHDRAWAL:" + hanHaiWater.getId(), 1, 5);
//微信-商家转账到零钱
String idStr = "H" + IdWorker.getIdStr();
TransferBatchesRequest transferBatchesRequest = new TransferBatchesRequest();
transferBatchesRequest.setAppid(appId);
transferBatchesRequest.setOutBillNo(idStr);
transferBatchesRequest.setTransferRemark("商家提现");
transferBatchesRequest.setOpenid(hanHaiMember.getAppletOpenid());
transferBatchesRequest.setTransferSceneId("1000");
String serialNo = null;
//加密真实姓名
try {
X509Certificate certificate = weChatPayConfig2.getVerifier().getValidCertificate();
serialNo = certificate.getSerialNumber().toString(16).toUpperCase();
//这里放真实姓名目前你的数据库表没有这个字段
String encryptOAEP = RsaCryptoUtil.encryptOAEP("廖志翔", certificate);
transferBatchesRequest.setUserName(encryptOAEP);
} catch (Exception e) {
log.info("真实姓名加密失败");
e.printStackTrace();
throw new JeecgBootException("真实姓名加密失败");
}
transferBatchesRequest.setTransferAmount(MoneyUtil.Yuan2Fen(hanHaiWater.getPrice().doubleValue()));
List<TransferBatchesDetailsRequest> transferBatchesDetailsRequests = new ArrayList<>();
TransferBatchesDetailsRequest transferBatchesDetailsRequest = new TransferBatchesDetailsRequest();
transferBatchesDetailsRequest.setInfoType("1000-现金营销");
transferBatchesDetailsRequest.setInfoContent("商品返利");
transferBatchesDetailsRequests.add(transferBatchesDetailsRequest);
transferBatchesRequest.setTransferDetailList(transferBatchesDetailsRequests);
String jsonString = JSONObject.toJSONString(transferBatchesRequest);
String postTransBatRequest = HttpRequestUtil.postTransBatRequest(transferBatchUrl, jsonString, serialNo, wxsSerialNo, mchId, pemPath);
log.error("返回结果1:" + postTransBatRequest);
TransferBatchesResp transferBatchesResp = JSON.parseObject(postTransBatRequest, TransferBatchesResp.class);
log.error("返回结果2:" + transferBatchesResp);
if (transferBatchesResp == null || org.apache.commons.lang3.StringUtils.isBlank(transferBatchesResp.getOutBillNo())|| StringUtils.equals(transferBatchesResp.getState(),"FAIL")) {
throw new JeecgBootException("打款失败");
}
//这里写自己的逻辑比如改变这条记录的状态变成提现成功
return Result.OK("提现成功");
}
// @PostMapping(value = "/withdrawal")
// public Result<?> withdrawal (@RequestBody HanHaiWater hanHaiWater) {
// HanHaiMember hanHaiMember = hanHaiMemberService.getById(hanHaiWater.getUserId());
//
// Integer n = (Integer) redisUtil.get("WITHDRAWAL:" + hanHaiWater.getId());
// if (n != null) {
// throw new JeecgBootException("请勿重复点击,后果自负!");
// }
// redisUtil.set("WITHDRAWAL:" + hanHaiWater.getId(), 1, 5);
//
// //微信-商家转账到零钱
//
// String idStr = "H" + IdWorker.getIdStr();
// TransferBatchesRequest transferBatchesRequest = new TransferBatchesRequest();
//
// transferBatchesRequest.setAppid(appId);
// transferBatchesRequest.setOutBillNo(idStr);
// transferBatchesRequest.setTransferRemark("商家提现");
// transferBatchesRequest.setOpenid(hanHaiMember.getAppletOpenid());
// transferBatchesRequest.setTransferSceneId("1000");
// String serialNo = null;
// //加密真实姓名
// try {
//
// X509Certificate certificate = weChatPayConfig2.getVerifier().getValidCertificate();
// serialNo = certificate.getSerialNumber().toString(16).toUpperCase();
// //这里放真实姓名目前你的数据库表没有这个字段
// String encryptOAEP = RsaCryptoUtil.encryptOAEP("廖志翔", certificate);
// transferBatchesRequest.setUserName(encryptOAEP);
// } catch (Exception e) {
// log.info("真实姓名加密失败");
// e.printStackTrace();
// throw new JeecgBootException("真实姓名加密失败");
// }
// transferBatchesRequest.setTransferAmount(MoneyUtil.Yuan2Fen(hanHaiWater.getPrice().doubleValue()));
// List<TransferBatchesDetailsRequest> transferBatchesDetailsRequests = new ArrayList<>();
// TransferBatchesDetailsRequest transferBatchesDetailsRequest = new TransferBatchesDetailsRequest();
// transferBatchesDetailsRequest.setInfoType("1000-现金营销");
// transferBatchesDetailsRequest.setInfoContent("商品返利");
//
//
//
// transferBatchesDetailsRequests.add(transferBatchesDetailsRequest);
// transferBatchesRequest.setTransferDetailList(transferBatchesDetailsRequests);
// String jsonString = JSONObject.toJSONString(transferBatchesRequest);
//
//
// String postTransBatRequest = HttpRequestUtil.postTransBatRequest(transferBatchUrl, jsonString, serialNo, wxsSerialNo, mchId, pemPath);
// log.error("返回结果1:" + postTransBatRequest);
// TransferBatchesResp transferBatchesResp = JSON.parseObject(postTransBatRequest, TransferBatchesResp.class);
// log.error("返回结果2:" + transferBatchesResp);
// if (transferBatchesResp == null || org.apache.commons.lang3.StringUtils.isBlank(transferBatchesResp.getOutBillNo())|| StringUtils.equals(transferBatchesResp.getState(),"FAIL")) {
// throw new JeecgBootException("打款失败");
// }
//
// //这里写自己的逻辑比如改变这条记录的状态变成提现成功
//
//
//
//
// return Result.OK("提现成功");
//
// }
@ -352,6 +356,7 @@ public class HanHaiWaterController extends JeecgController<HanHaiWater, IHanHaiW
@PostMapping("/withdrawal/notify")
public Object withdrawalNotify(@RequestBody TransferBatchesNotifyResp transferBatchesNotifyResp) throws GeneralSecurityException, IOException {
System.out.println("回调 ------ 领取成功");
log.info("回调内容:"+transferBatchesNotifyResp.toString());
String associatedData = "mch_payment";
String decryptToString = new AesUtil(apiV3Key.getBytes(StandardCharsets.UTF_8)).decryptToString(associatedData.getBytes(StandardCharsets.UTF_8), transferBatchesNotifyResp.getResource().getNonce().getBytes(StandardCharsets.UTF_8), transferBatchesNotifyResp.getResource().getCiphertext());
@ -365,7 +370,7 @@ public class HanHaiWaterController extends JeecgController<HanHaiWater, IHanHaiW
log.info("解密内容转换:"+transferBatchResourceDataResp.toString());
HanHaiWater hotelBalanceLog = hanHaiWaterService.lambdaQuery().eq(HanHaiWater::getPackageInfo, transferBatchResourceDataResp.getOutBillNo()).one();
HanHaiWater hotelBalanceLog = hanHaiWaterService.lambdaQuery().eq(HanHaiWater::getOutBatchNo, transferBatchResourceDataResp.getOutBillNo()).one();
Map<String, Object> map = new HashMap<>();


+ 9
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/entity/HanHaiWater.java View File

@ -20,7 +20,7 @@ import lombok.experimental.Accessors;
/**
* @Description: 流水信息表
* @Author: jeecg-boot
* @Date: 2025-01-20
* @Date: 2025-01-21
* @Version: V1.0
*/
@Data
@ -76,4 +76,12 @@ public class HanHaiWater implements Serializable {
@Excel(name = "回调", width = 15)
@ApiModelProperty(value = "回调")
private java.lang.String packageInfo;
/**标识*/
@Excel(name = "标识", width = 15)
@ApiModelProperty(value = "标识")
private java.lang.String outBatchNo;
/**内容*/
@Excel(name = "内容", width = 15)
@ApiModelProperty(value = "内容")
private java.lang.String batchId;
}

+ 1
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/mapper/HanHaiWaterMapper.java View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 流水信息表
* @Author: jeecg-boot
* @Date: 2025-01-20
* @Date: 2025-01-21
* @Version: V1.0
*/
public interface HanHaiWaterMapper extends BaseMapper<HanHaiWater> {


+ 1
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/service/IHanHaiWaterService.java View File

@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 流水信息表
* @Author: jeecg-boot
* @Date: 2025-01-20
* @Date: 2025-01-21
* @Version: V1.0
*/
public interface IHanHaiWaterService extends IService<HanHaiWater> {


+ 1
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/service/impl/HanHaiWaterServiceImpl.java View File

@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 流水信息表
* @Author: jeecg-boot
* @Date: 2025-01-20
* @Date: 2025-01-21
* @Version: V1.0
*/
@Service


+ 24
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/vue/HanHaiWaterList.vue View File

@ -9,6 +9,18 @@
<j-search-select-tag placeholder="请选择用户标识" v-model="queryParam.userId" dict="han_hai_member,nick_name,id"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="状态">
<a-input placeholder="请输入状态" v-model="queryParam.state"></a-input>
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="类型">
<a-input placeholder="请输入类型" v-model="queryParam.type"></a-input>
</a-form-item>
</a-col>
</template>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
@ -173,6 +185,16 @@
align:"center",
dataIndex: 'packageInfo'
},
{
title:'标识',
align:"center",
dataIndex: 'outBatchNo'
},
{
title:'内容',
align:"center",
dataIndex: 'batchId'
},
{
title: '操作',
dataIndex: 'action',
@ -214,6 +236,8 @@
fieldList.push({type:'datetime',value:'successTime',text:'到账时间'})
fieldList.push({type:'int',value:'type',text:'类型',dictCode:'pay_state'})
fieldList.push({type:'Text',value:'packageInfo',text:'回调',dictCode:''})
fieldList.push({type:'string',value:'outBatchNo',text:'标识',dictCode:''})
fieldList.push({type:'string',value:'batchId',text:'内容',dictCode:''})
this.superFieldList = fieldList
}
}


+ 10
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/vue/modules/HanHaiWaterForm.vue View File

@ -33,6 +33,16 @@
<a-input v-model="model.packageInfo" placeholder="请输入回调" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="标识" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="outBatchNo">
<a-input v-model="model.outBatchNo" placeholder="请输入标识" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batchId">
<a-input v-model="model.batchId" placeholder="请输入内容" ></a-input>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>


+ 32
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiWater/vue3/HanHaiWater.data.ts View File

@ -40,6 +40,16 @@ export const columns: BasicColumn[] = [
align:"center",
dataIndex: 'packageInfo'
},
{
title: '标识',
align:"center",
dataIndex: 'outBatchNo'
},
{
title: '内容',
align:"center",
dataIndex: 'batchId'
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
@ -52,6 +62,18 @@ export const searchFormSchema: FormSchema[] = [
},
colProps: {span: 6},
},
{
label: "状态",
field: "state",
component: 'Input',
colProps: {span: 6},
},
{
label: "类型",
field: "type",
component: 'Input',
colProps: {span: 6},
},
];
//表单数据
export const formSchema: FormSchema[] = [
@ -88,4 +110,14 @@ export const formSchema: FormSchema[] = [
field: 'packageInfo',
component: 'Input',
},
{
label: '标识',
field: 'outBatchNo',
component: 'Input',
},
{
label: '内容',
field: 'batchId',
component: 'Input',
},
];

+ 33
- 31
jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiservice/impl/OrderApiServiceImpl.java View File

@ -185,37 +185,39 @@ public class OrderApiServiceImpl implements OrderApiService {
//修改用余额
HanHaiMember byId1 = hanHaiMemberService.getById(collection.getUserId());
byId1.setPrice(byId1.getPrice().add(bigDecimal));
//微信分账代码
// 初始化商户配置
Config config =
new RSAAutoCertificateConfig.Builder()
.merchantId("1684030364")
// 使用 com.wechat.pay.java.core.util 中的函数从本地文件中加载商户私钥商户私钥会用来生成请求的签名
.privateKeyFromPath("apiclient_key.pem")
.merchantSerialNumber("2B56BA25B8D847A8A5099677B67F4994358A1B58")
.apiV3Key("0fdb77429ffdf206c151af76a663041c")
.build();
profitsharingService = new ProfitsharingService.Builder().config(config).build();
CreateOrderRequest createOrderRequest = new CreateOrderRequest();
// createOrderRequest.setSubMchid("1800001791");
createOrderRequest.setAppid("wx3c24e397e3b132ea");
createOrderRequest.setTransactionId(notify.getTransactionId());
createOrderRequest.setOutOrderNo(hanHaiWater.getId());
createOrderRequest.setUnfreezeUnsplit(true);
List<CreateOrderReceiver> createOrderReceivers = new ArrayList<>();
CreateOrderReceiver createOrderReceiver = new CreateOrderReceiver();
createOrderReceiver.setType("PERSONAL_OPENID");
System.out.println("发布者OPENID:"+member.getAppletOpenid());
createOrderReceiver.setAccount(member.getAppletOpenid());
createOrderReceiver.setAmount(bigDecimal.longValue()*100);
createOrderReceiver.setDescription("分佣");
createOrderReceivers.add(createOrderReceiver);
createOrderRequest.setReceivers(createOrderReceivers);
OrdersEntity order = profitsharingService.createOrder(createOrderRequest);
hanHaiMemberService.updateById(byId1);
// //微信分账代码
// // 初始化商户配置
// Config config =
// new RSAAutoCertificateConfig.Builder()
// .merchantId("1684030364")
// // 使用 com.wechat.pay.java.core.util 中的函数从本地文件中加载商户私钥商户私钥会用来生成请求的签名
// .privateKeyFromPath("apiclient_key.pem")
// .merchantSerialNumber("2B56BA25B8D847A8A5099677B67F4994358A1B58")
// .apiV3Key("0fdb77429ffdf206c151af76a663041c")
// .build();
// profitsharingService = new ProfitsharingService.Builder().config(config).build();
//
// CreateOrderRequest createOrderRequest = new CreateOrderRequest();
//// createOrderRequest.setSubMchid("1800001791");
// createOrderRequest.setAppid("wx3c24e397e3b132ea");
// createOrderRequest.setTransactionId(notify.getTransactionId());
// createOrderRequest.setOutOrderNo(hanHaiWater.getId());
// createOrderRequest.setUnfreezeUnsplit(true);
//
// List<CreateOrderReceiver> createOrderReceivers = new ArrayList<>();
// CreateOrderReceiver createOrderReceiver = new CreateOrderReceiver();
// createOrderReceiver.setType("PERSONAL_OPENID");
//
// System.out.println("发布者OPENID:"+member.getAppletOpenid());
// createOrderReceiver.setAccount(member.getAppletOpenid());
// createOrderReceiver.setAmount(bigDecimal.longValue()*100);
// createOrderReceiver.setDescription("分佣");
// createOrderReceivers.add(createOrderReceiver);
// createOrderRequest.setReceivers(createOrderReceivers);
// OrdersEntity order = profitsharingService.createOrder(createOrderRequest);
}


+ 1
- 0
jeecg-boot-module-system/src/main/resources/application-dev.yml View File

@ -376,4 +376,5 @@ wxpay:
serialNo: 2B56BA25B8D847A8A5099677B67F4994358A1B58
#转账到零钱
transferBatchUrl: https://api.mch.weixin.qq.com/v3/fund-app/mch-transfer/transfer-bills
withdrawalNotifyUrl: https://admin.ytonggao.com/a-notice-api/hanHaiWater/hanHaiWater/withdrawal/notify

Loading…
Cancel
Save