mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
校验支付确认是否撤销
This commit is contained in:
@@ -19,14 +19,12 @@ import com.jsowell.JsowellApplication;
|
||||
import com.jsowell.adapay.common.AdaPayment;
|
||||
import com.jsowell.adapay.config.AbstractAdapayConfig;
|
||||
import com.jsowell.adapay.dto.QueryAcctFlowDTO;
|
||||
import com.jsowell.adapay.dto.QueryConfirmReverseDTO;
|
||||
import com.jsowell.adapay.dto.QueryPaymentConfirmDTO;
|
||||
import com.jsowell.adapay.dto.SettleAccountDTO;
|
||||
import com.jsowell.adapay.factory.AdapayConfigFactory;
|
||||
import com.jsowell.adapay.operation.PaymentReverseOperation;
|
||||
import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
import com.jsowell.adapay.response.PaymentReverseResponse;
|
||||
import com.jsowell.adapay.response.QueryPaymentConfirmDetailResponse;
|
||||
import com.jsowell.adapay.response.RefundResponse;
|
||||
import com.jsowell.adapay.response.*;
|
||||
import com.jsowell.adapay.service.AdapayService;
|
||||
import com.jsowell.adapay.vo.DrawCashDetailVO;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
@@ -667,6 +665,15 @@ public class SpringBootTestController {
|
||||
orderPileOccupyService.generateOccupyPileOrder(dto);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQueryConfirmReverse() throws BaseAdaPayException {
|
||||
QueryConfirmReverseDTO dto = QueryConfirmReverseDTO.builder()
|
||||
.paymentConfirmId("0022120231023104957990562360205131259904")
|
||||
.wechatAppId(wechatAppId1)
|
||||
.build();
|
||||
adapayService.queryConfirmReverse(dto);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testStopOccupyPileOrder() {
|
||||
@@ -681,7 +688,16 @@ public class SpringBootTestController {
|
||||
// 需要重新分账的订单信息(针对未分账的订单)
|
||||
public JSONArray getPaymentList() {
|
||||
String jsonArrayString = "[" +
|
||||
"{\"orderCode\":\"C69677615458\", \"settleAmount\":\"14.90\", \"paymentId\":\"002212023121114570010580179384493879296\"}" +
|
||||
"{\"orderCode\":\"C23000133174\", \"settleAmount\":\"47.01\", \"paymentId\":\"002212023100819330610557056046136913920\"}" +
|
||||
"{\"orderCode\":\"C21732136953\", \"settleAmount\":\"10.00\", \"paymentId\":\"002212023101121251610558171434498875392\"}" +
|
||||
"{\"orderCode\":\"C21122501014\", \"settleAmount\":\"44.3\", \"paymentId\":\"002212023102217533710562104440424718336\"}" +
|
||||
"{\"orderCode\":\"C40769056697\", \"settleAmount\":\"11.23\", \"paymentId\":\"002212023102316213810562443678391427072\"}" +
|
||||
"{\"orderCode\":\"C23426149031\", \"settleAmount\":\"16.22\", \"paymentId\":\"002212023102520255110563229911567286272\"}" +
|
||||
"{\"orderCode\":\"C63782621987\", \"settleAmount\":\"10.82\", \"paymentId\":\"002212023102523371410563278077378646016\"}" +
|
||||
"{\"orderCode\":\"C40957699775\", \"settleAmount\":\"20.07\", \"paymentId\":\"002212023102608180610563409156395016192\"}" +
|
||||
"{\"orderCode\":\"C40134359627\", \"settleAmount\":\"0.19\", \"paymentId\":\"002212023102613265510563486871366881280\"}" +
|
||||
"{\"orderCode\":\"C29560601840\", \"settleAmount\":\"6.19\", \"paymentId\":\"002212023102812085110564192003156709376\"}" +
|
||||
"{\"orderCode\":\"C21185002061\", \"settleAmount\":\"15.29\", \"paymentId\":\"002212023103121471210565424714177380352\"}" +
|
||||
"]";
|
||||
return JSONArray.parseArray(jsonArrayString);
|
||||
}
|
||||
@@ -695,7 +711,7 @@ public class SpringBootTestController {
|
||||
// TODO 获取默认结算账户,如需分给对应商户就填写正确的汇付会员id
|
||||
// AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.getDefault();
|
||||
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
|
||||
adapayMemberAccount.setAdapayMemberId("ACM25158725");
|
||||
adapayMemberAccount.setAdapayMemberId("ACM23489463");
|
||||
for (int i = 0; i < paymentList.size(); i++) {
|
||||
JSONObject jsonObject = (JSONObject) paymentList.get(i);
|
||||
BigDecimal confirmAmt = jsonObject.getBigDecimal("settleAmount"); // 确认金额就是结算金额
|
||||
@@ -742,6 +758,10 @@ public class SpringBootTestController {
|
||||
unSplitList.add(paymentId);
|
||||
} else {
|
||||
for (QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm : confirms) {
|
||||
if (queryConfirmReverseStatus(confirm)) {
|
||||
System.out.println("支付确认id:" + confirm.getId() + "撤销了。。。");
|
||||
continue;
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(confirm.getDescription());
|
||||
String adapayMemberId = jsonObject.getString("adapayMemberId");
|
||||
BigDecimal confirmedAmt = new BigDecimal(confirm.getConfirmedAmt());
|
||||
@@ -763,7 +783,20 @@ public class SpringBootTestController {
|
||||
System.out.println("=================自己:" + JSON.toJSONString(selfList));
|
||||
}
|
||||
|
||||
private boolean queryConfirmReverseStatus(QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm) throws BaseAdaPayException {
|
||||
boolean result = false;
|
||||
|
||||
QueryConfirmReverseDTO dto = QueryConfirmReverseDTO.builder()
|
||||
.paymentConfirmId(confirm.getId())
|
||||
.wechatAppId(wechatAppId1)
|
||||
.build();
|
||||
ConfirmReverseResponse confirmReverseResponse = adapayService.queryConfirmReverse(dto);
|
||||
if (confirmReverseResponse.isSuccess()) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 延迟分账未确认调撤销调撤销接口退款
|
||||
@@ -856,10 +889,7 @@ public class SpringBootTestController {
|
||||
public List<String> getPaymentIdList() {
|
||||
List<String> list = Lists.newArrayList();
|
||||
|
||||
|
||||
list.add("002212023122611111810585558404842418176");
|
||||
|
||||
|
||||
list.add("002212023100819330610557056046136913920");
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.jsowell.adapay.dto;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class QueryConfirmReverseDTO {
|
||||
/**
|
||||
* 控制台 主页面应用的app_id
|
||||
*/
|
||||
private String wechatAppId;
|
||||
|
||||
/**
|
||||
* Adapay生成的支付确认对象id
|
||||
*/
|
||||
private String paymentConfirmId;
|
||||
}
|
||||
@@ -10,6 +10,9 @@ import lombok.*;
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdapayBaseResponse {
|
||||
// 是否 prod模式,true 是 prod模式,false 是 mock模式
|
||||
private String prod_mode;
|
||||
|
||||
/**
|
||||
* 当前交易结果状态,参见 状态 说明
|
||||
* @see com.jsowell.common.enums.adapay.AdapayStatusEnum
|
||||
@@ -20,6 +23,9 @@ public class AdapayBaseResponse {
|
||||
private String error_msg;
|
||||
private String error_type;
|
||||
|
||||
// 当发生参数错误时返回具体的参数名,便于定位错误原因,详见 错误
|
||||
private String invalid_param;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return StringUtils.equals(status, AdapayStatusEnum.SUCCEEDED.getValue());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jsowell.adapay.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class ConfirmReverseResponse extends AdapayBaseResponse {
|
||||
//支付确认撤销对象 列表,若未查询到结果时,字段为空
|
||||
private String confirm_reverses;
|
||||
}
|
||||
@@ -52,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -1206,4 +1207,21 @@ public class AdapayService {
|
||||
} while (hasMore);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付确认撤销对象
|
||||
*/
|
||||
public ConfirmReverseResponse queryConfirmReverse(QueryConfirmReverseDTO dto) throws BaseAdaPayException {
|
||||
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(dto.getWechatAppId());
|
||||
if (config == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
|
||||
}
|
||||
Map<String, Object> confirmReverseQueryParams = new HashMap<>();
|
||||
confirmReverseQueryParams.put("adapay_func_code", "payments.confirm.reverse.details");
|
||||
confirmReverseQueryParams.put("payment_confirm_id", dto.getPaymentConfirmId());
|
||||
Map<String, Object> confirmReverseQueryResult = AdapayCommon.queryAdapay(confirmReverseQueryParams, config.getWechatAppId());
|
||||
ConfirmReverseResponse confirmReverseResponse = JSON.parseObject(JSON.toJSONString(confirmReverseQueryResult), ConfirmReverseResponse.class);
|
||||
log.info("confirmReverseQueryResult:{}", JSON.toJSONString(confirmReverseResponse));
|
||||
return confirmReverseResponse;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +127,13 @@
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['member:memberGroup:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-plus"
|
||||
@click="handleAddMember(scope.row)"
|
||||
v-hasPermi="['member:memberGroup:edit']"
|
||||
>添加会员</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -180,6 +187,11 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!--添加会员-->
|
||||
<el-dialog title="添加会员" :visible.sync="openAddMember" width="500px" append-to-body>
|
||||
添加会员
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -193,7 +205,7 @@ export default {
|
||||
dicts: ["group_type"],
|
||||
data() {
|
||||
return {
|
||||
|
||||
openAddMember: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
@@ -353,7 +365,16 @@ export default {
|
||||
this.download('member/memberGroup/export', {
|
||||
...this.queryParams
|
||||
}, `memberGroup_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
},
|
||||
/** 添加会员按钮 */
|
||||
handleAddMember(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getMemberGroup(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.openAddMember = true;
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user