From 0eec6ce6df394b4e4f7c72963e344a36cf946b31 Mon Sep 17 00:00:00 2001 From: xyiege Date: Sun, 17 Jul 2022 09:22:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=94=AF=E4=BB=98=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/AdminAccountCloseController.java | 22 ++++++++++++++++++- .../szwh/service/AccountCloseService.java | 6 +++++ .../service/impl/AccountCloseServiceImpl.java | 22 +++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/main/java/cn/chjyj/szwh/controller/admin/AdminAccountCloseController.java b/src/main/java/cn/chjyj/szwh/controller/admin/AdminAccountCloseController.java index bc8e2f9..b9ecb01 100644 --- a/src/main/java/cn/chjyj/szwh/controller/admin/AdminAccountCloseController.java +++ b/src/main/java/cn/chjyj/szwh/controller/admin/AdminAccountCloseController.java @@ -4,16 +4,18 @@ import cn.chjyj.szwh.controller.BaseController; import cn.chjyj.szwh.service.AccountCloseService; import com.alibaba.fastjson.JSONObject; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletRequest; import java.util.Map; /** * 对账控制器 */ @RestController -@RequestMapping("//admin/order.AccountClose") +@RequestMapping("/admin/order.AccountClose") public class AdminAccountCloseController extends BaseController { @Autowired private AccountCloseService accountCloseService; @@ -29,4 +31,22 @@ public class AdminAccountCloseController extends BaseController { jsonObject.put("data",map); return jsonObject; } + + @PostMapping("/setPaySetting") + public JSONObject setPaySetting(HttpServletRequest request){ + String alipay= request.getParameter("alipay"); + int ialipay = Integer.valueOf(alipay); + + String wechatPay= request.getParameter("wechat_pay"); + int iwechat = Integer.valueOf(wechatPay); + + String ebankPay = request.getParameter("ebank_pay"); + int iebank= Integer.valueOf(ebankPay); + + accountCloseService.setPaySetting(ialipay,iwechat,iebank); + + jsonObject.put("code",200); + jsonObject.put("msg","成功"); + return jsonObject; + } } diff --git a/src/main/java/cn/chjyj/szwh/service/AccountCloseService.java b/src/main/java/cn/chjyj/szwh/service/AccountCloseService.java index ef095df..23ac002 100644 --- a/src/main/java/cn/chjyj/szwh/service/AccountCloseService.java +++ b/src/main/java/cn/chjyj/szwh/service/AccountCloseService.java @@ -13,4 +13,10 @@ public interface AccountCloseService { * @return */ Map getPaySetting(); + + /** + * 设置支付信息 + * @return + */ + int setPaySetting(int alipay,int wechaPay,int ebankPay); } diff --git a/src/main/java/cn/chjyj/szwh/service/impl/AccountCloseServiceImpl.java b/src/main/java/cn/chjyj/szwh/service/impl/AccountCloseServiceImpl.java index d1c8a7c..9c987b6 100644 --- a/src/main/java/cn/chjyj/szwh/service/impl/AccountCloseServiceImpl.java +++ b/src/main/java/cn/chjyj/szwh/service/impl/AccountCloseServiceImpl.java @@ -4,6 +4,7 @@ package cn.chjyj.szwh.service.impl; import cn.chjyj.szwh.bean.PaySetting; import cn.chjyj.szwh.mapper.PaySettingMapper; import cn.chjyj.szwh.service.AccountCloseService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,4 +31,25 @@ public class AccountCloseServiceImpl implements AccountCloseService { } return retmap; } + + @Override + public int setPaySetting(int alipay,int wechaPay,int ebankPay) { + // 如果有记录就执行更新,否则新增 + PaySetting paySetting =paySettingMapper.getPaySettingById(1); + int ret=0; + PaySetting npay = new PaySetting(); + if(paySetting!=null && StringUtils.isNotBlank(paySetting.getId().toString())){ + npay.setAlipay(alipay); + npay.setWechatPay(wechaPay); + npay.setEbankPay(ebankPay); + npay.setId(paySetting.getId()); + ret = paySettingMapper.upPaySetting(npay); + }else{ + npay.setEbankPay(ebankPay); + npay.setAlipay(alipay); + npay.setWechatPay(wechaPay); + paySettingMapper.addPaySetting(npay); + } + return ret; + } }