Browse Source

更新支付设置

master
xyiege 4 years ago
parent
commit
0eec6ce6df
  1. 22
      src/main/java/cn/chjyj/szwh/controller/admin/AdminAccountCloseController.java
  2. 6
      src/main/java/cn/chjyj/szwh/service/AccountCloseService.java
  3. 22
      src/main/java/cn/chjyj/szwh/service/impl/AccountCloseServiceImpl.java

22
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 cn.chjyj.szwh.service.AccountCloseService;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Map; import java.util.Map;
/** /**
* 对账控制器 * 对账控制器
*/ */
@RestController @RestController
@RequestMapping("//admin/order.AccountClose") @RequestMapping("/admin/order.AccountClose")
public class AdminAccountCloseController extends BaseController { public class AdminAccountCloseController extends BaseController {
@Autowired @Autowired
private AccountCloseService accountCloseService; private AccountCloseService accountCloseService;
@ -29,4 +31,22 @@ public class AdminAccountCloseController extends BaseController {
jsonObject.put("data",map); jsonObject.put("data",map);
return jsonObject; 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;
}
} }

6
src/main/java/cn/chjyj/szwh/service/AccountCloseService.java

@ -13,4 +13,10 @@ public interface AccountCloseService {
* @return * @return
*/ */
Map getPaySetting(); Map getPaySetting();
/**
* 设置支付信息
* @return
*/
int setPaySetting(int alipay,int wechaPay,int ebankPay);
} }

22
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.bean.PaySetting;
import cn.chjyj.szwh.mapper.PaySettingMapper; import cn.chjyj.szwh.mapper.PaySettingMapper;
import cn.chjyj.szwh.service.AccountCloseService; import cn.chjyj.szwh.service.AccountCloseService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -30,4 +31,25 @@ public class AccountCloseServiceImpl implements AccountCloseService {
} }
return retmap; 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;
}
} }

Loading…
Cancel
Save