123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- package com.yihu.wlyy.web.wx;
- import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
- import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
- import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
- import com.yihu.wlyy.web.WeixinBaseController;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.http.MediaType;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- /**
- * Created by hzp on 2017/05/23.
- */
- @Controller
- @RequestMapping(value = "/onepay", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- @Api(description = "统一支付服务")
- public class OnePayController extends WeixinBaseController {
- @Autowired
- private OnePayService pay;
- @RequestMapping(value = "bindCard", method = RequestMethod.POST)
- @ApiOperation("查询绑卡信息")
- @ResponseBody
- public String bindCard() throws Exception {
- try {
- BindCard bindCard = pay.bindCard(getOpenid()); //oULM4xOARzTFqr9y1aTWuzCQdUL0
- return write(200, "查询绑卡信息成功!","data",bindCard);
- }
- catch (Exception e)
- {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "charge", method = RequestMethod.POST)
- @ApiOperation("家庭医生签约支付")
- @ResponseBody
- public String charge(
- @ApiParam(name="orgCode",value="医疗机构编号",defaultValue = "3502050300")
- @RequestParam String orgCode,
- @ApiParam(name="code",value="签约代码",defaultValue = "044701ea5b2311e68344fa163e8aee56")
- @RequestParam String code,
- @ApiParam(name="date",value="签约付款时间yyyyMMddHHmmss",defaultValue = "20170523172400")
- @RequestParam String date,
- @ApiParam(name="cardNo",value="社保卡号",defaultValue = "DC0261911")
- @RequestParam String cardNo) throws Exception {
- try {
- String settleNo = pay.charge(orgCode,code,date,cardNo,getOpenid()); //"oULM4xOARzTFqr9y1aTWuzCQdUL0"
- return write(200, "家庭医生签约支付成功!","data",settleNo);
- }
- catch (Exception e)
- {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "chargeQuery", method = RequestMethod.POST)
- @ApiOperation("家庭医生签约支付查询")
- @ResponseBody
- public String chargeQuery(@ApiParam(name="code",value="签约代码",defaultValue = "20170523172835")
- @RequestParam String code) throws Exception {
- try {
- Charge charge = pay.chargeQuery(code);
- return write(200, "家庭医生签约支付查询成功!","data",charge);
- }
- catch (Exception e)
- {
- return error(-1, e.getMessage());
- }
- }
- }
|