update 汇付会员

This commit is contained in:
2023-06-09 14:44:32 +08:00
parent 87d4f8a9f0
commit e1bc44bbc3
6 changed files with 53 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
package com.jsowell.service;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -274,9 +275,10 @@ public class OrderService {
}
// 封装对象
String amount = AdapayUtil.formatAmount(dto.getPayAmount()); // 用户支付金额
CreateAdaPaymentParam createAdaPaymentParam = new CreateAdaPaymentParam();
createAdaPaymentParam.setOrder_no(orderInfo.getOrderCode());
createAdaPaymentParam.setPay_amt(AdapayUtil.formatAmount(dto.getPayAmount()));
createAdaPaymentParam.setPay_amt(amount);
createAdaPaymentParam.setApp_id(ADAPAY_APP_ID); // todo 后面移动到配置文件中
createAdaPaymentParam.setPay_channel("wx_lite"); // todo 如果以后有支付宝等别的渠道,这里需要做修改,判断是什么渠道的请求
createAdaPaymentParam.setGoods_title("充电费用");
@@ -288,12 +290,26 @@ public class OrderService {
//异步通知地址url为http/https路径服务器POST回调URL 上请勿附带参数
createAdaPaymentParam.setNotify_url(ADAPAY_CALLBACK_URL);
createAdaPaymentParam.setExpend(JSONObject.toJSONString( ImmutableMap.of("open_id", openId)));
// 分账对象信息
String adapayMemberId = pileStationInfoService.selectAdapayMemberId(orderInfo.getStationId());
if (StringUtils.isNotBlank(adapayMemberId)) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("member_id", adapayMemberId);
jsonObject.put("amount", amount);
jsonObject.put("fee_flag", Constants.Y);
// 分账对象信息列表最多仅支持7个分账方json 数组形式
JSONArray jsonArray = new JSONArray();
jsonArray.add(jsonObject);
createAdaPaymentParam.setDiv_members(jsonArray.toString());
}
try {
log.info("创建汇付支付参数:{}", JSONObject.toJSONString(createAdaPaymentParam));
Map<String, Object> response = Payment.create(BeanMap.create(createAdaPaymentParam));
if (response != null && !response.isEmpty()) {
JSONObject jsonObject = JSONObject.parseObject(response.get("expend").toString());
JSONObject pay_info = jsonObject.getJSONObject("pay_info");
JSONObject expend = JSONObject.parseObject(response.get("expend").toString());
JSONObject pay_info = expend.getJSONObject("pay_info");
Map<String, Object> resultMap = JSONObject.parseObject(pay_info.toJSONString(), new TypeReference<Map<String, Object>>() {
});
if (resultMap != null) {

View File

@@ -56,4 +56,12 @@ public class AdapayMemberController extends BaseController {
}
return result;
}
/**
* 查询汇付结算账户
*/
@PostMapping("/selectSettleAccount")
public AjaxResult selectSettleAccount(@RequestBody AdapayMemberInfoDTO dto) {
return null;
}
}

View File

@@ -217,4 +217,10 @@ public class Constants {
*/
public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.jsowell.common.util.file"};
// Y-是
public static final String Y = "Y";
// N-否
public static final String N = "N";
}

View File

@@ -94,4 +94,6 @@ public interface IPileStationInfoService {
List<PileStationInfo> getStationInfoForLianLian();
List<String> queryByStationDeptIds(List<String> stationIds);
String selectAdapayMemberId(String stationId);
}

View File

@@ -118,7 +118,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
if (StringUtils.isNotBlank(pileStationInfo.getQrcodePrefix())) {
vo.setQrcodePrefix(pileStationInfo.getQrcodePrefix());
}
vo.setMerchantId(pileStationInfo.getMerchantId().toString());
// vo.setMerchantId(pileStationInfo.getMerchantId().toString());
// vo.setMerchantName(pileStationInfo.getmer());
vo.setMerchantAdminName(pileStationInfo.getStationAdminName());
vo.setStationStatus(Integer.parseInt(pileStationInfo.getStationStatus()));
@@ -326,18 +326,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
// 小程序站点列表页只展示对外开放的站点
dto.setPublicFlag(Constants.ONE);
// 根据前台参数分页
// PageHelper.startPage(pageNum, pageSize);
List<PileStationVO> list = pileStationInfoMapper.queryStationInfos(dto);
// PageInfo<PileStationVO> pageInfo = new PageInfo<>(list);
// if (CollectionUtils.isEmpty(pageInfo.getList())) {
// return PageResponse.builder()
// .pageNum(pageInfo.getPageNum())
// .pageSize(pageInfo.getPageSize())
// .list(Lists.newArrayList())
// .pages(pageInfo.getPages())
// .total(pageInfo.getTotal())
// .build();
// }
List<StationInfoVO> stationVOList = Lists.newArrayList();
StationInfoVO stationVO = null;
@@ -430,5 +419,15 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
.build();
}
/**
* 根据站点id查询运营商配置的汇付会员id
* @param stationId
* @return
*/
@Override
public String selectAdapayMemberId(String stationId) {
return null;
}
}

View File

@@ -312,7 +312,7 @@ export default {
this.$refs[formName].resetFields();
},
// 查询汇付会员
getList() {
selectAdapayMember() {
console.log("this.merchantId", this.merchantId);
let param = {
merchantId: this.merchantId,
@@ -323,9 +323,14 @@ export default {
this.adapayMember = response.data;
});
},
// 查询汇付结算账户
selectSettleAccount() {
}
},
created() {
this.getList();
this.selectAdapayMember();
this.selectSettleAccount();
},
};
</script>