段飞宇
2 years ago
8 changed files with 239 additions and 7 deletions
@ -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; |
||||
} |
||||
|
||||
} |
@ -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; |
||||
|
||||
|
||||
|
||||
} |
@ -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); |
||||
|
||||
} |
@ -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 "运行人接收"; |
||||
|
||||
} |
||||
} |
@ -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 "签发人签发"; |
||||
} |
||||
} |
Loading…
Reference in new issue