From b9d11e53d8880c0a0c263647caddec1065bd20bd Mon Sep 17 00:00:00 2001 From: 199901012 Date: Mon, 22 Mar 2021 22:46:04 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HighGoodsPriceReferController.java | 61 ++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGoodsPriceReferController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGoodsPriceReferController.java index ca916280..95d3fb91 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGoodsPriceReferController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGoodsPriceReferController.java @@ -59,8 +59,13 @@ public class HighGoodsPriceReferController { if (highGoodsPriceRefer.getObjectType() == null || highGoodsPriceRefer.getObjectId() == null || highGoodsPriceRefer.getPromptlyType() == null - || highGoodsPriceRefer.getNewSalePrice() == null - || highGoodsPriceRefer.getEffectiveTime() == null) { + || highGoodsPriceRefer.getNewSalePrice() == null) { + log.error("HighGoodsPriceReferController -> insertGoodsPriceRefer() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 是否及时生效 否:需要填写生效时间 + if (highGoodsPriceRefer.getPromptlyType() == false && highGoodsPriceRefer.getEffectiveTime() == null) { log.error("HighGoodsPriceReferController -> insertGoodsPriceRefer() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } @@ -79,6 +84,58 @@ public class HighGoodsPriceReferController { } } + @RequestMapping(value="/updateGoodsPriceRefer",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "修改产品销售价格") + public ResponseData updateGoodsPriceRefer(@RequestBody HighGoodsPriceRefer highGoodsPriceRefer, HttpServletRequest request) { + try { + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + if (highGoodsPriceRefer.getId() == null + || highGoodsPriceRefer.getObjectType() == null + || highGoodsPriceRefer.getObjectId() == null + || highGoodsPriceRefer.getPromptlyType() == null + || highGoodsPriceRefer.getNewSalePrice() == null) { + log.error("HighGoodsPriceReferController -> insertGoodsPriceRefer() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 是否及时生效 否:需要填写生效时间 + if (highGoodsPriceRefer.getPromptlyType() == false && highGoodsPriceRefer.getEffectiveTime() == null) { + log.error("HighGoodsPriceReferController -> insertGoodsPriceRefer() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 查询价格信息 + HighGoodsPriceRefer refer = highGoodsPriceReferService.getPriceReferById(highGoodsPriceRefer.getId()); + if (refer == null) { + log.error("HighGoodsPriceReferController -> insertGoodsPriceRefer() error!","未找到价格信息"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.GOODS_PRICE_REFER_ERROR, ""); + } + + // 只有审批驳回后才能修改 + if (refer.getStatus() != 102) { + log.error("HighGoodsPriceReferController -> insertGoodsPriceRefer() error!","状态错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); + } + + refer.setObjectType(highGoodsPriceRefer.getObjectType()); + refer.setObjectId(highGoodsPriceRefer.getObjectId()); + refer.setPromptlyType(highGoodsPriceRefer.getPromptlyType()); + refer.setNewSalePrice(highGoodsPriceRefer.getNewSalePrice()); + refer.setStatus(101); // 状态: 0:删除 1:待编辑 2:待生效 3:已生效 4:已失效 101.审批中 102.审批驳回 + refer.setOperatorId(userInfoModel.getSecUser().getId()); + refer.setOperatorName(userInfoModel.getSecUser().getUserName()); + highGoodsPriceReferService.updatePriceRefer(refer); + + 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 = "查询价格列表")