fix:投放业务

上级 6106c597
...@@ -3,6 +3,14 @@ package com.study.design; ...@@ -3,6 +3,14 @@ package com.study.design;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 启动类
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/7/29 17:39
*/
@SpringBootApplication @SpringBootApplication
public class DesignApplication { public class DesignApplication {
......
...@@ -9,7 +9,7 @@ package com.study.design.pay.pojo; ...@@ -9,7 +9,7 @@ package com.study.design.pay.pojo;
*/ */
public class PayBody { public class PayBody {
/** /**
*支付账 *当前用
*/ */
private String account; private String account;
/** /**
......
package com.study.design.pojo; package com.study.design.pojo;
/**
* 卖票业务
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/7/29 17:35
*/
public class TicketParam { public class TicketParam {
/** /**
* 真实的项目里,我们的account是set到用户的请求头里的 ,header里。过我们的网管的时候就已经记录了 * 真实的项目里,我们的account是set到用户的请求头里的 ,header里。过我们的网管的时候就已经记录了
*/ */
/**
* 账户
*/
private String account; private String account;
/**
* 名称
*/
private String title; private String title;
/**
* 银行信息
*/
private String bankInfo; private String bankInfo;
/**
* 商品id
*/
private String productId; private String productId;
public String getAccount() { public String getAccount() {
......
...@@ -2,10 +2,30 @@ package com.study.design.pojo; ...@@ -2,10 +2,30 @@ package com.study.design.pojo;
import java.util.List; import java.util.List;
/**
* 用户信息
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/7/29 17:34
*/
public class UserInfo { public class UserInfo {
/**
* 用户名
*/
private String username; private String username;
/**
* 城市
*/
private String city; private String city;
/**
* 购买的商品
*/
private List<String> buyProducts; private List<String> buyProducts;
/**
* 是否是新用户
*/
private boolean isNewUser; private boolean isNewUser;
public String getUsername() { public String getUsername() {
......
...@@ -6,16 +6,19 @@ import com.study.design.pojo.UserInfo; ...@@ -6,16 +6,19 @@ import com.study.design.pojo.UserInfo;
import com.study.design.ticket.builder.CompanyTicketBuilder; import com.study.design.ticket.builder.CompanyTicketBuilder;
import com.study.design.ticket.builder.PersonalTicketBuilder; import com.study.design.ticket.builder.PersonalTicketBuilder;
import com.study.design.ticket.builder.TicketBuilder; import com.study.design.ticket.builder.TicketBuilder;
import login.implementor.LoginFunc;
import login.implementor.WbLoginFunc;
import login.implementor.abstractlogin.AbstractLoginProcessor;
import login.implementor.abstractlogin.ThirdPartLogin;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* 用户相关的实现类
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/7/29 17:37
*/
@Service @Service
public class UserService { public class UserService {
...@@ -32,16 +35,29 @@ public class UserService { ...@@ -32,16 +35,29 @@ public class UserService {
return results; return results;
} }
//因为这部分是需要查询 缓存(如果缓存没有,需要查库)不应该写到 service层,但是为了代码书写简便
//这部分我模拟在service 层。 /**
* 因为这部分是需要查询 缓存(如果缓存没有,需要查库)不应该写到 service层,但是为了代码书写简便
* 这部分我模拟在service 层。
*
* @param username
* @return
*/
private UserInfo getUserInfo(String username) { private UserInfo getUserInfo(String username) {
return new UserInfo(); return new UserInfo();
} }
/**
* 获取票
*
* @param ticketParam
* @return
*/
public Object getTicket(TicketParam ticketParam) { public Object getTicket(TicketParam ticketParam) {
TicketBuilder builder = null; TicketBuilder builder = null;
String bankInfo = null; String bankInfo = null;
if(ticketParam.getBankInfo() != null) { if (ticketParam.getBankInfo() != null) {
bankInfo = "from 3rd party interface check."; bankInfo = "from 3rd party interface check.";
builder = new CompanyTicketBuilder(); builder = new CompanyTicketBuilder();
} else { } else {
...@@ -57,6 +73,15 @@ public class UserService { ...@@ -57,6 +73,15 @@ public class UserService {
return builder.buildTicket(); return builder.buildTicket();
} }
/**
* 登录信息
*
* @param name
* @param pwd
* @param type
* @return
*/
public Boolean login(String name, String pwd, String type) { public Boolean login(String name, String pwd, String type) {
// 这部分我就不进行封装了,直接在 service里做了。小伙伴可以自行实现封装,类似享元。 // 这部分我就不进行封装了,直接在 service里做了。小伙伴可以自行实现封装,类似享元。
......
package login.implementor; package login.implementor;
public class ZfbLoginFunc implements LoginFunc{ public class ZfbLoginFunc implements LoginFunc {
@Override @Override
public boolean login(String name, String pwd, String type) { public boolean login(String name, String pwd, String type) {
// 进行第三方账号的校验流程。 // 进行第三方账号的校验流程。
......
...@@ -3,6 +3,14 @@ package com.study.design; ...@@ -3,6 +3,14 @@ package com.study.design;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
/**
* 测试类
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/7/29 17:40
*/
@SpringBootTest @SpringBootTest
class DesignApplicationTests { class DesignApplicationTests {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册