CustomerService单元测试

master
shijie 4 years ago
parent bd0ff253da
commit fb0d0d3e2e
  1. 74
      src/main/java/com/yipin/liuwanr/entity/Customer.java
  2. 127
      src/main/java/com/yipin/liuwanr/entity/UserM.java
  3. 3
      src/test/java/com/yipin/liuwanr/CoursePermissionsServiceTest.java
  4. 141
      src/test/java/com/yipin/liuwanr/CustomerServiceTest.java

@ -54,139 +54,213 @@ public class Customer {
public String getCreationTime() { public String getCreationTime() {
return creationTime; return creationTime;
} }
public void setCreationTime(String creationTime) { public void setCreationTime(String creationTime) {
this.creationTime = creationTime; this.creationTime = creationTime;
} }
public String getIndustryClassName() { public String getIndustryClassName() {
return industryClassName; return industryClassName;
} }
public void setIndustryClassName(String industryClassName) { public void setIndustryClassName(String industryClassName) {
this.industryClassName = industryClassName; this.industryClassName = industryClassName;
} }
public String getIndustryName() { public String getIndustryName() {
return industryName; return industryName;
} }
public void setIndustryName(String industryName) { public void setIndustryName(String industryName) {
this.industryName = industryName; this.industryName = industryName;
} }
public Integer getIndustryClassId() { public Integer getIndustryClassId() {
return industryClassId; return industryClassId;
} }
public void setIndustryClassId(Integer industryClassId) { public void setIndustryClassId(Integer industryClassId) {
this.industryClassId = industryClassId; this.industryClassId = industryClassId;
} }
public Integer getIndustryId() { public Integer getIndustryId() {
return industryId; return industryId;
} }
public void setIndustryId(Integer industryId) { public void setIndustryId(Integer industryId) {
this.industryId = industryId; this.industryId = industryId;
} }
public List<Customer> getCustomer() { public List<Customer> getCustomer() {
return customer; return customer;
} }
public void setCustomer(List<Customer> customer) { public void setCustomer(List<Customer> customer) {
this.customer = customer; this.customer = customer;
} }
public String getSearchContent() { public String getSearchContent() {
return searchContent; return searchContent;
} }
public void setSearchContent(String searchContent) { public void setSearchContent(String searchContent) {
this.searchContent = searchContent; this.searchContent = searchContent;
} }
public Integer getLevel() { public Integer getLevel() {
return level; return level;
} }
public void setLevel(Integer level) { public void setLevel(Integer level) {
this.level = level; this.level = level;
} }
public Integer getCustomerId() { public Integer getCustomerId() {
return customerId; return customerId;
} }
public void setCustomerId(Integer customerId) { public void setCustomerId(Integer customerId) {
this.customerId = customerId; this.customerId = customerId;
} }
public String getCustomerName() { public String getCustomerName() {
return customerName; return customerName;
} }
public void setCustomerName(String customerName) { public void setCustomerName(String customerName) {
this.customerName = customerName; this.customerName = customerName;
} }
public String getCountries() { public String getCountries() {
return countries; return countries;
} }
public void setCountries(String countries) { public void setCountries(String countries) {
this.countries = countries; this.countries = countries;
} }
public String getIndustry() { public String getIndustry() {
return industry; return industry;
} }
public void setIndustry(String industry) { public void setIndustry(String industry) {
this.industry = industry; this.industry = industry;
} }
public Integer getProvinceId() { public Integer getProvinceId() {
return provinceId; return provinceId;
} }
public void setProvinceId(Integer provinceId) { public void setProvinceId(Integer provinceId) {
this.provinceId = provinceId; this.provinceId = provinceId;
} }
public String getAdminName() { public String getAdminName() {
return adminName; return adminName;
} }
public void setAdminName(String adminName) { public void setAdminName(String adminName) {
this.adminName = adminName; this.adminName = adminName;
} }
public String getAdminPhone() { public String getAdminPhone() {
return adminPhone; return adminPhone;
} }
public void setAdminPhone(String adminPhone) { public void setAdminPhone(String adminPhone) {
this.adminPhone = adminPhone; this.adminPhone = adminPhone;
} }
public Integer getCityId() { public Integer getCityId() {
return cityId; return cityId;
} }
public void setCityId(Integer cityId) { public void setCityId(Integer cityId) {
this.cityId = cityId; this.cityId = cityId;
} }
public Integer getCustomerType() { public Integer getCustomerType() {
return customerType; return customerType;
} }
public void setCustomerType(Integer customerType) { public void setCustomerType(Integer customerType) {
this.customerType = customerType; this.customerType = customerType;
} }
public String getStopTime() { public String getStopTime() {
return stopTime; return stopTime;
} }
public void setStopTime(String stopTime) { public void setStopTime(String stopTime) {
this.stopTime = stopTime; this.stopTime = stopTime;
} }
public String getEmail() { public String getEmail() {
return email; return email;
} }
public void setEmail(String email) { public void setEmail(String email) {
this.email = email; this.email = email;
} }
public Integer getSchoolId() { public Integer getSchoolId() {
return schoolId; return schoolId;
} }
public void setSchoolId(Integer schoolId) { public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId; this.schoolId = schoolId;
} }
public String getProvinceName() { public String getProvinceName() {
return provinceName; return provinceName;
} }
public void setProvinceName(String provinceName) { public void setProvinceName(String provinceName) {
this.provinceName = provinceName; this.provinceName = provinceName;
} }
public String getCityName() { public String getCityName() {
return cityName; return cityName;
} }
public void setCityName(String cityName) { public void setCityName(String cityName) {
this.cityName = cityName; this.cityName = cityName;
} }
public String getSchoolName() { public String getSchoolName() {
return schoolName; return schoolName;
} }
public void setSchoolName(String schoolName) { public void setSchoolName(String schoolName) {
this.schoolName = schoolName; this.schoolName = schoolName;
} }
@Override
public String toString() {
return "Customer{" +
"customerId=" + customerId +
", customerName='" + customerName + '\'' +
", countries='" + countries + '\'' +
", industry='" + industry + '\'' +
", provinceId=" + provinceId +
", adminName='" + adminName + '\'' +
", adminPhone='" + adminPhone + '\'' +
", cityId=" + cityId +
", customerType=" + customerType +
", stopTime='" + stopTime + '\'' +
", creationTime='" + creationTime + '\'' +
", email='" + email + '\'' +
", schoolId=" + schoolId +
", searchContent='" + searchContent + '\'' +
", customer=" + customer +
", industryClassId=" + industryClassId +
", industryClassName='" + industryClassName + '\'' +
", industryId=" + industryId +
", industryName='" + industryName + '\'' +
", provinceName='" + provinceName + '\'' +
", cityName='" + cityName + '\'' +
", schoolName='" + schoolName + '\'' +
", level=" + level +
'}';
}
} }

@ -4,8 +4,8 @@ import java.util.List;
/** /**
* 用户信息实体 * 用户信息实体
* @author Ning
* *
* @author Ning
*/ */
public class UserM { public class UserM {
//用户id //用户id
@ -92,241 +92,366 @@ public class UserM {
public Integer getProfessionalClassId() { public Integer getProfessionalClassId() {
return professionalClassId; return professionalClassId;
} }
public void setProfessionalClassId(Integer professionalClassId) { public void setProfessionalClassId(Integer professionalClassId) {
this.professionalClassId = professionalClassId; this.professionalClassId = professionalClassId;
} }
public String getProfessionalClassName() { public String getProfessionalClassName() {
return professionalClassName; return professionalClassName;
} }
public void setProfessionalClassName(String professionalClassName) { public void setProfessionalClassName(String professionalClassName) {
this.professionalClassName = professionalClassName; this.professionalClassName = professionalClassName;
} }
public Integer getDisciplineId() { public Integer getDisciplineId() {
return disciplineId; return disciplineId;
} }
public void setDisciplineId(Integer disciplineId) { public void setDisciplineId(Integer disciplineId) {
this.disciplineId = disciplineId; this.disciplineId = disciplineId;
} }
public String getDisciplineName() { public String getDisciplineName() {
return disciplineName; return disciplineName;
} }
public void setDisciplineName(String disciplineName) { public void setDisciplineName(String disciplineName) {
this.disciplineName = disciplineName; this.disciplineName = disciplineName;
} }
public Integer getProfessionalId() { public Integer getProfessionalId() {
return professionalId; return professionalId;
} }
public void setProfessionalId(Integer professionalId) { public void setProfessionalId(Integer professionalId) {
this.professionalId = professionalId; this.professionalId = professionalId;
} }
public String getProfessionalName() { public String getProfessionalName() {
return professionalName; return professionalName;
} }
public void setProfessionalName(String professionalName) { public void setProfessionalName(String professionalName) {
this.professionalName = professionalName; this.professionalName = professionalName;
} }
public String getUserAvatars() { public String getUserAvatars() {
return userAvatars; return userAvatars;
} }
public void setUserAvatars(String userAvatars) { public void setUserAvatars(String userAvatars) {
this.userAvatars = userAvatars; this.userAvatars = userAvatars;
} }
public Integer getMonth() { public Integer getMonth() {
return month; return month;
} }
public void setMonth(Integer month) { public void setMonth(Integer month) {
this.month = month; this.month = month;
} }
public String getEndTime() { public String getEndTime() {
return endTime; return endTime;
} }
public void setEndTime(String endTime) { public void setEndTime(String endTime) {
this.endTime = endTime; this.endTime = endTime;
} }
public String getSearchContent() { public String getSearchContent() {
return searchContent; return searchContent;
} }
public void setSearchContent(String searchContent) { public void setSearchContent(String searchContent) {
this.searchContent = searchContent; this.searchContent = searchContent;
} }
public List<UserM> getUser() { public List<UserM> getUser() {
return user; return user;
} }
public void setUser(List<UserM> user) { public void setUser(List<UserM> user) {
this.user = user; this.user = user;
} }
public String getProvinceName() { public String getProvinceName() {
return provinceName; return provinceName;
} }
public void setProvinceName(String provinceName) { public void setProvinceName(String provinceName) {
this.provinceName = provinceName; this.provinceName = provinceName;
} }
public String getCityName() { public String getCityName() {
return cityName; return cityName;
} }
public void setCityName(String cityName) { public void setCityName(String cityName) {
this.cityName = cityName; this.cityName = cityName;
} }
public String getSchoolName() { public String getSchoolName() {
return schoolName; return schoolName;
} }
public void setSchoolName(String schoolName) { public void setSchoolName(String schoolName) {
this.schoolName = schoolName; this.schoolName = schoolName;
} }
public String getUniqueIdentificationAccount() { public String getUniqueIdentificationAccount() {
return uniqueIdentificationAccount; return uniqueIdentificationAccount;
} }
public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) { public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) {
this.uniqueIdentificationAccount = uniqueIdentificationAccount; this.uniqueIdentificationAccount = uniqueIdentificationAccount;
} }
public Integer getUserId() { public Integer getUserId() {
return userId; return userId;
} }
public void setUserId(Integer userId) { public void setUserId(Integer userId) {
this.userId = userId; this.userId = userId;
} }
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String getUserAccount() { public String getUserAccount() {
return userAccount; return userAccount;
} }
public void setUserAccount(String userAccount) { public void setUserAccount(String userAccount) {
this.userAccount = userAccount; this.userAccount = userAccount;
} }
public String getPassword() { public String getPassword() {
return password; return password;
} }
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
public String getCountries() { public String getCountries() {
return countries; return countries;
} }
public void setCountries(String countries) { public void setCountries(String countries) {
this.countries = countries; this.countries = countries;
} }
public Integer getProvinceId() { public Integer getProvinceId() {
return provinceId; return provinceId;
} }
public void setProvinceId(Integer provinceId) { public void setProvinceId(Integer provinceId) {
this.provinceId = provinceId; this.provinceId = provinceId;
} }
public Integer getCityId() { public Integer getCityId() {
return cityId; return cityId;
} }
public void setCityId(Integer cityId) { public void setCityId(Integer cityId) {
this.cityId = cityId; this.cityId = cityId;
} }
public Integer getAccountRole() { public Integer getAccountRole() {
return accountRole; return accountRole;
} }
public void setAccountRole(Integer accountRole) { public void setAccountRole(Integer accountRole) {
this.accountRole = accountRole; this.accountRole = accountRole;
} }
public String getCreationTime() { public String getCreationTime() {
return creationTime; return creationTime;
} }
public void setCreationTime(String creationTime) { public void setCreationTime(String creationTime) {
this.creationTime = creationTime; this.creationTime = creationTime;
} }
public Integer getLogInNumber() { public Integer getLogInNumber() {
return logInNumber; return logInNumber;
} }
public void setLogInNumber(Integer logInNumber) { public void setLogInNumber(Integer logInNumber) {
this.logInNumber = logInNumber; this.logInNumber = logInNumber;
} }
public String getWorkNumber() { public String getWorkNumber() {
return workNumber; return workNumber;
} }
public void setWorkNumber(String workNumber) { public void setWorkNumber(String workNumber) {
this.workNumber = workNumber; this.workNumber = workNumber;
} }
public String getDepartment() { public String getDepartment() {
return department; return department;
} }
public void setDepartment(String department) { public void setDepartment(String department) {
this.department = department; this.department = department;
} }
public String getClassAndGrade() { public String getClassAndGrade() {
return classAndGrade; return classAndGrade;
} }
public void setClassAndGrade(String classAndGrade) { public void setClassAndGrade(String classAndGrade) {
this.classAndGrade = classAndGrade; this.classAndGrade = classAndGrade;
} }
public String getLastTimeOfLanding() { public String getLastTimeOfLanding() {
return lastTimeOfLanding; return lastTimeOfLanding;
} }
public void setLastTimeOfLanding(String lastTimeOfLanding) { public void setLastTimeOfLanding(String lastTimeOfLanding) {
this.lastTimeOfLanding = lastTimeOfLanding; this.lastTimeOfLanding = lastTimeOfLanding;
} }
public Integer getSex() { public Integer getSex() {
return sex; return sex;
} }
public void setSex(Integer sex) { public void setSex(Integer sex) {
this.sex = sex; this.sex = sex;
} }
public Integer getDocumentType() { public Integer getDocumentType() {
return documentType; return documentType;
} }
public void setDocumentType(Integer documentType) { public void setDocumentType(Integer documentType) {
this.documentType = documentType; this.documentType = documentType;
} }
public String getIDNumber() { public String getIDNumber() {
return IDNumber; return IDNumber;
} }
public void setIDNumber(String iDNumber) { public void setIDNumber(String iDNumber) {
IDNumber = iDNumber; IDNumber = iDNumber;
} }
public Integer getEducationDegree() { public Integer getEducationDegree() {
return educationDegree; return educationDegree;
} }
public void setEducationDegree(Integer educationDegree) { public void setEducationDegree(Integer educationDegree) {
this.educationDegree = educationDegree; this.educationDegree = educationDegree;
} }
public Integer getSubjectsTaught() { public Integer getSubjectsTaught() {
return subjectsTaught; return subjectsTaught;
} }
public void setSubjectsTaught(Integer subjectsTaught) { public void setSubjectsTaught(Integer subjectsTaught) {
this.subjectsTaught = subjectsTaught; this.subjectsTaught = subjectsTaught;
} }
public String getPhone() { public String getPhone() {
return phone; return phone;
} }
public void setPhone(String phone) { public void setPhone(String phone) {
this.phone = phone; this.phone = phone;
} }
public String getWeChatID() { public String getWeChatID() {
return WeChatID; return WeChatID;
} }
public void setWeChatID(String weChatID) { public void setWeChatID(String weChatID) {
WeChatID = weChatID; WeChatID = weChatID;
} }
public String getTeachingProfessional() { public String getTeachingProfessional() {
return teachingProfessional; return teachingProfessional;
} }
public void setTeachingProfessional(String teachingProfessional) { public void setTeachingProfessional(String teachingProfessional) {
this.teachingProfessional = teachingProfessional; this.teachingProfessional = teachingProfessional;
} }
public String getDateBirth() { public String getDateBirth() {
return dateBirth; return dateBirth;
} }
public void setDateBirth(String dateBirth) { public void setDateBirth(String dateBirth) {
this.dateBirth = dateBirth; this.dateBirth = dateBirth;
} }
public String getEmail() { public String getEmail() {
return email; return email;
} }
public void setEmail(String email) { public void setEmail(String email) {
this.email = email; this.email = email;
} }
public Integer getSchoolId() { public Integer getSchoolId() {
return schoolId; return schoolId;
} }
public void setSchoolId(Integer schoolId) { public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId; this.schoolId = schoolId;
} }
@Override
public String toString() {
return "UserM{" +
"userId=" + userId +
", name='" + name + '\'' +
", userAccount='" + userAccount + '\'' +
", password='" + password + '\'' +
", countries='" + countries + '\'' +
", provinceId=" + provinceId +
", cityId=" + cityId +
", accountRole=" + accountRole +
", creationTime='" + creationTime + '\'' +
", logInNumber=" + logInNumber +
", workNumber='" + workNumber + '\'' +
", department='" + department + '\'' +
", classAndGrade='" + classAndGrade + '\'' +
", lastTimeOfLanding='" + lastTimeOfLanding + '\'' +
", sex=" + sex +
", documentType=" + documentType +
", IDNumber='" + IDNumber + '\'' +
", educationDegree=" + educationDegree +
", subjectsTaught=" + subjectsTaught +
", phone='" + phone + '\'' +
", WeChatID='" + WeChatID + '\'' +
", teachingProfessional='" + teachingProfessional + '\'' +
", dateBirth='" + dateBirth + '\'' +
", email='" + email + '\'' +
", schoolId=" + schoolId +
", uniqueIdentificationAccount='" + uniqueIdentificationAccount + '\'' +
", searchContent='" + searchContent + '\'' +
", user=" + user +
", userAvatars='" + userAvatars + '\'' +
", schoolName='" + schoolName + '\'' +
", provinceName='" + provinceName + '\'' +
", cityName='" + cityName + '\'' +
", month=" + month +
", endTime='" + endTime + '\'' +
", professionalClassId=" + professionalClassId +
", professionalClassName='" + professionalClassName + '\'' +
", disciplineId=" + disciplineId +
", disciplineName='" + disciplineName + '\'' +
", professionalId=" + professionalId +
", professionalName='" + professionalName + '\'' +
'}';
}
} }

@ -22,9 +22,6 @@ public class CoursePermissionsServiceTest {
@Autowired @Autowired
private CoursePermissionsService coursePermissionsService; private CoursePermissionsService coursePermissionsService;
@Autowired
private CoursePermissionsMapper coursePermissionsMapper;
/** /**
* 新增课程权限 * 新增课程权限
*/ */

@ -0,0 +1,141 @@
package com.yipin.liuwanr;
import com.yipin.liuwanr.entity.Customer;
import com.yipin.liuwanr.entity.UserM;
import com.yipin.liuwanr.service.CustomerService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
@RunWith(SpringRunner.class)
@SpringBootTest
public class CustomerServiceTest {
@Autowired
private CustomerService customerService;
//添加客户
@Test
@Transactional
public void addCustomer() {
Customer customer = new Customer();
customer.setCountries("测试");
customer.setIndustry("测试");
customer.setProvinceId(1);
customer.setAdminName("测试");
customer.setAdminPhone("测试");
customer.setCityId(1);
customer.setCustomerType(1);
customer.setStopTime("测试");
customer.setEmail("测试");
customer.setSchoolId(1);
customer.setIndustryClassId(1);
customer.setIndustryId(1);
customer.setCustomerName("测试");
HashMap<String, Object> map = customerService.addCustomer(customer);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//客户管理添加用户
@Test
@Transactional
public void addAdmin() {
UserM userm = new UserM();
userm.setCountries("测试");
userm.setProvinceId(1);
userm.setCityId(1);
userm.setPhone("13137366429");
userm.setEmail("123@gmail.com");
HashMap<String, Object> map = customerService.addAdmin(userm);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
@Test
public void queryCustomer() {
Customer customer = new Customer();
Integer pageNo = 1;
Integer pageSize = 10;
HashMap<String, Object> map = customerService.queryCustomer(customer, pageNo, pageSize);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
@Test
public void queryCustomerDetails() {
Integer customerId = 10;
HashMap<String, Object> map = customerService.queryCustomerDetails(customerId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//查询客户是否存在
@Test
public void queryCustomerIsExists() {
Integer schoolId = 10;
HashMap<String, Object> map = customerService.queryCustomerIsExists(schoolId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//删除客户
@Test
@Transactional
public void deleteCustomer() {
Customer customer = new Customer();
customer.setCountries("测试");
customer.setIndustry("测试");
customer.setProvinceId(1);
customer.setAdminName("测试");
customer.setAdminPhone("测试");
customer.setCityId(1);
customer.setCustomerType(1);
customer.setStopTime("测试");
customer.setEmail("测试");
customer.setSchoolId(1);
customer.setIndustryClassId(1);
customer.setIndustryId(1);
customer.setCustomerName("测试");
HashMap<String, Object> map = customerService.deleteCustomer(customer);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//更新客户
@Test
@Transactional
public void updateCustomer() {
Customer customer = new Customer();
customer.setCustomerId(53);
customer.setCountries("测试");
customer.setIndustry("测试");
customer.setProvinceId(1);
customer.setAdminName("测试");
customer.setAdminPhone("测试");
customer.setCityId(1);
customer.setCustomerType(1);
customer.setStopTime("测试");
customer.setEmail("测试");
customer.setSchoolId(1);
customer.setIndustryClassId(1);
customer.setIndustryId(1);
customer.setCustomerName("测试");
HashMap<String, Object> map = customerService.updateCustomer(customer);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//查询行业类
@Test
public void queryCustomerIndustryClass() {
HashMap<String, Object> map = customerService.queryCustomerIndustryClass();
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//查询行业
@Test
public void queryCustomerIndustry() {
Integer industryClassId = 10;
HashMap<String, Object> map = customerService.queryCustomerIndustry(industryClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
}
Loading…
Cancel
Save