Browse Source

移除lettuce-core

zhongwei
段飞宇 2 years ago
parent
commit
4c9d69c8c0
  1. 32
      hzims-service/ticket/pom.xml
  2. 26
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardWorkTicketController.java
  3. 38
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/strategy/abstracts/TicketAbstractService.java
  4. 30
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/strategy/entity/Ticket.java
  5. 29
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/strategy/service/TicketService.java
  6. 40
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/strategy/serviceimpl/OperatorTicketServiceImpl.java
  7. 43
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/strategy/serviceimpl/SignatureTicketServiceImpl.java
  8. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/utils/StandardTicketIdWorker.java

32
hzims-service/ticket/pom.xml

@ -102,7 +102,39 @@
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId>
<exclusions>
<exclusion>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-redis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-redis</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions>
<exclusion>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-cloud</artifactId>

26
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardWorkTicketController.java

@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.hnac.hzims.ticket.response.WorkTicketMessageResponse;
import com.hnac.hzims.ticket.standardTicket.service.StandardWorkTicketService;
import com.hnac.hzims.ticket.standardTicket.strategy.entity.Ticket;
import com.hnac.hzims.ticket.standardTicket.strategy.service.TicketService;
import com.hnac.hzims.ticket.standardTicket.utils.StandardTicketIdWorker;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -12,10 +14,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* 工作票管理
@ -42,6 +44,10 @@ public class StandardWorkTicketController {
@Autowired
private StandardTicketIdWorker standardTicketIdWorker;
@Autowired
List<TicketService> ticketService;
@ApiOperation("测试开票")
@PostMapping("/createTicket")
public R createTicket() {
@ -63,4 +69,16 @@ public class StandardWorkTicketController {
return R.data(ticketCode);
}
@ApiOperation("测试")
@GetMapping("/hello/{type}")
public R hello(@PathVariable int type) {
TicketService service = ticketService.stream().filter(item -> item.isCurrentTicket(type))
.findFirst().orElse(null);
String calculate = service.calculate(new Ticket());
return R.data(calculate);
}
}

38
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/strategy/abstracts/TicketAbstractService.java

@ -0,0 +1,38 @@
package com.hnac.hzims.ticket.standardTicket.strategy.abstracts;
import com.hnac.hzims.ticket.standardTicket.strategy.service.TicketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/3/28 9:02
*/
@Slf4j
public abstract class TicketAbstractService implements TicketService {
@Autowired
private RedisTemplate redisTemplate;
/**
* 查询所有的方法
*
* @return
*/
public List<Integer> getTicketList() {
System.out.println("实例化:" +redisTemplate);
List<Integer> list = new ArrayList<>();
list.add(1);
list.add(2);
return list;
}
}

30
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/strategy/entity/Ticket.java

@ -0,0 +1,30 @@
package com.hnac.hzims.ticket.standardTicket.strategy.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/3/27 16:49
*/
@Data
@Accessors(chain = true)
public class Ticket {
/**
* 实例Id
*/
private String flowId;
/**
* 实例Id说明
*/
private String segment;
}

29
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/strategy/service/TicketService.java

@ -0,0 +1,29 @@
package com.hnac.hzims.ticket.standardTicket.strategy.service;
import com.hnac.hzims.ticket.standardTicket.strategy.entity.Ticket;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/3/27 16:39
*/
public interface TicketService {
/**
* 设置执行那种实现类
* @param type
* @return
*/
Boolean isCurrentTicket(int type);
/**
* 两票管理业务方法
* @param ticket
*/
String calculate(Ticket ticket);
}

40
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/strategy/serviceimpl/OperatorTicketServiceImpl.java

@ -0,0 +1,40 @@
package com.hnac.hzims.ticket.standardTicket.strategy.serviceimpl;
import com.hnac.hzims.ticket.standardTicket.strategy.abstracts.TicketAbstractService;
import com.hnac.hzims.ticket.standardTicket.strategy.entity.Ticket;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 运行人接收
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/3/28 8:47
*/
@Service
public class OperatorTicketServiceImpl extends TicketAbstractService {
/**
* 设置执行那种实现类
*
* @param type
* @return
*/
@Override
public Boolean isCurrentTicket(int type) {
List<Integer> ticketList = this.getTicketList();
return type == ticketList.get(1);
}
/**
* 两票管理业务方法
*
* @param ticket
*/
@Override
public String calculate(Ticket ticket) {
System.out.println("OperatorTicketServiceImpl");
return "运行人接收";
}
}

43
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/strategy/serviceimpl/SignatureTicketServiceImpl.java

@ -0,0 +1,43 @@
package com.hnac.hzims.ticket.standardTicket.strategy.serviceimpl;
import com.hnac.hzims.ticket.standardTicket.strategy.abstracts.TicketAbstractService;
import com.hnac.hzims.ticket.standardTicket.strategy.entity.Ticket;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 签发人签发
*
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/3/27 16:40
*/
@Service
public class SignatureTicketServiceImpl extends TicketAbstractService {
/**
* 设置执行那种实现类
*
* @param type
* @return
*/
@Override
public Boolean isCurrentTicket(int type) {
List<Integer> ticketList = this.getTicketList();
return type == ticketList.get(0);
}
/**
* 两票管理业务方法
*
* @param ticket
*/
@Override
public String calculate(Ticket ticket) {
System.out.println("SignatureTicketServiceImpl");
return "签发人签发";
}
}

4
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/utils/StandardTicketIdWorker.java

@ -8,9 +8,12 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import org.xnio.sasl.SaslQop;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@ -192,7 +195,6 @@ public class StandardTicketIdWorker {
//
// String format = numberFormatter.format(2);
// System.out.println(format);
}

Loading…
Cancel
Save