'完成卡卷基本信息配置、上架审批'

dev-discount
hurui 4 years ago
parent 8eccefdc26
commit 7e3e0ad72b
  1. 94
      hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java
  2. 8
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  3. 3
      hai-service/src/main/java/com/hai/common/exception/ErrorCode.java
  4. 13
      hai-service/src/main/java/com/hai/model/HighCouponCodeModel.java
  5. 10
      hai-service/src/main/java/com/hai/model/HighCouponHandselModel.java
  6. 12
      hai-service/src/main/java/com/hai/model/HighCouponModel.java
  7. 24
      hai-service/src/main/java/com/hai/service/HighApproveService.java
  8. 14
      hai-service/src/main/java/com/hai/service/HighCouponCodeService.java
  9. 60
      hai-service/src/main/java/com/hai/service/HighCouponHandselService.java
  10. 27
      hai-service/src/main/java/com/hai/service/HighCouponService.java
  11. 21
      hai-service/src/main/java/com/hai/service/HighGoodsPriceReferService.java
  12. 13
      hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java
  13. 13
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java
  14. 74
      hai-service/src/main/java/com/hai/service/impl/HighCouponHandselServiceImpl.java
  15. 85
      hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java
  16. 26
      hai-service/src/main/java/com/hai/service/impl/HighGoodsPriceReferServiceImpl.java

@ -0,0 +1,94 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighApprove;
import com.hai.entity.HighCouponHandsel;
import com.hai.entity.HighMerchant;
import com.hai.model.HighCouponModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighApproveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
/**
* @ClassName HighApproveController
* @Description: 审批操作
* @Author 胡锐
* @Date 2021/3/16
**/
@Controller
@RequestMapping(value = "/coupon")
@Api(value = "卡卷接口")
public class HighApproveController {
private static Logger log = LoggerFactory.getLogger(HighApproveController.class);
@Autowired
private UserCenter userCenter;
@Resource
private HighApproveService highApproveService;
@RequestMapping(value="/approveProcessed",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "审批")
public ResponseData approveProcessed(@RequestBody String reqBody, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
JSONObject jsonObject = JSONObject.parseObject(reqBody);
Long approveId = jsonObject.getLong("approveId");
Integer status = jsonObject.getInteger("status");
String remarks = jsonObject.getString("remarks");
if(approveId == null || status == null) {
log.error("HighCouponController -> approveProcessed() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询审批记录
HighApprove approve = highApproveService.getApproveById(approveId);
if (approve == null) {
log.error("HighCouponController -> approveProcessed() error!","未找到审批记录");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_APPROVE, "");
}
if (approve.getStatus() != 1) {
log.error("HighCouponController -> approveProcessed() error!","审批已处理");
throw ErrorHelp.genException(SysCode.System, ErrorCode.APPROVE_PROCESSED, "");
}
approve.setRemarks(remarks);
approve.setUpdateTime(new Date());
approve.setApproveOperatorId(userInfoModel.getSecUser().getId());
approve.setApproveOperatorName(userInfoModel.getSecUser().getUserName());
highApproveService.approveProcessed(approve);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighCouponController -> approveProcessed() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -232,7 +232,7 @@ public class HighCouponController {
public ResponseData ofShelfApprove(@RequestParam(name = "id", required = true) Long id) { public ResponseData ofShelfApprove(@RequestParam(name = "id", required = true) Long id) {
try { try {
highCouponService.ofShelfApprove(id); highCouponService.ofShelfCoupon(id);
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");
} catch (Exception e) { } catch (Exception e) {
@ -258,13 +258,17 @@ public class HighCouponController {
@RequestMapping(value="/getCouponList",method = RequestMethod.GET) @RequestMapping(value="/getCouponList",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "卡卷列表") @ApiOperation(value = "卡卷列表")
public ResponseData getCouponList(@RequestParam(name = "couponName", required = false) String couponName, public ResponseData getCouponList(@RequestParam(name = "companyId", required = false) Long companyId,
@RequestParam(name = "merchantId", required = false) Long merchantId,
@RequestParam(name = "couponName", required = false) String couponName,
@RequestParam(name = "couponType", required = false) Integer couponType, @RequestParam(name = "couponType", required = false) Integer couponType,
@RequestParam(name = "status", required = false) Integer status, @RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) { @RequestParam(name = "pageSize", required = true) Integer pageSize) {
try { try {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("companyId", companyId);
map.put("merchantId", merchantId);
map.put("couponName", couponName); map.put("couponName", couponName);
map.put("couponType", couponType); map.put("couponType", couponType);
map.put("status", status); map.put("status", status);

@ -83,7 +83,8 @@ public enum ErrorCode {
NOT_FOUND_COUPON("2111","未找到卡卷信息"), NOT_FOUND_COUPON("2111","未找到卡卷信息"),
WRITE_COUPON_NUMBER_ERROR("2112","请填写卡卷数量"), WRITE_COUPON_NUMBER_ERROR("2112","请填写卡卷数量"),
COUPON_UNABLE_UP_SHELF("2113","卡卷状态错误"), COUPON_UNABLE_UP_SHELF("2113","卡卷状态错误"),
NOT_FOUND_APPROVE("2114","未找到审批记录"),
APPROVE_PROCESSED("2115","审批已处理"),
STATUS_ERROR("3000","状态错误"), STATUS_ERROR("3000","状态错误"),
ADD_DATA_ERROR("3001","增加数据失败"), ADD_DATA_ERROR("3001","增加数据失败"),

@ -0,0 +1,13 @@
package com.hai.model;
/**
* @ClassName HighCouponCodeModel
* @Description:
* @Author 胡锐
* @Date 2021/3/16
**/
public interface HighCouponCodeModel {
}

@ -10,13 +10,13 @@ import com.hai.entity.HighCouponHandsel;
*/ */
public class HighCouponHandselModel extends HighCouponHandsel { public class HighCouponHandselModel extends HighCouponHandsel {
HighCoupon highCoupon; HighCouponModel highCouponModel;
public HighCoupon getHighCoupon() { public HighCouponModel getHighCouponModel() {
return highCoupon; return highCouponModel;
} }
public void setHighCoupon(HighCoupon highCoupon) { public void setHighCouponModel(HighCouponModel highCouponModel) {
this.highCoupon = highCoupon; this.highCouponModel = highCouponModel;
} }
} }

@ -12,8 +12,20 @@ import java.util.List;
*/ */
public class HighCouponModel extends HighCoupon { public class HighCouponModel extends HighCoupon {
// 库存数量
private Integer stockCount;
// 赠送卡卷
List<HighCouponHandselModel> handselCouponList; List<HighCouponHandselModel> handselCouponList;
public Integer getStockCount() {
return stockCount;
}
public void setStockCount(Integer stockCount) {
this.stockCount = stockCount;
}
public List<HighCouponHandselModel> getHandselCouponList() { public List<HighCouponHandselModel> getHandselCouponList() {
return handselCouponList; return handselCouponList;
} }

@ -2,6 +2,8 @@ package com.hai.service;
import com.hai.entity.HighApprove; import com.hai.entity.HighApprove;
import java.util.List;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
* @Description: * @Description:
@ -16,4 +18,26 @@ public interface HighApproveService {
**/ **/
void insertApprove(HighApprove highApprove); void insertApprove(HighApprove highApprove);
/**
*
* @Title: getApproveById
* @Author 胡锐
* @Description: 根据id查询审批记录
* @Date 15:01 2021/3/16
* @Param [id]
* @return com.hai.entity.HighApprove
**/
HighApprove getApproveById(Long id);
/**
*
* @Title: approveProcessed
* @Author 胡锐
* @Description: 处理审批
* @Date 15:31 2021/3/16
* @Param [highApprove]
* @return void
**/
void approveProcessed(HighApprove highApprove);
} }

@ -1,6 +1,9 @@
package com.hai.service; package com.hai.service;
import com.hai.entity.HighCouponCode; import com.hai.entity.HighCouponCode;
import com.hai.model.HighCouponCodeModel;
import java.util.List;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
@ -16,4 +19,15 @@ public interface HighCouponCodeService {
**/ **/
void insertCouponCode(HighCouponCode highCouponCode); void insertCouponCode(HighCouponCode highCouponCode);
/**
*
* @Title: getStockCountByCoupon
* @Author 胡锐
* @Description: 查询卡卷的库存数量
* @Date 11:24 2021/3/16
* @Param [couponId]
* @return java.lang.Integer
**/
Integer getStockCountByCoupon(Long couponId);
} }

@ -0,0 +1,60 @@
package com.hai.service;
import com.hai.entity.HighCouponHandsel;
import com.hai.model.HighCouponHandselModel;
import java.util.List;
import java.util.Map;
/**
* @ClassName HighCouponHandselService
* @Description: 赠送卡卷配置
* @Author 胡锐
* @Date 2021/3/16
**/
public interface HighCouponHandselService {
/**
*
* @Title: insertCouponHandsel
* @Author 胡锐
* @Description: 增加
* @Date 11:02 2021/3/16
* @Param [highCouponHandsel]
* @return void
**/
void insertCouponHandsel(HighCouponHandsel highCouponHandsel);
/**
*
* @Title: updateCouponHandsel
* @Author 胡锐
* @Description: 修改
* @Date 11:04 2021/3/16
* @Param [highCouponHandsel]
* @return void
**/
void updateCouponHandsel(HighCouponHandsel highCouponHandsel);
/**
*
* @Title: getCouponHandselById
* @Author 胡锐
* @Description: 根据id查询
* @Date 11:06 2021/3/16
* @Param [id]
* @return com.hai.model.HighCouponHandselModel
**/
HighCouponHandselModel getCouponHandselById(Long id);
/**
*
* @Title: getHandselListByCoupon
* @Author 胡锐
* @Description: 根据卡卷 查询赠送配置列表
* @Date 14:18 2021/3/16
* @Param [couponId]
* @return java.util.List<com.hai.model.HighCouponHandselModel>
**/
List<HighCouponHandselModel> getHandselListByCoupon(Long couponId);
}

@ -1,5 +1,6 @@
package com.hai.service; package com.hai.service;
import com.hai.entity.HighApprove;
import com.hai.entity.HighCoupon; import com.hai.entity.HighCoupon;
import com.hai.model.HighCouponModel; import com.hai.model.HighCouponModel;
@ -41,21 +42,43 @@ public interface HighCouponService {
**/ **/
void upShelfApprove(Long id); void upShelfApprove(Long id);
/**
*
* @Title: upShelfApproveResult
* @Author 胡锐
* @Description: 卡卷上架审批结果
* @Date 15:39 2021/3/16
* @Param [highApprove]
* @return void
**/
void upShelfApproveResult(HighApprove highApprove);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 卡卷下架 * @Description 卡卷下架
* @Date 2021/3/14 20:56 * @Date 2021/3/14 20:56
**/ **/
void ofShelfApprove(Long id); void ofShelfCoupon(Long id);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 根据id查询 * @Description 根据id查询卡卷基本信息赠送信息
* @Date 2021/3/14 16:58 * @Date 2021/3/14 16:58
**/ **/
HighCouponModel getCouponById(Long id); HighCouponModel getCouponById(Long id);
/**
*
* @Title: getCouponDetail
* @Author 胡锐
* @Description: 根据id查询卡卷基本信息
* @Date 11:56 2021/3/16
* @Param [id]
* @return com.hai.model.HighCouponModel
**/
HighCouponModel getCouponDetail(Long id);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 获取卡卷集合 * @Description 获取卡卷集合

@ -19,6 +19,17 @@ public interface HighGoodsPriceReferService {
**/ **/
void insertPriceRefer(HighGoodsPriceRefer highGoodsPriceRefer); void insertPriceRefer(HighGoodsPriceRefer highGoodsPriceRefer);
/**
*
* @Title: updatePriceRefer
* @Author 胡锐
* @Description: 修改
* @Date 16:12 2021/3/16
* @Param [highGoodsPriceRefer]
* @return void
**/
void updatePriceRefer(HighGoodsPriceRefer highGoodsPriceRefer);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 卡卷价格 处于待编辑已生效待生效审批中 全部失效 * @Description 卡卷价格 处于待编辑已生效待生效审批中 全部失效
@ -33,4 +44,14 @@ public interface HighGoodsPriceReferService {
**/ **/
void couponAllInvalidKeepCurrent(Long couponId); void couponAllInvalidKeepCurrent(Long couponId);
/**
*
* @Title: getPriceList
* @Author 胡锐
* @Description: 查询价格列表
* @Date 16:04 2021/3/16
* @Param [map]
* @return java.util.List<com.hai.entity.HighGoodsPriceRefer>
**/
List<HighGoodsPriceRefer> getPriceList(Map<String, Object> map);
} }

@ -40,7 +40,18 @@ public class HighApproveServiceImpl implements HighApproveService {
if (Objects.equals(highApprove.getObjectType(), ApproveType.UP_SHELF_APPROVE.getType())) { if (Objects.equals(highApprove.getObjectType(), ApproveType.UP_SHELF_APPROVE.getType())) {
highCouponService.upShelfApprove(highApprove.getObjectId()); highCouponService.upShelfApprove(highApprove.getObjectId());
} }
highApproveMapper.insert(highApprove); highApproveMapper.insert(highApprove);
} }
@Override
public HighApprove getApproveById(Long id) {
return highApproveMapper.selectByPrimaryKey(id);
}
@Override
public void approveProcessed(HighApprove highApprove) {
if (highApprove.getObjectType() == ApproveType.UP_SHELF_APPROVE.getType()) {
highCouponService.upShelfApproveResult(highApprove);
}
}
} }

@ -1,13 +1,13 @@
package com.hai.service.impl; package com.hai.service.impl;
import com.hai.dao.HighCouponCodeMapper; import com.hai.dao.HighCouponCodeMapper;
import com.hai.entity.HighCoupon;
import com.hai.entity.HighCouponCode; import com.hai.entity.HighCouponCode;
import com.hai.model.HighCouponModel; import com.hai.entity.HighCouponCodeExample;
import com.hai.service.HighCouponCodeService; import com.hai.service.HighCouponCodeService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
@ -24,4 +24,13 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
public void insertCouponCode(HighCouponCode highCouponCode) { public void insertCouponCode(HighCouponCode highCouponCode) {
highCouponCodeMapper.insert(highCouponCode); highCouponCodeMapper.insert(highCouponCode);
} }
@Override
public Integer getStockCountByCoupon(Long couponId) {
HighCouponCodeExample example = new HighCouponCodeExample();
example.createCriteria().andStatusEqualTo(1).andSalesEndTimeLessThan(new Date());
return highCouponCodeMapper.selectByExample(example).size();
}
} }

@ -0,0 +1,74 @@
package com.hai.service.impl;
import com.hai.dao.HighCouponHandselMapper;
import com.hai.entity.HighCoupon;
import com.hai.entity.HighCouponHandsel;
import com.hai.entity.HighCouponHandselExample;
import com.hai.model.HighCouponHandselModel;
import com.hai.service.HighCouponHandselService;
import com.hai.service.HighCouponService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @ClassName HighCouponHandselServiceImpl
* @Description: TODO ()
* @Author 胡锐
* @Date 2021/3/16
**/
@Service("highCouponHandselService")
public class HighCouponHandselServiceImpl implements HighCouponHandselService {
@Resource
private HighCouponHandselMapper highCouponHandselMapper;
@Resource
private HighCouponService highCouponService;
@Override
public void insertCouponHandsel(HighCouponHandsel highCouponHandsel) {
highCouponHandselMapper.insert(highCouponHandsel);
}
@Override
public void updateCouponHandsel(HighCouponHandsel highCouponHandsel) {
highCouponHandselMapper.updateByPrimaryKey(highCouponHandsel);
}
@Override
public HighCouponHandselModel getCouponHandselById(Long id) {
HighCouponHandsel handsel = highCouponHandselMapper.selectByPrimaryKey(id);
if (handsel != null) {
HighCouponHandselModel model = new HighCouponHandselModel();
BeanUtils.copyProperties(handsel, model);
model.setHighCouponModel(highCouponService.getCouponDetail(handsel.getId()));
return model;
}
return null;
}
@Override
public List<HighCouponHandselModel> getHandselListByCoupon(Long couponId) {
HighCouponHandselExample example = new HighCouponHandselExample();
example.createCriteria().andCouponIdEqualTo(couponId).andStatusEqualTo(1);
List<HighCouponHandsel> list = highCouponHandselMapper.selectByExample(example);
if (list != null && list.size() > 0) {
HighCouponHandselModel model;
List<HighCouponHandselModel> modelList = new ArrayList<>();
for (HighCouponHandsel handsel : list) {
model = new HighCouponHandselModel();
BeanUtils.copyProperties(handsel, model);
model.setHighCouponModel(highCouponService.getCouponDetail(handsel.getId()));
modelList.add(model);
}
return modelList;
}
return new ArrayList<>();
}
}

@ -8,9 +8,7 @@ import com.hai.dao.HighCouponMapper;
import com.hai.entity.*; import com.hai.entity.*;
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.*;
import com.hai.service.HighCouponService;
import com.hai.service.HighGoodsPriceReferService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -20,10 +18,7 @@ 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.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
@ -37,7 +32,7 @@ public class HighCouponServiceImpl implements HighCouponService {
private HighCouponMapper highCouponMapper; private HighCouponMapper highCouponMapper;
@Resource @Resource
private HighCouponHandselMapper highCouponHandselMapper; private HighCouponHandselService highCouponHandselService;
@Resource @Resource
private HighGoodsPriceReferService highGoodsPriceReferService; private HighGoodsPriceReferService highGoodsPriceReferService;
@ -45,6 +40,9 @@ public class HighCouponServiceImpl implements HighCouponService {
@Resource @Resource
private HighCouponCodeService highCouponCodeService; private HighCouponCodeService highCouponCodeService;
@Resource
private HighApproveService highApproveService;
@Override @Override
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public void insertCoupon(HighCouponModel highCouponModel) { public void insertCoupon(HighCouponModel highCouponModel) {
@ -54,7 +52,7 @@ public class HighCouponServiceImpl implements HighCouponService {
if (highCouponModel.getHandselCouponList() != null && highCouponModel.getHandselCouponList().size() > 0) { if (highCouponModel.getHandselCouponList() != null && highCouponModel.getHandselCouponList().size() > 0) {
for (HighCouponHandselModel handsel : highCouponModel.getHandselCouponList()) { for (HighCouponHandselModel handsel : highCouponModel.getHandselCouponList()) {
handsel.setCouponId(highCouponModel.getId()); handsel.setCouponId(highCouponModel.getId());
highCouponHandselMapper.insert(handsel); highCouponHandselService.insertCouponHandsel(handsel);
} }
} }
@ -82,12 +80,12 @@ public class HighCouponServiceImpl implements HighCouponService {
for (HighCouponHandselModel handsel : highCouponModel.getHandselCouponList()) { for (HighCouponHandselModel handsel : highCouponModel.getHandselCouponList()) {
// 状态标记为删除的,进行删除操作 // 状态标记为删除的,进行删除操作
if (handsel.getStatus() == 0) { if (handsel.getStatus() == 0) {
highCouponHandselMapper.deleteByPrimaryKey(handsel.getId()); highCouponHandselService.updateCouponHandsel(handsel);
} }
// id为空的,进行增加操作 // id为空的,进行增加操作
if (handsel.getId() == null) { if (handsel.getId() == null) {
handsel.setCouponId(highCouponModel.getId()); handsel.setCouponId(highCouponModel.getId());
highCouponHandselMapper.insert(handsel); highCouponHandselService.insertCouponHandsel(handsel);
} }
} }
} }
@ -135,7 +133,45 @@ public class HighCouponServiceImpl implements HighCouponService {
@Override @Override
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public void ofShelfApprove(Long id) { public void upShelfApproveResult(HighApprove highApprove) {
// 查询卡卷
HighCouponModel couponDetail = getCouponDetail(highApprove.getObjectId());
if (couponDetail == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, "");
}
if (couponDetail.getStatus() != 101) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_UNABLE_UP_SHELF, "");
}
// 状态: 1:待审批 2:驳回 3:通过
if (highApprove.getStatus() == 1) {
couponDetail.setStatus(2);
Map<String, Object> map = new HashMap<>();
map.put("objectType", 1);
map.put("objectId", couponDetail.getId());
map.put("status", 1);
List<HighGoodsPriceRefer> list = highGoodsPriceReferService.getPriceList(map);
if (list != null && list.size() > 0) {
for (HighGoodsPriceRefer priceRefer : list) {
priceRefer.setEffectiveTime(new Date());
priceRefer.setStatus(3);
highGoodsPriceReferService.updatePriceRefer(priceRefer);
}
}
}
if (highApprove.getStatus() == 2) {
couponDetail.setStatus(102);
}
highCouponMapper.updateByPrimaryKey(couponDetail);
highApproveService.approveProcessed(highApprove);
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void ofShelfCoupon(Long id) {
HighCouponModel coupon = getCouponById(id); HighCouponModel coupon = getCouponById(id);
if (coupon == null) { if (coupon == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, "");
@ -159,8 +195,23 @@ public class HighCouponServiceImpl implements HighCouponService {
} }
HighCouponModel model = new HighCouponModel(); HighCouponModel model = new HighCouponModel();
BeanUtils.copyProperties(highCoupon, model); BeanUtils.copyProperties(highCoupon, model);
// 查询有效库存
model.setSalesCount(highCouponCodeService.getStockCountByCoupon(highCoupon.getId()));
// 查询赠送卡卷列表
model.setHandselCouponList(highCouponHandselService.getHandselListByCoupon(highCoupon.getId()));
return model;
}
@Override
public HighCouponModel getCouponDetail(Long id) {
HighCoupon highCoupon = highCouponMapper.selectByPrimaryKey(id);
if (highCoupon == null) {
return null;
}
HighCouponModel model = new HighCouponModel();
BeanUtils.copyProperties(highCoupon, model);
// 查询有效库存
model.setSalesCount(highCouponCodeService.getStockCountByCoupon(highCoupon.getId()));
return model; return model;
} }
@ -169,6 +220,14 @@ public class HighCouponServiceImpl implements HighCouponService {
HighCouponExample example = new HighCouponExample(); HighCouponExample example = new HighCouponExample();
HighCouponExample.Criteria criteria = example.createCriteria(); HighCouponExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "companyId") != null) {
criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId"));
}
if (MapUtils.getLong(map, "merchantId") != null) {
criteria.andMerchantIdEqualTo(MapUtils.getLong(map, "merchantId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "couponName"))) { if (StringUtils.isNotBlank(MapUtils.getString(map, "couponName"))) {
criteria.andCouponNameLike("%" + MapUtils.getString(map, "couponName") + "%"); criteria.andCouponNameLike("%" + MapUtils.getString(map, "couponName") + "%");
} }

@ -29,6 +29,11 @@ public class HighGoodsPriceReferServiceImpl implements HighGoodsPriceReferServic
highGoodsPriceReferMapper.insert(highGoodsPriceRefer); highGoodsPriceReferMapper.insert(highGoodsPriceRefer);
} }
@Override
public void updatePriceRefer(HighGoodsPriceRefer highGoodsPriceRefer) {
highGoodsPriceReferMapper.updateByPrimaryKey(highGoodsPriceRefer);
}
@Override @Override
public void couponAllPriceInvalid(Long couponId) { public void couponAllPriceInvalid(Long couponId) {
List<Integer> statusList = new ArrayList<>(); List<Integer> statusList = new ArrayList<>();
@ -67,5 +72,26 @@ public class HighGoodsPriceReferServiceImpl implements HighGoodsPriceReferServic
} }
} }
@Override
public List<HighGoodsPriceRefer> getPriceList(Map<String, Object> map) {
HighGoodsPriceReferExample example = new HighGoodsPriceReferExample();
HighGoodsPriceReferExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map, "objectType") != null) {
criteria.andObjectTypeEqualTo(MapUtils.getInteger(map, "objectType"));
}
if (MapUtils.getLong(map, "objectId") != null) {
criteria.andObjectIdEqualTo(MapUtils.getLong(map, "objectId"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
criteria.andStatusNotEqualTo(0);
return highGoodsPriceReferMapper.selectByExample(example);
}
} }

Loading…
Cancel
Save