CustomerService单元测试

master
shijie 4 years ago
parent bd0ff253da
commit fb0d0d3e2e
  1. 76
      src/main/java/com/yipin/liuwanr/entity/Customer.java
  2. 129
      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

@ -41,7 +41,7 @@ public class Customer {
private Integer industryId;
//绑定行业名称
private String industryName;
//————————————————————————
//————————————————————————
//绑定省份名称
private String provinceName;
//绑定城市名称
@ -54,139 +54,213 @@ public class Customer {
public String getCreationTime() {
return creationTime;
}
public void setCreationTime(String creationTime) {
this.creationTime = creationTime;
}
public String getIndustryClassName() {
return industryClassName;
}
public void setIndustryClassName(String industryClassName) {
this.industryClassName = industryClassName;
}
public String getIndustryName() {
return industryName;
}
public void setIndustryName(String industryName) {
this.industryName = industryName;
}
public Integer getIndustryClassId() {
return industryClassId;
}
public void setIndustryClassId(Integer industryClassId) {
this.industryClassId = industryClassId;
}
public Integer getIndustryId() {
return industryId;
}
public void setIndustryId(Integer industryId) {
this.industryId = industryId;
}
public List<Customer> getCustomer() {
return customer;
}
public void setCustomer(List<Customer> customer) {
this.customer = customer;
}
public String getSearchContent() {
return searchContent;
}
public void setSearchContent(String searchContent) {
this.searchContent = searchContent;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getCustomerId() {
return customerId;
}
public void setCustomerId(Integer customerId) {
this.customerId = customerId;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getCountries() {
return countries;
}
public void setCountries(String countries) {
this.countries = countries;
}
public String getIndustry() {
return industry;
}
public void setIndustry(String industry) {
this.industry = industry;
}
public Integer getProvinceId() {
return provinceId;
}
public void setProvinceId(Integer provinceId) {
this.provinceId = provinceId;
}
public String getAdminName() {
return adminName;
}
public void setAdminName(String adminName) {
this.adminName = adminName;
}
public String getAdminPhone() {
return adminPhone;
}
public void setAdminPhone(String adminPhone) {
this.adminPhone = adminPhone;
}
public Integer getCityId() {
return cityId;
}
public void setCityId(Integer cityId) {
this.cityId = cityId;
}
public Integer getCustomerType() {
return customerType;
}
public void setCustomerType(Integer customerType) {
this.customerType = customerType;
}
public String getStopTime() {
return stopTime;
}
public void setStopTime(String stopTime) {
this.stopTime = stopTime;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getSchoolId() {
return schoolId;
}
public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getSchoolName() {
return schoolName;
}
public void setSchoolName(String 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 {
//用户id
@ -65,7 +65,7 @@ public class UserM {
private List<UserM> user;
//用户头像路径
private String userAvatars;
//------------------------------------------------
//------------------------------------------------
//学校名称
private String schoolName;
//省份名称
@ -92,241 +92,366 @@ public class UserM {
public Integer getProfessionalClassId() {
return professionalClassId;
}
public void setProfessionalClassId(Integer professionalClassId) {
this.professionalClassId = professionalClassId;
}
public String getProfessionalClassName() {
return professionalClassName;
}
public void setProfessionalClassName(String professionalClassName) {
this.professionalClassName = professionalClassName;
}
public Integer getDisciplineId() {
return disciplineId;
}
public void setDisciplineId(Integer disciplineId) {
this.disciplineId = disciplineId;
}
public String getDisciplineName() {
return disciplineName;
}
public void setDisciplineName(String disciplineName) {
this.disciplineName = disciplineName;
}
public Integer getProfessionalId() {
return professionalId;
}
public void setProfessionalId(Integer professionalId) {
this.professionalId = professionalId;
}
public String getProfessionalName() {
return professionalName;
}
public void setProfessionalName(String professionalName) {
this.professionalName = professionalName;
}
public String getUserAvatars() {
return userAvatars;
}
public void setUserAvatars(String userAvatars) {
this.userAvatars = userAvatars;
}
public Integer getMonth() {
return month;
}
public void setMonth(Integer month) {
this.month = month;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getSearchContent() {
return searchContent;
}
public void setSearchContent(String searchContent) {
this.searchContent = searchContent;
}
public List<UserM> getUser() {
return user;
}
public void setUser(List<UserM> user) {
this.user = user;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getSchoolName() {
return schoolName;
}
public void setSchoolName(String schoolName) {
this.schoolName = schoolName;
}
public String getUniqueIdentificationAccount() {
return uniqueIdentificationAccount;
}
public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) {
this.uniqueIdentificationAccount = uniqueIdentificationAccount;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUserAccount() {
return userAccount;
}
public void setUserAccount(String userAccount) {
this.userAccount = userAccount;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCountries() {
return countries;
}
public void setCountries(String countries) {
this.countries = countries;
}
public Integer getProvinceId() {
return provinceId;
}
public void setProvinceId(Integer provinceId) {
this.provinceId = provinceId;
}
public Integer getCityId() {
return cityId;
}
public void setCityId(Integer cityId) {
this.cityId = cityId;
}
public Integer getAccountRole() {
return accountRole;
}
public void setAccountRole(Integer accountRole) {
this.accountRole = accountRole;
}
public String getCreationTime() {
return creationTime;
}
public void setCreationTime(String creationTime) {
this.creationTime = creationTime;
}
public Integer getLogInNumber() {
return logInNumber;
}
public void setLogInNumber(Integer logInNumber) {
this.logInNumber = logInNumber;
}
public String getWorkNumber() {
return workNumber;
}
public void setWorkNumber(String workNumber) {
this.workNumber = workNumber;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getClassAndGrade() {
return classAndGrade;
}
public void setClassAndGrade(String classAndGrade) {
this.classAndGrade = classAndGrade;
}
public String getLastTimeOfLanding() {
return lastTimeOfLanding;
}
public void setLastTimeOfLanding(String lastTimeOfLanding) {
this.lastTimeOfLanding = lastTimeOfLanding;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public Integer getDocumentType() {
return documentType;
}
public void setDocumentType(Integer documentType) {
this.documentType = documentType;
}
public String getIDNumber() {
return IDNumber;
}
public void setIDNumber(String iDNumber) {
IDNumber = iDNumber;
}
public Integer getEducationDegree() {
return educationDegree;
}
public void setEducationDegree(Integer educationDegree) {
this.educationDegree = educationDegree;
}
public Integer getSubjectsTaught() {
return subjectsTaught;
}
public void setSubjectsTaught(Integer subjectsTaught) {
this.subjectsTaught = subjectsTaught;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getWeChatID() {
return WeChatID;
}
public void setWeChatID(String weChatID) {
WeChatID = weChatID;
}
public String getTeachingProfessional() {
return teachingProfessional;
}
public void setTeachingProfessional(String teachingProfessional) {
this.teachingProfessional = teachingProfessional;
}
public String getDateBirth() {
return dateBirth;
}
public void setDateBirth(String dateBirth) {
this.dateBirth = dateBirth;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getSchoolId() {
return schoolId;
}
public void setSchoolId(Integer 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
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