|
|
|
@@ -1,26 +1,39 @@ |
|
|
|
package com.simple.controller; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.log4j.Logger; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.simple.common.Result; |
|
|
|
import com.simple.common.ResultData; |
|
|
|
|
|
|
|
import com.simple.domain.po.WxCoupon; |
|
|
|
import com.simple.domain.po.WxMerchant; |
|
|
|
import com.simple.service.WxCouponService; |
|
|
|
import com.simple.service.WxMerchantService; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequestMapping("wxCoupon") |
|
|
|
@Api(description="优惠券接口") |
|
|
|
public class WxCouponController extends BaseController |
|
|
|
{ |
|
|
|
@Autowired |
|
|
|
private WxCouponService wxCouponService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxMerchantService wxMerchantService; |
|
|
|
|
|
|
|
private Logger logger = Logger.getLogger(WxCouponController.class); |
|
|
|
|
|
|
|
@@ -43,7 +56,11 @@ public class WxCouponController extends BaseController |
|
|
|
public ResultData add(@RequestBody WxCoupon wxCoupon) { |
|
|
|
//Assert.notNull(wxCoupon.getName(), "角色名不能为空"); |
|
|
|
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); |
|
|
|
wxCouponService.saveOrUpdate(wxCoupon); |
|
|
|
if(StringUtils.isNotBlank(wxCoupon.getBusiness())) { |
|
|
|
String[] arys = wxCoupon.getBusiness().split(","); |
|
|
|
wxCoupon.setBusiness(JSON.toJSONString(arys)); |
|
|
|
} |
|
|
|
wxCouponService.saveOrUpdate(wxCoupon); |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -66,7 +83,10 @@ public class WxCouponController extends BaseController |
|
|
|
@GetMapping("/findById") |
|
|
|
@ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) |
|
|
|
public ResultData findById(Long id) { |
|
|
|
return new ResultData(Result.SUCCESS,"查询成功",wxCouponService.getById(id)); |
|
|
|
WxCoupon c = wxCouponService.getById(id); |
|
|
|
WxMerchant merchant = wxMerchantService.getById(c.getMerchantId()); |
|
|
|
c.setWxMerchant(merchant); |
|
|
|
return new ResultData(Result.SUCCESS,"查询成功",c); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|