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 = "查询价格列表")