'提交代码'

dev-discount
199901012 4 years ago
parent b1238b9ce5
commit 3933f99a31
  1. 105
      hai-bweb/src/main/java/com/bweb/controller/HighGoodsPriceReferController.java
  2. 2
      hai-cweb/src/main/resources/dev/config.properties
  3. 1
      hai-service/src/main/java/com/hai/common/exception/ErrorCode.java
  4. 3
      hai-service/src/main/java/com/hai/enum_type/ApproveType.java
  5. 7
      hai-service/src/main/java/com/hai/service/HighApproveService.java
  6. 9
      hai-service/src/main/java/com/hai/service/HighCouponService.java
  7. 7
      hai-service/src/main/java/com/hai/service/HighGoodsPriceReferService.java
  8. 11
      hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java
  9. 34
      hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java
  10. 5
      hai-service/src/main/java/com/hai/service/impl/HighGoodsPriceReferServiceImpl.java

@ -0,0 +1,105 @@
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.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.HighCouponHandsel;
import com.hai.entity.HighGoodsPriceRefer;
import com.hai.entity.HighMerchant;
import com.hai.model.HighCouponModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighGoodsPriceReferService;
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.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @Auther: 胡锐
* @Description:
* @Date: 2021/3/21 20:11
*/
@Controller
@RequestMapping(value = "/highGoodsPriceRefer")
@Api(value = "产品价格配置接口")
public class HighGoodsPriceReferController {
private static Logger log = LoggerFactory.getLogger(HighGoodsPriceReferController.class);
@Autowired
private UserCenter userCenter;
@Resource
private HighGoodsPriceReferService highGoodsPriceReferService;
@RequestMapping(value="/insertGoodsPriceRefer",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "增加产品销售价格")
public ResponseData insertGoodsPriceRefer(@RequestBody HighGoodsPriceRefer highGoodsPriceRefer, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (highGoodsPriceRefer.getObjectType() == null
|| highGoodsPriceRefer.getObjectId() == null
|| highGoodsPriceRefer.getPromptlyType() == null
|| highGoodsPriceRefer.getNewSalePrice() == null
|| highGoodsPriceRefer.getEffectiveTime() == null) {
log.error("HighGoodsPriceReferController -> insertGoodsPriceRefer() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
highGoodsPriceRefer.setCreateTime(new Date());
highGoodsPriceRefer.setStatus(101); // 状态: 0:删除 1:待编辑 2:待生效 3:已生效 4:已失效 101.审批中 102.审批驳回
highGoodsPriceRefer.setOperatorId(userInfoModel.getSecUser().getId());
highGoodsPriceRefer.setOperatorName(userInfoModel.getSecUser().getUserName());
highGoodsPriceReferService.insertPriceRefer(highGoodsPriceRefer);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighGoodsPriceReferController -> insertGoodsPriceRefer() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getPriceReferList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询价格列表")
public ResponseData getPriceReferList(@RequestParam(name = "objectType", required = true) Integer objectType,
@RequestParam(name = "objectId", required = true) Long objectId,
@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("objectType", objectType);
map.put("objectId", objectId);
map.put("status", status);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highGoodsPriceReferService.getPriceList(map)));
} catch (Exception e) {
log.error("HighGoodsPriceReferController -> getPriceReferList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,5 +1,5 @@
wxAppId=wx8d49e2f83025229d
wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df
mvn
fileUrl=/home/project/hsg/filesystem
cmsPath=/home/project/hsg/filesystem/cmsPath

@ -88,6 +88,7 @@ public enum ErrorCode {
COUPON_STOCK_ERROR("2116","卡卷库存数量错误"),
COUPON_TYPE_ERROR("2117","卡卷类型错误"),
COUPON_STATUS_ERROR("2118","卡卷状态错误"),
GOODS_PRICE_REFER_ERROR("2119","未找到价格信息"),
STATUS_ERROR("3000","状态错误"),
ADD_DATA_ERROR("3001","增加数据失败"),

@ -6,7 +6,8 @@ package com.hai.enum_type;
* @Date: 2021/3/14 20:41
*/
public enum ApproveType {
UP_SHELF_APPROVE(1, "卡卷上架审批")
UP_SHELF_APPROVE(1, "卡卷上架审批"),
COUPON_PRICE_APPROVE(2, "卡卷价格审批")
;
private Integer type;

@ -19,6 +19,13 @@ public interface HighApproveService {
**/
void insertApprove(HighApprove highApprove);
/**
* @Author 胡锐
* @Description 修改审批
* @Date 2021/3/21 22:12
**/
void updateApprove(HighApprove highApprove);
/**
*
* @Title: getApproveById

@ -22,8 +22,6 @@ public interface HighCouponService {
**/
void insertCoupon(HighCouponModel highCouponModel);
/**
* @Author 胡锐
* @Description 修改卡卷业务
@ -63,7 +61,12 @@ public interface HighCouponService {
**/
void ofShelfCoupon(Long id);
/**
* @Author 胡锐
* @Description 价格审批结果
* @Date 2021/3/21 22:08
**/
void priceApproveResult(HighApprove highApprove);
/**
* @Author 胡锐

@ -30,6 +30,13 @@ public interface HighGoodsPriceReferService {
**/
void updatePriceRefer(HighGoodsPriceRefer highGoodsPriceRefer);
/**
* @Author 胡锐
* @Description 根据id查询
* @Date 2021/3/21 22:15
**/
HighGoodsPriceRefer getPriceReferById(Long id);
/**
* @Author 胡锐
* @Description 卡卷价格 处于待编辑已生效待生效审批中 全部失效

@ -47,6 +47,11 @@ public class HighApproveServiceImpl implements HighApproveService {
highApproveMapper.insert(highApprove);
}
@Override
public void updateApprove(HighApprove highApprove) {
highApproveMapper.updateByPrimaryKey(highApprove);
}
@Override
public HighApprove getApproveById(Long id) {
return highApproveMapper.selectByPrimaryKey(id);
@ -57,6 +62,12 @@ public class HighApproveServiceImpl implements HighApproveService {
if (highApprove.getObjectType() == ApproveType.UP_SHELF_APPROVE.getType()) {
highCouponService.upShelfApproveResult(highApprove);
}
if (highApprove.getObjectType() == ApproveType.COUPON_PRICE_APPROVE.getType()) {
highCouponService.priceApproveResult(highApprove);
}
updateApprove(highApprove);
}
@Override

@ -166,7 +166,6 @@ public class HighCouponServiceImpl implements HighCouponService {
}
highCouponMapper.updateByPrimaryKey(couponDetail);
highApproveService.approveProcessed(highApprove);
}
@Override
@ -187,6 +186,39 @@ public class HighCouponServiceImpl implements HighCouponService {
highGoodsPriceReferService.couponAllInvalidKeepCurrent(coupon.getId());
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void priceApproveResult(HighApprove highApprove) {
HighGoodsPriceRefer highGoodsPriceRefer = highGoodsPriceReferService.getPriceReferById(highApprove.getObjectId());
if (highGoodsPriceRefer == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.GOODS_PRICE_REFER_ERROR, "");
}
// 状态: 0:删除 1:待编辑 2:待生效 3:已生效 4:已失效 101.审批中 102.审批驳回
if (highGoodsPriceRefer.getStatus() != 101) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, "");
}
// 卡卷信息
HighCouponModel coupon = getCouponById(highGoodsPriceRefer.getObjectId());
if (coupon == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, "");
}
// 状态: 1:待审批 2:驳回 3:通过
if (highApprove.getStatus() == 1) {
// 及时生效 0:否 1:是
if (highGoodsPriceRefer.getPromptlyType() == true) {
coupon.setCouponPrice(highGoodsPriceRefer.getNewSalePrice());
update(coupon);
}
highGoodsPriceRefer.setStatus(2);
}
if (highApprove.getStatus() == 2) {
highGoodsPriceRefer.setStatus(102);
}
highGoodsPriceReferService.updatePriceRefer(highGoodsPriceRefer);
}
@Override
public HighCouponModel getCouponById(Long id) {
HighCoupon highCoupon = highCouponMapper.selectByPrimaryKey(id);

@ -34,6 +34,11 @@ public class HighGoodsPriceReferServiceImpl implements HighGoodsPriceReferServic
highGoodsPriceReferMapper.updateByPrimaryKey(highGoodsPriceRefer);
}
@Override
public HighGoodsPriceRefer getPriceReferById(Long id) {
return highGoodsPriceReferMapper.selectByPrimaryKey(id);
}
@Override
public void couponAllPriceInvalid(Long couponId) {
List<Integer> statusList = new ArrayList<>();

Loading…
Cancel
Save