parent
60506ba311
commit
fb58391cc1
|
|
@ -1,6 +1,8 @@
|
||||||
package com.mdd.admin.controller.setting;
|
package com.mdd.admin.controller.setting;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.mdd.admin.service.ISettingPaymentService;
|
import com.mdd.admin.service.ISettingPaymentService;
|
||||||
import com.mdd.admin.validate.setting.SettingPayConfigValidate;
|
import com.mdd.admin.validate.setting.SettingPayConfigValidate;
|
||||||
import com.mdd.admin.vo.setting.SettingPaymentMethodVo;
|
import com.mdd.admin.vo.setting.SettingPaymentMethodVo;
|
||||||
|
|
@ -13,6 +15,7 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -25,14 +28,14 @@ public class SettingPayWayController {
|
||||||
|
|
||||||
@GetMapping("/getPayWay")
|
@GetMapping("/getPayWay")
|
||||||
@ApiOperation(value="支付方式列表")
|
@ApiOperation(value="支付方式列表")
|
||||||
public AjaxResult<List<List<SettingPaymentMethodVo>>> method() {
|
public AjaxResult<HashMap> method() {
|
||||||
List<List<SettingPaymentMethodVo>> list = iSettingPaymentService.getPayWay();
|
HashMap list = iSettingPaymentService.getPayWay();
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/setPayWay")
|
@PostMapping("/setPayWay")
|
||||||
@ApiOperation(value="支付方式编辑")
|
@ApiOperation(value="支付方式编辑")
|
||||||
public AjaxResult<Object> setPayWay(@Validated @RequestBody List<List<SettingPaymentMethodVo>> data) {
|
public AjaxResult<Object> setPayWay(@Validated @RequestBody HashMap<Integer, List<SettingPaymentMethodVo>> data) {
|
||||||
iSettingPaymentService.setPayWay(data);
|
iSettingPaymentService.setPayWay(data);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
package com.mdd.admin.service;
|
package com.mdd.admin.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.mdd.admin.validate.setting.SettingPayConfigValidate;
|
import com.mdd.admin.validate.setting.SettingPayConfigValidate;
|
||||||
import com.mdd.admin.validate.setting.SettingPayMethodValidate;
|
import com.mdd.admin.validate.setting.SettingPayMethodValidate;
|
||||||
import com.mdd.admin.vo.setting.SettingPaymentMethodVo;
|
import com.mdd.admin.vo.setting.SettingPaymentMethodVo;
|
||||||
import com.mdd.common.entity.setting.DevPayConfig;
|
import com.mdd.common.entity.setting.DevPayConfig;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -19,7 +21,7 @@ public interface ISettingPaymentService {
|
||||||
* @author fzr
|
* @author fzr
|
||||||
* @return List<List<SettingPaymentMethodVo>>
|
* @return List<List<SettingPaymentMethodVo>>
|
||||||
*/
|
*/
|
||||||
List<List<SettingPaymentMethodVo>> getPayWay();
|
HashMap getPayWay();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置列表
|
* 配置列表
|
||||||
|
|
@ -52,6 +54,6 @@ public interface ISettingPaymentService {
|
||||||
* @author fzr
|
* @author fzr
|
||||||
* @param data 参数
|
* @param data 参数
|
||||||
*/
|
*/
|
||||||
void setPayWay(List<List<SettingPaymentMethodVo>> data);
|
void setPayWay(HashMap<Integer, List<SettingPaymentMethodVo>> data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.mdd.admin.service.impl;
|
package com.mdd.admin.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.mdd.admin.service.ISettingPaymentService;
|
import com.mdd.admin.service.ISettingPaymentService;
|
||||||
|
|
@ -20,9 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付配置服务实现类
|
* 支付配置服务实现类
|
||||||
|
|
@ -42,10 +41,11 @@ public class SettingPaymentServiceImpl implements ISettingPaymentService {
|
||||||
* @author fzr
|
* @author fzr
|
||||||
* @return List<List<SettingPaymentMethodVo>>
|
* @return List<List<SettingPaymentMethodVo>>
|
||||||
*/
|
*/
|
||||||
public List<List<SettingPaymentMethodVo>> getPayWay() {
|
public HashMap getPayWay() {
|
||||||
List<DevPayWay> lists = devPayWayMapper.selectList(null);
|
List<DevPayWay> lists = devPayWayMapper.selectList(null);
|
||||||
|
|
||||||
List<List<SettingPaymentMethodVo>> result = new LinkedList<>();
|
//List<List<SettingPaymentMethodVo>> result = new LinkedList<>();
|
||||||
|
HashMap result = new LinkedHashMap<Integer, String>();
|
||||||
List<SettingPaymentMethodVo> mnp = new LinkedList<>();
|
List<SettingPaymentMethodVo> mnp = new LinkedList<>();
|
||||||
List<SettingPaymentMethodVo> oa = new LinkedList<>();
|
List<SettingPaymentMethodVo> oa = new LinkedList<>();
|
||||||
List<SettingPaymentMethodVo> h5 = new LinkedList<>();
|
List<SettingPaymentMethodVo> h5 = new LinkedList<>();
|
||||||
|
|
@ -74,9 +74,9 @@ public class SettingPaymentServiceImpl implements ISettingPaymentService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.add(mnp);
|
result.put(1, mnp);
|
||||||
result.add(oa);
|
result.put(2, oa);
|
||||||
result.add(h5);
|
result.put(3, h5);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,9 +161,9 @@ public class SettingPaymentServiceImpl implements ISettingPaymentService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void setPayWay(List<List<SettingPaymentMethodVo>> data) {
|
public void setPayWay(HashMap<Integer, List<SettingPaymentMethodVo>> data) {
|
||||||
|
for (Integer key : data.keySet()) {
|
||||||
for (List<SettingPaymentMethodVo> list : data) {
|
List<SettingPaymentMethodVo> list = data.get(key);
|
||||||
for (SettingPaymentMethodVo vo : list) {
|
for (SettingPaymentMethodVo vo : list) {
|
||||||
DevPayWay way = new DevPayWay();
|
DevPayWay way = new DevPayWay();
|
||||||
way.setIsDefault(vo.getIsDefault());
|
way.setIsDefault(vo.getIsDefault());
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ public class PayServiceImpl implements IPayService {
|
||||||
List<DevPayWay> devPayWays = devPayWayMapper.selectList(
|
List<DevPayWay> devPayWays = devPayWayMapper.selectList(
|
||||||
new QueryWrapper<DevPayWay>()
|
new QueryWrapper<DevPayWay>()
|
||||||
.eq("scene", terminal)
|
.eq("scene", terminal)
|
||||||
.eq("status", YesNoEnum.YES.getCode()).orderByDesc("is_default").orderByAsc("id"));
|
.eq("status", YesNoEnum.YES.getCode()).orderByDesc("id"));
|
||||||
|
|
||||||
PayWayListVo vo = new PayWayListVo();
|
PayWayListVo vo = new PayWayListVo();
|
||||||
if (from.equals("recharge")) {
|
if (from.equals("recharge")) {
|
||||||
|
|
@ -113,10 +113,11 @@ public class PayServiceImpl implements IPayService {
|
||||||
if (devPayConfig.getPayWay().equals(PaymentEnum.ALI_PAY.getCode())) {
|
if (devPayConfig.getPayWay().equals(PaymentEnum.ALI_PAY.getCode())) {
|
||||||
infoVo.setExtra("支付宝快捷支付");
|
infoVo.setExtra("支付宝快捷支付");
|
||||||
}
|
}
|
||||||
|
|
||||||
list.add(infoVo);
|
list.add(infoVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Collections.sort(list, Comparator.comparing(PayWayInfoVo::getSort).reversed()
|
||||||
|
.thenComparing(Comparator.comparingInt(PayWayInfoVo::getId).reversed()));
|
||||||
vo.setLists(list);
|
vo.setLists(list);
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -242,8 +242,7 @@ INSERT INTO `la_dev_pay_way` (`id`, `pay_config_id`, `scene`, `is_default`, `sta
|
||||||
(4, 2, 2, 1, 1),
|
(4, 2, 2, 1, 1),
|
||||||
(5, 1, 3, 0, 1),
|
(5, 1, 3, 0, 1),
|
||||||
(6, 2, 3, 1, 1),
|
(6, 2, 3, 1, 1),
|
||||||
(7, 3, 3, 0, 1),
|
(7, 3, 3, 0, 1);
|
||||||
(8, 3, 1, 0, 1);
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `la_dict_data`;
|
DROP TABLE IF EXISTS `la_dict_data`;
|
||||||
CREATE TABLE `la_dict_data` (
|
CREATE TABLE `la_dict_data` (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue