| @@ -23,14 +23,14 @@ import io.swagger.annotations.ApiOperation; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxOrder") | |||
| @RequestMapping("/api/order/") | |||
| public class WxOrderController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxOrderController.class); | |||
| @Autowired | |||
| private WxOrderService wxOrderService; | |||
| @ApiOperation(value = "提交订单", notes = "{\"couponId\":\"String\"}") | |||
| @ApiOperation(value = "下订单", notes = "{\"couponId\":\"String\"}") | |||
| @PostMapping("save") | |||
| public ResultData saveOrder(@RequestBody Map<String, String> paramMap) { | |||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | |||
| @@ -90,28 +90,18 @@ public class WxOrderController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxOrder wxOrder) { | |||
| //Assert.notNull(wxOrder.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxOrderService.saveOrUpdate(wxOrder); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxOrder wxOrder) { | |||
| wxOrderService.saveOrUpdate(wxOrder); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxOrderService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { | |||
| if (null == wxOrder) wxOrder = new WxOrder(); | |||
| // c端用户应该只能看到自己的订单 | |||
| WxCUser user = getUser(); | |||
| wxOrder.setCUserId(user.getId()); | |||
| final PageInfo<WxOrder> page = wxOrderService.listAsPage(wxOrder, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @@ -31,7 +31,7 @@ import java.nio.charset.Charset; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxPayOrder") | |||
| @RequestMapping("/api/pay") | |||
| public class WxPayOrderController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxPayOrderController.class); | |||
| @@ -94,7 +94,7 @@ public class WxPayOrderController extends BaseController { | |||
| * @return 同步回调(订单状态主动检查) | |||
| * @throws Exception 可能产生的任何异常 | |||
| */ | |||
| @RequestMapping(value = "callback", method = {RequestMethod.GET, RequestMethod.POST}) | |||
| @RequestMapping(value = "/callback", method = {RequestMethod.GET, RequestMethod.POST}) | |||
| public String __doCallback(HttpServletRequest request) throws Exception { | |||
| logger.info("payment wxpay, callback,request:" + request.toString()); | |||
| @@ -109,7 +109,7 @@ public class WxPayOrderController extends BaseController { | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @GetMapping("/list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| @@ -120,7 +120,7 @@ public class WxPayOrderController extends BaseController { | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| @PostMapping("/add") | |||
| public ResultData add(@RequestBody WxPayOrder wxPayOrder) { | |||
| //Assert.notNull(wxPayOrder.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| @@ -129,7 +129,7 @@ public class WxPayOrderController extends BaseController { | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| @PostMapping("/update") | |||
| public ResultData update(@RequestBody WxPayOrder wxPayOrder) { | |||
| wxPayOrderService.saveOrUpdate(wxPayOrder); | |||
| return new ResultData(); | |||
| @@ -233,77 +233,4 @@ public class WxUserGrantController extends BaseController { | |||
| } | |||
| } | |||
| /** | |||
| * 判断是否是老用户 | |||
| * @param map | |||
| * @return | |||
| */ | |||
| /* | |||
| @PostMapping("/isOldUser") | |||
| @ApiOperation(value = "判断是否是老用户", notes="{\"openId\":\"\"}") | |||
| public R isOldUser(@RequestBody Map<String, String> map) { | |||
| logger.debug(map.toString()); | |||
| String openId = map.get("openId"); | |||
| //登录凭证不能为空 | |||
| if (StringUtils.isBlank(openId)) { | |||
| return R.code(1, "openId 不能为空"); | |||
| } | |||
| R r = new R(); | |||
| try { | |||
| WxUserEntity user1 = wxUserService.queryObjectByOpenId(openId); | |||
| if (user1 != null) { | |||
| logger.info(user1.toString()); | |||
| // nickname, unionId is null, 31 | |||
| // phone is null, 29, | |||
| // idcard,name is null, 30 | |||
| // all have, 32 | |||
| if (!StringUtils.isBlank(user1.getUnionid())) { | |||
| r.put("unionId", user1.getUnionid()); | |||
| } | |||
| if (!StringUtils.isBlank(user1.getPhone())) { | |||
| r.put("phone", user1.getPhone()); | |||
| } | |||
| if (!StringUtils.isBlank(user1.getVipno())) { | |||
| r.put("memberId", user1.getVipno()); | |||
| } | |||
| if (StringUtils.isBlank(user1.getUnionid())) { | |||
| r.put("type", 31).put("code", 31); | |||
| r.put("msg", "是新用户,请跳转到用户授权页!"); | |||
| logger.warn("是新用户,跳转到用户授权页!"); | |||
| return r; | |||
| } | |||
| if (StringUtils.isBlank(user1.getPhone())) { | |||
| r.put("type", 29).put("code", 29); | |||
| r.put("msg", "是新用户,跳转到授权手机号页!"); | |||
| logger.warn("是新用户,跳转到授权手机号页!"); | |||
| return r; | |||
| } | |||
| if (StringUtils.isBlank(user1.getVipno())) { | |||
| r.put("type",28).put("code", 28); | |||
| r.put("msg", "是新用户,跳转到注册华联会员!"); | |||
| logger.warn("是新用户,跳转到注册华联会员!"); | |||
| return r; | |||
| } | |||
| r.put("type",32).put("code", 32); | |||
| r.put("msg", "老用户"); | |||
| return r; | |||
| } else { | |||
| r.put("type", 31).put("code", 31); | |||
| r.put("msg", "是新用户,请跳转到用户授权页!"); | |||
| logger.warn("是新用户,跳转到用户授权页!"); | |||
| return r; | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage(), e); | |||
| return R.error(e.toString()); | |||
| } | |||
| }*/ | |||
| } | |||