@ -0,0 +1,13 @@ | |||
<component name="libraryTable"> | |||
<library name="Maven: com.github.wechatpay-apiv3:wechatpay-java:0.2.15"> | |||
<CLASSES> | |||
<root url="jar://D:/Softwares/Environments/Maven/apache-maven-3.6.1/Repository/com/github/wechatpay-apiv3/wechatpay-java/0.2.15/wechatpay-java-0.2.15.jar!/" /> | |||
</CLASSES> | |||
<JAVADOC> | |||
<root url="jar://D:/Softwares/Environments/Maven/apache-maven-3.6.1/Repository/com/github/wechatpay-apiv3/wechatpay-java/0.2.15/wechatpay-java-0.2.15-javadoc.jar!/" /> | |||
</JAVADOC> | |||
<SOURCES> | |||
<root url="jar://D:/Softwares/Environments/Maven/apache-maven-3.6.1/Repository/com/github/wechatpay-apiv3/wechatpay-java/0.2.15/wechatpay-java-0.2.15-sources.jar!/" /> | |||
</SOURCES> | |||
</library> | |||
</component> |
@ -0,0 +1,13 @@ | |||
<component name="libraryTable"> | |||
<library name="Maven: com.github.wechatpay-apiv3:wechatpay-java-core:0.2.15"> | |||
<CLASSES> | |||
<root url="jar://D:/Softwares/Environments/Maven/apache-maven-3.6.1/Repository/com/github/wechatpay-apiv3/wechatpay-java-core/0.2.15/wechatpay-java-core-0.2.15.jar!/" /> | |||
</CLASSES> | |||
<JAVADOC> | |||
<root url="jar://D:/Softwares/Environments/Maven/apache-maven-3.6.1/Repository/com/github/wechatpay-apiv3/wechatpay-java-core/0.2.15/wechatpay-java-core-0.2.15-javadoc.jar!/" /> | |||
</JAVADOC> | |||
<SOURCES> | |||
<root url="jar://D:/Softwares/Environments/Maven/apache-maven-3.6.1/Repository/com/github/wechatpay-apiv3/wechatpay-java-core/0.2.15/wechatpay-java-core-0.2.15-sources.jar!/" /> | |||
</SOURCES> | |||
</library> | |||
</component> |
@ -0,0 +1,171 @@ | |||
package org.jeecg.modules.massageRefoundLog.controller; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
import java.io.IOException; | |||
import java.io.UnsupportedEncodingException; | |||
import java.net.URLDecoder; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
import org.jeecg.common.api.vo.Result; | |||
import org.jeecg.common.system.query.QueryGenerator; | |||
import org.jeecg.common.util.oConvertUtils; | |||
import org.jeecg.modules.massageRefoundLog.entity.MassageRefoundLog; | |||
import org.jeecg.modules.massageRefoundLog.service.IMassageRefoundLogService; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
import org.jeecgframework.poi.excel.entity.ExportParams; | |||
import org.jeecgframework.poi.excel.entity.ImportParams; | |||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
import org.jeecg.common.system.base.controller.JeecgController; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import org.springframework.web.multipart.MultipartFile; | |||
import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
import org.springframework.web.servlet.ModelAndView; | |||
import com.alibaba.fastjson.JSON; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.jeecg.common.aspect.annotation.AutoLog; | |||
/** | |||
* @Description: 退款记录表 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-05-20 | |||
* @Version: V1.0 | |||
*/ | |||
@Api(tags="退款记录表") | |||
@RestController | |||
@RequestMapping("/massageRefoundLog/massageRefoundLog") | |||
@Slf4j | |||
public class MassageRefoundLogController extends JeecgController<MassageRefoundLog, IMassageRefoundLogService> { | |||
@Autowired | |||
private IMassageRefoundLogService massageRefoundLogService; | |||
/** | |||
* 分页列表查询 | |||
* | |||
* @param massageRefoundLog | |||
* @param pageNo | |||
* @param pageSize | |||
* @param req | |||
* @return | |||
*/ | |||
//@AutoLog(value = "退款记录表-分页列表查询") | |||
@ApiOperation(value="退款记录表-分页列表查询", notes="退款记录表-分页列表查询") | |||
@GetMapping(value = "/list") | |||
public Result<IPage<MassageRefoundLog>> queryPageList(MassageRefoundLog massageRefoundLog, | |||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
HttpServletRequest req) { | |||
QueryWrapper<MassageRefoundLog> queryWrapper = QueryGenerator.initQueryWrapper(massageRefoundLog, req.getParameterMap()); | |||
Page<MassageRefoundLog> page = new Page<MassageRefoundLog>(pageNo, pageSize); | |||
IPage<MassageRefoundLog> pageList = massageRefoundLogService.page(page, queryWrapper); | |||
return Result.OK(pageList); | |||
} | |||
/** | |||
* 添加 | |||
* | |||
* @param massageRefoundLog | |||
* @return | |||
*/ | |||
@AutoLog(value = "退款记录表-添加") | |||
@ApiOperation(value="退款记录表-添加", notes="退款记录表-添加") | |||
@PostMapping(value = "/add") | |||
public Result<String> add(@RequestBody MassageRefoundLog massageRefoundLog) { | |||
massageRefoundLogService.save(massageRefoundLog); | |||
return Result.OK("添加成功!"); | |||
} | |||
/** | |||
* 编辑 | |||
* | |||
* @param massageRefoundLog | |||
* @return | |||
*/ | |||
@AutoLog(value = "退款记录表-编辑") | |||
@ApiOperation(value="退款记录表-编辑", notes="退款记录表-编辑") | |||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
public Result<String> edit(@RequestBody MassageRefoundLog massageRefoundLog) { | |||
massageRefoundLogService.updateById(massageRefoundLog); | |||
return Result.OK("编辑成功!"); | |||
} | |||
/** | |||
* 通过id删除 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@AutoLog(value = "退款记录表-通过id删除") | |||
@ApiOperation(value="退款记录表-通过id删除", notes="退款记录表-通过id删除") | |||
@DeleteMapping(value = "/delete") | |||
public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
massageRefoundLogService.removeById(id); | |||
return Result.OK("删除成功!"); | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param ids | |||
* @return | |||
*/ | |||
@AutoLog(value = "退款记录表-批量删除") | |||
@ApiOperation(value="退款记录表-批量删除", notes="退款记录表-批量删除") | |||
@DeleteMapping(value = "/deleteBatch") | |||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
this.massageRefoundLogService.removeByIds(Arrays.asList(ids.split(","))); | |||
return Result.OK("批量删除成功!"); | |||
} | |||
/** | |||
* 通过id查询 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
//@AutoLog(value = "退款记录表-通过id查询") | |||
@ApiOperation(value="退款记录表-通过id查询", notes="退款记录表-通过id查询") | |||
@GetMapping(value = "/queryById") | |||
public Result<MassageRefoundLog> queryById(@RequestParam(name="id",required=true) String id) { | |||
MassageRefoundLog massageRefoundLog = massageRefoundLogService.getById(id); | |||
if(massageRefoundLog==null) { | |||
return Result.error("未找到对应数据"); | |||
} | |||
return Result.OK(massageRefoundLog); | |||
} | |||
/** | |||
* 导出excel | |||
* | |||
* @param request | |||
* @param massageRefoundLog | |||
*/ | |||
@RequestMapping(value = "/exportXls") | |||
public ModelAndView exportXls(HttpServletRequest request, MassageRefoundLog massageRefoundLog) { | |||
return super.exportXls(request, massageRefoundLog, MassageRefoundLog.class, "退款记录表"); | |||
} | |||
/** | |||
* 通过excel导入数据 | |||
* | |||
* @param request | |||
* @param response | |||
* @return | |||
*/ | |||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
return super.importExcel(request, response, MassageRefoundLog.class); | |||
} | |||
} |
@ -0,0 +1,71 @@ | |||
package org.jeecg.modules.massageRefoundLog.entity; | |||
import java.io.Serializable; | |||
import java.io.UnsupportedEncodingException; | |||
import java.util.Date; | |||
import java.math.BigDecimal; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import lombok.Data; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import org.jeecgframework.poi.excel.annotation.Excel; | |||
import org.jeecg.common.aspect.annotation.Dict; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* @Description: 退款记录表 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-05-20 | |||
* @Version: V1.0 | |||
*/ | |||
@Data | |||
@TableName("massage_refound_log") | |||
@Accessors(chain = true) | |||
@EqualsAndHashCode(callSuper = false) | |||
@ApiModel(value="massage_refound_log对象", description="退款记录表") | |||
public class MassageRefoundLog implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/**主键*/ | |||
@TableId(type = IdType.ASSIGN_ID) | |||
@ApiModelProperty(value = "主键") | |||
private java.lang.String id; | |||
/**创建人*/ | |||
@ApiModelProperty(value = "创建人") | |||
private java.lang.String createBy; | |||
/**创建日期*/ | |||
@ApiModelProperty(value = "创建日期") | |||
private java.util.Date createTime; | |||
/**更新人*/ | |||
@ApiModelProperty(value = "更新人") | |||
private java.lang.String updateBy; | |||
/**更新日期*/ | |||
@ApiModelProperty(value = "更新日期") | |||
private java.util.Date updateTime; | |||
/**关联订单id*/ | |||
@Excel(name = "关联订单id", width = 15) | |||
@ApiModelProperty(value = "关联订单id") | |||
private java.lang.String orderId; | |||
/**退款时间*/ | |||
@Excel(name = "退款时间", width = 15) | |||
@ApiModelProperty(value = "退款时间") | |||
private java.util.Date refoundTime; | |||
/**退款金额*/ | |||
@Excel(name = "退款金额", width = 15) | |||
@ApiModelProperty(value = "退款金额") | |||
private java.math.BigDecimal refoundAmount; | |||
/**退款状态*/ | |||
@Excel(name = "退款状态", width = 15) | |||
@ApiModelProperty(value = "退款状态") | |||
private java.lang.String status; | |||
/**关联用户id*/ | |||
@Excel(name = "关联用户id", width = 15, dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") | |||
@Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") | |||
@ApiModelProperty(value = "关联用户id") | |||
private java.lang.String userId; | |||
} |
@ -0,0 +1,17 @@ | |||
package org.jeecg.modules.massageRefoundLog.mapper; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; | |||
import org.jeecg.modules.massageRefoundLog.entity.MassageRefoundLog; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* @Description: 退款记录表 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-05-20 | |||
* @Version: V1.0 | |||
*/ | |||
public interface MassageRefoundLogMapper extends BaseMapper<MassageRefoundLog> { | |||
} |
@ -0,0 +1,5 @@ | |||
<?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="org.jeecg.modules.massageRefoundLog.mapper.MassageRefoundLogMapper"> | |||
</mapper> |
@ -0,0 +1,14 @@ | |||
package org.jeecg.modules.massageRefoundLog.service; | |||
import org.jeecg.modules.massageRefoundLog.entity.MassageRefoundLog; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* @Description: 退款记录表 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-05-20 | |||
* @Version: V1.0 | |||
*/ | |||
public interface IMassageRefoundLogService extends IService<MassageRefoundLog> { | |||
} |
@ -0,0 +1,19 @@ | |||
package org.jeecg.modules.massageRefoundLog.service.impl; | |||
import org.jeecg.modules.massageRefoundLog.entity.MassageRefoundLog; | |||
import org.jeecg.modules.massageRefoundLog.mapper.MassageRefoundLogMapper; | |||
import org.jeecg.modules.massageRefoundLog.service.IMassageRefoundLogService; | |||
import org.springframework.stereotype.Service; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* @Description: 退款记录表 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-05-20 | |||
* @Version: V1.0 | |||
*/ | |||
@Service | |||
public class MassageRefoundLogServiceImpl extends ServiceImpl<MassageRefoundLogMapper, MassageRefoundLog> implements IMassageRefoundLogService { | |||
} |
@ -0,0 +1,196 @@ | |||
<template> | |||
<a-card :bordered="false"> | |||
<!-- 查询区域 --> | |||
<div class="table-page-search-wrapper"> | |||
<a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
<a-row :gutter="24"> | |||
</a-row> | |||
</a-form> | |||
</div> | |||
<!-- 查询区域-END --> | |||
<!-- 操作按钮区域 --> | |||
<div class="table-operator"> | |||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
<a-button type="primary" icon="download" @click="handleExportXls('退款记录表')">导出</a-button> | |||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
<a-button type="primary" icon="import">导入</a-button> | |||
</a-upload> | |||
<!-- 高级查询区域 --> | |||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
<a-dropdown v-if="selectedRowKeys.length > 0"> | |||
<a-menu slot="overlay"> | |||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
</a-menu> | |||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
</a-dropdown> | |||
</div> | |||
<!-- table区域-begin --> | |||
<div> | |||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
</div> | |||
<a-table | |||
ref="table" | |||
size="middle" | |||
:scroll="{x:true}" | |||
bordered | |||
rowKey="id" | |||
:columns="columns" | |||
:dataSource="dataSource" | |||
:pagination="ipagination" | |||
:loading="loading" | |||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
class="j-table-force-nowrap" | |||
@change="handleTableChange"> | |||
<template slot="htmlSlot" slot-scope="text"> | |||
<div v-html="text"></div> | |||
</template> | |||
<template slot="imgSlot" slot-scope="text,record"> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
</template> | |||
<template slot="fileSlot" slot-scope="text"> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
<a-button | |||
v-else | |||
:ghost="true" | |||
type="primary" | |||
icon="download" | |||
size="small" | |||
@click="downloadFile(text)"> | |||
下载 | |||
</a-button> | |||
</template> | |||
<span slot="action" slot-scope="text, record"> | |||
<a @click="handleEdit(record)">编辑</a> | |||
<a-divider type="vertical" /> | |||
<a-dropdown> | |||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
<a-menu slot="overlay"> | |||
<a-menu-item> | |||
<a @click="handleDetail(record)">详情</a> | |||
</a-menu-item> | |||
<a-menu-item> | |||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
<a>删除</a> | |||
</a-popconfirm> | |||
</a-menu-item> | |||
</a-menu> | |||
</a-dropdown> | |||
</span> | |||
</a-table> | |||
</div> | |||
<massage-refound-log-modal ref="modalForm" @ok="modalFormOk"></massage-refound-log-modal> | |||
</a-card> | |||
</template> | |||
<script> | |||
import '@/assets/less/TableExpand.less' | |||
import { mixinDevice } from '@/utils/mixin' | |||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
import MassageRefoundLogModal from './modules/MassageRefoundLogModal' | |||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |||
export default { | |||
name: 'MassageRefoundLogList', | |||
mixins:[JeecgListMixin, mixinDevice], | |||
components: { | |||
MassageRefoundLogModal | |||
}, | |||
data () { | |||
return { | |||
description: '退款记录表管理页面', | |||
// 表头 | |||
columns: [ | |||
{ | |||
title: '#', | |||
dataIndex: '', | |||
key:'rowIndex', | |||
width:60, | |||
align:"center", | |||
customRender:function (t,r,index) { | |||
return parseInt(index)+1; | |||
} | |||
}, | |||
{ | |||
title:'关联订单id', | |||
align:"center", | |||
dataIndex: 'orderId' | |||
}, | |||
{ | |||
title:'退款时间', | |||
align:"center", | |||
dataIndex: 'refoundTime' | |||
}, | |||
{ | |||
title:'退款金额', | |||
align:"center", | |||
dataIndex: 'refoundAmount' | |||
}, | |||
{ | |||
title:'退款状态', | |||
align:"center", | |||
dataIndex: 'status_dictText' | |||
}, | |||
{ | |||
title:'关联用户id', | |||
align:"center", | |||
dataIndex: 'userId_dictText' | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'action', | |||
align:"center", | |||
fixed:"right", | |||
width:147, | |||
scopedSlots: { customRender: 'action' } | |||
} | |||
], | |||
url: { | |||
list: "/massageRefoundLog/massageRefoundLog/list", | |||
delete: "/massageRefoundLog/massageRefoundLog/delete", | |||
deleteBatch: "/massageRefoundLog/massageRefoundLog/deleteBatch", | |||
exportXlsUrl: "/massageRefoundLog/massageRefoundLog/exportXls", | |||
importExcelUrl: "massageRefoundLog/massageRefoundLog/importExcel", | |||
}, | |||
dictOptions:{}, | |||
superFieldList:[], | |||
} | |||
}, | |||
created() { | |||
this.getSuperFieldList(); | |||
}, | |||
computed: { | |||
importExcelUrl: function(){ | |||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
}, | |||
}, | |||
methods: { | |||
initDictConfig(){ | |||
}, | |||
getSuperFieldList(){ | |||
let fieldList=[]; | |||
fieldList.push({type:'string',value:'orderId',text:'关联订单id',dictCode:''}) | |||
fieldList.push({type:'datetime',value:'refoundTime',text:'退款时间'}) | |||
fieldList.push({type:'BigDecimal',value:'refoundAmount',text:'退款金额',dictCode:''}) | |||
fieldList.push({type:'string',value:'status',text:'退款状态',dictCode:''}) | |||
fieldList.push({type:'string',value:'userId',text:'关联用户id',dictCode:"han_hai_member,nick_name,id"}) | |||
this.superFieldList = fieldList | |||
} | |||
} | |||
} | |||
</script> | |||
<style scoped> | |||
@import '~@assets/less/common.less'; | |||
</style> |
@ -0,0 +1,124 @@ | |||
<template> | |||
<a-spin :spinning="confirmLoading"> | |||
<j-form-container :disabled="formDisabled"> | |||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
<a-row> | |||
<a-col :span="24"> | |||
<a-form-model-item label="关联订单id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderId"> | |||
<a-input v-model="model.orderId" placeholder="请输入关联订单id" ></a-input> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="退款时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="refoundTime"> | |||
<j-date placeholder="请选择退款时间" v-model="model.refoundTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" /> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="退款金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="refoundAmount"> | |||
<a-input-number v-model="model.refoundAmount" placeholder="请输入退款金额" style="width: 100%" /> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="退款状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status"> | |||
<j-dict-select-tag type="list" v-model="model.status" dictCode="" placeholder="请选择退款状态" /> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="关联用户id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> | |||
<j-dict-select-tag type="list" v-model="model.userId" dictCode="han_hai_member,nick_name,id" placeholder="请选择关联用户id" /> | |||
</a-form-model-item> | |||
</a-col> | |||
</a-row> | |||
</a-form-model> | |||
</j-form-container> | |||
</a-spin> | |||
</template> | |||
<script> | |||
import { httpAction, getAction } from '@/api/manage' | |||
import { validateDuplicateValue } from '@/utils/util' | |||
export default { | |||
name: 'MassageRefoundLogForm', | |||
components: { | |||
}, | |||
props: { | |||
//表单禁用 | |||
disabled: { | |||
type: Boolean, | |||
default: false, | |||
required: false | |||
} | |||
}, | |||
data () { | |||
return { | |||
model:{ | |||
}, | |||
labelCol: { | |||
xs: { span: 24 }, | |||
sm: { span: 5 }, | |||
}, | |||
wrapperCol: { | |||
xs: { span: 24 }, | |||
sm: { span: 16 }, | |||
}, | |||
confirmLoading: false, | |||
validatorRules: { | |||
}, | |||
url: { | |||
add: "/massageRefoundLog/massageRefoundLog/add", | |||
edit: "/massageRefoundLog/massageRefoundLog/edit", | |||
queryById: "/massageRefoundLog/massageRefoundLog/queryById" | |||
} | |||
} | |||
}, | |||
computed: { | |||
formDisabled(){ | |||
return this.disabled | |||
}, | |||
}, | |||
created () { | |||
//备份model原始值 | |||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
}, | |||
methods: { | |||
add () { | |||
this.edit(this.modelDefault); | |||
}, | |||
edit (record) { | |||
this.model = Object.assign({}, record); | |||
this.visible = true; | |||
}, | |||
submitForm () { | |||
const that = this; | |||
// 触发表单验证 | |||
this.$refs.form.validate(valid => { | |||
if (valid) { | |||
that.confirmLoading = true; | |||
let httpurl = ''; | |||
let method = ''; | |||
if(!this.model.id){ | |||
httpurl+=this.url.add; | |||
method = 'post'; | |||
}else{ | |||
httpurl+=this.url.edit; | |||
method = 'put'; | |||
} | |||
httpAction(httpurl,this.model,method).then((res)=>{ | |||
if(res.success){ | |||
that.$message.success(res.message); | |||
that.$emit('ok'); | |||
}else{ | |||
that.$message.warning(res.message); | |||
} | |||
}).finally(() => { | |||
that.confirmLoading = false; | |||
}) | |||
} | |||
}) | |||
}, | |||
} | |||
} | |||
</script> |
@ -0,0 +1,84 @@ | |||
<template> | |||
<a-drawer | |||
:title="title" | |||
:width="width" | |||
placement="right" | |||
:closable="false" | |||
@close="close" | |||
destroyOnClose | |||
:visible="visible"> | |||
<massage-refound-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></massage-refound-log-form> | |||
<div class="drawer-footer"> | |||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
</div> | |||
</a-drawer> | |||
</template> | |||
<script> | |||
import MassageRefoundLogForm from './MassageRefoundLogForm' | |||
export default { | |||
name: 'MassageRefoundLogModal', | |||
components: { | |||
MassageRefoundLogForm | |||
}, | |||
data () { | |||
return { | |||
title:"操作", | |||
width:800, | |||
visible: false, | |||
disableSubmit: false | |||
} | |||
}, | |||
methods: { | |||
add () { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.add(); | |||
}) | |||
}, | |||
edit (record) { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.edit(record); | |||
}); | |||
}, | |||
close () { | |||
this.$emit('close'); | |||
this.visible = false; | |||
}, | |||
submitCallback(){ | |||
this.$emit('ok'); | |||
this.visible = false; | |||
}, | |||
handleOk () { | |||
this.$refs.realForm.submitForm(); | |||
}, | |||
handleCancel () { | |||
this.close() | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
/** Button按钮间距 */ | |||
.ant-btn { | |||
margin-left: 30px; | |||
margin-bottom: 30px; | |||
float: right; | |||
} | |||
.drawer-footer{ | |||
position: absolute; | |||
bottom: -8px; | |||
width: 100%; | |||
border-top: 1px solid #e8e8e8; | |||
padding: 10px 16px; | |||
text-align: right; | |||
left: 0; | |||
background: #fff; | |||
border-radius: 0 0 2px 2px; | |||
} | |||
</style> |
@ -0,0 +1,60 @@ | |||
<template> | |||
<j-modal | |||
:title="title" | |||
:width="width" | |||
:visible="visible" | |||
switchFullscreen | |||
@ok="handleOk" | |||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
@cancel="handleCancel" | |||
cancelText="关闭"> | |||
<massage-refound-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></massage-refound-log-form> | |||
</j-modal> | |||
</template> | |||
<script> | |||
import MassageRefoundLogForm from './MassageRefoundLogForm' | |||
export default { | |||
name: 'MassageRefoundLogModal', | |||
components: { | |||
MassageRefoundLogForm | |||
}, | |||
data () { | |||
return { | |||
title:'', | |||
width:800, | |||
visible: false, | |||
disableSubmit: false | |||
} | |||
}, | |||
methods: { | |||
add () { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.add(); | |||
}) | |||
}, | |||
edit (record) { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.edit(record); | |||
}) | |||
}, | |||
close () { | |||
this.$emit('close'); | |||
this.visible = false; | |||
}, | |||
handleOk () { | |||
this.$refs.realForm.submitForm(); | |||
}, | |||
submitCallback(){ | |||
this.$emit('ok'); | |||
this.visible = false; | |||
}, | |||
handleCancel () { | |||
this.close() | |||
} | |||
} | |||
} | |||
</script> |
@ -0,0 +1,61 @@ | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import {Modal} from 'ant-design-vue'; | |||
enum Api { | |||
list = '/massageRefoundLog/massageRefoundLog/list', | |||
save='/massageRefoundLog/massageRefoundLog/add', | |||
edit='/massageRefoundLog/massageRefoundLog/edit', | |||
deleteOne = '/massageRefoundLog/massageRefoundLog/delete', | |||
deleteBatch = '/massageRefoundLog/massageRefoundLog/deleteBatch', | |||
importExcel = '/massageRefoundLog/massageRefoundLog/importExcel', | |||
exportXls = '/massageRefoundLog/massageRefoundLog/exportXls', | |||
} | |||
/** | |||
* 导出api | |||
* @param params | |||
*/ | |||
export const getExportUrl = Api.exportXls; | |||
/** | |||
* 导入api | |||
*/ | |||
export const getImportUrl = Api.importExcel; | |||
/** | |||
* 列表接口 | |||
* @param params | |||
*/ | |||
export const list = (params) => | |||
defHttp.get({url: Api.list, params}); | |||
/** | |||
* 删除单个 | |||
*/ | |||
export const deleteOne = (params,handleSuccess) => { | |||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
/** | |||
* 批量删除 | |||
* @param params | |||
*/ | |||
export const batchDelete = (params, handleSuccess) => { | |||
Modal.confirm({ | |||
title: '确认删除', | |||
content: '是否删除选中数据', | |||
okText: '确认', | |||
cancelText: '取消', | |||
onOk: () => { | |||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
}); | |||
} | |||
/** | |||
* 保存或者更新 | |||
* @param params | |||
*/ | |||
export const saveOrUpdate = (params, isUpdate) => { | |||
let url = isUpdate ? Api.edit : Api.save; | |||
return defHttp.post({url: url, params}); | |||
} |
@ -0,0 +1,69 @@ | |||
import {BasicColumn} from '/@/components/Table'; | |||
import {FormSchema} from '/@/components/Table'; | |||
import { rules} from '/@/utils/helper/validator'; | |||
import { render } from '/@/utils/common/renderUtils'; | |||
//列表数据 | |||
export const columns: BasicColumn[] = [ | |||
{ | |||
title: '关联订单id', | |||
align:"center", | |||
dataIndex: 'orderId' | |||
}, | |||
{ | |||
title: '退款时间', | |||
align:"center", | |||
dataIndex: 'refoundTime' | |||
}, | |||
{ | |||
title: '退款金额', | |||
align:"center", | |||
dataIndex: 'refoundAmount' | |||
}, | |||
{ | |||
title: '退款状态', | |||
align:"center", | |||
dataIndex: 'status_dictText' | |||
}, | |||
{ | |||
title: '关联用户id', | |||
align:"center", | |||
dataIndex: 'userId_dictText' | |||
}, | |||
]; | |||
//查询数据 | |||
export const searchFormSchema: FormSchema[] = [ | |||
]; | |||
//表单数据 | |||
export const formSchema: FormSchema[] = [ | |||
{ | |||
label: '关联订单id', | |||
field: 'orderId', | |||
component: 'Input', | |||
}, | |||
{ | |||
label: '退款时间', | |||
field: 'refoundTime', | |||
component: 'Input', | |||
}, | |||
{ | |||
label: '退款金额', | |||
field: 'refoundAmount', | |||
component: 'InputNumber', | |||
}, | |||
{ | |||
label: '退款状态', | |||
field: 'status', | |||
component: 'JDictSelectTag', | |||
componentProps:{ | |||
dictCode:"" | |||
}, | |||
}, | |||
{ | |||
label: '关联用户id', | |||
field: 'userId', | |||
component: 'JDictSelectTag', | |||
componentProps:{ | |||
dictCode:"han_hai_member,nick_name,id" | |||
}, | |||
}, | |||
]; |
@ -0,0 +1,162 @@ | |||
<template> | |||
<div> | |||
<!--引用表格--> | |||
<BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
<!--插槽:table标题--> | |||
<template #tableTitle> | |||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
<a-dropdown v-if="checkedKeys.length > 0"> | |||
<template #overlay> | |||
<a-menu> | |||
<a-menu-item key="1" @click="batchHandleDelete"> | |||
<Icon icon="ant-design:delete-outlined"></Icon> | |||
删除 | |||
</a-menu-item> | |||
</a-menu> | |||
</template> | |||
<a-button>批量操作 | |||
<Icon icon="mdi:chevron-down"></Icon> | |||
</a-button> | |||
</a-dropdown> | |||
</template> | |||
<!--操作栏--> | |||
<template #action="{ record }"> | |||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
</template> | |||
<!--字段回显插槽--> | |||
<template #htmlSlot="{text}"> | |||
<div v-html="text"></div> | |||
</template> | |||
<template #fileSlot="{text}"> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
</template> | |||
</BasicTable> | |||
<!-- 表单区域 --> | |||
<MassageRefoundLogModal @register="registerModal" @success="handleSuccess"></MassageRefoundLogModal> | |||
</div> | |||
</template> | |||
<script lang="ts" name="massageRefoundLog-massageRefoundLog" setup> | |||
import {ref, computed, unref} from 'vue'; | |||
import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
import {useModal} from '/@/components/Modal'; | |||
import { useListPage } from '/@/hooks/system/useListPage' | |||
import MassageRefoundLogModal from './components/MassageRefoundLogModal.vue' | |||
import {columns, searchFormSchema} from './massageRefoundLog.data'; | |||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './massageRefoundLog.api'; | |||
const checkedKeys = ref<Array<string | number>>([]); | |||
//注册model | |||
const [registerModal, {openModal}] = useModal(); | |||
//注册table数据 | |||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
tableProps:{ | |||
title: '退款记录表', | |||
api: list, | |||
columns, | |||
canResize:false, | |||
formConfig: { | |||
labelWidth: 120, | |||
schemas: searchFormSchema, | |||
autoSubmitOnEnter:true, | |||
showAdvancedButton:true, | |||
fieldMapToTime: [ | |||
], | |||
}, | |||
actionColumn: { | |||
width: 120, | |||
}, | |||
}, | |||
exportConfig: { | |||
name:"退款记录表", | |||
url: getExportUrl, | |||
}, | |||
importConfig: { | |||
url: getImportUrl | |||
}, | |||
}) | |||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
/** | |||
* 新增事件 | |||
*/ | |||
function handleAdd() { | |||
openModal(true, { | |||
isUpdate: false, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 编辑事件 | |||
*/ | |||
function handleEdit(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 详情 | |||
*/ | |||
function handleDetail(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: false, | |||
}); | |||
} | |||
/** | |||
* 删除事件 | |||
*/ | |||
async function handleDelete(record) { | |||
await deleteOne({id: record.id}, reload); | |||
} | |||
/** | |||
* 批量删除事件 | |||
*/ | |||
async function batchHandleDelete() { | |||
await batchDelete({ids: checkedKeys.value}, reload); | |||
} | |||
/** | |||
* 成功回调 | |||
*/ | |||
function handleSuccess() { | |||
reload(); | |||
} | |||
/** | |||
* 操作栏 | |||
*/ | |||
function getTableAction(record){ | |||
return [ | |||
{ | |||
label: '编辑', | |||
onClick: handleEdit.bind(null, record), | |||
} | |||
] | |||
} | |||
/** | |||
* 下拉操作栏 | |||
*/ | |||
function getDropDownAction(record){ | |||
return [ | |||
{ | |||
label: '详情', | |||
onClick: handleDetail.bind(null, record), | |||
}, { | |||
label: '删除', | |||
popConfirm: { | |||
title: '是否确认删除', | |||
confirm: handleDelete.bind(null, record), | |||
} | |||
} | |||
] | |||
} | |||
</script> | |||
<style scoped> | |||
</style> |
@ -0,0 +1,58 @@ | |||
<template> | |||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
<BasicForm @register="registerForm"/> | |||
</BasicModal> | |||
</template> | |||
<script lang="ts" setup> | |||
import {ref, computed, unref} from 'vue'; | |||
import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
import {BasicForm, useForm} from '/@/components/Form/index'; | |||
import {formSchema} from '../massageRefoundLog.data'; | |||
import {saveOrUpdate} from '../massageRefoundLog.api'; | |||
// Emits声明 | |||
const emit = defineEmits(['register','success']); | |||
const isUpdate = ref(true); | |||
//表单配置 | |||
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
labelWidth: 150, | |||
schemas: formSchema, | |||
showActionButtonGroup: false, | |||
}); | |||
//表单赋值 | |||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
//重置表单 | |||
await resetFields(); | |||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
isUpdate.value = !!data?.isUpdate; | |||
if (unref(isUpdate)) { | |||
//表单赋值 | |||
await setFieldsValue({ | |||
...data.record, | |||
}); | |||
} | |||
// 隐藏底部时禁用整个表单 | |||
setProps({ disabled: !data?.showFooter }) | |||
}); | |||
//设置标题 | |||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
//表单提交事件 | |||
async function handleSubmit(v) { | |||
try { | |||
let values = await validate(); | |||
setModalProps({confirmLoading: true}); | |||
//提交表单 | |||
await saveOrUpdate(values, isUpdate.value); | |||
//关闭弹窗 | |||
closeModal(); | |||
//刷新列表 | |||
emit('success'); | |||
} finally { | |||
setModalProps({confirmLoading: false}); | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
</style> |
@ -0,0 +1,61 @@ | |||
package org.jeecg.modules.api.massageController; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.jeecg.modules.apiService.WxMiniappPayService; | |||
import org.jeecg.modules.wxUtils.RefundOrderReq; | |||
import org.jeecg.modules.wxUtils.Response; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.annotation.Resource; | |||
import javax.servlet.http.HttpServletRequest; | |||
@Api(tags="退款-退款相关接口") | |||
@RestController | |||
@RequestMapping("/massage/refound") | |||
@Slf4j | |||
public class RefoundController { | |||
@Resource | |||
private WxMiniappPayService wxMiniappPayService; | |||
/** | |||
* 退款申请 | |||
* @param orderId | |||
* @return | |||
*/ | |||
@ApiOperation( | |||
value="退款", | |||
notes="退款") | |||
@PostMapping("/refund") | |||
public Response<?> refund(@RequestHeader("X-Access-Token") String token, String orderId) { | |||
log.info("------微信支付退款------"); | |||
return wxMiniappPayService.refund(token, orderId); | |||
} | |||
// /** | |||
// * 查询单笔退款(通过商户退款单号) | |||
// * @param outRefundNo 商户退款单号 | |||
// * @return | |||
// */ | |||
// @ApiOperation( | |||
// value="查询单笔退款(通过商户退款单号)", | |||
// notes="查询单笔退款(通过商户退款单号)") | |||
// @GetMapping("/queryByOutRefundNo") | |||
// public Response<?> queryByOutRefundNo(String outRefundNo) { | |||
// log.info("------微信支付查询单笔退款------"); | |||
// return wxMiniappPayService.queryByOutRefundNo(outRefundNo); | |||
// } | |||
/** | |||
* 微信小程序退款回调 | |||
* @param request | |||
* @return | |||
* @throws Exception | |||
*/ | |||
@PostMapping("/refundNotify") | |||
public String refundNotify(HttpServletRequest request) throws Exception { | |||
log.info("------微信支付微信小程序退款回调------"); | |||
return wxMiniappPayService.refundNotify(request); | |||
} | |||
} |
@ -0,0 +1,29 @@ | |||
package org.jeecg.modules.apiService; | |||
import org.jeecg.modules.wxUtils.RefundOrderReq; | |||
import org.jeecg.modules.wxUtils.Response; | |||
import javax.servlet.http.HttpServletRequest; | |||
public interface WxMiniappPayService { | |||
/** | |||
* 退款 | |||
* @param orderId | |||
* @return | |||
*/ | |||
Response<?> refund(String token, String orderId); | |||
/** | |||
* 查询单笔退款(通过商户退款单号) | |||
* @param outRefundNo 商户退款单号 | |||
* @return | |||
*/ | |||
Response<?> queryByOutRefundNo(String outRefundNo); | |||
/** | |||
* 微信小程序退款回调 | |||
* @param request | |||
* @return | |||
*/ | |||
String refundNotify(HttpServletRequest request); | |||
} |
@ -0,0 +1,422 @@ | |||
package org.jeecg.modules.apiService.impl; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.wechat.pay.java.core.Config; | |||
import com.wechat.pay.java.core.exception.HttpException; | |||
import com.wechat.pay.java.core.exception.MalformedMessageException; | |||
import com.wechat.pay.java.core.exception.ServiceException; | |||
import com.wechat.pay.java.core.exception.ValidationException; | |||
import com.wechat.pay.java.core.notification.NotificationConfig; | |||
import com.wechat.pay.java.core.notification.NotificationParser; | |||
import com.wechat.pay.java.core.notification.RequestParam; | |||
import com.wechat.pay.java.service.refund.RefundService; | |||
import com.wechat.pay.java.service.refund.model.*; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.jeecg.config.shiro.ShiroRealm; | |||
import org.jeecg.modules.apiService.WxMiniappPayService; | |||
import org.jeecg.modules.apiUtils.CommonUtils; | |||
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; | |||
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; | |||
import org.jeecg.modules.massageOrder.entity.MassageOrder; | |||
import org.jeecg.modules.massageOrder.service.IMassageOrderService; | |||
import org.jeecg.modules.massageRefoundLog.entity.MassageRefoundLog; | |||
import org.jeecg.modules.massageRefoundLog.service.IMassageRefoundLogService; | |||
import org.jeecg.modules.wxUtils.HttpServletUtils; | |||
import org.jeecg.modules.wxUtils.RefundOrderReq; | |||
import org.jeecg.modules.wxUtils.Response; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Qualifier; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.stereotype.Service; | |||
import javax.annotation.Resource; | |||
import javax.servlet.http.HttpServletRequest; | |||
import java.math.BigDecimal; | |||
import java.util.Date; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
@Slf4j | |||
@Service | |||
public class WxMiniappPayServiceImpl implements WxMiniappPayService { | |||
/** | |||
* 微信小程序的 AppID | |||
*/ | |||
@Value("${wx.miniapp.appid}") | |||
private String appid; | |||
/** | |||
* 微信小程序的密钥 | |||
*/ | |||
@Value("${wx.miniapp.secret}") | |||
private String secret; | |||
/** | |||
* 商户号 | |||
*/ | |||
@Value("${wx.miniapp.merchantId}") | |||
private String merchantId; | |||
/** | |||
* 商户API私钥路径 | |||
*/ | |||
@Value("${wx.miniapp.privateKeyPath}") | |||
private String privateKeyPath; | |||
/** | |||
* 商户证书序列号 | |||
*/ | |||
@Value("${wx.miniapp.merchantSerialNumber}") | |||
private String merchantSerialNumber; | |||
/** | |||
* 商户APIV3密钥 | |||
*/ | |||
@Value("${wx.miniapp.apiV3Key}") | |||
private String apiV3Key; | |||
/** | |||
* 支付通知地址 | |||
*/ | |||
@Value("${wx.miniapp.payNotifyUrl}") | |||
private String payNotifyUrl; | |||
/** | |||
* 退款通知地址 | |||
*/ | |||
@Value("${wx.miniapp.refundNotifyUrl}") | |||
private String refundNotifyUrl; | |||
@Autowired | |||
@Qualifier("rsaAutoCertificateConfig") | |||
private Config config; | |||
@Autowired | |||
@Qualifier("rsaAutoCertificateConfig") | |||
private Config notificationConfig; | |||
// @Autowired | |||
// private IPopularizeOrderService popularizeOrderService; | |||
// | |||
// @Autowired | |||
// private IPopularizeOrderTuiLogService popularizeOrderTuiLogService; | |||
//权限验证 | |||
@Resource | |||
private ShiroRealm shiroRealm; | |||
//退款记录 | |||
@Autowired | |||
private IHanHaiMemberService hanHaiMemberService; | |||
//订单信息 | |||
@Autowired | |||
private IMassageOrderService massageOrderService; | |||
//退款记录 | |||
@Autowired | |||
private IMassageRefoundLogService massageRefoundLogService; | |||
/** | |||
* 退款 | |||
* <pre> | |||
* 交易时间超过一年的订单无法提交退款(按支付成功时间+365天计算) | |||
* 微信支付退款支持单笔交易分多次退款,多次退款需要提交原支付订单的商户订单号和设置不同的退款单号。申请退款总金额不能超过订单金额。 一笔退款失败后重新提交,请不要更换退款单号,请使用原商户退款单号 | |||
* 请求频率限制:150qps,即每秒钟正常的申请退款请求次数不超过150次 | |||
* 每个支付订单的部分退款次数不能超过50次 | |||
* 如果同一个用户有多笔退款,建议分不同批次进行退款,避免并发退款导致退款失败 | |||
* 申请退款接口的返回仅代表业务的受理情况,具体退款是否成功,需要通过退款查询接口获取结果 | |||
* 错误或无效请求频率限制:6qps,即每秒钟异常或错误的退款申请请求不超过6次 | |||
* 一个月之前的订单申请退款频率限制为:5000/min | |||
* 同一笔订单多次退款的请求需相隔1分钟 | |||
* </pre> | |||
* | |||
* @param orderId | |||
* @return | |||
*/ | |||
@Override | |||
public Response refund(String token, String orderId) { | |||
//权限验证 | |||
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); | |||
//HanHaiMember hanHaiMember = hanHaiMemberService.getById("1919297392365035521"); | |||
// 初始化服务 | |||
RefundService service = new RefundService.Builder().config(config).build(); | |||
//根据订单标识查询订单 | |||
MassageOrder payOrder = massageOrderService.lambdaQuery() | |||
.eq(MassageOrder::getId, orderId) | |||
.eq(MassageOrder::getUserId, hanHaiMember.getId()) | |||
.one(); | |||
if (payOrder == null) { | |||
return Response.error("订单不存在"); | |||
} | |||
//查询订单是否已经退款过 | |||
MassageRefoundLog check = massageRefoundLogService | |||
.lambdaQuery() | |||
.eq(MassageRefoundLog::getOrderId, orderId) | |||
.eq(MassageRefoundLog::getUserId, hanHaiMember.getId()) | |||
.one(); | |||
if(null != check){ | |||
return Response.error("该订单已经退款过:"+orderId); | |||
} | |||
//添加退款记录 | |||
MassageRefoundLog massageRefoundLog = new MassageRefoundLog(); | |||
massageRefoundLog.setStatus("0");//退款状态 | |||
massageRefoundLog.setOrderId(orderId);//退款订单号 | |||
massageRefoundLog.setRefoundAmount(payOrder.getAmount());//退款金额 | |||
massageRefoundLog.setUserId(hanHaiMember.getId());//退款用户 | |||
massageRefoundLogService.save(massageRefoundLog); | |||
// if (payOrder.getAmount().compareTo(req.getRefundAmount()) < 0) { | |||
// return Response.error("退款金额不能大于支付金额"); | |||
// } | |||
CreateRequest request = new CreateRequest(); | |||
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 | |||
request.setOutTradeNo(orderId); | |||
request.setOutRefundNo("REFUND_" + orderId); | |||
AmountReq amount = new AmountReq(); | |||
// 订单总金额,单位为分,只能为整数,详见支付金额 | |||
amount.setTotal(decimalToLong(payOrder.getAmount())); | |||
// 退款金额,单位为分,只能为整数,不能超过支付总额 | |||
amount.setRefund(decimalToLong(payOrder.getAmount())); | |||
amount.setCurrency("CNY"); | |||
request.setAmount(amount); | |||
request.setNotifyUrl(refundNotifyUrl); | |||
// 调用接口 | |||
Refund refund = null; | |||
try { | |||
refund = service.create(request); | |||
} catch (HttpException e) { | |||
log.error("退款申请失败,发送HTTP请求失败:", e); | |||
return Response.error("退款失败"); | |||
} catch (MalformedMessageException e) { | |||
log.error("退款申请失败,解析微信支付应答或回调报文异常,返回信息:", e); | |||
return Response.error("退款失败"); | |||
} catch (ValidationException e) { | |||
log.error("退款申请失败,验证签名失败,返回信息:", e); | |||
return Response.error("验证签名失败"); | |||
} catch (ServiceException e) { | |||
log.error("退款申请失败,发送HTTP请求成功,返回异常,返回码:{},返回信息:", e.getErrorCode(), e); | |||
return Response.error("退款失败:" + e.getErrorMessage()); | |||
} catch (Exception e) { | |||
log.error("退款申请失败,异常:", e); | |||
return Response.error("退款失败"); | |||
} | |||
if (Status.SUCCESS.equals(refund.getStatus())) { | |||
log.info("退款成功!-订单号:{}", payOrder.getId()); | |||
//修改退款记录订单状态 | |||
MassageRefoundLog refoundLog = massageRefoundLogService.lambdaQuery() | |||
.eq(MassageRefoundLog::getOrderId, payOrder.getId()) | |||
.one(); | |||
refoundLog.setRefoundTime(CommonUtils.getCurrentTime()); | |||
refoundLog.setStatus("1"); | |||
massageRefoundLogService.updateById(refoundLog); | |||
return Response.success("退款成功"); | |||
} else if (Status.CLOSED.equals(refund.getStatus())) { | |||
log.info("退款关闭!-订单号:{}", payOrder.getId()); | |||
return Response.error("退款关闭"); | |||
} else if (Status.PROCESSING.equals(refund.getStatus())) { | |||
log.info("退款处理中!-订单号:{}", payOrder.getId()); | |||
return Response.error("退款处理中"); | |||
} else if (Status.ABNORMAL.equals(refund.getStatus())) { | |||
log.info("退款异常!-订单号:{}", payOrder.getId()); | |||
return Response.error("退款异常"); | |||
} | |||
return Response.error("退款失败"); | |||
} | |||
/** | |||
* 查询单笔退款(通过商户退款单号) | |||
* <pre> | |||
* 提交退款申请后,通过调用该接口查询退款状态。退款有一定延时,建议查询退款状态在提交退款申请后1分钟发起,一般来说零钱支付的退款5分钟内到账,银行卡支付的退款1-3个工作日到账。 | |||
* </pre> | |||
* | |||
* @param outRefundNo 商户退款单号 | |||
* @return | |||
*/ | |||
@Override | |||
public Response queryByOutRefundNo(String outRefundNo) { | |||
// 初始化服务 | |||
RefundService service = new RefundService.Builder().config(config).build(); | |||
QueryByOutRefundNoRequest request = new QueryByOutRefundNoRequest(); | |||
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 | |||
request.setOutRefundNo(outRefundNo.trim()); | |||
// 调用接口 | |||
Refund refund = null; | |||
try { | |||
refund = service.queryByOutRefundNo(request); | |||
log.info("退款查询结果:{}", JSONObject.toJSONString(refund)); | |||
//【退款状态】退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往商户平台(pay.weixin.qq.com)-交易中心,手动处理此笔退款。可选取值:SUCCESS:退款成功CLOSED:退款关闭PROCESSING:退款处理中ABNORMAL:退款异常【退款状态】退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往商户平台(pay.weixin.qq.com)-交易中心,手动处理此笔退款。可选取值:SUCCESS:退款成功CLOSED:退款关闭PROCESSING:退款处理中ABNORMAL:退款异常 | |||
if (Status.SUCCESS.equals(refund.getStatus())) { | |||
log.info("退款成功!-订单号:{}", outRefundNo); | |||
return Response.success("退款成功"); | |||
} else if (Status.CLOSED.equals(refund.getStatus())) { | |||
log.info("退款关闭!-订单号:{}", outRefundNo); | |||
return Response.error("退款关闭"); | |||
} else if (Status.PROCESSING.equals(refund.getStatus())) { | |||
log.info("退款处理中!-订单号:{}", outRefundNo); | |||
return Response.success("退款处理中"); | |||
} else if (Status.ABNORMAL.equals(refund.getStatus())) { | |||
log.info("退款异常!-订单号:{}", outRefundNo); | |||
return Response.error("退款异常"); | |||
} | |||
} catch (HttpException e) { | |||
log.error("退款查询失败,发送HTTP请求失败:", e); | |||
return Response.error("退款查询失败"); | |||
} catch (MalformedMessageException e) { | |||
log.error("退款查询失败,解析微信支付应答或回调报文异常,返回信息:", e); | |||
return Response.error("退款查询失败"); | |||
} catch (ValidationException e) { | |||
log.error("退款查询失败,验证签名失败,返回信息:", e); | |||
return Response.error("退款查询失败"); | |||
} catch (ServiceException e) { | |||
log.error("退款查询失败,发送HTTP请求成功,返回异常,返回码:{},返回信息:", e.getErrorCode(), e); | |||
return Response.error("退款查询失败"); | |||
} catch (Exception e) { | |||
log.error("退款查询失败,异常:", e); | |||
return Response.error("退款查询失败"); | |||
} | |||
return Response.success(refund); | |||
} | |||
/** | |||
* 微信小程序退款回调 | |||
* <pre> | |||
* 注意: | |||
* 对后台通知交互时,如果微信收到应答不是成功或超时,微信认为通知失败,微信会通过一定的策略定期重新发起通知,尽可能提高通知的成功率,但微信不保证通知最终能成功 | |||
* | |||
* 同样的通知可能会多次发送给商户系统。商户系统必须能够正确处理重复的通知。 推荐的做法是,当商户系统收到通知进行处理时,先检查对应业务数据的状态,并判断该通知是否已经处理。如果未处理,则再进行处理;如果已处理,则直接返回结果成功。在对业务数据进行状态检查和处理之前,要采用数据锁进行并发控制,以避免函数重入造成的数据混乱。 | |||
* 如果在所有通知频率后没有收到微信侧回调。商户应调用查询订单接口确认订单状态。 | |||
* </pre> | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
@Override | |||
public String refundNotify(HttpServletRequest request) { | |||
Map<String, String> returnMap = new HashMap<>(2); | |||
returnMap.put("code", "FAIL"); | |||
returnMap.put("message", "失败"); | |||
try { | |||
// 请求头Wechatpay-Signature | |||
String signature = request.getHeader("Wechatpay-Signature"); | |||
// 请求头Wechatpay-nonce | |||
String nonce = request.getHeader("Wechatpay-Nonce"); | |||
// 请求头Wechatpay-Timestamp | |||
String timestamp = request.getHeader("Wechatpay-Timestamp"); | |||
// 微信支付证书序列号 | |||
String serial = request.getHeader("Wechatpay-Serial"); | |||
// 签名方式 | |||
String signType = request.getHeader("Wechatpay-Signature-Type"); | |||
// 构造解析器和请求参数 | |||
NotificationParser parser = new NotificationParser((NotificationConfig) notificationConfig); | |||
RequestParam requestParam = new RequestParam.Builder() | |||
.serialNumber(serial) | |||
.nonce(nonce) | |||
.signature(signature) | |||
.timestamp(timestamp) | |||
.signType(signType) | |||
.body(HttpServletUtils.getRequestBody(request)) | |||
.build(); | |||
log.info("微信小程序支付退款回调验签参数: {}", JSON.toJSONString(requestParam)); | |||
// 解析通知 | |||
RefundNotification notification = null; | |||
try { | |||
notification = parser.parse(requestParam, RefundNotification.class); | |||
} catch (MalformedMessageException e) { | |||
log.error("微信小程序支付退款回调:回调通知参数不正确、解析通知数据失败:", e); | |||
returnMap.put("message", "回调通知参数不正确"); | |||
return JSONObject.toJSONString(returnMap); | |||
} catch (ValidationException e) { | |||
log.error("微信小程序支付退款回调:签名验证失败 ", e); | |||
returnMap.put("message", "签名验证失败"); | |||
return JSONObject.toJSONString(returnMap); | |||
} catch (Exception e) { | |||
log.error("微信小程序支付退款回调:未知异常 ", e); | |||
returnMap.put("message", "未知异常"); | |||
return JSONObject.toJSONString(returnMap); | |||
} | |||
log.info("微信小程序支付退款回调解析成功: {}", JSON.toJSONString(notification)); | |||
// 根据退款状态处理 | |||
Status refundStatus = notification.getRefundStatus(); | |||
switch (refundStatus) { | |||
case SUCCESS: | |||
// TODO 退款成功逻辑 | |||
returnMap.put("code", "SUCCESS"); | |||
returnMap.put("message", "退款成功"); | |||
//修改订单退款状态 | |||
MassageOrder order = massageOrderService | |||
.lambdaQuery() | |||
.eq(MassageOrder::getId, notification.getOutTradeNo()) | |||
.eq(MassageOrder::getIsRefound, "0") | |||
.one(); | |||
if(null != order){ | |||
order.setStatus("3"); | |||
order.setIsRefound("1"); | |||
massageOrderService.updateById(order); | |||
} | |||
//修改退款记录状态 | |||
MassageRefoundLog refoundLog = massageRefoundLogService | |||
.lambdaQuery() | |||
.eq(MassageRefoundLog::getOrderId, notification.getOutTradeNo()) | |||
.eq(MassageRefoundLog::getStatus, "0") | |||
.one(); | |||
if(null != refoundLog){ | |||
refoundLog.setStatus("1"); | |||
refoundLog.setRefoundTime(CommonUtils.getCurrentTime()); | |||
massageRefoundLogService.updateById(refoundLog); | |||
} | |||
return JSONObject.toJSONString(returnMap); | |||
case PROCESSING: | |||
log.warn("退款处理中: {}", notification); | |||
returnMap.put("message", "退款处理中,请稍后查询"); | |||
return JSONObject.toJSONString(returnMap); | |||
case ABNORMAL: | |||
log.error("退款异常: {}", notification); | |||
returnMap.put("message", "退款异常,请联系客服"); | |||
return JSONObject.toJSONString(returnMap); | |||
case CLOSED: | |||
log.warn("退款已关闭: {}", notification); | |||
returnMap.put("message", "退款已关闭,操作失败"); | |||
return JSONObject.toJSONString(returnMap); | |||
default: | |||
log.error("未知退款状态: {}", refundStatus); | |||
returnMap.put("message", "未知退款状态"); | |||
return JSONObject.toJSONString(returnMap); | |||
} | |||
} catch (Exception e) { | |||
log.error("退款回调处理异常", e); | |||
returnMap.put("message", "退款处理异常"); | |||
return JSONObject.toJSONString(returnMap); | |||
} | |||
} | |||
/** | |||
* 金额转换 | |||
* | |||
* @param money | |||
* @return | |||
*/ | |||
private static long decimalToLong(BigDecimal money) { | |||
return money.multiply(BigDecimal.valueOf(100)).longValue(); | |||
} | |||
} |
@ -0,0 +1,8 @@ | |||
package org.jeecg.modules.wxUtils; | |||
public class CreateOrderReq { | |||
/** | |||
* 微信用户openid(前端不用传参) | |||
*/ | |||
private String wxOpenId; | |||
} |
@ -0,0 +1,47 @@ | |||
package org.jeecg.modules.wxUtils; | |||
import javax.servlet.ServletInputStream; | |||
import javax.servlet.http.HttpServletRequest; | |||
import java.io.BufferedReader; | |||
import java.io.IOException; | |||
import java.io.InputStreamReader; | |||
import java.nio.charset.StandardCharsets; | |||
/** | |||
* <p> | |||
* HttpServletRequest 获取请求体 | |||
* </p> | |||
* | |||
* @author songfayuan | |||
* @date 2024/9/30 19:11 | |||
*/ | |||
public class HttpServletUtils { | |||
/** | |||
* 获取请求体 | |||
* | |||
* @param request | |||
* @return | |||
* @throws IOException | |||
*/ | |||
public static String getRequestBody(HttpServletRequest request) throws IOException { | |||
ServletInputStream stream = null; | |||
BufferedReader reader = null; | |||
StringBuffer sb = new StringBuffer(); | |||
try { | |||
stream = request.getInputStream(); | |||
// 获取响应 | |||
reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8)); | |||
String line; | |||
while ((line = reader.readLine()) != null) { | |||
sb.append(line); | |||
} | |||
} catch (IOException e) { | |||
throw new IOException("读取返回支付接口数据流出现异常!"); | |||
} finally { | |||
reader.close(); | |||
} | |||
return sb.toString(); | |||
} | |||
} |
@ -0,0 +1,31 @@ | |||
package org.jeecg.modules.wxUtils; | |||
import lombok.Data; | |||
import java.math.BigDecimal; | |||
/** | |||
* <p> | |||
* 支付订单信息 | |||
* </p> | |||
* | |||
* @author songfayuan | |||
* @date 2024/9/30 17:46 | |||
*/ | |||
@Data | |||
public class PayOrderInfo { | |||
/** | |||
* 订单标题 | |||
*/ | |||
private String description; | |||
/** | |||
* 商户订单号 | |||
* 只能是数字、大小写字母_-*且在同一个商户号下唯一。 | |||
*/ | |||
private String outTradeNo; | |||
/** | |||
* 支付金额,单位:元 | |||
*/ | |||
private BigDecimal amount; | |||
} | |||
@ -0,0 +1,23 @@ | |||
package org.jeecg.modules.wxUtils; | |||
import lombok.Data; | |||
/** | |||
* <p> | |||
* 订单查询请求 | |||
* </p> | |||
* | |||
* @author songfayuan | |||
* @date 2024/9/30 19:19 | |||
*/ | |||
@Data | |||
public class QueryOrderReq { | |||
/** | |||
* 订单号:业务侧的订单号 | |||
*/ | |||
private String transactionId; | |||
/** | |||
* 商户订单号 | |||
*/ | |||
private String outTradeNo; | |||
} |
@ -0,0 +1,36 @@ | |||
package org.jeecg.modules.wxUtils; | |||
import lombok.Data; | |||
import java.math.BigDecimal; | |||
/** | |||
* <p> | |||
* 退款订单请求参数 | |||
* </p> | |||
* | |||
* @author songfayuan | |||
* @date 2024/9/30 19:19 | |||
*/ | |||
@Data | |||
public class RefundOrderReq { | |||
/** | |||
* 订单号:业务侧的订单号 | |||
*/ | |||
private String transactionId; | |||
/** | |||
* 商户订单号 | |||
*/ | |||
private String outTradeNo; | |||
/** | |||
* 原订单金额 说明:原支付交易的订单总金额,这里单位为元。 | |||
*/ | |||
private BigDecimal totalAmount; | |||
/** | |||
* 退款金额 说明:退款金额,这里单位为元,不能超过原订单支付金额。 | |||
*/ | |||
private BigDecimal refundAmount; | |||
} | |||
@ -0,0 +1,164 @@ | |||
package org.jeecg.modules.wxUtils; | |||
import lombok.Data; | |||
/** | |||
* 返回参数封装类 | |||
* | |||
* @param <T> | |||
* @author songfayuan | |||
*/ | |||
@Data | |||
public class Response<T> { | |||
/** | |||
* 状态码 | |||
*/ | |||
protected int code; | |||
/** | |||
* 提示信息 | |||
*/ | |||
protected String msg; | |||
/** | |||
* 数据 | |||
*/ | |||
protected T data; | |||
/** | |||
* 成功时状态码 | |||
*/ | |||
private static final int SUCCESS_CODE = 200; | |||
/** | |||
* 成功时提示信息 | |||
*/ | |||
private static final String SUCCESS_MSG = "success"; | |||
/** | |||
* 异常、错误信息状态码 | |||
*/ | |||
private static final int ERROR_CODE = 500; | |||
/** | |||
* 异常、错误提示信息 | |||
*/ | |||
private static final String ERROR_MSG = "服务器内部异常,请联系技术人员!"; | |||
/** | |||
* 返回成功消息 | |||
* | |||
* @param <T> | |||
* @return | |||
*/ | |||
public static <T> Response<T> success() { | |||
Response resp = new Response(); | |||
resp.code = (SUCCESS_CODE); | |||
resp.msg = (SUCCESS_MSG); | |||
return resp; | |||
} | |||
/** | |||
* 返回成功消息 | |||
* | |||
* @param <T> | |||
* @param msg | |||
* @return | |||
*/ | |||
public static <T> Response<T> successResponse(String msg) { | |||
Response resp = new Response(); | |||
resp.code = SUCCESS_CODE; | |||
resp.msg = msg; | |||
return resp; | |||
} | |||
/** | |||
* 返回错误消息 | |||
* | |||
* @param <T> | |||
* @return | |||
*/ | |||
public static <T> Response<T> error() { | |||
Response resp = new Response(); | |||
resp.code = (ERROR_CODE); | |||
resp.msg = (ERROR_MSG); | |||
return resp; | |||
} | |||
/** | |||
* 返回错误消息 | |||
* | |||
* @param <T> | |||
* @param msg | |||
* @return | |||
*/ | |||
public static <T> Response<T> errorResponse(String msg) { | |||
Response resp = new Response(); | |||
resp.code = ERROR_CODE; | |||
resp.msg = msg; | |||
return resp; | |||
} | |||
/** | |||
* 自定义状态码、提示信息 | |||
* | |||
* @param <T> | |||
* @param code 状态码 | |||
* @param msg 提示信息 | |||
* @return | |||
*/ | |||
public static <T> Response<T> response(int code, String msg) { | |||
Response resp = new Response(); | |||
resp.code = (code); | |||
resp.msg = (msg); | |||
return resp; | |||
} | |||
/** | |||
* 自定义状态码、提示信息、业务数据 | |||
* | |||
* @param <T> | |||
* @param code 状态码 | |||
* @param msg 提示信息 | |||
* @param data 业务数据 | |||
* @return | |||
*/ | |||
public static <T> Response<T> response(int code, String msg, T data) { | |||
Response<T> resp = new Response<>(); | |||
resp.code = (code); | |||
resp.msg = (msg); | |||
resp.data = data; | |||
return resp; | |||
} | |||
/** | |||
* 返回成功数据 | |||
* | |||
* @param <T> | |||
* @param data 业务数据 | |||
* @return | |||
*/ | |||
public static <T> Response<T> success(T data) { | |||
Response<T> resp = new Response<>(); | |||
resp.code = (SUCCESS_CODE); | |||
resp.msg = (SUCCESS_MSG); | |||
resp.data = data; | |||
return resp; | |||
} | |||
/** | |||
* 返回错误消息 | |||
* | |||
* @param <T> | |||
* @param data 业务数据 | |||
* @return | |||
*/ | |||
public static <T> Response<T> error(T data) { | |||
Response<T> resp = new Response<>(); | |||
resp.code = (ERROR_CODE); | |||
resp.msg = (ERROR_MSG); | |||
resp.data = data; | |||
return resp; | |||
} | |||
} |
@ -0,0 +1,113 @@ | |||
package org.jeecg.modules.wxUtils; | |||
import com.wechat.pay.java.core.Config; | |||
import com.wechat.pay.java.core.RSAAutoCertificateConfig; | |||
import com.wechat.pay.java.core.RSAPublicKeyConfig; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.context.annotation.Configuration; | |||
@Slf4j | |||
@Configuration | |||
public class WxPayAutoCertificateConfig { | |||
/** | |||
* 微信小程序的 AppID | |||
*/ | |||
@Value("${wx.miniapp.appid}") | |||
private String appid; | |||
/** | |||
* 微信小程序的密钥 | |||
*/ | |||
@Value("${wx.miniapp.secret}") | |||
private String secret; | |||
/** | |||
* 商户号 | |||
*/ | |||
@Value("${wx.miniapp.merchantId}") | |||
private String merchantId; | |||
/** | |||
* 商户API私钥路径 | |||
*/ | |||
@Value("${wx.miniapp.privateKeyPath}") | |||
private String privateKeyPath; | |||
/** | |||
* 商户API公钥路径 | |||
*/ | |||
@Value("${wx.miniapp.publicKeyPath}") | |||
private String publicKeyPath; | |||
/** | |||
* 公钥 | |||
*/ | |||
@Value("${wx.miniapp.publicKeyId}") | |||
private String publicKeyId; | |||
/** | |||
* 商户证书序列号 | |||
*/ | |||
@Value("${wx.miniapp.merchantSerialNumber}") | |||
private String merchantSerialNumber; | |||
/** | |||
* 商户APIV3密钥 | |||
*/ | |||
@Value("${wx.miniapp.apiV3Key}") | |||
private String apiV3Key; | |||
/** | |||
* 支付通知地址 | |||
*/ | |||
@Value("${wx.miniapp.payNotifyUrl}") | |||
private String payNotifyUrl; | |||
/** | |||
* 退款通知地址 | |||
*/ | |||
@Value("${wx.miniapp.refundNotifyUrl}") | |||
private String refundNotifyUrl; | |||
/** | |||
* 初始化商户配置 | |||
* @return | |||
*/ | |||
@Bean | |||
public Config rsaAutoCertificateConfig() { | |||
// 这里把Config作为配置Bean是为了避免多次创建资源,一般项目运行的时候这些东西都确定了 | |||
// 具体的参数改为申请的数据,可以通过读配置文件的形式获取 | |||
// Config config = new RSAAutoCertificateConfig.Builder() | |||
// .merchantId("1659066870") | |||
// .privateKeyFromPath("E:\\git_java\\api_java\\popularize-admin\\popularize-admin\\popularize-admin\\module-pay\\src\\main\\resources\\apiclient_key.pem") | |||
// .merchantSerialNumber("7BE56DC695B2B612BD1C6C710A7FBFA1AC46B10F") | |||
// .apiV3Key("vtribevtribevtribevtribevtribe12") | |||
// .build(); | |||
Config config = new RSAPublicKeyConfig.Builder() | |||
.merchantId(merchantId) | |||
.privateKeyFromPath(privateKeyPath) | |||
.publicKeyFromPath(publicKeyPath) | |||
.publicKeyId(publicKeyId) | |||
.merchantSerialNumber(merchantSerialNumber) | |||
.apiV3Key(apiV3Key) | |||
.build(); | |||
// Config config = new RSAAutoCertificateConfig.Builder() | |||
// .merchantId(merchantId) | |||
// .privateKeyFromPath(privateKeyPath) | |||
// .merchantSerialNumber(merchantSerialNumber) | |||
// .apiV3Key(apiV3Key) | |||
// .build(); | |||
log.info("初始化微信支付商户配置完成..."); | |||
return config; | |||
} | |||
} |
@ -0,0 +1,13 @@ | |||
package org.jeecg.modules.wxUtils; | |||
import lombok.Data; | |||
import org.springframework.stereotype.Component; | |||
@Data | |||
@Component | |||
public class WxPayConfig { | |||
} | |||
@ -0,0 +1,28 @@ | |||
-----BEGIN PRIVATE KEY----- | |||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC8an3vcCIsBgcy | |||
wG+H5tZZ0/qZJIEeqFHYDvKxqs69slnT4pUxG7wir66o+SQP7bPBpHDh7OGghuhP | |||
8KTSYMnG100k44Rfm7Ch+P2/mdexfgu4aC2CBFf6ziOjopBzBfc3TEOuwCdPTcFL | |||
4G3yZ65xldiO+stiDdeXa5EQrD9LFWL4YADOkd8RPxUGFQaWWWnUR+7VdWCHsYZ7 | |||
J1qrwmyVsNXsbcWAdQKwiXy7fws6IOyRUj4p8tUc/GDqz1vwCTZQJ6Km3b+nCLqb | |||
SDbZ82XhSJJzZRzGzcY/IqdeQT9Lrb0SYWs3HDmN5/NngU2cihiUqw4LrzWy/ui0 | |||
+Fvt46AVAgMBAAECggEBAJbphO0fF3/DZEiWMb7ceZuBWhsHThRMJSG091auxODT | |||
1XcM6QpoeIwfwvm8c9H+Rhg3qeKLZTy6UaCV0q5er77/+94sDX62qQdS84tfoY+c | |||
sa6GYszcxcsxCQKr1p8KjDRSdXOmnNW8JbKsk+Owf9yidM4wum5TP/ccRRjhneB4 | |||
YmN+cw93bl+5yqebvaRwC1S7WcUspj2lmaSLE/IvFOBU91Wnn6XvjkAU7QnuUxlV | |||
0NVWgJqhykng6E/lsXkEB6Akk5fZXHDvJCgP6zCDHZs0LC8MTl984fDtr1CB1lnw | |||
n/B6gQEYhVnqlvGxLhjGwZbfYzFuPZqgnDkVbBWflYECgYEA99s7k74edmVkOriI | |||
KYuYctDkU22HsoKHaB+VhKfeaZWWr25RPpWk0yQWNr1SxkdEJopzxVMuCoxrGy6F | |||
MUpgM0By6QBoU3WFZONSzDalqFJANIVj+o3/RCnI5w4na6MAaw4t/hMd2avxSje/ | |||
k1A2CeBYm7eN7bYaFXe+hwFGyz0CgYEAwptLctRG3R35beRBXMccuvvxjXmSNfpW | |||
qIBCnNn0KzBu7r8JyxHVI8mIdA5jD8C0G91wFnm0hG+fcZ+9eFpLZCaHbfVI55GS | |||
NsOBwkO5WrOj2LcWd9yi4cKPxFceOLrEBKmxTXFGnoeVoA4468ec8kEQywG96dvb | |||
QKFZ4JM11bkCgYEAhRA9u+Ollwp39M58y1EWVw2uhtuWrk9FQrEyJDW7QhP9AdHH | |||
7EGKa5BEHL8nYSuBeu95l8ZAQYmBNuaSuxOi8eD3z/9YAvZk1vTzzo7IAMWnkorK | |||
UglJsd587Q68Ox0XbGIAbxb0P5f/wkiLoRq+6C55Y5/3olbRShUvRGt7BkECgYBw | |||
zuCvkcn6R3PddeFFzM4kvgNKBVzyGUm+p4r1rYpStuK3Vtpwcsfg1ORakjRuX0CI | |||
npZpEOfJlYMRtI16hK0LQyJiZTt7sPDW+gHwAJ4jq9qgt5E4rhdlUwlPwUhtjiYu | |||
pcd3ouBS6Tmc7GGmm7Go5Hq9kybpt16jWmTlP7CHUQKBgGaJwRKkIjJsvpGEkxcx | |||
ReFyK5avL+ky/q/Q/TyCmEr8uVZGe1kEXdDk53+VR1YzwX/K+7Bjx0vlH3T57Z9J | |||
vv1fiJZimmLy17mkRQurREvWfICTH/WJxzMF5ALJLpqGzr451fzaupMNhI04Ln/e | |||
dTDkCyho1MMaRP+2a12AIEex | |||
-----END PRIVATE KEY----- |
@ -0,0 +1,9 @@ | |||
-----BEGIN PUBLIC KEY----- | |||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6xCzq1CjrZYTqtE52f7t | |||
4AU9rgRZYKNn94tmkIuYa1wGX13gWNIlo1muExV/Ejg4H9Xe0RCQwNNJieeyfhU7 | |||
Vl/qms4Ukj8sqIrvKqw9j81AVHK2BSk87aRs0ha+gvV1tDDmcCLHrY8SeGcJ2U2z | |||
I9iu5X1kLdkXNiojWrMngGslki2FSfJelftoZUDk30mf18AoG5iBzIPJ4/Gy5Rh0 | |||
U+FDwpWzERR7XjMoAZ7YiRYUdV/SpQkx6CrM4Em3AKxmpxvwSVg7NiMDoTljfgq+ | |||
6ZHB9DMQPbeqkQ9qkCMg0sVjpB/aI9tObE0mtU8zP/mBg7TDTs0qa2SXFem5ZTDg | |||
JQIDAQAB | |||
-----END PUBLIC KEY----- |