记得上下班打卡 | git大法好,push需谨慎

Commit 84bc5fd0 authored by 姜秀龙's avatar 姜秀龙

离线支付-手环信息、金额列表

parent 0c1a0c2e
...@@ -356,6 +356,7 @@ public class GoblinRedisConst { ...@@ -356,6 +356,7 @@ public class GoblinRedisConst {
public static final String GOBLIN_MIX_RESERVE_UID = PREFIX.concat("mix:reserve:uid:");//$mixId:$uid 混合售用户预约保存 public static final String GOBLIN_MIX_RESERVE_UID = PREFIX.concat("mix:reserve:uid:");//$mixId:$uid 混合售用户预约保存
public static final String GOBLIN_RECHARGE_WRISTBAND = PREFIX.concat("recharge:wristband");
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
public static final String GOBLIN_ORDER_LOG = PREFIX.concat("order:log:");//无用 public static final String GOBLIN_ORDER_LOG = PREFIX.concat("order:log:");//无用
......
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinRechargeAmountVo implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " 金额ID")
private String amountId;
@ApiModelProperty(value = "金额名称")
private String name;
@ApiModelProperty(value = "充值金额")
private BigDecimal price;
private final static GoblinRechargeAmountVo obj = new GoblinRechargeAmountVo();
public static GoblinRechargeAmountVo getNew() {
try {
return (GoblinRechargeAmountVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinRechargeAmountVo();
}
}
}
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinRechargeWristbandVo implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " 手环ID")
private String wristbandId;
@ApiModelProperty(value = "手环名称")
private String name;
@ApiModelProperty(value = "手环价格")
private BigDecimal price;
@ApiModelProperty(value = "充值金额")
private List<GoblinRechargeAmountVo> amonutList;
private final static GoblinRechargeWristbandVo obj = new GoblinRechargeWristbandVo();
public static GoblinRechargeWristbandVo getNew() {
try {
return (GoblinRechargeWristbandVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinRechargeWristbandVo();
}
}
}
package com.liquidnet.service.goblin.service;
import com.liquidnet.service.goblin.entity.GoblinRechargeAmount;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 充值金额选项表 服务类
* </p>
*
* @author jiangxiulong
* @since 2025-07-03
*/
public interface IGoblinRechargeAmountService extends IService<GoblinRechargeAmount> {
}
package com.liquidnet.service.goblin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.liquidnet.service.goblin.dto.vo.GoblinRechargeWristbandVo;
import com.liquidnet.service.goblin.entity.GoblinRechargeWristband;
/**
* <p>
* 手环信息表 服务类
* </p>
*
* @author jiangxiulong
* @since 2025-07-03
*/
public interface IGoblinRechargeWristbandService extends IService<GoblinRechargeWristband> {
GoblinRechargeWristbandVo getList();
}
...@@ -73,7 +73,7 @@ spring: ...@@ -73,7 +73,7 @@ spring:
autoconfigure: autoconfigure:
exclude: exclude:
- org.springframework.cloud.bus.BusAutoConfiguration - org.springframework.cloud.bus.BusAutoConfiguration
- org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration # - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
redis: redis:
queue: queue:
database: ${liquidnet.redis.queue.database} database: ${liquidnet.redis.queue.database}
...@@ -102,6 +102,17 @@ spring: ...@@ -102,6 +102,17 @@ spring:
uri: mongodb://${liquidnet.mongodb.user}:${liquidnet.mongodb.pwd}@${liquidnet.mongodb.host}/?authSource=admin&maxPoolSize=200&waitQueueMultiple=100 uri: mongodb://${liquidnet.mongodb.user}:${liquidnet.mongodb.pwd}@${liquidnet.mongodb.host}/?authSource=admin&maxPoolSize=200&waitQueueMultiple=100
sslEnabled: ${liquidnet.mongodb.sslEnabled} sslEnabled: ${liquidnet.mongodb.sslEnabled}
database: ${liquidnet.mongodb.database} database: ${liquidnet.mongodb.database}
datasource:
name: ${liquidnet.mysql.database-name}
url: jdbc:mysql://${liquidnet.mysql.urlHostAndPort}/${liquidnet.mysql.database-name}?serverTimezone=UTC&characterEncoding=utf-8&useSSL=false
username: ${liquidnet.mysql.username}
password: ${liquidnet.mysql.password}
# type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
maximum-pool-size: 45
minimum-idle: 8
connection-test-query: SELECT 1
# ----------------------------------------------------------- # -----------------------------------------------------------
......
package com.liquidnet.service.goblin.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 充值金额选项表
* </p>
*
* @author jiangxiulong
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinRechargeAmount implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 金额ID
*/
private String amountId;
/**
* 金额名称
*/
private String name;
/**
* 充值金额
*/
private BigDecimal price;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
}
package com.liquidnet.service.goblin.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 手环信息表
* </p>
*
* @author jiangxiulong
* @since 2025-07-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinRechargeWristband implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 手环ID
*/
private String wristbandId;
/**
* 手环名称
*/
private String name;
/**
* 手环价格
*/
private BigDecimal price;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
}
package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.entity.GoblinRechargeAmount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 充值金额选项表 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2025-07-03
*/
public interface GoblinRechargeAmountMapper extends BaseMapper<GoblinRechargeAmount> {
}
package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.entity.GoblinRechargeWristband;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 手环信息表 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2025-07-03
*/
public interface GoblinRechargeWristbandMapper extends BaseMapper<GoblinRechargeWristband> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.goblin.mapper.GoblinRechargeAmountMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.goblin.mapper.GoblinRechargeWristbandMapper">
</mapper>
-- 创建手环产品表
CREATE TABLE IF NOT EXISTS goblin_recharge_wristband
(
mid BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
wristband_id VARCHAR(64) NOT NULL DEFAULT '' COMMENT '手环ID',
name VARCHAR(255) NOT NULL DEFAULT '' COMMENT '手环名称',
price DECIMAL(10, 2) NOT NULL DEFAULT 0 COMMENT '手环价格',
created_at timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_at timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='手环信息表';
-- 创建充值金额表
CREATE TABLE IF NOT EXISTS goblin_recharge_amount
(
mid BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
amount_id VARCHAR(64) NOT NULL DEFAULT '' COMMENT '金额ID',
name VARCHAR(255) NOT NULL DEFAULT '' COMMENT '金额名称',
price DECIMAL(10, 2) NOT NULL DEFAULT 0 COMMENT '充值金额',
created_at timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_at timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='充值金额选项表';
\ No newline at end of file
package com.liquidnet.service; package com.liquidnet.service;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
...@@ -14,6 +15,7 @@ import java.util.Arrays; ...@@ -14,6 +15,7 @@ import java.util.Arrays;
@Slf4j @Slf4j
@EnableFeignClients @EnableFeignClients
@SpringBootApplication(scanBasePackages = {"com.liquidnet"}) @SpringBootApplication(scanBasePackages = {"com.liquidnet"})
@MapperScan(basePackages = {"com.liquidnet.service.*.mapper"})
public class ServiceGoblinApplication implements CommandLineRunner { public class ServiceGoblinApplication implements CommandLineRunner {
@Autowired @Autowired
private Environment environment; private Environment environment;
......
package com.liquidnet.service.goblin.controller;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinRechargeWristbandVo;
import com.liquidnet.service.goblin.service.IGoblinRechargeWristbandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@Api(tags = "充值金额")
@RestController
@Validated
@RequestMapping("/recharge/goods")
public class GoblinRechargeAmountController {
@Autowired
private IGoblinRechargeWristbandService iGoblinRechargeWristbandService;
@GetMapping("list")
@ApiOperation("获得金额列表")
public ResponseDto<GoblinRechargeWristbandVo> getList() {
return ResponseDto.success(iGoblinRechargeWristbandService.getList());
}
}
package com.liquidnet.service.goblin.service.impl;
import com.liquidnet.service.goblin.entity.GoblinRechargeAmount;
import com.liquidnet.service.goblin.mapper.GoblinRechargeAmountMapper;
import com.liquidnet.service.goblin.service.IGoblinRechargeAmountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 充值金额选项表 服务实现类
* </p>
*
* @author jiangxiulong
* @since 2025-07-03
*/
@Service
public class GoblinRechargeAmountServiceImpl extends ServiceImpl<GoblinRechargeAmountMapper, GoblinRechargeAmount> implements IGoblinRechargeAmountService {
}
package com.liquidnet.service.goblin.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.goblin.dto.vo.GoblinRechargeAmountVo;
import com.liquidnet.service.goblin.dto.vo.GoblinRechargeWristbandVo;
import com.liquidnet.service.goblin.entity.GoblinRechargeAmount;
import com.liquidnet.service.goblin.entity.GoblinRechargeWristband;
import com.liquidnet.service.goblin.mapper.GoblinRechargeAmountMapper;
import com.liquidnet.service.goblin.mapper.GoblinRechargeWristbandMapper;
import com.liquidnet.service.goblin.service.IGoblinRechargeWristbandService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 手环信息表 服务实现类
* </p>
*
* @author jiangxiulong
* @since 2025-07-03
*/
@Service
public class GoblinRechargeWristbandServiceImpl extends ServiceImpl<GoblinRechargeWristbandMapper, GoblinRechargeWristband> implements IGoblinRechargeWristbandService {
@Autowired
GoblinRedisUtils goblinRedisUtils;
@Autowired
private GoblinRechargeAmountMapper rechargeAmountMapper;
@Autowired
private GoblinRechargeWristbandMapper rechargeWristbandMapper;
@Override
public GoblinRechargeWristbandVo getList() {
GoblinRechargeWristbandVo result = goblinRedisUtils.getRechargeWristbandVo();
if (result == null) {
// 从数据库中查询数据
List<GoblinRechargeWristband> rechargeWristbands = rechargeWristbandMapper.selectList(null);
List<GoblinRechargeAmount> rechargeAmounts = rechargeAmountMapper.selectList(null);
// 组合数据
if (!CollectionUtils.isEmpty(rechargeAmounts) && !CollectionUtils.isEmpty(rechargeWristbands)) {
GoblinRechargeWristbandVo wristbandVo = GoblinRechargeWristbandVo.getNew();
wristbandVo.setWristbandId(rechargeWristbands.get(0).getWristbandId());
wristbandVo.setName(rechargeWristbands.get(0).getName());
wristbandVo.setPrice(rechargeWristbands.get(0).getPrice());
List<GoblinRechargeAmountVo> list = new ArrayList<>();
for (GoblinRechargeAmount amount : rechargeAmounts) {
GoblinRechargeAmountVo amountVo = GoblinRechargeAmountVo.getNew();
amountVo.setAmountId(amount.getAmountId());
amountVo.setName(amount.getName());
amountVo.setPrice(amount.getPrice());
list.add(amountVo);
}
wristbandVo.setAmonutList(list);
goblinRedisUtils.setRechargeWristbandVo(wristbandVo);
return wristbandVo;
}
}
return result;
}
}
\ No newline at end of file
...@@ -2923,6 +2923,20 @@ public class GoblinRedisUtils { ...@@ -2923,6 +2923,20 @@ public class GoblinRedisUtils {
return (int) redisUtil.rightPush(rdk, orderId); return (int) redisUtil.rightPush(rdk, orderId);
} }
public GoblinRechargeWristbandVo getRechargeWristbandVo() {
Object obj = redisUtil.get(GoblinRedisConst.GOBLIN_RECHARGE_WRISTBAND);
if (obj == null) {
return null;
} else {
return (GoblinRechargeWristbandVo) obj;
}
}
public void setRechargeWristbandVo(GoblinRechargeWristbandVo vo) {
String rdk = GoblinRedisConst.GOBLIN_RECHARGE_WRISTBAND;
redisUtil.set(rdk, vo);
}
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment