parent
a5f90b7b18
commit
96be942be1
11 changed files with 1252 additions and 941 deletions
@ -0,0 +1,217 @@ |
||||
package com.yipin.liuwanr; |
||||
|
||||
import com.yipin.liuwanr.entity.*; |
||||
import com.yipin.liuwanr.service.OrderService; |
||||
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.text.ParseException; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
@RunWith(SpringRunner.class) |
||||
@SpringBootTest |
||||
public class OrderServiceTest { |
||||
@Autowired |
||||
private OrderService orderService; |
||||
|
||||
//添加合同信息
|
||||
@Test |
||||
@Transactional |
||||
public void addOrder() { |
||||
Order order = new Order(); |
||||
order.setOrderNumber("1596424017647"); |
||||
order.setCustomerName("测试"); |
||||
order.setOrderName("测试"); |
||||
order.setOrderAmount("120"); |
||||
order.setOrderType(1); |
||||
order.setProvinceId(1); |
||||
order.setCityId(1); |
||||
order.setOrderContact("张三"); |
||||
order.setPhone("15267668899"); |
||||
order.setEmail("123@qq.com"); |
||||
order.setCustomerId(126); |
||||
HashMap<String, Object> map = orderService.addOrder(order); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void addContractInformation() { |
||||
ContractInformation contractInformation = new ContractInformation(); |
||||
contractInformation.setContractInformationName("1"); |
||||
contractInformation.setContractInformationNumber("1"); |
||||
contractInformation.setContractInformationSum("1"); |
||||
contractInformation.setContractInformationLink("1"); |
||||
contractInformation.setOrderId(20); |
||||
HashMap<String, Object> map = orderService.addContractInformation(contractInformation); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//添加课程权限
|
||||
@Test |
||||
@Transactional |
||||
public void addCoursePermissionss() throws ParseException { |
||||
List<CoursePermissions> coursePermissionss = new ArrayList<>(); |
||||
CoursePermissions coursePermissions = new CoursePermissions(); |
||||
coursePermissions.setCourseId(77); |
||||
coursePermissions.setUsePeriod(30); |
||||
coursePermissions.setMarketPrice(12.8); |
||||
coursePermissions.setTransactionPrice(1); |
||||
coursePermissions.setDiscount(7); |
||||
coursePermissions.setPortAddressId(1); |
||||
coursePermissions.setIsDeliverGoods(1); |
||||
coursePermissions.setOrderId(118); |
||||
coursePermissionss.add(coursePermissions); |
||||
HashMap<String, Object> map = orderService.addCoursePermissionss(coursePermissionss); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//绑定应用权限
|
||||
@Test |
||||
@Transactional |
||||
public void bindingApplicationPermissions() { |
||||
ApplicationPermissions applicationPermissions = new ApplicationPermissions(); |
||||
applicationPermissions.setSystemId("2"); |
||||
applicationPermissions.setOrderId(2); |
||||
HashMap<String, Object> map = orderService.bindingApplicationPermissions(applicationPermissions); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void queryCoursePermissions() { |
||||
String courseId = "1"; |
||||
HashMap<String, Object> map = orderService.queryCoursePermissions(courseId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void queryOrder() { |
||||
Order order = new Order(); |
||||
Integer pageNo = 1; |
||||
Integer pageSize = 10; |
||||
HashMap<String, Object> map = orderService.queryOrder(order, pageNo, pageSize); |
||||
Integer retcode = (Integer) map.get("retcode"); |
||||
System.out.println(retcode); |
||||
if (retcode == 200) { |
||||
PageResult pageResult = (PageResult) map.get("retvalue"); |
||||
Long total = pageResult.getTotal(); |
||||
System.out.println("total = " + total); |
||||
List<Order> rows = (List<Order>) pageResult.getRows(); |
||||
rows.forEach(item -> System.out.println(item.toString())); |
||||
} else { |
||||
String msg = (String) map.get("retvalue"); |
||||
System.out.println(msg); |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void queryOrderDetails() { |
||||
Integer orderId = 1; |
||||
HashMap<String, Object> map = orderService.queryOrderDetails(orderId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void deleteOrder() { |
||||
List<Integer> orderId = new ArrayList<>(); |
||||
orderId.add(1); |
||||
orderId.add(2); |
||||
orderId.add(3); |
||||
HashMap<String, Object> map = orderService.deleteOrder(orderId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void updateOrder() { |
||||
Order order = new Order(); |
||||
HashMap<String, Object> map = orderService.updateOrder(order); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void deleteCoursePermissions() { |
||||
Integer orderId = 1; |
||||
HashMap<String, Object> map = orderService.deleteCoursePermissions(orderId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void updateCoursePermissions() { |
||||
List<CoursePermissions> coursePermissionss = new ArrayList<>(); |
||||
CoursePermissions coursePermissions = new CoursePermissions(); |
||||
coursePermissionss.add(coursePermissions); |
||||
HashMap<String, Object> map = orderService.updateCoursePermissions(coursePermissionss); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void updateContractInformation() { |
||||
ContractInformation contractInformation = new ContractInformation(); |
||||
HashMap<String, Object> map = orderService.updateContractInformation(contractInformation); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//绑定应用权限
|
||||
@Test |
||||
@Transactional |
||||
public void isDeliverGoods() { |
||||
CoursePermissions coursePermissions = new CoursePermissions(); |
||||
HashMap<String, Object> map = orderService.isDeliverGoods(coursePermissions); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void queryOrderCustomer() { |
||||
Integer cityId = 1; |
||||
Integer provinceId = 1; |
||||
HashMap<String, Object> map = orderService.queryOrderCustomer(cityId, provinceId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void queryOrderCustomerContact() { |
||||
Integer customerId = 1; |
||||
HashMap<String, Object> map = orderService.queryOrderCustomerContact(customerId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//查询订单课程列表
|
||||
@Test |
||||
@Transactional |
||||
public void queryCourseList() { |
||||
String searchContent = ""; |
||||
List<Integer> courseId = new ArrayList<>(); |
||||
Integer pageNo = 1; |
||||
Integer pageSize = 10; |
||||
HashMap<String, Object> map = orderService.queryCourseList(searchContent, courseId, pageNo, pageSize); |
||||
Integer retcode = (Integer) map.get("retcode"); |
||||
System.out.println(retcode); |
||||
if (retcode == 200) { |
||||
PageResult pageResult = (PageResult) map.get("retvalue"); |
||||
Long total = pageResult.getTotal(); |
||||
System.out.println("total = " + total); |
||||
List<Course> rows = (List<Course>) pageResult.getRows(); |
||||
rows.forEach(item -> System.out.println(item.toString())); |
||||
} else { |
||||
String msg = (String) map.get("retvalue"); |
||||
System.out.println(msg); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,83 @@ |
||||
package com.yipin.liuwanr; |
||||
|
||||
import com.yipin.liuwanr.entity.PageResult; |
||||
import com.yipin.liuwanr.entity.ServiceConfig; |
||||
import com.yipin.liuwanr.service.ServiceConfigService; |
||||
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; |
||||
import java.util.List; |
||||
|
||||
@RunWith(SpringRunner.class) |
||||
@SpringBootTest |
||||
public class ServiceConfigServiceTest { |
||||
@Autowired |
||||
private ServiceConfigService serviceConfigService; |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void addServiceConfig() { |
||||
ServiceConfig serviceConfig = new ServiceConfig(); |
||||
serviceConfig.setSystemName("测试"); |
||||
serviceConfig.setSystemType(2); |
||||
serviceConfig.setSystemAttribution(2); |
||||
serviceConfig.setSystemStatus(1); |
||||
HashMap<String, Object> map = serviceConfigService.addServiceConfig(serviceConfig); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
public void queryServiceConfig() { |
||||
ServiceConfig serviceConfig = new ServiceConfig(); |
||||
Integer pageNo = 1; |
||||
Integer pageSize = 10; |
||||
HashMap<String, Object> map = serviceConfigService.queryServiceConfig(serviceConfig, pageNo, pageSize); |
||||
Integer retcode = (Integer) map.get("retcode"); |
||||
System.out.println(retcode); |
||||
if (retcode == 200) { |
||||
PageResult pageResult = (PageResult) map.get("retvalue"); |
||||
Long total = pageResult.getTotal(); |
||||
System.out.println("total = " + total); |
||||
List<ServiceConfig> rows = (List<ServiceConfig>) pageResult.getRows(); |
||||
rows.forEach(item -> System.out.println(item.toString())); |
||||
} else { |
||||
String msg = (String) map.get("retvalue"); |
||||
System.out.println(msg); |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
public void queryServiceConfigDetails() { |
||||
Integer systemId = 1; |
||||
HashMap<String, Object> map = serviceConfigService.queryServiceConfigDetails(systemId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void deleteServiceConfig() { |
||||
ServiceConfig serviceConfig = new ServiceConfig(); |
||||
serviceConfig.setSystemId(1); |
||||
HashMap<String, Object> map = serviceConfigService.deleteServiceConfig(serviceConfig); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void updateServiceConfig() { |
||||
ServiceConfig serviceConfig = new ServiceConfig(); |
||||
serviceConfig.setSystemName("测试"); |
||||
serviceConfig.setSystemType(2); |
||||
serviceConfig.setSystemAttribution(2); |
||||
serviceConfig.setSystemStatus(1); |
||||
serviceConfig.setSystemId(1); |
||||
HashMap<String, Object> map = serviceConfigService.updateServiceConfig(serviceConfig); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue