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