From fa93ea34047ed1cf749308388a8f01ae43c19f9c Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 12 Jun 2024 15:05:20 +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 --- .../bweb/controller/BsDeviceController.java | 15 +++- .../BsGasClassGroupTaskController.java | 79 ++++--------------- .../com/hfkj/dao/BsGasOilPriceMapperExt.java | 17 ++-- .../service/impl/BsDeviceServiceImpl.java | 12 +-- .../service/order/OrderCreateService.java | 7 ++ 5 files changed, 49 insertions(+), 81 deletions(-) diff --git a/bweb/src/main/java/com/bweb/controller/BsDeviceController.java b/bweb/src/main/java/com/bweb/controller/BsDeviceController.java index 1a41176..ec9377a 100644 --- a/bweb/src/main/java/com/bweb/controller/BsDeviceController.java +++ b/bweb/src/main/java/com/bweb/controller/BsDeviceController.java @@ -178,12 +178,19 @@ public class BsDeviceController { SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); if (sessionModel == null) { - log.error("HighDeviceController -> getDeviceList() error!",""); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); } - Map param = new HashMap<>(); - param.put("merNo", merNo); + if (sessionModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) { + param.put("merNo", merNo); + } else if (sessionModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { + param.put("merNo", sessionModel.getMerchant().getMerNo()); + } else if (sessionModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { + param.put("merNo", sessionModel.getMerchant().getMerNo()); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); + } + param.put("merName", merName); param.put("deviceName", deviceName); PageHelper.startPage(pageNum, pageSize); diff --git a/bweb/src/main/java/com/bweb/controller/BsGasClassGroupTaskController.java b/bweb/src/main/java/com/bweb/controller/BsGasClassGroupTaskController.java index 49c6621..bc5391e 100644 --- a/bweb/src/main/java/com/bweb/controller/BsGasClassGroupTaskController.java +++ b/bweb/src/main/java/com/bweb/controller/BsGasClassGroupTaskController.java @@ -72,18 +72,10 @@ public class BsGasClassGroupTaskController { if (body == null || body.getLong("gasClassGroupId") == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - Long gasId = null; - if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { - gasId = userInfoModel.getAccount().getObjectId(); - - } else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { - // 查询油站工作人员 - BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId()); - if (gasStaff == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - gasId = gasStaff.getMerId(); + if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) + || userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { + gasId = userInfoModel.getMerchant().getId(); } gasClassGroupTaskService.startGroupTask(gasId, body.getLong("gasClassGroupId")); @@ -102,22 +94,10 @@ public class BsGasClassGroupTaskController { public ResponseData endGroupTask() { try { SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class); - if (userInfoModel == null || - (!userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) - && !userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode()))) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS); - } Long gasId = null; - if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { - gasId = userInfoModel.getAccount().getObjectId(); - - } else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { - // 查询油站工作人员 - BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId()); - if (gasStaff == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - gasId = gasStaff.getMerId(); + if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) + || userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { + gasId = userInfoModel.getMerchant().getId(); } gasClassGroupTaskService.endGroupTask(gasId); @@ -138,24 +118,11 @@ public class BsGasClassGroupTaskController { if (body == null || body.getLong("gasClassGroupId") == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class); - if (userInfoModel == null || - (!userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) - && !userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode()))) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS); - } Long gasId = null; - if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { - gasId = userInfoModel.getAccount().getObjectId(); - - } else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { - // 查询油站工作人员 - BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId()); - if (gasStaff == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - gasId = gasStaff.getMerId(); + if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) + || userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { + gasId = userInfoModel.getMerchant().getId(); } gasClassGroupTaskService.swapGroupTask(gasId, body.getLong("gasClassGroupId")); @@ -178,18 +145,12 @@ public class BsGasClassGroupTaskController { throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS); } Map param = new HashMap<>(); - if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { - gasId = userInfoModel.getAccount().getObjectId(); - - } else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { - // 查询油站工作人员 - BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId()); - if (gasStaff == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - gasId = gasStaff.getMerId(); + if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) + || userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { + gasId = userInfoModel.getMerchant().getId(); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); } - GasClassGroupTaskDataCount dataCount; param.put("merId", gasId); @@ -253,15 +214,9 @@ public class BsGasClassGroupTaskController { throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); } - if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { - param.put("merchantStoreId", userInfoModel.getAccount().getObjectId()); - } else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { - // 查询油站工作人员 - BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId()); - if (gasStaff == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - param.put("merchantStoreId", gasStaff.getMerId()); + if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) + || userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { + param.put("merId", userInfoModel.getMerchant().getId()); } else { throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); } diff --git a/service/src/main/java/com/hfkj/dao/BsGasOilPriceMapperExt.java b/service/src/main/java/com/hfkj/dao/BsGasOilPriceMapperExt.java index afd1a48..9ef63e9 100644 --- a/service/src/main/java/com/hfkj/dao/BsGasOilPriceMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsGasOilPriceMapperExt.java @@ -20,17 +20,20 @@ public interface BsGasOilPriceMapperExt { " and a.province_code = #{regionId} " + " and b.oil_no = #{oilNo} "}) @Results({ - @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true), - @Result(column="merchant_store_id", property="merchantStoreId", jdbcType=JdbcType.BIGINT), - @Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER), + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), + @Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR), + @Result(column="oil_type", property="oilType", jdbcType=JdbcType.INTEGER), + @Result(column="oil_type_name", property="oilTypeName", jdbcType=JdbcType.VARCHAR), + @Result(column="oil_no", property="oilNo", jdbcType=JdbcType.VARCHAR), @Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR), @Result(column="preferential_margin", property="preferentialMargin", jdbcType=JdbcType.DECIMAL), @Result(column="gas_station_drop", property="gasStationDrop", jdbcType=JdbcType.DECIMAL), - @Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL), - @Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL), @Result(column="price_official", property="priceOfficial", jdbcType=JdbcType.DECIMAL), - @Result(column="oil_type", property="oilType", jdbcType=JdbcType.INTEGER), - @Result(column="oil_type_name", property="oilTypeName", jdbcType=JdbcType.VARCHAR), + @Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL), + @Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), diff --git a/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java index 5682c15..85f3df3 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java @@ -60,16 +60,12 @@ public class BsDeviceServiceImpl implements BsDeviceService { criteria.andTypeEqualTo(MapUtils.getInteger(param, "type")); } - if (MapUtils.getLong(param, "companyId") != null) { - criteria.andCompanyIdEqualTo(MapUtils.getLong(param, "companyId")); + if (StringUtils.isNotBlank(MapUtils.getString(param, "merNo"))) { + criteria.andMerNoEqualTo(MapUtils.getString(param, "merNo")); } - if (MapUtils.getLong(param, "agentId") != null) { - criteria.andAgentIdEqualTo(MapUtils.getLong(param, "agentId")); - } - - if (MapUtils.getLong(param, "merId") != null) { - criteria.andMerIdEqualTo(MapUtils.getLong(param, "merId")); + if (StringUtils.isNotBlank(MapUtils.getString(param, "merName"))) { + criteria.andMerNameLike("%"+MapUtils.getString(param, "merName")+"%"); } if (StringUtils.isNotBlank(MapUtils.getString(param, "deviceName"))) { diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java index 1afb818..e1e95e2 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -46,6 +46,13 @@ public class OrderCreateService { @Resource private BsGasStaffService gasStaffService; + /** + * 加油业务 + * @param order 订单 + * @param orderDeduction 优惠 + * @param orderChild 商品订单 + * @return + */ public OrderChildModel oilHandle(BsOrder order, BsOrderDeduction orderDeduction, OrderChildModel orderChild) { // 查询油品类型 SecDictionary gasOilType = secDictionaryService.getDictionary("OIL_NO", orderChild.getGasOilNo());