Просмотр исходного кода

更新优惠劵查询格式问题

release_toaliyun_real
jinguo24@163.com 7 лет назад
Родитель
Сommit
be6fed4d5d
2 измененных файлов: 37 добавлений и 5 удалений
  1. +25
    -5
      mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java
  2. +12
    -0
      mallinkService/src/main/java/com/simple/domain/po/WxCoupon.java

+ 25
- 5
mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java Просмотреть файл

@@ -1,26 +1,39 @@
package com.simple.controller; package com.simple.controller;


import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; 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.github.pagehelper.PageInfo;
import com.simple.common.Result; import com.simple.common.Result;
import com.simple.common.ResultData; import com.simple.common.ResultData;

import com.simple.domain.po.WxCoupon; import com.simple.domain.po.WxCoupon;
import com.simple.domain.po.WxMerchant;
import com.simple.service.WxCouponService; import com.simple.service.WxCouponService;
import com.simple.service.WxMerchantService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;


@RestController @RestController
@RequestMapping("wxCoupon") @RequestMapping("wxCoupon")
@Api(description="优惠券接口")
public class WxCouponController extends BaseController public class WxCouponController extends BaseController
{ {
@Autowired @Autowired
private WxCouponService wxCouponService; private WxCouponService wxCouponService;
@Autowired
private WxMerchantService wxMerchantService;


private Logger logger = Logger.getLogger(WxCouponController.class); private Logger logger = Logger.getLogger(WxCouponController.class);
@@ -43,7 +56,11 @@ public class WxCouponController extends BaseController
public ResultData add(@RequestBody WxCoupon wxCoupon) { public ResultData add(@RequestBody WxCoupon wxCoupon) {
//Assert.notNull(wxCoupon.getName(), "角色名不能为空"); //Assert.notNull(wxCoupon.getName(), "角色名不能为空");
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); //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(); return new ResultData();
} }


@@ -66,7 +83,10 @@ public class WxCouponController extends BaseController
@GetMapping("/findById") @GetMapping("/findById")
@ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true)
public ResultData findById(Long id) { 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);
} }


+ 12
- 0
mallinkService/src/main/java/com/simple/domain/po/WxCoupon.java Просмотреть файл

@@ -119,6 +119,18 @@ public class WxCoupon implements Serializable {
/*业态**/ /*业态**/
@io.swagger.annotations.ApiModelProperty(value="业态",name="business") @io.swagger.annotations.ApiModelProperty(value="业态",name="business")
private String business; private String business;
@Transient
private WxMerchant wxMerchant;
public WxMerchant getWxMerchant() {
return wxMerchant;
}

public void setWxMerchant(WxMerchant wxMerchant) {
this.wxMerchant = wxMerchant;
}

public String getTenantId() { public String getTenantId() {
return tenantId; return tenantId;
} }


Загрузка…
Отмена
Сохранить