From 84eebf542ae87ba9a1efde040d18beff1c5c1446 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Sat, 20 Nov 2021 10:46:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E9=80=89=E5=95=86=E5=93=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/HighBrandController.java | 193 +++++++++++++++++- .../bweb/controller/HighCouponController.java | 20 +- .../controller/HighGoodsTypeController.java | 47 ++++- .../bweb/controller/HighOrderController.java | 151 +++++++------- .../cweb/controller/HighCouponController.java | 4 + .../com/hai/common/exception/ErrorCode.java | 1 + .../com/hai/service/HighBrandService.java | 14 +- .../service/impl/HighBrandServiceImpl.java | 22 +- 8 files changed, 358 insertions(+), 94 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighBrandController.java b/hai-bweb/src/main/java/com/bweb/controller/HighBrandController.java index e2be97af..f7a665e8 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighBrandController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighBrandController.java @@ -1,8 +1,33 @@ 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.ResponseMsgUtil; +import com.hai.entity.HighBrand; +import com.hai.entity.HighGoodsType; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.service.HighBrandService; +import com.hai.service.HighGoodsTypeService; 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.RequestMapping; +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: 袁野 @@ -13,4 +38,170 @@ import org.springframework.web.bind.annotation.RequestMapping; @RequestMapping(value = "/highBrand") @Api(value = "品牌接口") public class HighBrandController { + + private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); + + @Autowired + private UserCenter userCenter; + + @Resource + private HighGoodsTypeService highGoodsTypeService; + + @Resource + private HighBrandService highBrandService; + + @RequestMapping(value = "/getBrandByList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取品牌列表") + public ResponseData getBrandByList(@RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + @RequestParam(name = "title", required = false) String title, + @RequestParam(name = "goodTypeId", required = false) String goodTypeId, + HttpServletRequest request) { + try { + + Map map = new HashMap<>(); + map.put("title", title); + map.put("goodTypeId", goodTypeId); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highBrandService.getListBand(map))); + + } catch (Exception e) { + log.error("HighOrderController --> getUserOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/findById", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据id查询详情") + public ResponseData findById(@RequestParam(name = "id", required = true) Integer id) { + try { + + return ResponseMsgUtil.success(highBrandService.findById(id)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getByDelete", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "根据id删除") + public ResponseData getByDelete( + @RequestBody HighBrand highBrand, + HttpServletRequest request + ) { + try { + + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + HighBrand highBrands = highBrandService.findById(highBrand.getId()); + + if (highBrands == null) { + log.error("HighGoodsTypeController --> getGoodsTypeByDelete() error!", "当前品牌不存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.DELETE_DATA_ERROR, ""); + } + + highBrands.setStatus(0); + highBrands.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); + highBrands.setUpdatedTime(new Date()); + + highBrandService.updateBrand(highBrands); + + return ResponseMsgUtil.success("删除成功"); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value = "/insertBrand", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "新增品牌") + public ResponseData insertBrand(@RequestBody HighBrand highBrand, HttpServletRequest request) { + try { + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + + if (StringUtils.isBlank(highBrand.getTitle()) + || StringUtils.isBlank(highBrand.getImg()) + || highBrand.getGoodTypeId() == null + ) { + log.error("HighAgentController -> insertAgent() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 校验账号用户名是否存在 + if (highBrandService.findByTitle(highBrand.getTitle() , highBrand.getGoodTypeId())) { + log.error("HighGoodsTypeController --> insertGoodsType() error!", "已存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ADD_REPEATEDLY, ""); + } + + highBrand.setCreatedTime(new Date()); + highBrand.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); + highBrand.setUpdatedTime(new Date()); + highBrand.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); + highBrand.setStatus(1); + + highBrandService.insertBrand(highBrand); + + return ResponseMsgUtil.success("新增成功"); + + } catch (Exception e) { + log.error("HighAgentController --> insertAgent() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/updateBrand", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "修改品牌") + public ResponseData updateBrand(@RequestBody HighBrand highBrand, HttpServletRequest request) { + try { + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + + if (StringUtils.isBlank(highBrand.getTitle()) + || StringUtils.isBlank(highBrand.getImg()) + || highBrand.getId() == null + || highBrand.getGoodTypeId() == null + ) { + log.error("HighAgentController -> insertAgent() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + HighBrand highBrands = highBrandService.findById(highBrand.getId()); + + // 校验账号用户名是否存在 + if (highBrandService.findByTitle(highBrand.getTitle() , highBrand.getGoodTypeId()) && !highBrand.getId().equals(highBrands.getId())) { + log.error("HighGoodsTypeController --> insertGoodsType() error!", "已存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ADD_REPEATEDLY, ""); + } + + highBrands.setUpdatedTime(new Date()); + highBrands.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); + highBrands.setImg(highBrand.getImg()); + highBrands.setTitle(highBrand.getTitle()); + highBrands.setGoodTypeId(highBrand.getGoodTypeId()); + + highBrandService.updateBrand(highBrands); + + return ResponseMsgUtil.success("修改成功"); + + } catch (Exception e) { + log.error("HighAgentController --> insertAgent() error!", e); + return ResponseMsgUtil.exception(e); + } + } } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java index 9b398a48..a244b2b1 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java @@ -378,14 +378,16 @@ public class HighCouponController { @ResponseBody @ApiOperation(value = "卡卷列表") public ResponseData getCouponList( - @RequestParam(name = "merchantId", required = false) Long merchantId, - @RequestParam(name = "couponName", required = false) String couponName, - @RequestParam(name = "couponType", required = false) Integer couponType, - @RequestParam(name = "displayArea", required = false) Integer displayArea, - @RequestParam(name = "couponSource", required = false) Integer couponSource, - @RequestParam(name = "status", required = false) Integer status, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { + @RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "couponName", required = false) String couponName, + @RequestParam(name = "couponType", required = false) Integer couponType, + @RequestParam(name = "displayArea", required = false) Integer displayArea, + @RequestParam(name = "couponSource", required = false) Integer couponSource, + @RequestParam(name = "brandId", required = false) Integer brandId, + @RequestParam(name = "goodsTypeId", required = false) Integer goodsTypeId, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { SessionObject sessionObject = userCenter.getSessionObject(request); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); @@ -399,6 +401,8 @@ public class HighCouponController { map.put("merchantId", merchantId); map.put("couponName", couponName); map.put("couponType", couponType); + map.put("brandId", brandId); + map.put("goodsTypeId", goodsTypeId); map.put("displayArea", displayArea); map.put("couponSource", couponSource); map.put("status", status); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGoodsTypeController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGoodsTypeController.java index 0232d24a..60f44f58 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGoodsTypeController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGoodsTypeController.java @@ -81,6 +81,41 @@ public class HighGoodsTypeController { } } + @RequestMapping(value = "/getGoodsTypeByDelete", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "根据id删除") + public ResponseData getGoodsTypeByDelete( + @RequestBody HighGoodsType highGoodsType, + HttpServletRequest request + ) { + try { + + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + HighGoodsType highGoodsTypes = highGoodsTypeService.findById(highGoodsType.getId()); + + if (highGoodsTypes == null) { + log.error("HighGoodsTypeController --> getGoodsTypeByDelete() error!", "当前商品类别不存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.DELETE_DATA_ERROR, ""); + } + + highGoodsTypes.setStatus(0); + highGoodsTypes.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); + highGoodsTypes.setUpdatedTime(new Date()); + + highGoodsTypeService.updateGoodsType(highGoodsType); + + return ResponseMsgUtil.success("删除成功"); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/insertGoodsType", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "新增商品类型") @@ -100,8 +135,8 @@ public class HighGoodsTypeController { // 校验账号用户名是否存在 if (highGoodsTypeService.findByTitle(highGoodsType.getTitle())) { - log.error("HighGoodsTypeController --> insertGoodsType() error!", "用户名已存在"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_LOGIN_NAME_IS_EXIST_ERROR, ""); + log.error("HighGoodsTypeController --> insertGoodsType() error!", "已存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ADD_REPEATEDLY, ""); } highGoodsType.setCreatedTime(new Date()); @@ -132,7 +167,7 @@ public class HighGoodsTypeController { if (StringUtils.isBlank(highGoodsType.getTitle()) || StringUtils.isBlank(highGoodsType.getImg()) - || highGoodsType.getId() != null + || highGoodsType.getId() == null ) { log.error("HighAgentController -> insertAgent() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -142,8 +177,8 @@ public class HighGoodsTypeController { // 校验账号用户名是否存在 if (highGoodsTypeService.findByTitle(highGoodsType.getTitle()) && !highGoodsTypes.getId().equals(highGoodsType.getId())) { - log.error("HighGoodsTypeController --> insertGoodsType() error!", "用户名已存在"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_LOGIN_NAME_IS_EXIST_ERROR, ""); + log.error("HighGoodsTypeController --> insertGoodsType() error!", "已存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ADD_REPEATEDLY, ""); } highGoodsTypes.setUpdatedTime(new Date()); @@ -151,7 +186,7 @@ public class HighGoodsTypeController { highGoodsTypes.setImg(highGoodsType.getImg()); highGoodsTypes.setTitle(highGoodsType.getTitle()); - highGoodsTypeService.updateGoodsType(highGoodsType); + highGoodsTypeService.updateGoodsType(highGoodsTypes); return ResponseMsgUtil.success("修改成功"); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java index b6305c4f..370d8555 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java @@ -130,7 +130,7 @@ public class HighOrderController { Map map = new HashMap<>(); if (userInfoModel.getSecRole().getRoleType() == 5) { - map.put("companyId" , userInfoModel.getBsCompany().getId()); + map.put("companyId" , userInfoModel.getBsCompany().getId()); } if (userInfoModel.getSecRole().getRoleType() == 2) { map.put("merchantId" , userInfoModel.getMerchant().getId()); @@ -241,7 +241,12 @@ public class HighOrderController { map.put("merchantId", merchantId); } else if (userInfoModel.getSecUser().getObjectType() == 1) { - map.put("companyId", userInfoModel.getBsCompany().getId()); + if (userInfoModel.getBsCompany().getId() == 3) { + map.put("companyId", 23); + } else { + map.put("companyId", userInfoModel.getBsCompany().getId()); + } + map.put("merchantId", merchantId); } else if (userInfoModel.getSecUser().getObjectType() == 2) { @@ -275,19 +280,19 @@ public class HighOrderController { @ResponseBody @ApiOperation(value = "查询加油订单列表") public ResponseData getGasOrderList(@RequestParam(name = "companyId", required = false) Long companyId, - @RequestParam(name = "merchantId", required = false) Long merchantId, - @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "paySerialNo", required = false) String paySerialNo, - @RequestParam(name = "payModel", required = false) Integer payModel, - @RequestParam(name = "payType", required = false) Integer payType, - @RequestParam(name = "orderStatus", required = false) Integer orderStatus, - @RequestParam(name = "createTimeS", required = false) Long createTimeS, - @RequestParam(name = "createTimeE", required = false) Long createTimeE, - @RequestParam(name = "payTimeS", required = false) Long payTimeS, - @RequestParam(name = "payTimeE", required = false) Long payTimeE, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize, - HttpServletRequest request) { + @RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "payModel", required = false) Integer payModel, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { try { SessionObject sessionObject = userCenter.getSessionObject(request); @@ -383,19 +388,19 @@ public class HighOrderController { @ResponseBody @ApiOperation(value = "查询电影订单列表") public ResponseData getCinemaOrderList(@RequestParam(name = "companyId", required = false) Long companyId, - @RequestParam(name = "merchantId", required = false) Long merchantId, - @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "paySerialNo", required = false) String paySerialNo, - @RequestParam(name = "payModel", required = false) Integer payModel, - @RequestParam(name = "payType", required = false) Integer payType, - @RequestParam(name = "orderStatus", required = false) Integer orderStatus, - @RequestParam(name = "createTimeS", required = false) Long createTimeS, - @RequestParam(name = "createTimeE", required = false) Long createTimeE, - @RequestParam(name = "payTimeS", required = false) Long payTimeS, - @RequestParam(name = "payTimeE", required = false) Long payTimeE, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize, - HttpServletRequest request) { + @RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "payModel", required = false) Integer payModel, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { try { SessionObject sessionObject = userCenter.getSessionObject(request); @@ -437,21 +442,21 @@ public class HighOrderController { @ResponseBody @ApiOperation(value = "根据表示查询订单") public ResponseData getOrderListByIdCode(@RequestParam(name = "merchantId", required = false) Long merchantId, - @RequestParam(name = "identificationCode", required = true) String identificationCode, - @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "paySerialNo", required = false) String paySerialNo, - @RequestParam(name = "memPhone", required = false) String memPhone, - @RequestParam(name = "memDiscountName", required = false) String memDiscountName, - @RequestParam(name = "payModel", required = false) Integer payModel, - @RequestParam(name = "payType", required = false) Integer payType, - @RequestParam(name = "orderStatus", required = false) Integer orderStatus, - @RequestParam(name = "createTimeS", required = false) Long createTimeS, - @RequestParam(name = "createTimeE", required = false) Long createTimeE, - @RequestParam(name = "payTimeS", required = false) Long payTimeS, - @RequestParam(name = "payTimeE", required = false) Long payTimeE, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize, - HttpServletRequest request) { + @RequestParam(name = "identificationCode", required = true) String identificationCode, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "memDiscountName", required = false) String memDiscountName, + @RequestParam(name = "payModel", required = false) Integer payModel, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { try { SessionObject sessionObject = userCenter.getSessionObject(request); @@ -484,20 +489,20 @@ public class HighOrderController { @ResponseBody @ApiOperation(value = "导出商品订单列表") public ResponseData exportOrderListByIdCode(@RequestParam(name = "companyId", required = false) Long companyId, - @RequestParam(name = "merchantId", required = false) Long merchantId, - @RequestParam(name = "identificationCode", required = true) String identificationCode, - @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "memPhone", required = false) String memPhone, - @RequestParam(name = "memDiscountName", required = false) String memDiscountName, - @RequestParam(name = "paySerialNo", required = false) String paySerialNo, - @RequestParam(name = "payModel", required = false) Integer payModel, - @RequestParam(name = "payType", required = false) Integer payType, - @RequestParam(name = "orderStatus", required = false) Integer orderStatus, - @RequestParam(name = "createTimeS", required = false) Long createTimeS, - @RequestParam(name = "createTimeE", required = false) Long createTimeE, - @RequestParam(name = "payTimeS", required = false) Long payTimeS, - @RequestParam(name = "payTimeE", required = false) Long payTimeE, - HttpServletRequest request) { + @RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "identificationCode", required = true) String identificationCode, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "memDiscountName", required = false) String memDiscountName, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "payModel", required = false) Integer payModel, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + HttpServletRequest request) { try { SessionObject sessionObject = userCenter.getSessionObject(request); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); @@ -585,7 +590,7 @@ public class HighOrderController { @ResponseBody @ApiOperation(value = "汇联通订单退款") public ResponseData orderToRefundHlt(@RequestParam(name = "orderId", required = false) Long orderId, - HttpServletRequest request) { + HttpServletRequest request) { try { HighOrder order = highOrderService.getOrderById(orderId); @@ -601,21 +606,21 @@ public class HighOrderController { } - JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); - JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); - - if (dataObject.getBoolean("success")) { - order.setOrderStatus(4); - order.setRefundTime(new Date()); - order.setRefundContent(dataObject.getString("orderId")); - order.setRefusalRefundContent("HFR"+new Date().getTime() ); - order.setRefundPrice(order.getPayRealPrice()); - highOrderService.updateOrder(order); - return ResponseMsgUtil.success("退款成功"); - } else { - log.error("orderToPay error!", dataObject.getString("message")); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message")); - } + JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); + JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); + + if (dataObject.getBoolean("success")) { + order.setOrderStatus(4); + order.setRefundTime(new Date()); + order.setRefundContent(dataObject.getString("orderId")); + order.setRefusalRefundContent("HFR"+new Date().getTime() ); + order.setRefundPrice(order.getPayRealPrice()); + highOrderService.updateOrder(order); + return ResponseMsgUtil.success("退款成功"); + } else { + log.error("orderToPay error!", dataObject.getString("message")); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message")); + } } catch (Exception e) { log.error("HighOrderController --> getUserOrderList() error!", e); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java index 650b9408..ddee2d97 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java @@ -73,6 +73,8 @@ public class HighCouponController { @RequestParam(name = "couponName", required = false) String couponName, @RequestParam(name = "couponType", required = false) Integer couponType, @RequestParam(name = "displayArea", required = false) Integer displayArea, + @RequestParam(name = "brandId", required = false) Integer brandId, + @RequestParam(name = "goodsTypeId", required = false) Integer goodsTypeId, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { @@ -86,6 +88,8 @@ public class HighCouponController { map.put("merchantId", merchantId); map.put("couponName", couponName); map.put("couponType", couponType); + map.put("brandId", brandId); + map.put("goodsTypeId", goodsTypeId); map.put("displayArea", displayArea); map.put("notCouponSource", 2); map.put("status", 2); diff --git a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java index cfc3de98..7798d7bb 100644 --- a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java +++ b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java @@ -116,6 +116,7 @@ public enum ErrorCode { USER_PAY_PWD_ERROR("2132","支付密码错误"), NO_BIND_PHONE("2133","未绑定手机号"), title_("2134","名称已存在"), + ADD_REPEATEDLY("2135","重复添加"), STATUS_ERROR("3000","状态错误"), diff --git a/hai-service/src/main/java/com/hai/service/HighBrandService.java b/hai-service/src/main/java/com/hai/service/HighBrandService.java index 58bf9180..78ff7f13 100644 --- a/hai-service/src/main/java/com/hai/service/HighBrandService.java +++ b/hai-service/src/main/java/com/hai/service/HighBrandService.java @@ -19,12 +19,22 @@ public interface HighBrandService { /** * @Author Sum1Dream - * @Description // 根据订单ID查询订单 + * @Description // 根据订单ID查询 * @Date 15:19 2021/6/11 * @Param [id] * @return com.hai.entity.HighBrand **/ - HighBrand findByOrderId(Integer id); + HighBrand findById(Integer id); + + /** + * @Author Sum1Dream + * @name HighGoodsType.java + * @Description // 根据标题判断是否存在 + * @Date 4:58 下午 2021/11/11 + * @Param + * @return + **/ + Boolean findByTitle(String title , Integer goodsTypeId); /*** diff --git a/hai-service/src/main/java/com/hai/service/impl/HighBrandServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighBrandServiceImpl.java index 22c88d57..5fd9de74 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighBrandServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighBrandServiceImpl.java @@ -1,9 +1,7 @@ package com.hai.service.impl; import com.hai.dao.HighBrandMapper; -import com.hai.entity.HighBrand; -import com.hai.entity.HighBrandExample; -import com.hai.entity.HighOrder; +import com.hai.entity.*; import com.hai.service.HighBrandService; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; @@ -33,6 +31,10 @@ public class HighBrandServiceImpl implements HighBrandService { criteria.andTitleLike("%" + MapUtils.getString(map, "title") + "%"); } + if (MapUtils.getString(map, "goodTypeId") != null) { + criteria.andGoodTypeIdEqualTo(MapUtils.getIntValue(map, "goodTypeId")); + } + criteria.andStatusEqualTo(1); example.setOrderByClause("created_time desc"); @@ -41,10 +43,22 @@ public class HighBrandServiceImpl implements HighBrandService { } @Override - public HighBrand findByOrderId(Integer id) { + public HighBrand findById(Integer id) { return highBrandMapper.selectByPrimaryKey(id); } + @Override + public Boolean findByTitle(String title , Integer goodsTypeId) { + HighBrandExample example = new HighBrandExample(); + HighBrandExample.Criteria criteria = example.createCriteria(); + + criteria.andTitleEqualTo(title).andStatusEqualTo(1).andGoodTypeIdEqualTo(goodsTypeId); + + List highBrands = highBrandMapper.selectByExample(example); + + return highBrands.size() > 0; + } + @Override public void insertBrand(HighBrand highBrand) { highBrandMapper.insert(highBrand);