From c520f8e2e3a6f78deaa31d0f797ad8a82638d18f Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 5 Jul 2024 10:52: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/BsGasOrderController.java | 185 +++++++++++++++++- .../BsMerchantAccountController.java | 33 ++-- .../hfkj/dao/BsMerchantAccountMapperExt.java | 30 ++- .../hfkj/model/order/ExportGasOrderModel.java | 126 ++++++++++++ .../merchant/BsMerchantAccountService.java | 8 + .../impl/BsMerchantAccountServiceImpl.java | 5 + .../order/impl/BsOrderRefundServiceImpl.java | 6 +- .../hfkj/sysenum/MerchantSourceTypeEnum.java | 4 +- .../hfkj/sysenum/order/OrderPayTypeEnum.java | 15 ++ 9 files changed, 390 insertions(+), 22 deletions(-) create mode 100644 service/src/main/java/com/hfkj/model/order/ExportGasOrderModel.java diff --git a/bweb/src/main/java/com/bweb/controller/BsGasOrderController.java b/bweb/src/main/java/com/bweb/controller/BsGasOrderController.java index 61462c7..2a5c897 100644 --- a/bweb/src/main/java/com/bweb/controller/BsGasOrderController.java +++ b/bweb/src/main/java/com/bweb/controller/BsGasOrderController.java @@ -1,5 +1,7 @@ package com.bweb.controller; +import com.alibaba.excel.EasyExcel; +import com.bweb.config.SysConst; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.hfkj.common.exception.ErrorCode; @@ -7,17 +9,23 @@ import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; import com.hfkj.common.security.UserCenter; import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.config.CommonSysConst; import com.hfkj.entity.BsGasOrder; import com.hfkj.entity.BsOrderSettle; import com.hfkj.model.ResponseData; import com.hfkj.model.SecUserSessionObject; import com.hfkj.model.UserSessionObject; +import com.hfkj.model.order.ExportGasOrderModel; import com.hfkj.service.BsDeviceService; import com.hfkj.service.gas.BsGasOrderService; import com.hfkj.service.order.BsOrderService; +import com.hfkj.sysenum.MerchantSourceTypeEnum; import com.hfkj.sysenum.SecUserObjectTypeEnum; +import com.hfkj.sysenum.gas.OrderOilStatus; +import com.hfkj.sysenum.order.OrderPayTypeEnum; 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.stereotype.Controller; @@ -27,8 +35,9 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; -import java.util.HashMap; -import java.util.Map; +import java.io.File; +import java.math.BigDecimal; +import java.util.*; @Controller @RequestMapping(value = "/gasOrder") @@ -97,8 +106,10 @@ public class BsGasOrderController { } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type4.getCode())) { param.put("agentId", sessionObject.getAccount().getObjectId()); param.put("agentStaffId", agentStaffId); + param.put("merName", merName); } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type5.getCode())) { param.put("agentStaffId", sessionObject.getAccount().getObjectId()); + param.put("merName", merName); } else { throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); } @@ -166,8 +177,10 @@ public class BsGasOrderController { } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type4.getCode())) { param.put("agentId", sessionObject.getAccount().getObjectId()); param.put("agentStaffId", agentStaffId); + param.put("merName", merName); } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type5.getCode())) { param.put("agentStaffId", sessionObject.getAccount().getObjectId()); + param.put("merName", merName); } else { throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); } @@ -181,6 +194,174 @@ public class BsGasOrderController { } } + @RequestMapping(value="/exportOilOrder",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出加油订单") + public ResponseData exportOilOrder(@RequestParam(name = "merId", required = false) Long merId, + @RequestParam(name = "merName", required = false) String merName, + @RequestParam(name = "userPhone", required = false) String userPhone, + @RequestParam(name = "gasStaffName", required = false) String gasStaffName, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "payType", required = false) String payType, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "status", required = false) Integer status, + @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 = "refundTimeS", required = false) Long refundTimeS, + @RequestParam(name = "refundTimeE", required = false) Long refundTimeE, + @RequestParam(name = "gasOilNo", required = false) String gasOilNo, + @RequestParam(name = "gasClassGroupId", required = false) Long gasClassGroupId, + @RequestParam(name = "gasClassGroupTaskId", required = false) Long gasClassGroupTaskId, + @RequestParam(name = "agentId", required = false) Long agentId, + @RequestParam(name = "agentStaffId", required = false) Long agentStaffId) { + try { + SecUserSessionObject sessionObject = userCenter.getSessionModel(SecUserSessionObject.class); + Map param = new HashMap<>(); + param.put("orderNo", orderNo); + param.put("payType", payType); + param.put("paySerialNo", paySerialNo); + param.put("userPhone", userPhone); + param.put("status", status); + param.put("createTimeS", createTimeS); + param.put("createTimeE", createTimeE); + param.put("payTimeS", payTimeS); + param.put("payTimeE", payTimeE); + param.put("refundTimeS", refundTimeS); + param.put("refundTimeE", refundTimeE); + param.put("gasClassGroupId", gasClassGroupId); + param.put("gasClassGroupTaskId", gasClassGroupTaskId); + param.put("gasStaffName", gasStaffName); + param.put("gasOilNo", gasOilNo); + + if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) { + param.put("merId", merId); + param.put("merName", merName); + param.put("agentId", agentId); + param.put("agentStaffId", agentStaffId); + } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { + param.put("merId", sessionObject.getMerchant().getId()); + } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { + param.put("gasStaffId", sessionObject.getAccount().getObjectId()); + } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type4.getCode())) { + param.put("agentId", sessionObject.getAccount().getObjectId()); + param.put("agentStaffId", agentStaffId); + param.put("merName", merName); + } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type5.getCode())) { + param.put("agentStaffId", sessionObject.getAccount().getObjectId()); + param.put("merName", merName); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); + } + + // 数据 + List gasOrderList = gasOrderService.getGasOrderList(param); + + List dataList = new ArrayList<>(); + ExportGasOrderModel model; + + for (BsGasOrder gasOrder : gasOrderList) { + model = new ExportGasOrderModel(); + model.setAgentName(StringUtils.isBlank(gasOrder.getAgentName())?"无":gasOrder.getAgentName()); + model.setAgentStaffName(StringUtils.isBlank(gasOrder.getAgentStaffName())?"无":gasOrder.getAgentStaffName()); + model.setChannelTypeName(MerchantSourceTypeEnum.getNameByType(gasOrder.getChannelType())); + model.setOrderNo(gasOrder.getOrderNo()); + model.setUserPhone(StringUtils.isBlank(gasOrder.getUserPhone())?"无":gasOrder.getUserPhone()); + model.setMerName(gasOrder.getMerName()); + model.setGasStaffName(gasOrder.getGasStaffName()); + model.setGasRefuelPrice(gasOrder.getGasRefuelPrice()); + model.setGasOilLiters(gasOrder.getGasOilLiters()); + model.setGasDiscount(gasOrder.getGasDiscount().compareTo(new BigDecimal("1")) != 0?gasOrder.getGasDiscount().multiply(new BigDecimal("100")).setScale(2).toString():"无"); + model.setGasOilNo(gasOrder.getGasOilNo() + "#"); + model.setGasGunNo(gasOrder.getGasGunNo() + "号枪"); + model.setGasPricePlatform(gasOrder.getGasPricePlatform()); + model.setGasPriceGun(gasOrder.getGasPriceGun()); + model.setGasPriceOfficial(gasOrder.getGasPriceOfficial()); + model.setPayTypeName(gasOrder.getPayType()!=null? OrderPayTypeEnum.getDataByType(gasOrder.getPayType()).getName():"未支付"); + model.setTotalDeductionPrice(gasOrder.getTotalDeductionPrice()); + model.setDeductionCouponPrice(gasOrder.getDeductionCouponPrice()); + model.setDeductionOilPrice(gasOrder.getDeductionOilPrice()); + model.setPayablePrice(gasOrder.getPayablePrice()); + model.setPayIntegral(gasOrder.getPayIntegral()==null?new BigDecimal("0"):new BigDecimal(""+gasOrder.getPayIntegral()).divide(new BigDecimal("100"))); + model.setPayPrice(gasOrder.getActualPayPrice()!=null?gasOrder.getActualPayPrice().toString():"未支付"); + model.setStatus(OrderOilStatus.getNameByType(gasOrder.getStatus())); + model.setCreateTime(gasOrder.getCreateTime()); + model.setPayTime(gasOrder.getPayTime()); + model.setRefundTime(gasOrder.getRefundTime()); + model.setCancelTime(gasOrder.getCancelTime()); + dataList.add(model); + } + + String fileUrl = CommonSysConst.getSysConfig().getFilesystem() + "/temporary/"; + String pathName = System.currentTimeMillis()+".xlsx"; + File file = new File(fileUrl); + if (!file.exists()) { + file.mkdirs(); + } + + Set includeColumnFiledNames = new HashSet(); + includeColumnFiledNames.add("orderNo"); + includeColumnFiledNames.add("gasRefuelPrice"); + includeColumnFiledNames.add("gasOilLiters"); + includeColumnFiledNames.add("gasOilNo"); + includeColumnFiledNames.add("gasGunNo"); + includeColumnFiledNames.add("gasDiscount"); + includeColumnFiledNames.add("gasPricePlatform"); + includeColumnFiledNames.add("gasPriceGun"); + includeColumnFiledNames.add("gasPriceOfficial"); + includeColumnFiledNames.add("payTypeName"); + includeColumnFiledNames.add("totalDeductionPrice"); + includeColumnFiledNames.add("deductionCouponPrice"); + includeColumnFiledNames.add("deductionOilPrice"); + includeColumnFiledNames.add("payablePrice"); + includeColumnFiledNames.add("payIntegral"); + includeColumnFiledNames.add("payPrice"); + includeColumnFiledNames.add("status"); + includeColumnFiledNames.add("createTime"); + includeColumnFiledNames.add("payTime"); + includeColumnFiledNames.add("refundTime"); + includeColumnFiledNames.add("cancelTime"); + + if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) { + includeColumnFiledNames.add("agentName"); + includeColumnFiledNames.add("agentStaffName"); + includeColumnFiledNames.add("merName"); + includeColumnFiledNames.add("gasStaffName"); + includeColumnFiledNames.add("channelTypeName"); + includeColumnFiledNames.add("userPhone"); + + } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) ) { + includeColumnFiledNames.add("userPhone"); + includeColumnFiledNames.add("gasStaffName"); + + } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode()) ) { + includeColumnFiledNames.add("userPhone"); + + } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type4.getCode()) ) { + includeColumnFiledNames.add("agentStaffName"); + includeColumnFiledNames.add("merName"); + includeColumnFiledNames.add("channelTypeName"); + + } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type5.getCode()) ) { + includeColumnFiledNames.add("merName"); + includeColumnFiledNames.add("channelTypeName"); + } + + EasyExcel.write(fileUrl+pathName) + .head(ExportGasOrderModel.class) + .includeColumnFiledNames(includeColumnFiledNames) + .sheet("加油订单") + .doWrite(dataList); + return ResponseMsgUtil.success(pathName); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/queryOilOrder",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询加油订单详情") diff --git a/bweb/src/main/java/com/bweb/controller/BsMerchantAccountController.java b/bweb/src/main/java/com/bweb/controller/BsMerchantAccountController.java index 2970c1e..d4c0dfd 100644 --- a/bweb/src/main/java/com/bweb/controller/BsMerchantAccountController.java +++ b/bweb/src/main/java/com/bweb/controller/BsMerchantAccountController.java @@ -80,29 +80,34 @@ public class BsMerchantAccountController { } } - @RequestMapping(value = "/consume", method = RequestMethod.POST) + @RequestMapping(value = "/getMerList", method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "consume") - public ResponseData consume(@RequestBody JSONObject body) { + @ApiOperation(value = "查询商户列表") + public ResponseData getMerList(@RequestParam(value = "merNo", required = false) Long merNo, + @RequestParam(value = "merName", required = false) Long merName, + @RequestParam(value = "provinceCode", required = false) Long provinceCode, + @RequestParam(value = "cityCode", required = false) Long cityCode, + @RequestParam(value = "areaCode", required = false) Long areaCode, + @RequestParam(value = "pageNum", required = true) Integer pageNum, + @RequestParam(value = "pageSize", required = true) Integer pageSize) { try { - if (body == null - || StringUtils.isBlank(body.getString("merNo")) - || body.getBigDecimal("amount") == null - ) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - // 账户充值 - merchantAccountService.consume(body.getString("merNo"), body.getBigDecimal("amount"), new HashMap<>()); - return ResponseMsgUtil.success("操作成功"); + Map param = new HashMap<>(); + param.put("merNo", merNo); + param.put("merName", merName); + param.put("provinceCode", provinceCode); + param.put("cityCode", cityCode); + param.put("areaCode", areaCode); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(merchantAccountService.getMerList(param))); } catch (Exception e) { - log.error("BsMerchantAccountController --> recharge() error!", e); + log.error("BsMerchantAccountController --> getRecordList() error!", e); return ResponseMsgUtil.exception(e); } } - @RequestMapping(value = "/getRecordList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "记录列表") diff --git a/service/src/main/java/com/hfkj/dao/BsMerchantAccountMapperExt.java b/service/src/main/java/com/hfkj/dao/BsMerchantAccountMapperExt.java index b4f23e2..27e634b 100644 --- a/service/src/main/java/com/hfkj/dao/BsMerchantAccountMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsMerchantAccountMapperExt.java @@ -1,7 +1,35 @@ package com.hfkj.dao; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; +import java.util.Map; + /** * mapper扩展类 */ public interface BsMerchantAccountMapperExt { -} \ No newline at end of file + + @Select("") + List> selectMerList(@Param("param") Map param); +} diff --git a/service/src/main/java/com/hfkj/model/order/ExportGasOrderModel.java b/service/src/main/java/com/hfkj/model/order/ExportGasOrderModel.java new file mode 100644 index 0000000..99d5d30 --- /dev/null +++ b/service/src/main/java/com/hfkj/model/order/ExportGasOrderModel.java @@ -0,0 +1,126 @@ +package com.hfkj.model.order; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 导出油站订单模型 + * @className: ExportGasOrderModel + * @author: HuRui + * @date: 2022/9/20 + **/ +@Data +public class ExportGasOrderModel { + + @ColumnWidth(20) + @ExcelProperty("代理商") + private String agentName; + + @ColumnWidth(20) + @ExcelProperty("业务员") + private String agentStaffName; + + @ColumnWidth(25) + @ExcelProperty("交易单号") + private String orderNo; + + @ColumnWidth(15) + @ExcelProperty("客户电话") + private String userPhone; + + @ColumnWidth(25) + @ExcelProperty("加油站") + private String merName; + + @ColumnWidth(15) + @ExcelProperty("加油员") + private String gasStaffName; + + @ColumnWidth(15) + @ExcelProperty({ "加油信息", "加油金额"}) + private BigDecimal gasRefuelPrice; + + @ColumnWidth(15) + @ExcelProperty({ "加油信息", "加油升数"}) + private BigDecimal gasOilLiters; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "油号"}) + private String gasOilNo; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "油枪号"}) + private String gasGunNo; + + @ColumnWidth(15) + @ExcelProperty({ "加油信息", "平台折扣"}) + private String gasDiscount; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "平台价"}) + private BigDecimal gasPricePlatform; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "油站价"}) + private BigDecimal gasPriceGun; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "国标价"}) + private BigDecimal gasPriceOfficial; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "总优惠"}) + private BigDecimal totalDeductionPrice; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "优惠券优惠"}) + private BigDecimal deductionCouponPrice; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "加油优惠"}) + private BigDecimal deductionOilPrice; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "应付金额"}) + private BigDecimal payablePrice; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "积分抵扣"}) + private BigDecimal payIntegral; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "实付金额"}) + private String payPrice; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "支付方式"}) + private String payTypeName; + + @ColumnWidth(15) + @ExcelProperty("交易状态") + private String status; + + @ColumnWidth(22) + @ExcelProperty("创建时间") + private Date createTime; + + @ColumnWidth(22) + @ExcelProperty("支付时间") + private Date payTime; + + @ColumnWidth(22) + @ExcelProperty("退款时间") + private Date refundTime; + + @ColumnWidth(22) + @ExcelProperty("取消时间") + private Date cancelTime; + + @ColumnWidth(22) + @ExcelProperty("渠道") + private String channelTypeName; +} diff --git a/service/src/main/java/com/hfkj/service/merchant/BsMerchantAccountService.java b/service/src/main/java/com/hfkj/service/merchant/BsMerchantAccountService.java index d7925c8..a2a7b0d 100644 --- a/service/src/main/java/com/hfkj/service/merchant/BsMerchantAccountService.java +++ b/service/src/main/java/com/hfkj/service/merchant/BsMerchantAccountService.java @@ -4,6 +4,7 @@ import com.hfkj.entity.BsMerchantAccount; import com.hfkj.entity.BsOrderRefund; import java.math.BigDecimal; +import java.util.List; import java.util.Map; /** @@ -47,5 +48,12 @@ public interface BsMerchantAccountService { * @param orderRefund */ void refund(String merNo, BigDecimal amount, BsOrderRefund orderRefund) throws Exception; + + /** + * 查询商户列表 + * @param param + * @return + */ + List> getMerList(Map param); } diff --git a/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantAccountServiceImpl.java b/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantAccountServiceImpl.java index 4d58470..56c371a 100644 --- a/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantAccountServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantAccountServiceImpl.java @@ -210,5 +210,10 @@ public class BsMerchantAccountServiceImpl implements BsMerchantAccountService { } } + @Override + public List> getMerList(Map param) { + return merchantAccountMapper.selectMerList(param); + } + } diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java index 311b620..a9c66d0 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java @@ -221,10 +221,10 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService { orderChild.setSurplusRefundIntegral(orderChild.getSurplusRefundIntegral() - orderRefund.getRefundIntegral()); orderChild.setStatus(orderChild.getSurplusRefundCount()==0? OrderChildStatusEnum.status4.getCode():orderChild.getStatus()); orderChildService.editData(orderChild); - } - // 处理退款业务 - OrderRefundBusiness.gasOrder(orderRefund); + // 处理退款业务 + OrderRefundBusiness.gasOrder(orderRefund); + } // 删除缓存 orderService.cacheDelete(order.getOrderNo()); diff --git a/service/src/main/java/com/hfkj/sysenum/MerchantSourceTypeEnum.java b/service/src/main/java/com/hfkj/sysenum/MerchantSourceTypeEnum.java index 13f117f..f9c556c 100644 --- a/service/src/main/java/com/hfkj/sysenum/MerchantSourceTypeEnum.java +++ b/service/src/main/java/com/hfkj/sysenum/MerchantSourceTypeEnum.java @@ -23,10 +23,10 @@ public enum MerchantSourceTypeEnum { this.name = name; } - public static MerchantSourceTypeEnum getNameByType(Integer type) { + public static String getNameByType(Integer type) { for (MerchantSourceTypeEnum ele : values()) { if (Objects.equals(type,ele.getNumber())) { - return ele; + return ele.getName(); } } return null; diff --git a/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java b/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java index 470d0a8..f6c3967 100644 --- a/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java +++ b/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java @@ -2,6 +2,8 @@ package com.hfkj.sysenum.order; import lombok.Getter; +import java.util.Objects; + /** * 交易支付类型 * @className: OrderPayModelEnum @@ -32,4 +34,17 @@ public enum OrderPayTypeEnum { this.code = code; this.name = name; } + + /** + * 根据类型查询数据 + * @param type + * @return + */ + public static OrderPayTypeEnum getDataByType(Integer type) { + for (OrderPayTypeEnum ele : values()) { + if (Objects.equals(type, ele.getCode())) return ele; + } + return null; + } + }