feat(order): 添加XT支付功能和确认收款功能
- 新增XT支付创建订单接口和支付接口
- 添加管理员确认收款功能,支持订单状态更新
- 集成XT支付链接配置和支付流程
- 在订单列表界面添加确认收款按钮和操作
- 更新支付方式常量,支持XT支付类型
- 添加XT支付相关的数据传输对象和验证
- 修复LWPAY支付成功消息显示问题
| | |
| | | if (StrUtil.isBlank(dto.getXtLink())) { |
| | | return new FebsResponse().fail().message("付款链接不能为空"); |
| | | } |
| | | if (StrUtil.isBlank(dto.getXtLinkImg())) { |
| | | return new FebsResponse().fail().message("付款链接图片不能为空"); |
| | | } |
| | | commonService.addDataDic("PAY_LINK", "XT_LINK", dto.getXtLink(), "付款链接", false); |
| | | commonService.addDataDic("PAY_LINK", "XT_LINK_IMG", dto.getXtLinkImg(), "付款链接图片", false); |
| | | return new FebsResponse().success().message("保存成功"); |
| | | } |
| | | |
| | |
| | | public String payLink(Model model) { |
| | | PayLinkDto dto = new PayLinkDto(); |
| | | DataDictionaryCustom xtLink = dataDictionaryCustomMapper.selectDicDataByTypeAndCode("PAY_LINK", "XT_LINK"); |
| | | DataDictionaryCustom xtLinkImg = dataDictionaryCustomMapper.selectDicDataByTypeAndCode("PAY_LINK", "XT_LINK_IMG"); |
| | | if (xtLink != null) dto.setXtLink(xtLink.getValue()); |
| | | if (xtLinkImg != null) dto.setXtLinkImg(xtLinkImg.getValue()); |
| | | model.addAttribute("payLink", dto); |
| | | return FebsUtil.view("modules/system/payLink"); |
| | | } |
| | |
| | | public class PayLinkDto { |
| | | /** 付款链接 */ |
| | | private String xtLink; |
| | | /** 付款链接图片 */ |
| | | private String xtLinkImg; |
| | | } |
| | |
| | | DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | "PAY_LINK", "XT_LINK" |
| | | ); |
| | | |
| | | DataDictionaryCustom dataDictionaryCustomImg = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | "PAY_LINK", "XT_LINK_IMG" |
| | | ); |
| | | if (ObjectUtil.isEmpty(dataDictionaryCustom)){ |
| | | return new FebsResponse().fail().message("Payment channel exception"); |
| | | } |
| | | if (ObjectUtil.isEmpty(dataDictionaryCustomImg)){ |
| | | return new FebsResponse().fail().message("Payment channel exception"); |
| | | } |
| | | if (StrUtil.isEmpty(dataDictionaryCustom.getValue())){ |
| | | return new FebsResponse().fail().message("Payment channel exception"); |
| | | } |
| | | return new FebsResponse().success().data(dataDictionaryCustom.getValue()); |
| | | if (StrUtil.isEmpty(dataDictionaryCustomImg.getValue())){ |
| | | return new FebsResponse().fail().message("Payment channel exception"); |
| | | } |
| | | |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("link", dataDictionaryCustom.getValue()); |
| | | result.put("linkImg", dataDictionaryCustomImg.getValue()); |
| | | return new FebsResponse().success().data(result); |
| | | } |
| | | |
| | | } |
| | |
| | | </div> |
| | | <div class="layui-word-aux" style="margin-left: 150px;">用户点击付款时跳转的链接地址,必须以 http(s):// 开头</div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label required">链接图片:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal" id="pay-link-img-upload">上传图片</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="pay-link-img-preview"></div> |
| | | </blockquote> |
| | | <div class="layui-word-aux">双击图片删除</div> |
| | | </div> |
| | | <input type="hidden" name="xtLinkImg" id="xtLinkImg" data-th-id="${payLink.xtLinkImg}" lay-verify="required" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-card-footer"> |
| | |
| | | .layui-table-form .layui-form-item { |
| | | margin-bottom: 20px !important; |
| | | } |
| | | |
| | | .layui-upload-list { |
| | | margin: 0 !important; |
| | | } |
| | | |
| | | .pay-link-upload-img { |
| | | width: 130px; |
| | | } |
| | | </style> |
| | | <script data-th-inline="javascript" type="text/javascript"> |
| | | layui.use(['dropdown', 'jquery', 'validate', 'febs', 'form'], function () { |
| | | layui.use(['dropdown', 'jquery', 'validate', 'febs', 'form', 'upload'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | upload = layui.upload, |
| | | payLink = [[${payLink}]], |
| | | validate = layui.validate, |
| | | $view = $('#pay-link'); |
| | |
| | | form.val("pay-link-form", { |
| | | "xtLink": payLink.xtLink |
| | | }); |
| | | if (payLink.xtLinkImg) { |
| | | $('#xtLinkImg').val(payLink.xtLinkImg); |
| | | $('#pay-link-img-preview').html('<img src="' + payLink.xtLinkImg + '" class="layui-upload-img pay-link-upload-img">'); |
| | | imgBind(); |
| | | } |
| | | } |
| | | |
| | | form.render(); |
| | | |
| | | // 图片上传 |
| | | upload.render({ |
| | | elem: '#pay-link-img-upload' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' |
| | | ,multiple: false |
| | | ,before: function(obj){ |
| | | obj.preview(function(index, file, result){ |
| | | $('#pay-link-img-preview').html('<img src="' + result + '" alt="' + file.name + '" class="layui-upload-img pay-link-upload-img">'); |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $('#xtLinkImg').val(res.data.src); |
| | | imgBind(); |
| | | } |
| | | }); |
| | | |
| | | function imgBind() { |
| | | $(".pay-link-upload-img").off("dblclick").on("dblclick", function() { |
| | | $(this).remove(); |
| | | $('#xtLinkImg').val(""); |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(pay-link-form-submit)', function (data) { |
| | | febs.post(ctx + 'admin/system/payLink', data.field, function (res) { |
| | | febs.alert.success('保存成功'); |