'提交代码'

dev-discount
199901012 4 years ago
parent c9faca55ad
commit 9da0d16342
  1. 44
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  2. 10
      hai-service/src/main/java/com/hai/service/HighCouponService.java
  3. 37
      hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java

@ -1,5 +1,7 @@
package com.bweb.controller; package com.bweb.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
@ -28,6 +30,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
@ -183,7 +187,7 @@ public class HighCouponController {
} }
} }
@RequestMapping(value="/upShelfApprove",method = RequestMethod.POST) @RequestMapping(value="/upShelfApprove",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "卡卷上架审批") @ApiOperation(value = "卡卷上架审批")
public ResponseData upShelfApprove(@RequestParam(name = "id", required = true) Long id, HttpServletRequest request) { public ResponseData upShelfApprove(@RequestParam(name = "id", required = true) Long id, HttpServletRequest request) {
@ -222,7 +226,7 @@ public class HighCouponController {
} }
} }
@RequestMapping(value="/ofShelfApprove",method = RequestMethod.POST) @RequestMapping(value="/ofShelfApprove",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "卡卷下架") @ApiOperation(value = "卡卷下架")
public ResponseData ofShelfApprove(@RequestParam(name = "id", required = true) Long id) { public ResponseData ofShelfApprove(@RequestParam(name = "id", required = true) Long id) {
@ -237,4 +241,40 @@ public class HighCouponController {
} }
} }
@RequestMapping(value="/getCouponById",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id 查询卡卷")
public ResponseData getCouponById(@RequestParam(name = "id", required = true) Long id) {
try {
return ResponseMsgUtil.success(highCouponService.getCouponById(id));
} catch (Exception e) {
log.error("HighCouponController -> getCouponById() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getCouponList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "卡卷列表")
public ResponseData getCouponList(@RequestParam(name = "couponName", required = false) String couponName,
@RequestParam(name = "couponType", required = false) Integer couponType,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
Map<String, Object> map = new HashMap<>();
map.put("couponName", couponName);
map.put("couponType", couponType);
map.put("status", status);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highCouponService.getCouponList(map)));
} catch (Exception e) {
log.error("HighCouponController -> getCouponList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -3,6 +3,9 @@ package com.hai.service;
import com.hai.entity.HighCoupon; import com.hai.entity.HighCoupon;
import com.hai.model.HighCouponModel; import com.hai.model.HighCouponModel;
import java.util.List;
import java.util.Map;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
* @Description: * @Description:
@ -53,4 +56,11 @@ public interface HighCouponService {
**/ **/
HighCouponModel getCouponById(Long id); HighCouponModel getCouponById(Long id);
/**
* @Author 胡锐
* @Description 获取卡卷集合
* @Date 2021/3/15 23:12
**/
List<HighCouponModel> getCouponList(Map<String, Object> map);
} }

@ -5,23 +5,25 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.dao.HighCouponHandselMapper; import com.hai.dao.HighCouponHandselMapper;
import com.hai.dao.HighCouponMapper; import com.hai.dao.HighCouponMapper;
import com.hai.entity.HighCoupon; import com.hai.entity.*;
import com.hai.entity.HighCouponCode;
import com.hai.entity.HighCouponHandsel;
import com.hai.entity.HighGoodsPriceRefer;
import com.hai.model.HighCouponHandselModel; import com.hai.model.HighCouponHandselModel;
import com.hai.model.HighCouponModel; import com.hai.model.HighCouponModel;
import com.hai.service.HighCouponCodeService; import com.hai.service.HighCouponCodeService;
import com.hai.service.HighCouponService; import com.hai.service.HighCouponService;
import com.hai.service.HighGoodsPriceReferService; import com.hai.service.HighGoodsPriceReferService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
@ -147,7 +149,6 @@ public class HighCouponServiceImpl implements HighCouponService {
// 卡卷价格全部失效。但保留当前生效的价格 // 卡卷价格全部失效。但保留当前生效的价格
highGoodsPriceReferService.couponAllInvalidKeepCurrent(coupon.getId()); highGoodsPriceReferService.couponAllInvalidKeepCurrent(coupon.getId());
} }
@Override @Override
@ -162,4 +163,30 @@ public class HighCouponServiceImpl implements HighCouponService {
return model; return model;
} }
@Override
public List<HighCouponModel> getCouponList(Map<String, Object> map) {
HighCouponExample example = new HighCouponExample();
HighCouponExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(MapUtils.getString(map, "couponName"))) {
criteria.andCouponNameLike("%" + MapUtils.getString(map, "couponName") + "%");
}
if (MapUtils.getInteger(map, "couponType") != null) {
criteria.andCouponTypeEqualTo(MapUtils.getInteger(map, "couponType"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
List<HighCoupon> coupons = highCouponMapper.selectByExample(example);
if (coupons != null && coupons.size() > 0) {
List<HighCouponModel> list = new ArrayList<>();
BeanUtils.copyProperties(coupons, list);
return list;
}
return new ArrayList<>();
}
} }

Loading…
Cancel
Save