15 changed files with 58 additions and 672 deletions
@ -0,0 +1,5 @@ |
|||
package bc.mm.mis.service; |
|||
|
|||
public interface DemoService { |
|||
String atest(); |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
package bc.mm.mis.service.impl; |
|||
|
|||
import bc.mm.mis.service.DemoService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
@Service |
|||
public class DemoServiceImpl implements DemoService { |
|||
@Override |
|||
public String atest() { |
|||
return "sss"; |
|||
} |
|||
} |
|||
@ -1,412 +0,0 @@ |
|||
package bc.mm.mis.bean; |
|||
|
|||
import javax.persistence.Column; |
|||
import javax.persistence.Entity; |
|||
import javax.persistence.Id; |
|||
import javax.persistence.Table; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* user bean |
|||
*/ |
|||
@Entity |
|||
@Table(name = "users") |
|||
public class Users { |
|||
@Id |
|||
@Column(name = "user_id") |
|||
private Long userId; |
|||
private Long id; //for agent
|
|||
private String name; // angent name
|
|||
private String account; // major account
|
|||
@Column(name = "account_type") |
|||
private Integer accountTpe; // 1:phone 2:email
|
|||
private String username; // user name
|
|||
private Integer referrer; // agent refer userid
|
|||
private Long pid; //parent id
|
|||
private Integer deep; // agent deep length
|
|||
private String path; |
|||
@Column(name = "country_id") |
|||
private Integer countryIdd; //
|
|||
@Column(name = "country_code") |
|||
private String countryCode; //
|
|||
private String phone; |
|||
@Column(name = "phone_status") |
|||
private Integer phoneStatus; // verfied or no
|
|||
private String email; //
|
|||
@Column(name = "email_status") |
|||
private Integer emailStatus; |
|||
private String avatar; //
|
|||
@Column(name = "google_token") |
|||
private String googleToken; // google authontion
|
|||
@Column(name = "google_status") |
|||
private Integer googleStatus; //
|
|||
@Column(name = "second_verify") |
|||
private Integer secondVerify; |
|||
private String password; //
|
|||
private String payword; |
|||
@Column(name = "invite_code") |
|||
private String inviteCode; |
|||
@Column(name = "purchase_code") |
|||
private String purchaseCode; |
|||
@Column(name = "user_grade") |
|||
private Integer userGrade; // default value 1
|
|||
@Column(name = "user_identity") |
|||
private Integer userIdentity; // user type defalt 1
|
|||
@Column(name = "is_agency") |
|||
private Integer isAgency; |
|||
@Column(name = "is_palce") |
|||
private Integer isPalce; |
|||
@Column(name = "user_auth_level") |
|||
private Integer userAuthLevel; //
|
|||
@Column(name = "is_system") |
|||
private Integer isSystem; |
|||
@Column(name = "contract_deal") |
|||
private Integer contractDeal; |
|||
@Column(name = "login_code") |
|||
private String loginCode; |
|||
private Integer status; |
|||
@Column(name = "trade_status") |
|||
private Integer tradeStatus; |
|||
@Column(name = "trade_verify") |
|||
private Integer tradeVerify; |
|||
@Column(name = "contract_anomaly") |
|||
private Integer contractAnomaly; |
|||
@Column(name = "reg_ip") |
|||
private String regIp; |
|||
@Column(name = "last_login_time") |
|||
private Date lastLoginTime; |
|||
@Column(name = "last_login_ip") |
|||
private String lastLoginIp; |
|||
@Column(name = "created_at") |
|||
private Date createdAt; |
|||
@Column(name = "update_at") |
|||
private Date updatedAt; |
|||
|
|||
public Long getUserId() { |
|||
return userId; |
|||
} |
|||
|
|||
public void setUserId(Long userId) { |
|||
this.userId = userId; |
|||
} |
|||
|
|||
public Long getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(Long id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getAccount() { |
|||
return account; |
|||
} |
|||
|
|||
public void setAccount(String account) { |
|||
this.account = account; |
|||
} |
|||
|
|||
public Integer getAccountTpe() { |
|||
return accountTpe; |
|||
} |
|||
|
|||
public void setAccountTpe(Integer accountTpe) { |
|||
this.accountTpe = accountTpe; |
|||
} |
|||
|
|||
public String getUsername() { |
|||
return username; |
|||
} |
|||
|
|||
public void setUsername(String username) { |
|||
this.username = username; |
|||
} |
|||
|
|||
public Integer getReferrer() { |
|||
return referrer; |
|||
} |
|||
|
|||
public void setReferrer(Integer referrer) { |
|||
this.referrer = referrer; |
|||
} |
|||
|
|||
public Long getPid() { |
|||
return pid; |
|||
} |
|||
|
|||
public void setPid(Long pid) { |
|||
this.pid = pid; |
|||
} |
|||
|
|||
public Integer getDeep() { |
|||
return deep; |
|||
} |
|||
|
|||
public void setDeep(Integer deep) { |
|||
this.deep = deep; |
|||
} |
|||
|
|||
public String getPath() { |
|||
return path; |
|||
} |
|||
|
|||
public void setPath(String path) { |
|||
this.path = path; |
|||
} |
|||
|
|||
public Integer getCountryIdd() { |
|||
return countryIdd; |
|||
} |
|||
|
|||
public void setCountryIdd(Integer countryIdd) { |
|||
this.countryIdd = countryIdd; |
|||
} |
|||
|
|||
public String getCountryCode() { |
|||
return countryCode; |
|||
} |
|||
|
|||
public void setCountryCode(String countryCode) { |
|||
this.countryCode = countryCode; |
|||
} |
|||
|
|||
public String getPhone() { |
|||
return phone; |
|||
} |
|||
|
|||
public void setPhone(String phone) { |
|||
this.phone = phone; |
|||
} |
|||
|
|||
public Integer getPhoneStatus() { |
|||
return phoneStatus; |
|||
} |
|||
|
|||
public void setPhoneStatus(Integer phoneStatus) { |
|||
this.phoneStatus = phoneStatus; |
|||
} |
|||
|
|||
public String getEmail() { |
|||
return email; |
|||
} |
|||
|
|||
public void setEmail(String email) { |
|||
this.email = email; |
|||
} |
|||
|
|||
public Integer getEmailStatus() { |
|||
return emailStatus; |
|||
} |
|||
|
|||
public void setEmailStatus(Integer emailStatus) { |
|||
this.emailStatus = emailStatus; |
|||
} |
|||
|
|||
public String getAvatar() { |
|||
return avatar; |
|||
} |
|||
|
|||
public void setAvatar(String avatar) { |
|||
this.avatar = avatar; |
|||
} |
|||
|
|||
public String getGoogleToken() { |
|||
return googleToken; |
|||
} |
|||
|
|||
public void setGoogleToken(String googleToken) { |
|||
this.googleToken = googleToken; |
|||
} |
|||
|
|||
public Integer getGoogleStatus() { |
|||
return googleStatus; |
|||
} |
|||
|
|||
public void setGoogleStatus(Integer googleStatus) { |
|||
this.googleStatus = googleStatus; |
|||
} |
|||
|
|||
public Integer getSecondVerify() { |
|||
return secondVerify; |
|||
} |
|||
|
|||
public void setSecondVerify(Integer secondVerify) { |
|||
this.secondVerify = secondVerify; |
|||
} |
|||
|
|||
public String getPassword() { |
|||
return password; |
|||
} |
|||
|
|||
public void setPassword(String password) { |
|||
this.password = password; |
|||
} |
|||
|
|||
public String getPayword() { |
|||
return payword; |
|||
} |
|||
|
|||
public void setPayword(String payword) { |
|||
this.payword = payword; |
|||
} |
|||
|
|||
public String getInviteCode() { |
|||
return inviteCode; |
|||
} |
|||
|
|||
public void setInviteCode(String inviteCode) { |
|||
this.inviteCode = inviteCode; |
|||
} |
|||
|
|||
public String getPurchaseCode() { |
|||
return purchaseCode; |
|||
} |
|||
|
|||
public void setPurchaseCode(String purchaseCode) { |
|||
this.purchaseCode = purchaseCode; |
|||
} |
|||
|
|||
public Integer getUserGrade() { |
|||
return userGrade; |
|||
} |
|||
|
|||
public void setUserGrade(Integer userGrade) { |
|||
this.userGrade = userGrade; |
|||
} |
|||
|
|||
public Integer getUserIdentity() { |
|||
return userIdentity; |
|||
} |
|||
|
|||
public void setUserIdentity(Integer userIdentity) { |
|||
this.userIdentity = userIdentity; |
|||
} |
|||
|
|||
public Integer getIsAgency() { |
|||
return isAgency; |
|||
} |
|||
|
|||
public void setIsAgency(Integer isAgency) { |
|||
this.isAgency = isAgency; |
|||
} |
|||
|
|||
public Integer getIsPalce() { |
|||
return isPalce; |
|||
} |
|||
|
|||
public void setIsPalce(Integer isPalce) { |
|||
this.isPalce = isPalce; |
|||
} |
|||
|
|||
public Integer getUserAuthLevel() { |
|||
return userAuthLevel; |
|||
} |
|||
|
|||
public void setUserAuthLevel(Integer userAuthLevel) { |
|||
this.userAuthLevel = userAuthLevel; |
|||
} |
|||
|
|||
public Integer getIsSystem() { |
|||
return isSystem; |
|||
} |
|||
|
|||
public void setIsSystem(Integer isSystem) { |
|||
this.isSystem = isSystem; |
|||
} |
|||
|
|||
public Integer getContractDeal() { |
|||
return contractDeal; |
|||
} |
|||
|
|||
public void setContractDeal(Integer contractDeal) { |
|||
this.contractDeal = contractDeal; |
|||
} |
|||
|
|||
public String getLoginCode() { |
|||
return loginCode; |
|||
} |
|||
|
|||
public void setLoginCode(String loginCode) { |
|||
this.loginCode = loginCode; |
|||
} |
|||
|
|||
public Integer getStatus() { |
|||
return status; |
|||
} |
|||
|
|||
public void setStatus(Integer status) { |
|||
this.status = status; |
|||
} |
|||
|
|||
public Integer getTradeStatus() { |
|||
return tradeStatus; |
|||
} |
|||
|
|||
public void setTradeStatus(Integer tradeStatus) { |
|||
this.tradeStatus = tradeStatus; |
|||
} |
|||
|
|||
public Integer getTradeVerify() { |
|||
return tradeVerify; |
|||
} |
|||
|
|||
public void setTradeVerify(Integer tradeVerify) { |
|||
this.tradeVerify = tradeVerify; |
|||
} |
|||
|
|||
public Integer getContractAnomaly() { |
|||
return contractAnomaly; |
|||
} |
|||
|
|||
public void setContractAnomaly(Integer contractAnomaly) { |
|||
this.contractAnomaly = contractAnomaly; |
|||
} |
|||
|
|||
public String getRegIp() { |
|||
return regIp; |
|||
} |
|||
|
|||
public void setRegIp(String regIp) { |
|||
this.regIp = regIp; |
|||
} |
|||
|
|||
public Date getLastLoginTime() { |
|||
return lastLoginTime; |
|||
} |
|||
|
|||
public void setLastLoginTime(Date lastLoginTime) { |
|||
this.lastLoginTime = lastLoginTime; |
|||
} |
|||
|
|||
public String getLastLoginIp() { |
|||
return lastLoginIp; |
|||
} |
|||
|
|||
public void setLastLoginIp(String lastLoginIp) { |
|||
this.lastLoginIp = lastLoginIp; |
|||
} |
|||
|
|||
public Date getCreatedAt() { |
|||
return createdAt; |
|||
} |
|||
|
|||
public void setCreatedAt(Date createdAt) { |
|||
this.createdAt = createdAt; |
|||
} |
|||
|
|||
public Date getUpdatedAt() { |
|||
return updatedAt; |
|||
} |
|||
|
|||
public void setUpdatedAt(Date updatedAt) { |
|||
this.updatedAt = updatedAt; |
|||
} |
|||
} |
|||
@ -1,81 +0,0 @@ |
|||
package bc.mm.mis.utils; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
public class AjaxResult { |
|||
/** |
|||
* 接口返回数据 |
|||
* @param msg |
|||
* @param dataList |
|||
* @return |
|||
*/ |
|||
public static JSONObject success(String msg, List dataList){ |
|||
JSONObject result = new JSONObject(); |
|||
result.put("status",200); |
|||
result.put("msg",msg); |
|||
result.put("data",dataList); |
|||
return result; |
|||
} |
|||
|
|||
public static JSONObject success(String token){ |
|||
JSONObject result= new JSONObject(); |
|||
result.put("code",200); |
|||
result.put("token",token); |
|||
return result; |
|||
} |
|||
|
|||
public static JSONObject success(String msg, Map map){ |
|||
JSONObject result = new JSONObject(); |
|||
result.put("code",200); |
|||
result.put("msg",msg); |
|||
result.put("data",map); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 异常信息 |
|||
* @param msg |
|||
* @return |
|||
*/ |
|||
public static JSONObject error(String msg){ |
|||
JSONObject result = new JSONObject(); |
|||
result.put("code",500); |
|||
result.put("msg",msg); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 格式异常返回 |
|||
* @param code |
|||
* @param msg |
|||
* @return |
|||
*/ |
|||
public static JSONObject exception(int code, String msg){ |
|||
Map rmap = new HashMap(); |
|||
rmap.put("message",msg); |
|||
rmap.put("time",System.currentTimeMillis()/1000l); |
|||
|
|||
//
|
|||
JSONObject rjson = new JSONObject(); |
|||
rjson.put("status",code); |
|||
rjson.put("message",msg); |
|||
// rjson.put("data",rmap);
|
|||
|
|||
return rjson; |
|||
} |
|||
|
|||
public static JSONObject error500(String msg){ |
|||
Map rmap = new HashMap(); |
|||
rmap.put("message",msg); |
|||
//
|
|||
JSONObject rjson = new JSONObject(); |
|||
rjson.put("data",rmap); |
|||
rjson.put("status",500); |
|||
return rjson; |
|||
} |
|||
} |
|||
@ -1,41 +0,0 @@ |
|||
package bc.mm.mis.dao; |
|||
|
|||
|
|||
import bc.mm.mis.bean.Country; |
|||
import org.junit.jupiter.api.Test; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.data.domain.PageRequest; |
|||
|
|||
import java.util.List; |
|||
|
|||
import static org.junit.jupiter.api.Assertions.*; |
|||
|
|||
@SpringBootTest |
|||
class CountryDaoTest { |
|||
@Autowired |
|||
private CountryDao countryDao; |
|||
|
|||
@Test |
|||
void findAll() { |
|||
} |
|||
|
|||
@Test |
|||
void dopage() { |
|||
PageRequest pagereq = PageRequest.of(0,20); |
|||
Page<Country> pageobj = countryDao.findAll(pagereq); |
|||
int tt = pageobj.getTotalPages(); |
|||
long count = pageobj.getTotalElements(); |
|||
|
|||
List<Country> countryList =pageobj.getContent(); |
|||
|
|||
System.out.println(count); |
|||
System.out.println(tt); |
|||
|
|||
// foreach
|
|||
countryList.stream().forEach(s->{ |
|||
System.out.println(s.getEnName()); |
|||
}); |
|||
} |
|||
} |
|||
@ -1,38 +0,0 @@ |
|||
package bc.mm.mis.controller; |
|||
|
|||
import bc.mm.mis.bean.Country; |
|||
import bc.mm.mis.service.CountryService; |
|||
import bc.mm.mis.utils.AjaxResult; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.aspectj.weaver.loadtime.Aj; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
|
|||
@RestController |
|||
@RequestMapping("/v1") |
|||
public class HomeController { |
|||
@Resource |
|||
private CountryService countrySerive; |
|||
|
|||
@RequestMapping("/list") |
|||
public JSONObject alist(){ |
|||
List<Country> countryList = countrySerive.findAll(); |
|||
return AjaxResult.success("success",countryList); |
|||
} |
|||
|
|||
@RequestMapping("/aclist/{page}/{size}") |
|||
public JSONObject aclist(@PathVariable(value = "page") int page, @PathVariable("size") int size){ |
|||
|
|||
// List<Country> countries = countrySerive.pagers(page,size);
|
|||
HashMap asmap = new HashMap(); |
|||
asmap.put("page",page); |
|||
asmap.put("size",size); |
|||
// asmap.put("data",countries);
|
|||
return AjaxResult.success("success",asmap); |
|||
} |
|||
} |
|||
@ -1,81 +0,0 @@ |
|||
package bc.mm.mis.utils; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
public class AjaxResult { |
|||
/** |
|||
* 接口返回数据 |
|||
* @param msg |
|||
* @param dataList |
|||
* @return |
|||
*/ |
|||
public static JSONObject success(String msg, List dataList){ |
|||
JSONObject result = new JSONObject(); |
|||
result.put("status",200); |
|||
result.put("msg",msg); |
|||
result.put("data",dataList); |
|||
return result; |
|||
} |
|||
|
|||
public static JSONObject success(String token){ |
|||
JSONObject result= new JSONObject(); |
|||
result.put("code",200); |
|||
result.put("token",token); |
|||
return result; |
|||
} |
|||
|
|||
public static JSONObject success(String msg, Map map){ |
|||
JSONObject result = new JSONObject(); |
|||
result.put("code",200); |
|||
result.put("msg",msg); |
|||
result.put("data",map); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 异常信息 |
|||
* @param msg |
|||
* @return |
|||
*/ |
|||
public static JSONObject error(String msg){ |
|||
JSONObject result = new JSONObject(); |
|||
result.put("code",500); |
|||
result.put("msg",msg); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 格式异常返回 |
|||
* @param code |
|||
* @param msg |
|||
* @return |
|||
*/ |
|||
public static JSONObject exception(int code, String msg){ |
|||
Map rmap = new HashMap(); |
|||
rmap.put("message",msg); |
|||
rmap.put("time",System.currentTimeMillis()/1000l); |
|||
|
|||
//
|
|||
JSONObject rjson = new JSONObject(); |
|||
rjson.put("status",code); |
|||
rjson.put("message",msg); |
|||
// rjson.put("data",rmap);
|
|||
|
|||
return rjson; |
|||
} |
|||
|
|||
public static JSONObject error500(String msg){ |
|||
Map rmap = new HashMap(); |
|||
rmap.put("message",msg); |
|||
//
|
|||
JSONObject rjson = new JSONObject(); |
|||
rjson.put("data",rmap); |
|||
rjson.put("status",500); |
|||
return rjson; |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
package bc.mm.mis.v1; |
|||
|
|||
import bc.mm.mis.bean.Country; |
|||
import bc.mm.mis.service.CountryService; |
|||
import bc.mm.mis.service.DemoService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
@RestController |
|||
@RequestMapping("/v1") |
|||
public class HomeController { |
|||
@Autowired |
|||
DemoService demoService; |
|||
//
|
|||
@Autowired |
|||
CountryService countryService; |
|||
|
|||
@RequestMapping("/hi") |
|||
public String hi(){ |
|||
demoService.atest(); |
|||
return "aa"; |
|||
} |
|||
|
|||
|
|||
@RequestMapping("/cc") |
|||
public String aa(){ |
|||
List<Country> countryList = countryService.findAllByPage(0,10); |
|||
int size = countryList.size(); |
|||
return String.valueOf(size); |
|||
} |
|||
} |
|||
@ -1,15 +1,7 @@ |
|||
# 应用服务 WEB 访问端口 |
|||
server.port=9091 |
|||
|
|||
# logback日志操作 |
|||
logging.config=classpath:logback-spring.xml |
|||
logging.path=./logs/ |
|||
|
|||
# |
|||
spring.datasource.url=jdbc:mysql://localhost:3306/bcdb?useUnicode=true&characterEncoding=utf8 |
|||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver |
|||
spring.datasource.username=root |
|||
spring.datasource.password=root |
|||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver |
|||
# jpa |
|||
spring.jpa.show-sql=true |
|||
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect |
|||
spring.datasource.url=jdbc:mysql://localhost:3306/bcdb |
|||
Loading…
Reference in new issue