diff --git a/src/main/java/com/yipin/liuwanr/controller/CustomerController.java b/src/main/java/com/yipin/liuwanr/controller/CustomerController.java index a74cfd9..3e0e856 100644 --- a/src/main/java/com/yipin/liuwanr/controller/CustomerController.java +++ b/src/main/java/com/yipin/liuwanr/controller/CustomerController.java @@ -1,268 +1,263 @@ package com.yipin.liuwanr.controller; -import java.util.HashMap; - -import com.yipin.liuwanr.entity.School; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - import com.yipin.liuwanr.entity.Customer; import com.yipin.liuwanr.entity.Response; +import com.yipin.liuwanr.entity.School; import com.yipin.liuwanr.entity.UserM; import com.yipin.liuwanr.helper.RedisHelper; import com.yipin.liuwanr.service.CustomerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; @RestController @RequestMapping("/customer") @CrossOrigin public class CustomerController { - @Autowired - private CustomerService customerService; + @Autowired + private CustomerService customerService; - @Autowired - RedisHelper redisHelper; + @Autowired + RedisHelper redisHelper; - /** - * 添加客户 - */ - @PostMapping("/addCustomer") - Response addCustomer(@RequestBody Customer customer) { - Response resp = new Response(); - UserM userm = new UserM(); - Integer provinceId = customer.getProvinceId(); - Integer cityId = customer.getCityId(); - String countries = customer.getCountries(); - String phone = customer.getAdminPhone(); - String email = customer.getEmail(); - String name = customer.getAdminName(); - Integer schoolId = customer.getSchoolId(); - userm.setSchoolId(schoolId); - userm.setCityId(cityId); - userm.setCountries(countries); - userm.setProvinceId(provinceId); - userm.setPhone(phone); - userm.setEmail(email); - userm.setName(name); - userm.setPassword("huoran123"); - if (email==null||email==""){ - resp.setStatus(300); - resp.setErrmessage("邮箱不能为空!"); - }if (phone==null||phone==""){ - resp.setStatus(300); - resp.setErrmessage("电话不能为空!"); - }else if (name==null||name==""){ - resp.setStatus(300); - resp.setErrmessage("姓名不能为空!"); - }else if (schoolId==null){ - resp.setStatus(300); - resp.setErrmessage("学校不能为空!"); - }else if (provinceId==null){ - resp.setStatus(300); - resp.setErrmessage("省份不能为空!"); - }else if (cityId==null) { - resp.setStatus(300); - resp.setErrmessage("城市不能为空!"); - } else { - HashMap ret = customerService.addCustomer(customer); - HashMap ret1 = customerService.addAdmin(userm); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } - } - return resp; - } - - /** - * 查询客户 - */ - @GetMapping("/queryCustomer") - Response queryCustomer(@RequestParam String countries,Integer provinceId,Integer cityId,Integer pageNo,Integer pageSize,String searchContent) { - Response resp = new Response(); - Customer customer = new Customer(); - if (searchContent!=null&&searchContent!="") { - customer.setSearchContent(searchContent); - } - if (countries!=null&&countries!="") { - customer.setCountries(countries); - } - if (provinceId!=null) { - customer.setProvinceId(provinceId); - } - if (cityId!=null) { - customer.setCityId(cityId); - } - HashMap ret = customerService.queryCustomer(customer,pageNo,pageSize); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } - return resp; -} - - /** - * 查询客户详情 - */ - @GetMapping("/queryCustomerDetails") - Response queryCustomerDetails(@RequestParam Integer customerId) { - Response resp = new Response(); - if (customerId==null) { - resp.setStatus(300); - resp.setErrmessage("Parameter Invalid"); - }else { - HashMap ret = customerService.queryCustomerDetails(customerId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } - } - return resp; -} - - /** - * 删除客户 - */ - @PostMapping("/deleteCustomer") - Response deleteCustomer(@RequestBody Customer customer) { - Response resp = new Response(); - if (customer.getCustomer().isEmpty()) { - resp.setStatus(300); - resp.setErrmessage("客户不能为空!"); - } else { - HashMap ret = customerService.deleteCustomer(customer); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } - } - return resp; - } - - /** - * 更新客户 - */ - @PostMapping("/updateCustomer") - Response updateCustomer(@RequestBody Customer customer) { - Response resp = new Response(); - if (customer.getCustomerId()==null) { - resp.setStatus(300); - resp.setErrmessage("客户不能为空!"); - } else { - HashMap ret = customerService.updateCustomer(customer); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } - } - return resp; - } - - /** - * 查询客户是否存在 - */ - @GetMapping("/queryCustomerIsExists") - Response queryCustomerIsExists(@RequestParam Integer schoolId) { - Response resp = new Response(); - if (schoolId==null) { - resp.setStatus(300); - resp.setErrmessage("学校不能为空!"); - }else { - HashMap ret = customerService.queryCustomerIsExists(schoolId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } - } - return resp; -} - /** - * 查询行业类 - */ - @GetMapping("/queryCustomerIndustryClass") - Response queryCustomerIndustryClass() { - Response resp = new Response(); - HashMap ret = customerService.queryCustomerIndustryClass(); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } - return resp; - } - - /** - * 查询行业 - */ - @GetMapping("/queryCustomerIndustry") - Response queryCustomerIndustry(@RequestParam Integer industryClassId) { - Response resp = new Response(); - HashMap ret = customerService.queryCustomerIndustry(industryClassId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } - return resp; - } + /** + * 添加客户 + */ + @PostMapping("/addCustomer") + Response addCustomer(@RequestBody Customer customer) { + Response resp = new Response(); + UserM userm = new UserM(); + Integer provinceId = customer.getProvinceId(); + Integer cityId = customer.getCityId(); + String countries = customer.getCountries(); + String phone = customer.getAdminPhone(); + String email = customer.getEmail(); + String name = customer.getAdminName(); + Integer schoolId = customer.getSchoolId(); + userm.setSchoolId(schoolId); + userm.setCityId(cityId); + userm.setCountries(countries); + userm.setProvinceId(provinceId); + userm.setPhone(phone); + userm.setEmail(email); + userm.setName(name); + userm.setPassword("huoran123"); + if (email == null || email == "") { + resp.setStatus(300); + resp.setErrmessage("邮箱不能为空!"); + } + if (phone == null || phone == "") { + resp.setStatus(300); + resp.setErrmessage("电话不能为空!"); + } else if (name == null || name == "") { + resp.setStatus(300); + resp.setErrmessage("姓名不能为空!"); + } else if (schoolId == null) { + resp.setStatus(300); + resp.setErrmessage("学校不能为空!"); + } else if (provinceId == null) { + resp.setStatus(300); + resp.setErrmessage("省份不能为空!"); + } else if (cityId == null) { + resp.setStatus(300); + resp.setErrmessage("城市不能为空!"); + } else { + HashMap ret = customerService.addCustomer(customer); + HashMap ret1 = customerService.addAdmin(userm); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } + + /** + * 查询客户 + */ + @GetMapping("/queryCustomer") + Response queryCustomer(@RequestParam String countries, Integer provinceId, Integer cityId, Integer pageNo, Integer pageSize, String searchContent) { + Response resp = new Response(); + Customer customer = new Customer(); + if (searchContent != null && searchContent != "") { + customer.setSearchContent(searchContent); + } + if (countries != null && countries != "") { + customer.setCountries(countries); + } + if (provinceId != null) { + customer.setProvinceId(provinceId); + } + if (cityId != null) { + customer.setCityId(cityId); + } + HashMap ret = customerService.queryCustomer(customer, pageNo, pageSize); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } + + /** + * 查询客户详情 + */ + @GetMapping("/queryCustomerDetails") + Response queryCustomerDetails(@RequestParam Integer customerId) { + Response resp = new Response(); + if (customerId == null) { + resp.setStatus(300); + resp.setErrmessage("Parameter Invalid"); + } else { + HashMap ret = customerService.queryCustomerDetails(customerId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } + + /** + * 删除客户 + */ + @PostMapping("/deleteCustomer") + Response deleteCustomer(@RequestBody Customer customer) { + Response resp = new Response(); + if (customer.getCustomer().isEmpty()) { + resp.setStatus(300); + resp.setErrmessage("客户不能为空!"); + } else { + HashMap ret = customerService.deleteCustomer(customer); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } + + /** + * 更新客户 + */ + @PostMapping("/updateCustomer") + Response updateCustomer(@RequestBody Customer customer) { + Response resp = new Response(); + if (customer.getCustomerId() == null) { + resp.setStatus(300); + resp.setErrmessage("客户不能为空!"); + } else { + HashMap ret = customerService.updateCustomer(customer); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } + + /** + * 查询客户是否存在 + */ + @GetMapping("/queryCustomerIsExists") + Response queryCustomerIsExists(@RequestParam Integer schoolId) { + Response resp = new Response(); + if (schoolId == null) { + resp.setStatus(300); + resp.setErrmessage("学校不能为空!"); + } else { + HashMap ret = customerService.queryCustomerIsExists(schoolId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } + + /** + * 查询行业类 + */ + @GetMapping("/queryCustomerIndustryClass") + Response queryCustomerIndustryClass() { + Response resp = new Response(); + HashMap ret = customerService.queryCustomerIndustryClass(); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } + + /** + * 查询行业 + */ + @GetMapping("/queryCustomerIndustry") + Response queryCustomerIndustry(@RequestParam Integer industryClassId) { + Response resp = new Response(); + HashMap ret = customerService.queryCustomerIndustry(industryClassId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } - /** - * 查询学校 - */ - @GetMapping("/querySchool") - Response querySchool(@RequestParam String schoolName) { - Response resp = new Response(); - School school = new School(); - if (schoolName!=null||schoolName!=""){ - school.setSchoolName(schoolName); - } - HashMap ret = customerService.querySchool(school); - resp.setStatus(200); - resp.setErrmessage("Parameter effective"); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } - return resp; - } + /** + * 查询学校 + */ + @GetMapping("/querySchool") + Response querySchool(@RequestParam String schoolName) { + Response resp = new Response(); + School school = new School(); + if (schoolName != null || schoolName != "") { + school.setSchoolName(schoolName); + } + HashMap ret = customerService.querySchool(school); + resp.setStatus(200); + resp.setErrmessage("Parameter effective"); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } } diff --git a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java index 07440ab..47b21a8 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java @@ -297,7 +297,7 @@ public class ExperimentalClassController { Integer schoolId = experimentalClass.getSchoolId(); if (schoolId==null) { resp.setStatus(300); - resp.setErrmessage("Parameter Invalid"); + resp.setErrmessage("学校为空,新增失败!"); }else { HashMap ret = classService.addExperimentalClass(experimentalClass); Integer experimentalClassId = experimentalClass.getExperimentalClassId(); @@ -336,7 +336,7 @@ public class ExperimentalClassController { Integer experimentalClassId = experimentalClass.getExperimentalClassId(); if (experimentalClassId==null) { resp.setStatus(300); - resp.setErrmessage("Parameter cannot be empty"); + resp.setErrmessage("实验班级为空,删除失败!"); }else { HashMap ret = classService.deleteExperimentalClass(experimentalClassId); int status = (int) ret.get("retcode"); diff --git a/src/main/java/com/yipin/liuwanr/controller/OrderController.java b/src/main/java/com/yipin/liuwanr/controller/OrderController.java index 684dfe4..0611539 100644 --- a/src/main/java/com/yipin/liuwanr/controller/OrderController.java +++ b/src/main/java/com/yipin/liuwanr/controller/OrderController.java @@ -1,6 +1,5 @@ package com.yipin.liuwanr.controller; -import java.util.Date; import java.util.HashMap; import java.util.List; @@ -17,7 +16,7 @@ import org.springframework.web.bind.annotation.RestController; import com.yipin.liuwanr.entity.ContractInformation; import com.yipin.liuwanr.entity.CoursePermissions; import com.yipin.liuwanr.entity.Order; -import com.yipin.liuwanr.entity.OrderVo; +import com.yipin.liuwanr.vo.OrderVo; import com.yipin.liuwanr.entity.Response; import com.yipin.liuwanr.helper.RedisHelper; import com.yipin.liuwanr.service.OrderService; diff --git a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java new file mode 100644 index 0000000..f90d850 --- /dev/null +++ b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java @@ -0,0 +1,473 @@ +package com.yipin.liuwanr.controller; + +import com.yipin.liuwanr.entity.Staff; +import com.yipin.liuwanr.entity.Student; +import com.yipin.liuwanr.entity.UserInfo; +import com.yipin.liuwanr.entity.UserM; +import com.yipin.liuwanr.helper.RedisHelper; +import com.yipin.liuwanr.service.StaffService; +import com.yipin.liuwanr.service.StudentService; +import com.yipin.liuwanr.service.UserService; +import com.yipin.liuwanr.vo.UserVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.List; + +@RestController +@RequestMapping("/userInfo") +public class UserInfoController { + + @Autowired + private UserService userService; + + @Autowired + private StudentService studentService; + + @Autowired + private StaffService staffService; + + @Autowired + RedisHelper redisHelper; + + /** + * 添加用户 + */ + @Transactional + @PostMapping("/addUser") + Response addUser(@RequestBody UserVO vo) { + Response resp = new Response(); + //用户实体 + UserM user = vo.getUser(); + //学生实体 + Student student = vo.getStudent(); + //员工实体 + Staff staff = vo.getStaff(); + //用户手机号 + String phone = user.getPhone(); + //用户名称 + String name = user.getName(); + //省份id + Integer provinceId = user.getProvinceId(); + //用户角色id + Integer accountRole = user.getAccountRole(); + //城市id + Integer cityId = user.getCityId(); + //学校id + Integer schoolId = user.getSchoolId(); + if (phone==null||phone=="") { + resp.setStatus(300); + resp.setErrmessage("电话不能为空!"); + }else if(name==null||name==""){ + resp.setStatus(300); + resp.setErrmessage("姓名不能为空!"); + }else if(provinceId==null){ + resp.setStatus(300); + resp.setErrmessage("省份不能为空!"); + }else if(accountRole==null){ + resp.setStatus(300); + resp.setErrmessage("用户角色不能为空!"); + }else if(cityId==null){ + resp.setStatus(300); + resp.setErrmessage("城市不能为空!"); + }else if(schoolId==null){ + resp.setStatus(300); + resp.setErrmessage("学校不能为空!"); + }else { + HashMap ret = userService.addUser(user); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + if (accountRole == 4){ + HashMap stu = studentService.addStudent(student); + int stuStatus = (int) stu.get("retcode"); + if (stuStatus == 200){ + resp.setStatus(stuStatus); + resp.setMessage(stu.get("retvalue")); + }else { + resp.setStatus(stuStatus); + resp.setErrmessage(stu.get("retvalue").toString()); + throw new RuntimeException(); + } + } + if(accountRole == 3||accountRole==2){ + HashMap sta = staffService.addStaff(staff); + int staStatus = (int) sta.get("retcode"); + if (staStatus == 200){ + resp.setStatus(staStatus); + resp.setMessage(sta.get("retvalue")); + }else { + resp.setStatus(staStatus); + resp.setErrmessage(sta.get("retvalue").toString()); + throw new RuntimeException(); + } + } + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + throw new RuntimeException(); + } + } + return resp; + } + + /** + * 查询用户(根据国家、省份、城市) + */ + @GetMapping("/queryUserInfo") + Response queryUserInfo(@RequestParam String countries, Integer provinceId, Integer cityId, Integer pageNo, Integer pageSize, Integer schoolId, Integer roleId, String searchContent, Integer month, String creationTime, String endTime) { + Response resp = new Response(); + UserInfo userInfo = new UserInfo(); + //设置国家 + if (countries != null&&countries!="") { + userInfo.setCountries(countries); + } + //设置省份 + if(provinceId!=null) { + userInfo.setProvinceId(provinceId); + } + //设置城市 + if(cityId!=null) { + userInfo.setCityId(cityId); + } + //学校 + if (schoolId!=null) { + userInfo.setSchoolId(schoolId); + } + //角色 + if (roleId!=null) { + userInfo.setRoleId(roleId); + } + //搜索内容 + if (searchContent!=null&&searchContent!="") { + userInfo.setSearchContent(searchContent); + } + //月份 + if (month!=null) { + userInfo.setMonth(month);; + } + //创建时间 + if (creationTime!=null&&creationTime!="") { + userInfo.setCreationTime(creationTime); + } + //结束时间 + if (endTime!=null&&endTime!="") { + userInfo.setEndTime(endTime); + } + HashMap ret = userService.queryUserInfo(userInfo,pageNo,pageSize); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } + + /** + * 删除用户(根据ID修改isdel状态,0可见 1不可见) + */ + @Transactional + @PostMapping("/deleteUserInfo") + Response deleteUser(@RequestBody List userList) { + Response resp = new Response(); + int size = userList.size(); + for(int i=0;i ret = userService.deleteUser(userId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + if (roleId==3||roleId==2){ + HashMap sta = userService.deleteStaff(user); + int staStatus = (int) ret.get("retcode"); + if (200 == staStatus) { + resp.setStatus(staStatus); + resp.setMessage(sta.get("retvalue")); + }else{ + resp.setStatus(staStatus); + resp.setErrmessage(sta.get("retvalue").toString()); + throw new RuntimeException(); + } + } + if (roleId==4){ + HashMap stu = userService.deleteStudent(user); + int stuStatus = (int) stu.get("retcode"); + if (200 == stuStatus) { + resp.setStatus(stuStatus); + resp.setMessage(stu.get("retvalue")); + }else{ + resp.setStatus(stuStatus); + resp.setErrmessage(stu.get("retvalue").toString()); + throw new RuntimeException(); + } + } + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + throw new RuntimeException(); + } + } + } + return resp; + } + + /** + * 更新用户 + */ + @Transactional + @PostMapping("/updateUser") + Response updateUser(@RequestBody UserVO vo) { + Response resp = new Response(); + UserM user = vo.getUser(); + Staff staff = vo.getStaff(); + Student student = vo.getStudent(); + Integer userId = user.getUserId(); + Integer roleId = user.getAccountRole(); + if (userId==null) { + resp.setStatus(300); + resp.setErrmessage("用户ID为空,修改用户失败!"); + }else if (roleId==null){ + resp.setStatus(300); + resp.setErrmessage("角色ID为空,修改用户失败!"); + } + else { + HashMap ret = userService.updateUser(user); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + if (roleId ==3||roleId==2){ + HashMap sta = userService.updateStaff(staff); + int staStatus = (int) sta.get("retcode"); + if (200 == status) { + resp.setStatus(staStatus); + resp.setMessage(sta.get("retvalue")); + }else{ + resp.setStatus(staStatus); + resp.setErrmessage(sta.get("retvalue").toString()); + throw new RuntimeException("修改员工失败!"); + } + } + if (roleId ==4){ + HashMap stu = userService.updateStudent(student); + int stuStatus = (int) stu.get("retcode"); + if (200 == status) { + resp.setStatus(stuStatus); + resp.setMessage(stu.get("retvalue")); + }else{ + resp.setStatus(stuStatus); + resp.setErrmessage(stu.get("retvalue").toString()); + throw new RuntimeException("修改学生失败!"); + } + } + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + throw new RuntimeException("修改用户失败!"); + } + } + return resp; + } + + + /** + * 登陆(前台传来的key必须是phone、password) + */ + @GetMapping("/logins") + Response logins(@RequestParam("phone") String phone, @RequestParam("password") String password, + HttpServletRequest req, HttpServletResponse res) { + Response resp = new Response(); + UserM user = new UserM(); + if (phone != null) { + user.setPhone(phone); + }if(password!=null) { + user.setPassword(password); + } + HashMap ret = userService.logins(user); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } + + + /** + * 查询用户详情(ID) + */ + @GetMapping("/queryUserDetails") + Response queryUserDetails(@RequestParam Integer userId, Integer roleId) { + Response resp = new Response(); + if (roleId == null){ + resp.setStatus(300); + resp.setErrmessage("用户角色id为空!查询失败!"); + }else if (userId==null) { + resp.setStatus(300); + resp.setErrmessage("用户id为空!查询失败!"); + }else { + HashMap ret = userService.queryUserDetails(userId,roleId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } + + @PostMapping("/uploadUserAvatars") + Response uploadUserAvatars(MultipartFile file, Integer userId) { + Response resp = new Response(); + if (userId==null) {//前台传来的值是否为空 + resp.setStatus(300); + resp.setErrmessage("Parameter Invalid"); + }else { + HashMap ret = userService.uploadUserAvatars(file,userId); + + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } + + /** + * 更新登录次数和时间 + */ + @PostMapping("/updateLogInNumber") + Response updateLogInNumber(@RequestBody UserM user) { + Response resp = new Response(); + Integer userId = user.getUserId(); + String phone = user.getPhone(); + Integer accountRole = user.getAccountRole(); + if (userId==null) { + resp.setStatus(300); + resp.setErrmessage("用户id不能为空!"); + }else if(phone==null||phone==""){ + resp.setStatus(300); + resp.setErrmessage("用户电话不能为空!"); + } else if(accountRole==null){ + resp.setStatus(300); + resp.setErrmessage("用户角色不能为空!"); + } else { + HashMap ret = userService.updateLogInNumber(user); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } + /** + * 用户模块查询客户 + */ + @GetMapping("/queryCustomer") + Response queryCustomer(@RequestParam Integer cityId, Integer provinceId) { + Response resp = new Response(); + if(provinceId == null){ + resp.setStatus(300); + resp.setErrmessage("省份id为空!查询失败!"); + }else if (cityId==null) { + resp.setStatus(300); + resp.setErrmessage("城市id为空!查询失败!"); + }else { + HashMap ret = userService.queryCustomer(cityId,provinceId); + resp.setStatus(200); + resp.setErrmessage("查询成功!"); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } + + /** + * 查询账号是否存在 + */ + @GetMapping("/queryAccountIsExist") + Response queryAccountIsExist(@RequestParam String userAccount) { + Response resp = new Response(); + if (userAccount==null) { + resp.setStatus(300); + resp.setErrmessage("账号为空!"); + }else { + HashMap ret = userService.queryAccountIsExist(userAccount); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } + + /** + * 查询学号、工号是否存在 + */ + @GetMapping("/queryWorkNumberIsExist") + Response queryWorkNumberIsExist(@RequestParam String workNumber) { + Response resp = new Response(); + if (workNumber==null) { + resp.setStatus(300); + resp.setErrmessage("账号为空!"); + }else { + HashMap ret = userService.queryWorkNumberIsExist(workNumber); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } +} \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/entity/ExperimentalClass.java b/src/main/java/com/yipin/liuwanr/entity/ExperimentalClass.java index 6cfa6b4..40e66c3 100644 --- a/src/main/java/com/yipin/liuwanr/entity/ExperimentalClass.java +++ b/src/main/java/com/yipin/liuwanr/entity/ExperimentalClass.java @@ -4,130 +4,147 @@ import java.util.List; /** * 实验班级信息 - * - * @author 全承珠 * + * @author 全承珠 */ public class ExperimentalClass { - //实验班级主键ID - private Integer experimentalClassId; - //实验班级名称 - private String experimentalClassName; - //班级大小 - private Integer classSize; - //练习次数 - private Integer practiceNumber; - //考核次数 - private Integer inspectionNumber; - //课程进度 - private String courseSchedule; - //创建时间 - private String creationTime; - //创建人 - private String founder; - //绑定课程Id - private Integer courseId; - //绑定学校id - private Integer schoolId; - //绑定用户Id - private Integer userId; - - private List students; - - public List getStudents() { - return students; - } - - public void setStudents(List students) { - this.students = students; - } - - public Integer getUserId() { - return userId; - } - - public void setUserId(Integer userId) { - this.userId = userId; - } - - public Integer getSchoolId() { - return schoolId; - } - - public void setSchoolId(Integer schoolId) { - this.schoolId = schoolId; - } - - public Integer getExperimentalClassId() { - return experimentalClassId; - } - - public void setExperimentalClassId(Integer experimentalClassId) { - this.experimentalClassId = experimentalClassId; - } - - public String getExperimentalClassName() { - return experimentalClassName; - } - - public void setExperimentalClassName(String experimentalClassName) { - this.experimentalClassName = experimentalClassName; - } - - public Integer getClassSize() { - return classSize; - } - - public void setClassSize(Integer classSize) { - this.classSize = classSize; - } - - public Integer getPracticeNumber() { - return practiceNumber; - } - - public void setPracticeNumber(Integer practiceNumber) { - this.practiceNumber = practiceNumber; - } - - public Integer getInspectionNumber() { - return inspectionNumber; - } - - public void setInspectionNumber(Integer inspectionNumber) { - this.inspectionNumber = inspectionNumber; - } - - public String getCourseSchedule() { - return courseSchedule; - } - - public void setCourseSchedule(String courseSchedule) { - this.courseSchedule = courseSchedule; - } - - public String getCreationTime() { - return creationTime; - } - - public void setCreationTime(String creationTime) { - this.creationTime = creationTime; - } - - public String getFounder() { - return founder; - } - - public void setFounder(String founder) { - this.founder = founder; - } - - public Integer getCourseId() { - return courseId; - } - - public void setCourseId(Integer courseId) { - this.courseId = courseId; - } + //实验班级主键ID + private Integer experimentalClassId; + //实验班级名称 + private String experimentalClassName; + //班级大小 + private Integer classSize; + //练习次数 + private Integer practiceNumber; + //考核次数 + private Integer inspectionNumber; + //课程进度 + private String courseSchedule; + //创建时间 + private String creationTime; + //创建人 + private String founder; + //绑定课程Id + private Integer courseId; + //绑定学校id + private Integer schoolId; + //绑定用户Id + private Integer userId; + + private List students; + + public List getStudents() { + return students; + } + + public void setStudents(List students) { + this.students = students; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public Integer getSchoolId() { + return schoolId; + } + + public void setSchoolId(Integer schoolId) { + this.schoolId = schoolId; + } + + public Integer getExperimentalClassId() { + return experimentalClassId; + } + + public void setExperimentalClassId(Integer experimentalClassId) { + this.experimentalClassId = experimentalClassId; + } + + public String getExperimentalClassName() { + return experimentalClassName; + } + + public void setExperimentalClassName(String experimentalClassName) { + this.experimentalClassName = experimentalClassName; + } + + public Integer getClassSize() { + return classSize; + } + + public void setClassSize(Integer classSize) { + this.classSize = classSize; + } + + public Integer getPracticeNumber() { + return practiceNumber; + } + + public void setPracticeNumber(Integer practiceNumber) { + this.practiceNumber = practiceNumber; + } + + public Integer getInspectionNumber() { + return inspectionNumber; + } + + public void setInspectionNumber(Integer inspectionNumber) { + this.inspectionNumber = inspectionNumber; + } + + public String getCourseSchedule() { + return courseSchedule; + } + + public void setCourseSchedule(String courseSchedule) { + this.courseSchedule = courseSchedule; + } + + public String getCreationTime() { + return creationTime; + } + + public void setCreationTime(String creationTime) { + this.creationTime = creationTime; + } + + public String getFounder() { + return founder; + } + + public void setFounder(String founder) { + this.founder = founder; + } + + public Integer getCourseId() { + return courseId; + } + + public void setCourseId(Integer courseId) { + this.courseId = courseId; + } + + @Override + public String toString() { + return "ExperimentalClass{" + + "experimentalClassId=" + experimentalClassId + + ", experimentalClassName='" + experimentalClassName + '\'' + + ", classSize=" + classSize + + ", practiceNumber=" + practiceNumber + + ", inspectionNumber=" + inspectionNumber + + ", courseSchedule='" + courseSchedule + '\'' + + ", creationTime='" + creationTime + '\'' + + ", founder='" + founder + '\'' + + ", courseId=" + courseId + + ", schoolId=" + schoolId + + ", userId=" + userId + + ", students=" + students + + '}'; + } } diff --git a/src/main/java/com/yipin/liuwanr/entity/UserInfo.java b/src/main/java/com/yipin/liuwanr/entity/UserInfo.java new file mode 100644 index 0000000..0762b68 --- /dev/null +++ b/src/main/java/com/yipin/liuwanr/entity/UserInfo.java @@ -0,0 +1,402 @@ +package com.yipin.liuwanr.entity; + +import java.util.List; + +/** + * 用户信息实体 + * + * @author Ning + */ +public class UserInfo { + //用户id + private Integer userId; + //角色id + private Integer roleId; + //用户姓名 + private String userName; + //用户账号 + private String account; + //用户密码 + private String password; + //国家 + private String countries; + //绑定省份id + private Integer provinceId; + //绑定城市id + private Integer cityId; + //创建时间 + private String creationTime; + //登陆次数 + private Integer logInNumber; + //上次登陆时间 + private String lastTimeOfLanding; + //性别 + private Integer sex; + //证件类型(1、身份证) + private Integer documentType; + //身份证 + private String IDNumber; + //教育程度(1、研究数及以上) + private Integer educationDegree; + //电话 + private String phone; + //微信账号 + private String WeChatID; + //出生日期 + private String dateBirth; + //邮箱 + private String email; + //学校id + private Integer schoolId; + //唯一标示性账号 + private String uniqueIdentificationAccount; + //搜索内容 + private String searchContent; + private List user; + //用户头像路径 + private String userAvatars; + //------------------------------------------------ + //学校名称 + private String schoolName; + //省份名称 + private String provinceName; + //城市名称 + private String cityName; + //条件查询月 + private Integer month; + //条件查询结束时间 + private String endTime; + //专业类ID + private Integer professionalClassId; + //专业类名称 + private String professionalClassName; + //学科ID + private Integer disciplineId; + //学科名称 + private String disciplineName; + //专业id + private Integer professionalId; + //专业名称 + private String professionalName; + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + 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 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 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) { + this.IDNumber = IDNumber; + } + + public Integer getEducationDegree() { + return educationDegree; + } + + public void setEducationDegree(Integer educationDegree) { + this.educationDegree = educationDegree; + } + + 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 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; + } + + public String getUniqueIdentificationAccount() { + return uniqueIdentificationAccount; + } + + public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) { + this.uniqueIdentificationAccount = uniqueIdentificationAccount; + } + + public String getSearchContent() { + return searchContent; + } + + public void setSearchContent(String searchContent) { + this.searchContent = searchContent; + } + + public List getUser() { + return user; + } + + public void setUser(List user) { + this.user = user; + } + + public String getUserAvatars() { + return userAvatars; + } + + public void setUserAvatars(String userAvatars) { + this.userAvatars = userAvatars; + } + + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + + 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 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 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 Integer getRoleId() { + return roleId; + } + + public void setRoleId(Integer roleId) { + this.roleId = roleId; + } + + @Override + public String toString() { + return "UserInfo{" + + "userId=" + userId + + ", roleId=" + roleId + + ", userName='" + userName + '\'' + + ", account='" + account + '\'' + + ", password='" + password + '\'' + + ", countries='" + countries + '\'' + + ", provinceId=" + provinceId + + ", cityId=" + cityId + + ", creationTime='" + creationTime + '\'' + + ", logInNumber=" + logInNumber + + ", lastTimeOfLanding='" + lastTimeOfLanding + '\'' + + ", sex=" + sex + + ", documentType=" + documentType + + ", IDNumber='" + IDNumber + '\'' + + ", educationDegree=" + educationDegree + + ", phone='" + phone + '\'' + + ", WeChatID='" + WeChatID + '\'' + + ", 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 + '\'' + + '}'; + } +} diff --git a/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java index 016c618..aa95625 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java @@ -13,40 +13,42 @@ import com.yipin.liuwanr.entity.ExperimentalClass; import com.yipin.liuwanr.entity.Professional; import com.yipin.liuwanr.entity.StuProfessionalArchitecture; import com.yipin.liuwanr.entity.Student; +import org.apache.ibatis.annotations.*; -public interface ExperimentalClassMapper { +import java.util.List; +public interface ExperimentalClassMapper { @Insert("INSERT INTO experimental_class_student(studentId,experimentalClassId)" + "VALUES(#{studentId},#{experimentalClassId})") void experimentClassAddStudent(Student student); - + @Delete("DELETE from experimental_class_student where studentId = #{studentId} and experimentalClassId = #{experimentalClassId}") void experimentClassDeleteStudent(Student student); - + //创建实验班级 @Insert("INSERT INTO experimental_class_ning(experimentalClassName,classSize,creationTime,founder,courseId,isdel,userId,schoolId)" + "VALUES(#{experimentalClassName},#{classSize},now(),#{founder},#{courseId},0,#{userId},#{schoolId})") @Options(useGeneratedKeys=true, keyProperty="experimentalClassId", keyColumn="experimentalClassId") void addExperimentalClass(ExperimentalClass experimentalClass); - + @Select({" "}) List queryExperimentalClass(Integer schoolId,Integer courseId); - + //查询实验班级学生专业 @Select({" "}) List queryExperimentalClassSP(Integer experimentalClassId); - + //查询学生行政班级 @Select({" "}) List queryStudentClass(Integer experimentalClassId); - + @Select({" "}) List queryExperimentalClassDetails(Student student); - + @Select({" "}) List queryExperimentalClassDetails1(Integer experimentalClassId); - + @Update("UPDATE experimental_class_ning SET isdel = 1 where experimentalClassId = #{experimentalClassId}") void deleteExperimentalClass(Integer experimentalClassId); - + + @Delete("Delete from experimental_class_student where experimentalClassId = #{experimentalClassId}") + void deleteExperimentalClassStu(Integer experimentalClassId); + @Update("UPDATE experimental_class_ning SET experimentalClassName = #{experimentalClassName},classSize = #{classSize},practiceNumber = #{practiceNumber},inspectionNumber = #{inspectionNumber},courseSchedule = #{courseSchedule},founder = #{founder},courseId = #{courseId} where experimentalClassId = #{experimentalClassId}") void updateExperimentalClass(ExperimentalClass experimentalClass); diff --git a/src/main/java/com/yipin/liuwanr/mapper/ExperimentallearningMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ExperimentallearningMapper.java index 6d12e73..22b44ee 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ExperimentallearningMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ExperimentallearningMapper.java @@ -68,8 +68,8 @@ public interface ExperimentallearningMapper { * @param studentId * @return */ - @Select("select ecn.experimentalClassId from experimental_class_ning ecn left join experimental_class_student ecs on ecn.experimentalClassId=ecs.experimentalClassId where\n" + - "ecn.courseId=#{courseId} and ecs.studentId=#{studentId} GROUP BY ecn.experimentalClassId") + @Select("select ecn.experimentalClassId from experimental_class_ning ecn left join experimental_class_student ecs on ecn.experimentalClassId=ecs.experimentalClassId where " + + "ecn.courseId=#{courseId} and ecs.studentId=#{studentId} and ecn.isdel=0 GROUP BY ecn.experimentalClassId") Integer queryExperimentalClassId(@Param("courseId") Integer courseId,@Param("studentId")Integer studentId); /** @@ -123,6 +123,6 @@ public interface ExperimentallearningMapper { @Select("select DISTINCT hpm.projectId,projectName,isAttendance from hr_project_management hpm left join teacher_project tp on hpm.projectId=tp.projectId " + - " where tp.courseId=#{courseId} and tp.experimentalClassId=#{experimentalClassId} and tp.isOpenProject=0 and hpm.isShow=0") + " where tp.courseId=#{courseId} and tp.experimentalClassId=#{experimentalClassId} and tp.isOpenProject=0") List getBycourseId(@Param("experimentalClassId")Integer experimentalClassId,@Param("courseId") Integer courseId); } diff --git a/src/main/java/com/yipin/liuwanr/mapper/OrderMapper.java b/src/main/java/com/yipin/liuwanr/mapper/OrderMapper.java index 11cd13e..28eeb4d 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/OrderMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/OrderMapper.java @@ -1,7 +1,6 @@ package com.yipin.liuwanr.mapper; -import java.util.List; - +import com.yipin.liuwanr.entity.*; import org.apache.ibatis.annotations.*; import com.yipin.liuwanr.entity.ApplicationPermissions; @@ -10,7 +9,7 @@ import com.yipin.liuwanr.entity.Course; import com.yipin.liuwanr.entity.CoursePermissions; import com.yipin.liuwanr.entity.Customer; import com.yipin.liuwanr.entity.Order; -import com.yipin.liuwanr.entity.OrderVo; +import com.yipin.liuwanr.vo.OrderVo; public interface OrderMapper { @@ -32,106 +31,106 @@ public interface OrderMapper { //添加课程权限 @Insert({" "}) - void addCoursePermissionss(@Param("coursePermissionss")List coursePermissionss); - - @Insert("INSERT INTO hr_application_permissions(systemId,isdel,orderId" - + ") VALUES(#{systemId},0,#{orderId})") - void bindingApplicationPermissions(ApplicationPermissions applicationPermissions); - - @Select("SELECT c.courseId,c.courseName,c.marketPrice from course c where c.isdel = 0 and FIND_IN_SET(c.courseId,#{courseId})") - List queryCoursePermissions(String courseId); - - @Select({" "}) - List queryOrder(Order order); - - @Select( - "SELECT o.* from orders o where o.isdel = 0 and o.orderId = #{orderId} ") - @Results({ - @Result(property = "orders", column = "orderId",one = @One(select = "com.yipin.liuwanr.mapper.OrderMapper.queryOrderDetailsO")), - @Result(property = "contractInformations", column = "orderId",one = @One(select = "com.yipin.liuwanr.mapper.OrderMapper.queryOrderDetailsCI")), - @Result(property = "coursePermissionss", column = "orderId",many = @Many(select = "com.yipin.liuwanr.mapper.OrderMapper.queryOrderDetailsCP")) -}) - List queryOrderDetails(Integer orderId); - - @Select({" "}) - Order queryOrderDetailsO(Integer orderId); - - @Select({" "}) - ListqueryOrderDetailsCP(Integer orderId); - - @Select({" "}) - ContractInformation queryOrderDetailsCI(Integer orderId); - - @Update({" "}) - void deleteOrder(@Param("orderId")List orderId); - - @Update("UPDATE orders SET customerName = #{customerName},orderName = #{orderName},orderAmount = #{orderAmount},orderType = #{orderType},provinceId = #{provinceId},cityId = #{cityId},orderContact = #{orderContact},phone = #{phone},email = #{email},customerId = #{customerId} where orderId = #{orderId}") - void updateOrder(Order order); + //缺少个过期时间 + "INSERT INTO hr_course_permissions(courseId,usePeriod,marketPrice,transactionPrice,discount,portAddressId,isDeliverGoods,isdel,orderId) VALUES" + + "" + + " (#{c.courseId},#{c.usePeriod},#{c.marketPrice},#{c.transactionPrice},#{c.discount},#{c.portAddressId},#{c.isDeliverGoods},0,#{c.orderId})" + + "", + " "}) + void addCoursePermissionss(@Param("coursePermissionss") List coursePermissionss); - @Delete("Delete from hr_course_permissions WHERE orderId = #{orderId}") - void deleteCoursePermissions(Integer orderId); + @Insert("INSERT INTO hr_application_permissions(systemId,isdel,orderId" + + ") VALUES(#{systemId},0,#{orderId})") + void bindingApplicationPermissions(ApplicationPermissions applicationPermissions); + + @Select("SELECT c.courseId,c.courseName,c.marketPrice from course c where c.isdel = 0 and FIND_IN_SET(c.courseId,#{courseId})") + List queryCoursePermissions(String courseId); + + @Select({" "}) + List queryOrder(Order order); + + @Select( + "SELECT o.* from orders o where o.isdel = 0 and o.orderId = #{orderId} ") + @Results({ + @Result(property = "orders", column = "orderId", one = @One(select = "com.yipin.liuwanr.mapper.OrderMapper.queryOrderDetailsO")), + @Result(property = "contractInformations", column = "orderId", one = @One(select = "com.yipin.liuwanr.mapper.OrderMapper.queryOrderDetailsCI")), + @Result(property = "coursePermissionss", column = "orderId", many = @Many(select = "com.yipin.liuwanr.mapper.OrderMapper.queryOrderDetailsCP")) + }) + List queryOrderDetails(Integer orderId); + + @Select({" "}) + Order queryOrderDetailsO(Integer orderId); + + @Select({" "}) + List queryOrderDetailsCP(Integer orderId); + + @Select({" "}) + ContractInformation queryOrderDetailsCI(Integer orderId); + + @Update({" "}) + void deleteOrder(@Param("orderId") List orderId); + + @Update("UPDATE orders SET customerName = #{customerName},orderName = #{orderName},orderAmount = #{orderAmount},orderType = #{orderType},provinceId = #{provinceId},cityId = #{cityId},orderContact = #{orderContact},phone = #{phone},email = #{email},customerId = #{customerId} where orderId = #{orderId}") + void updateOrder(Order order); + + @Delete("Delete from hr_course_permissions WHERE orderId = #{orderId}") + void deleteCoursePermissions(Integer orderId); + + //缺少个过期时间 + @Update("INSERT INTO hr_course_permissions(courseId,usePeriod,marketPrice,transactionPrice,discount,portAddressId,isDeliverGoods,orderId) VALUES (#{courseId},#{usePeriod},#{marketPrice},#{transactionPrice},#{discount},#{portAddressId},#{isDeliverGoods},#{orderId})") + void updateCoursePermissions(CoursePermissions coursePermissions); + + @Update("UPDATE hr_contract_information SET contractInformationName = #{contractInformationName},contractInformationNumber = #{contractInformationNumber},contractInformationSum = #{contractInformationSum},contractInformationLink = #{contractInformationLink} where contractInformationId = #{contractInformationId}") + void updateContractInformation(ContractInformation contractInformation); + + @Update({" "}) + void isDeliverGoods(CoursePermissions coursePermissions); + + @Select({" "}) + List queryOrderCustomer(Integer cityId, Integer provinceId); + + @Select({" "}) + List queryOrderCustomerContact(Integer customerId); + + //查询订单课程列表 + @Select({" "}) + List queryCourseList(String searchContent, @Param("courseId") List courseId); - //缺少个过期时间 - @Update("INSERT INTO hr_course_permissions(courseId,usePeriod,marketPrice,transactionPrice,discount,portAddressId,isDeliverGoods,orderId) VALUES (#{courseId},#{usePeriod},#{marketPrice},#{transactionPrice},#{discount},#{portAddressId},#{isDeliverGoods},#{orderId})") - void updateCoursePermissions(CoursePermissions coursePermissions); - - @Update("UPDATE hr_contract_information SET contractInformationName = #{contractInformationName},contractInformationNumber = #{contractInformationNumber},contractInformationSum = #{contractInformationSum},contractInformationLink = #{contractInformationLink} where contractInformationId = #{contractInformationId}") - void updateContractInformation(ContractInformation contractInformation); - - @Update({" "}) - void isDeliverGoods(CoursePermissions coursePermissions); - - @Select({" "}) - List queryOrderCustomer(Integer cityId,Integer provinceId); - - @Select({" "}) - List queryOrderCustomerContact(Integer customerId); - - //查询订单课程列表 - @Select({" "}) - List queryCourseList(String searchContent,@Param("courseId")List courseId); - } \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/mapper/ServiceConfigMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ServiceConfigMapper.java index 2b5861f..d4fdafd 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ServiceConfigMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ServiceConfigMapper.java @@ -1,34 +1,33 @@ package com.yipin.liuwanr.mapper; -import java.util.List; - +import com.yipin.liuwanr.entity.ServiceConfig; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; -import com.yipin.liuwanr.entity.ServiceConfig; +import java.util.List; public interface ServiceConfigMapper { - - @Insert("INSERT INTO service_config(systemName,systemType,systemAttribution,systemStatus,isdel) VALUES(#{systemName},#{systemType},#{systemAttribution},#{systemStatus},0)") - void addServiceConfig(ServiceConfig serviceConfig); - - @Select({" "}) - List queryServiceConfig(ServiceConfig serviceConfig); - - @Select({" "}) - List queryServiceConfigDetails(Integer systemId); - - @Update("UPDATE service_config SET isdel = 1 where systemId = #{systemId}") - void deleteServiceConfig(ServiceConfig serviceConfig); - - @Update("UPDATE service_config SET systemName = #{systemName},systemType = #{systemType},systemAttribution = #{systemAttribution},systemStatus = #{systemStatus} where systemId = #{systemId}") - void updateServiceConfig(ServiceConfig serviceConfig); + + @Insert("INSERT INTO service_config(systemName,systemType,systemAttribution,systemStatus,isdel) VALUES(#{systemName},#{systemType},#{systemAttribution},#{systemStatus},0)") + void addServiceConfig(ServiceConfig serviceConfig); + + @Select({" "}) + List queryServiceConfig(ServiceConfig serviceConfig); + + @Select({" "}) + List queryServiceConfigDetails(Integer systemId); + + @Update("UPDATE service_config SET isdel = 1 where systemId = #{systemId}") + void deleteServiceConfig(ServiceConfig serviceConfig); + + @Update("UPDATE service_config SET systemName = #{systemName},systemType = #{systemType},systemAttribution = #{systemAttribution},systemStatus = #{systemStatus} where systemId = #{systemId}") + void updateServiceConfig(ServiceConfig serviceConfig); } \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java index 347d08b..ce3f75d 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java @@ -129,7 +129,24 @@ public interface UserMapper { "GROUP BY u.userId order by u.creationTime desc", " "}) List queryUser(UserM user); - + + @Select({" "}) + List queryUserInfo(UserInfo userInfo); + @Update("UPDATE user SET isdel = 1 where userId = #{userId}") void deleteUser(Integer userId); diff --git a/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java b/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java index 56c1d3e..09f2559 100644 --- a/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java +++ b/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java @@ -1,23 +1,16 @@ package com.yipin.liuwanr.service; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - +import com.yipin.liuwanr.entity.*; +import com.yipin.liuwanr.mapper.ExperimentalClassMapper; +import com.yipin.liuwanr.mapper.TeacherProjectAndCourseMapper; import org.jboss.logging.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - -import com.yipin.liuwanr.entity.ExperimentalClass; -import com.yipin.liuwanr.entity.Professional; -import com.yipin.liuwanr.entity.Project_Management; -import com.yipin.liuwanr.entity.StuProfessionalArchitecture; -import com.yipin.liuwanr.entity.Student; -import com.yipin.liuwanr.mapper.ExperimentalClassMapper; -import com.yipin.liuwanr.mapper.TeacherProjectAndCourseMapper; -import com.yipin.liuwanr.vo.ExperimentalClassVo; import org.springframework.util.StringUtils; +import java.util.HashMap; +import java.util.List; + @Service public class ExperimentalClassService { @@ -86,7 +79,7 @@ public class ExperimentalClassService { Integer experimentalClassId = experimentalClass.getExperimentalClassId(); Integer courseId = experimentalClass.getCourseId(); List projectIds = projectAndCourseMapper.queryProject(courseId); - projectAndCourseMapper.addBatchTeachProject(experimentalClassId,courseId,projectIds); + projectAndCourseMapper.addBatchTeachProject(experimentalClassId, courseId, projectIds); resp.put("retcode", 200); } catch (RuntimeException e) { @@ -98,11 +91,11 @@ public class ExperimentalClassService { return resp; } - public HashMap queryExperimentalClass(Integer schoolId,Integer courseId) { + public HashMap queryExperimentalClass(Integer schoolId, Integer courseId) { HashMap resp = new HashMap(); try { - if(!StringUtils.isEmpty(courseId)){ - resp.put("retvalue", experimentalClassMapper.queryExperimentalClass(schoolId,courseId)); + if (!StringUtils.isEmpty(courseId)) { + resp.put("retvalue", experimentalClassMapper.queryExperimentalClass(schoolId, courseId)); resp.put("retcode", 200); } } catch (RuntimeException e) { @@ -233,11 +226,12 @@ public class ExperimentalClassService { return resp; } - + //删除实验班级和删除实验班级下所有学生 public HashMap deleteExperimentalClass(Integer experimentalClassId) { HashMap resp = new HashMap(); try { experimentalClassMapper.deleteExperimentalClass(experimentalClassId); + experimentalClassMapper.deleteExperimentalClassStu(experimentalClassId); resp.put("retcode", 200); } catch (RuntimeException e) { logger.error(e.getMessage()); @@ -247,6 +241,20 @@ public class ExperimentalClassService { } return resp; } + //删除实验班级下的所有学生 +// public HashMap deleteExperimentalClassStu(Integer experimentalClassId) { +// HashMap resp = new HashMap(); +// try { +// experimentalClassMapper.deleteExperimentalClassStu(experimentalClassId); +// resp.put("retcode", 200); +// } catch (RuntimeException e) { +// logger.error(e.getMessage()); +// resp.put("retcode", 500); +// resp.put("retvalue", "删除实验班级失败!"); +// return resp; +// } +// return resp; +// } public HashMap updateExperimentalClass(ExperimentalClass experimentalClass) { HashMap resp = new HashMap(); diff --git a/src/main/java/com/yipin/liuwanr/service/ExperimentallearningService.java b/src/main/java/com/yipin/liuwanr/service/ExperimentallearningService.java index c8f2d5c..1470ea4 100644 --- a/src/main/java/com/yipin/liuwanr/service/ExperimentallearningService.java +++ b/src/main/java/com/yipin/liuwanr/service/ExperimentallearningService.java @@ -44,10 +44,11 @@ public class ExperimentallearningService { try { if(!StringUtils.isEmpty(courseId)&&!StringUtils.isEmpty(studentId)){ Integer experimentalClassId=mapper.queryExperimentalClassId(courseId,studentId); - List projectIds = mapper.queryIsAttendance(studentId, courseId); - List projects = mapper.getBycourseId(experimentalClassId,courseId); - for (int i = 0; i < projects.size(); i++) { - Project_Management project = projects.get(i); + if(!StringUtils.isEmpty(experimentalClassId)){ + List projectIds = mapper.queryIsAttendance(studentId, courseId); + List projects = mapper.getBycourseId(experimentalClassId,courseId); + for (int i = 0; i < projects.size(); i++) { + Project_Management project = projects.get(i); // 教师那边开启了考勤,学生这边才可以有是否已经签到 if (project.getIsAttendance() == 1) { // 判断该学生签到的项目,是否在开启的项目中 @@ -58,8 +59,9 @@ public class ExperimentallearningService { } projects.set(i, project); } + } + resp.put("retvalue", projects); } - resp.put("retvalue", projects); } resp.put("retcode", 200); }catch(Exception e){ @@ -107,9 +109,11 @@ public class ExperimentallearningService { if(!StringUtils.isEmpty(courseId)){ //实验班级 Integer experimentalClassId=mapper.queryExperimentalClassId(courseId,studentId); - //学生信息 - List users =mapper.queryStudentName(experimentalClassId); - resp.put("retvalue", users); + if(!StringUtils.isEmpty(experimentalClassId)){ + //学生信息 + List users =mapper.queryStudentName(experimentalClassId); + resp.put("retvalue", users); + } } resp.put("retcode", 200); } catch (Exception e) { @@ -130,9 +134,11 @@ public class ExperimentallearningService { if(!StringUtils.isEmpty(courseId)){ //实验班级 Integer experimentalClassId=mapper.queryExperimentalClassId(courseId,studentId); - //教师信息 - UserM user =mapper.queryTeacherName(experimentalClassId); - resp.put("retvalue",user); + if(!StringUtils.isEmpty(experimentalClassId)){ + //教师信息 + UserM user =mapper.queryTeacherName(experimentalClassId); + resp.put("retvalue",user); + } } resp.put("retcode", 200); } catch (Exception e) { diff --git a/src/main/java/com/yipin/liuwanr/service/OrderService.java b/src/main/java/com/yipin/liuwanr/service/OrderService.java index fe7c1a5..430d851 100644 --- a/src/main/java/com/yipin/liuwanr/service/OrderService.java +++ b/src/main/java/com/yipin/liuwanr/service/OrderService.java @@ -1,319 +1,312 @@ package com.yipin.liuwanr.service; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.yipin.liuwanr.entity.*; +import com.yipin.liuwanr.mapper.OrderMapper; +import org.jboss.logging.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; -import org.jboss.logging.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.yipin.liuwanr.entity.ApplicationPermissions; -import com.yipin.liuwanr.entity.ContractInformation; -import com.yipin.liuwanr.entity.Course; -import com.yipin.liuwanr.entity.CoursePermissions; -import com.yipin.liuwanr.entity.Order; -import com.yipin.liuwanr.entity.PageResult; -import com.yipin.liuwanr.mapper.OrderMapper; - @Service public class OrderService { - - private static Logger logger = Logger.getLogger(OrderService.class); - - @Autowired - private OrderMapper orderMapper; - //添加合同信息 - public HashMap addOrder(Order order){ - HashMap resp = new HashMap(); - try { - long timeStamp = new Date().getTime();//获取时间戳 - String orderNumber = String.valueOf(timeStamp);//long转String - order.setOrderNumber(orderNumber); - orderMapper.addOrder(order); - resp.put("orderId", order.getOrderId()); - resp.put("retcode", 200); - orderMapper.updateOrderCustomer(order); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "添加订单失败!"); - return resp; - } - return resp; - } - public HashMap addContractInformation(ContractInformation contractInformation){ - HashMap resp = new HashMap(); - try { - orderMapper.addContractInformation(contractInformation); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "添加信息合同失败!"); - return resp; - } - return resp; - } - - //添加课程权限 - public HashMap addCoursePermissionss(List coursePermissionss) throws ParseException{ - HashMap resp = new HashMap(); - try { - Integer size = coursePermissionss.size(); - for (int i = 0; i < size; i++) { - CoursePermissions coursePermissionssList = coursePermissionss.get(i); - Integer usePeriod = coursePermissionssList.getUsePeriod(); - Integer usePeriod1 = usePeriod*1000*(60*60*24); - long DQSJC = System.currentTimeMillis(); - long expireSJC = usePeriod1 + DQSJC; - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - long lt = new Long(expireSJC); - Date date = new Date(lt); - String time = simpleDateFormat.format(date); - coursePermissionss.get(i).setExpirationTime(time); - } - orderMapper.addCoursePermissionss(coursePermissionss); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "添加课程权限失败!"); - return resp; - } - return resp; - } - - //绑定应用权限 - public HashMap bindingApplicationPermissions(ApplicationPermissions applicationPermissions){ - HashMap resp = new HashMap(); - try { - orderMapper.bindingApplicationPermissions(applicationPermissions); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - public HashMap queryCoursePermissions(String courseId){ - HashMap resp = new HashMap(); - try { - List list = orderMapper.queryCoursePermissions(courseId); - resp.put("retvalue", list); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - - public HashMap queryOrder(Order order,Integer pageNo,Integer pageSize){ - HashMap resp = new HashMap(); - try { - if(pageNo!=null&&pageSize!=null) { - PageHelper.startPage(pageNo, pageSize); - List list = orderMapper.queryOrder(order); - PageInfo info=new PageInfo(list); - int total1 = (int) info.getTotal(); - int totalPages; - totalPages = total1 / pageSize; - if (total1 % pageSize != 0){ - totalPages ++; - } - long total = total1; - resp.put("retvalue", new PageResult(total, list,totalPages)); - resp.put("retcode", 200); - }else { - List list = orderMapper.queryOrder(order); - resp.put("retvalue", list); - resp.put("retcode", 200); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - public HashMap queryOrderDetails(Integer orderId){ - HashMap resp = new HashMap(); - try { - resp.put("retvalue", orderMapper.queryOrderDetails(orderId)); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - public HashMap deleteOrder(List orderId){ - HashMap resp = new HashMap(); - try { - orderMapper.deleteOrder(orderId); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - public HashMap updateOrder(Order order){ - HashMap resp = new HashMap(); - try { - orderMapper.updateOrder(order); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } + private static Logger logger = Logger.getLogger(OrderService.class); + + @Autowired + private OrderMapper orderMapper; + + //添加合同信息 + public HashMap addOrder(Order order) { + HashMap resp = new HashMap(); + try { + long timeStamp = new Date().getTime();//获取时间戳 + String orderNumber = String.valueOf(timeStamp);//long转String + order.setOrderNumber(orderNumber); + orderMapper.addOrder(order); + resp.put("orderId", order.getOrderId()); + resp.put("retcode", 200); + orderMapper.updateOrderCustomer(order); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "添加订单失败!"); + return resp; + } + return resp; + } + + public HashMap addContractInformation(ContractInformation contractInformation) { + HashMap resp = new HashMap(); + try { + orderMapper.addContractInformation(contractInformation); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "添加信息合同失败!"); + return resp; + } + return resp; + } + + //添加课程权限 + public HashMap addCoursePermissionss(List coursePermissionss) throws ParseException { + HashMap resp = new HashMap(); + try { + Integer size = coursePermissionss.size(); + for (int i = 0; i < size; i++) { + CoursePermissions coursePermissionssList = coursePermissionss.get(i); + Integer usePeriod = coursePermissionssList.getUsePeriod(); + Integer usePeriod1 = usePeriod * 1000 * (60 * 60 * 24); + long DQSJC = System.currentTimeMillis(); + long expireSJC = usePeriod1 + DQSJC; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + long lt = new Long(expireSJC); + Date date = new Date(lt); + String time = simpleDateFormat.format(date); + coursePermissionss.get(i).setExpirationTime(time); + } + orderMapper.addCoursePermissionss(coursePermissionss); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "添加课程权限失败!"); + return resp; + } + return resp; + } + + //绑定应用权限 + public HashMap bindingApplicationPermissions(ApplicationPermissions applicationPermissions) { + HashMap resp = new HashMap(); + try { + orderMapper.bindingApplicationPermissions(applicationPermissions); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap queryCoursePermissions(String courseId) { + HashMap resp = new HashMap(); + try { + List list = orderMapper.queryCoursePermissions(courseId); + resp.put("retvalue", list); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap queryOrder(Order order, Integer pageNo, Integer pageSize) { + HashMap resp = new HashMap(); + try { + if (pageNo != null && pageSize != null) { + PageHelper.startPage(pageNo, pageSize); + List list = orderMapper.queryOrder(order); + PageInfo info = new PageInfo(list); + int total1 = (int) info.getTotal(); + int totalPages; + totalPages = total1 / pageSize; + if (total1 % pageSize != 0) { + totalPages++; + } + long total = total1; + resp.put("retvalue", new PageResult(total, list, totalPages)); + resp.put("retcode", 200); + } else { + List list = orderMapper.queryOrder(order); + resp.put("retvalue", list); + resp.put("retcode", 200); + } + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap queryOrderDetails(Integer orderId) { + HashMap resp = new HashMap(); + try { + resp.put("retvalue", orderMapper.queryOrderDetails(orderId)); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap deleteOrder(List orderId) { + HashMap resp = new HashMap(); + try { + orderMapper.deleteOrder(orderId); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap updateOrder(Order order) { + HashMap resp = new HashMap(); + try { + orderMapper.updateOrder(order); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap deleteCoursePermissions(Integer orderId) { + HashMap resp = new HashMap(); + try { + orderMapper.deleteCoursePermissions(orderId); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap updateCoursePermissions(List coursePermissionss) { + HashMap resp = new HashMap(); + int size = coursePermissionss.size(); + if (coursePermissionss.isEmpty()) { + resp.put("retcode", 200); + } else { + try { + for (int i = 0; i < size; i++) { + CoursePermissions coursePermissions = coursePermissionss.get(i); + orderMapper.updateCoursePermissions(coursePermissions); + } + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + } + return resp; + } + + public HashMap updateContractInformation(ContractInformation contractInformation) { + HashMap resp = new HashMap(); + try { + orderMapper.updateContractInformation(contractInformation); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + //绑定应用权限 + public HashMap isDeliverGoods(CoursePermissions coursePermissions) { + HashMap resp = new HashMap(); + try { + orderMapper.isDeliverGoods(coursePermissions); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap queryOrderCustomer(Integer cityId, Integer provinceId) { + HashMap resp = new HashMap(); + try { + resp.put("retvalue", orderMapper.queryOrderCustomer(cityId, provinceId)); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } - public HashMap deleteCoursePermissions(Integer orderId){ - HashMap resp = new HashMap(); - try { - orderMapper.deleteCoursePermissions(orderId); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } + public HashMap queryOrderCustomerContact(Integer customerId) { + HashMap resp = new HashMap(); + try { + resp.put("retvalue", orderMapper.queryOrderCustomerContact(customerId)); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } - public HashMap updateCoursePermissions(List coursePermissionss){ - HashMap resp = new HashMap(); - int size = coursePermissionss.size(); - if (coursePermissionss.isEmpty()) { - resp.put("retcode", 200); - }else { - try { - for (int i = 0; i < size; i++) { - CoursePermissions coursePermissions = coursePermissionss.get(i); - orderMapper.updateCoursePermissions(coursePermissions); - } - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - } - return resp; - } - - public HashMap updateContractInformation(ContractInformation contractInformation){ - HashMap resp = new HashMap(); - try { - orderMapper.updateContractInformation(contractInformation); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - //绑定应用权限 - public HashMap isDeliverGoods(CoursePermissions coursePermissions){ - HashMap resp = new HashMap(); - try { - orderMapper.isDeliverGoods(coursePermissions); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - public HashMap queryOrderCustomer(Integer cityId,Integer provinceId){ - HashMap resp = new HashMap(); - try { - resp.put("retvalue", orderMapper.queryOrderCustomer(cityId,provinceId)); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - - public HashMap queryOrderCustomerContact(Integer customerId){ - HashMap resp = new HashMap(); - try { - resp.put("retvalue", orderMapper.queryOrderCustomerContact(customerId)); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - //查询订单课程列表 - public HashMap queryCourseList(String searchContent,List courseId,Integer pageNo,Integer pageSize){ - HashMap resp = new HashMap(); - try { - if(pageNo!=null&&pageSize!=null) { - PageHelper.startPage(pageNo, pageSize); - List list = orderMapper.queryCourseList(searchContent,courseId); - PageInfo info=new PageInfo(list); - int total1 = (int) info.getTotal(); - int totalPages; - totalPages = total1 / pageSize; - if (total1 % pageSize != 0){ - totalPages ++; - } - long total = total1; - resp.put("retvalue", new PageResult(total, list,totalPages)); - resp.put("retcode", 200); - }else { - List list = orderMapper.queryCourseList(searchContent,courseId); - resp.put("retvalue", list); - resp.put("retcode", 200); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } + //查询订单课程列表 + public HashMap queryCourseList(String searchContent, List courseId, Integer pageNo, Integer pageSize) { + HashMap resp = new HashMap(); + try { + if (pageNo != null && pageSize != null) { + PageHelper.startPage(pageNo, pageSize); + List list = orderMapper.queryCourseList(searchContent, courseId); + PageInfo info = new PageInfo(list); + int total1 = (int) info.getTotal(); + int totalPages; + totalPages = total1 / pageSize; + if (total1 % pageSize != 0) { + totalPages++; + } + long total = total1; + resp.put("retvalue", new PageResult(total, list, totalPages)); + resp.put("retcode", 200); + } else { + List list = orderMapper.queryCourseList(searchContent, courseId); + resp.put("retvalue", list); + resp.put("retcode", 200); + } + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } } diff --git a/src/main/java/com/yipin/liuwanr/service/PracticeService.java b/src/main/java/com/yipin/liuwanr/service/PracticeService.java index 3c1f3b6..f8979d1 100644 --- a/src/main/java/com/yipin/liuwanr/service/PracticeService.java +++ b/src/main/java/com/yipin/liuwanr/service/PracticeService.java @@ -4,8 +4,12 @@ import java.net.URLEncoder; import java.util.HashMap; import java.util.List; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.yipin.liuwanr.entity.*; +import com.yipin.liuwanr.helper.RedisHelper; +import com.yipin.liuwanr.vo.UserVO; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.jboss.logging.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -13,13 +17,14 @@ import org.springframework.stereotype.Service; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import com.yipin.liuwanr.entity.PageResult; -import com.yipin.liuwanr.entity.Record; import com.yipin.liuwanr.helper.ExcelExportHelper; import com.yipin.liuwanr.mapper.AssesmentMapper; import com.yipin.liuwanr.mapper.RecordMapper; import com.yipin.liuwanr.vo.PracticeRecordVo; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; /** * 练习记录 @@ -172,7 +177,6 @@ public class PracticeService { return resp; } - public HashMap queryAllExperiment(Integer courseId) { HashMap resp = new HashMap(); try { @@ -188,5 +192,4 @@ public class PracticeService { } return resp; } - } diff --git a/src/main/java/com/yipin/liuwanr/service/ServiceConfigService.java b/src/main/java/com/yipin/liuwanr/service/ServiceConfigService.java index e35c4ed..32da9fd 100644 --- a/src/main/java/com/yipin/liuwanr/service/ServiceConfigService.java +++ b/src/main/java/com/yipin/liuwanr/service/ServiceConfigService.java @@ -1,110 +1,109 @@ package com.yipin.liuwanr.service; -import java.util.HashMap; -import java.util.List; - -import org.jboss.logging.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.yipin.liuwanr.entity.PageResult; import com.yipin.liuwanr.entity.ServiceConfig; import com.yipin.liuwanr.mapper.ServiceConfigMapper; +import org.jboss.logging.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; @Service public class ServiceConfigService { - - private static Logger logger = Logger.getLogger(ServiceConfigService.class); - - @Autowired - private ServiceConfigMapper serviceConfigMapper; - public HashMap addServiceConfig(ServiceConfig serviceConfig){ - HashMap resp = new HashMap(); - try { - serviceConfigMapper.addServiceConfig(serviceConfig); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - public HashMap queryServiceConfig(ServiceConfig serviceConfig,Integer pageNo,Integer pageSize){ - HashMap resp = new HashMap(); - try { - if(pageNo!=null&&pageSize!=null) { - PageHelper.startPage(pageNo, pageSize); - List list = serviceConfigMapper.queryServiceConfig(serviceConfig); - PageInfo info=new PageInfo(list); - int total1 = (int) info.getTotal(); - int totalPages; - totalPages = total1 / pageSize; - if (total1 % pageSize != 0){ - totalPages ++; - } - long total = total1; - resp.put("retvalue", new PageResult(total, list,totalPages)); - resp.put("retcode", 200); - }else { - List list = serviceConfigMapper.queryServiceConfig(serviceConfig); - resp.put("retvalue", list); - resp.put("retcode", 200); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - public HashMap queryServiceConfigDetails(Integer systemId){ - HashMap resp = new HashMap(); - try { - resp.put("retvalue", serviceConfigMapper.queryServiceConfigDetails(systemId)); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - public HashMap deleteServiceConfig(ServiceConfig serviceConfig){ - HashMap resp = new HashMap(); - try { - serviceConfigMapper.deleteServiceConfig(serviceConfig); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - - public HashMap updateServiceConfig(ServiceConfig serviceConfig){ - HashMap resp = new HashMap(); - try { - serviceConfigMapper.updateServiceConfig(serviceConfig); - resp.put("retcode", 200); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); - return resp; - } - return resp; - } - + private static Logger logger = Logger.getLogger(ServiceConfigService.class); + + @Autowired + private ServiceConfigMapper serviceConfigMapper; + + public HashMap addServiceConfig(ServiceConfig serviceConfig) { + HashMap resp = new HashMap(); + try { + serviceConfigMapper.addServiceConfig(serviceConfig); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap queryServiceConfig(ServiceConfig serviceConfig, Integer pageNo, Integer pageSize) { + HashMap resp = new HashMap(); + try { + if (pageNo != null && pageSize != null) { + PageHelper.startPage(pageNo, pageSize); + List list = serviceConfigMapper.queryServiceConfig(serviceConfig); + PageInfo info = new PageInfo(list); + int total1 = (int) info.getTotal(); + int totalPages; + totalPages = total1 / pageSize; + if (total1 % pageSize != 0) { + totalPages++; + } + long total = total1; + resp.put("retvalue", new PageResult(total, list, totalPages)); + resp.put("retcode", 200); + } else { + List list = serviceConfigMapper.queryServiceConfig(serviceConfig); + resp.put("retvalue", list); + resp.put("retcode", 200); + } + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap queryServiceConfigDetails(Integer systemId) { + HashMap resp = new HashMap(); + try { + resp.put("retvalue", serviceConfigMapper.queryServiceConfigDetails(systemId)); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap deleteServiceConfig(ServiceConfig serviceConfig) { + HashMap resp = new HashMap(); + try { + serviceConfigMapper.deleteServiceConfig(serviceConfig); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + public HashMap updateServiceConfig(ServiceConfig serviceConfig) { + HashMap resp = new HashMap(); + try { + serviceConfigMapper.updateServiceConfig(serviceConfig); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + } diff --git a/src/main/java/com/yipin/liuwanr/service/UserService.java b/src/main/java/com/yipin/liuwanr/service/UserService.java index cac1651..b6d8947 100644 --- a/src/main/java/com/yipin/liuwanr/service/UserService.java +++ b/src/main/java/com/yipin/liuwanr/service/UserService.java @@ -170,6 +170,37 @@ public class UserService { return resp; } + //查询用户信息 + public HashMap queryUserInfo(UserInfo userInfo,Integer pageNo,Integer pageSize){ + HashMap resp = new HashMap(); + try { + if(pageNo!=null&&pageSize!=null) { + PageHelper.startPage(pageNo, pageSize); + List list = userMapper.queryUserInfo(userInfo); + PageInfo info=new PageInfo(list); + int total1 = (int) info.getTotal(); + int totalPages; + totalPages = total1 / pageSize; + if (total1 % pageSize != 0){ + totalPages ++; + } + long total = total1; + resp.put("retvalue", new PageResult(total, list,totalPages)); + resp.put("retcode", 200); + }else { + List list = userMapper.queryUserInfo(userInfo); + resp.put("retvalue", list); + resp.put("retcode", 200); + } + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "查询用户失败!"); + return resp; + } + return resp; + } + //删除用户 public HashMap deleteUser(Integer userId){ HashMap resp = new HashMap(); diff --git a/src/main/java/com/yipin/liuwanr/entity/OrderVo.java b/src/main/java/com/yipin/liuwanr/vo/OrderVo.java similarity index 89% rename from src/main/java/com/yipin/liuwanr/entity/OrderVo.java rename to src/main/java/com/yipin/liuwanr/vo/OrderVo.java index 6ce5f26..81d4c39 100644 --- a/src/main/java/com/yipin/liuwanr/entity/OrderVo.java +++ b/src/main/java/com/yipin/liuwanr/vo/OrderVo.java @@ -1,4 +1,8 @@ -package com.yipin.liuwanr.entity; +package com.yipin.liuwanr.vo; + +import com.yipin.liuwanr.entity.ContractInformation; +import com.yipin.liuwanr.entity.CoursePermissions; +import com.yipin.liuwanr.entity.Order; import java.util.ArrayList; import java.util.List; diff --git a/src/test/java/com/yipin/liuwanr/AliyunOssServiceTest.java b/src/test/java/com/yipin/liuwanr/AliyunOssServiceTest.java index ed82dc6..539d5de 100644 --- a/src/test/java/com/yipin/liuwanr/AliyunOssServiceTest.java +++ b/src/test/java/com/yipin/liuwanr/AliyunOssServiceTest.java @@ -34,20 +34,20 @@ public class AliyunOssServiceTest { /** * 测试上传文件 */ - @Test - public void testUploadFiles() throws IOException { - File file = new File("D:\\pic\\1.jpg"); - FileItem fileItem = new DiskFileItem("file", - Files.probeContentType(file.toPath()), - false, - file.getName(), - (int) file.length(), - file.getParentFile()); - IOUtils.copy(new FileInputStream(file), fileItem.getOutputStream()); - MultipartFile multipartFile = new CommonsMultipartFile(fileItem); - HashMap map = aliyunOssService.uploadFiles(multipartFile); - map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); - } +// @Test +// public void testUploadFiles() throws IOException { +// File file = new File("D:\\pic\\1.jpg"); +// FileItem fileItem = new DiskFileItem("file", +// Files.probeContentType(file.toPath()), +// false, +// file.getName(), +// (int) file.length(), +// file.getParentFile()); +// IOUtils.copy(new FileInputStream(file), fileItem.getOutputStream()); +// MultipartFile multipartFile = new CommonsMultipartFile(fileItem); +// HashMap map = aliyunOssService.uploadFiles(multipartFile); +// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); +// } /** * 测试下载文件 diff --git a/src/test/java/com/yipin/liuwanr/ExperimentalClassServiceTest.java b/src/test/java/com/yipin/liuwanr/ExperimentalClassServiceTest.java index d24ba9f..d7d8428 100644 --- a/src/test/java/com/yipin/liuwanr/ExperimentalClassServiceTest.java +++ b/src/test/java/com/yipin/liuwanr/ExperimentalClassServiceTest.java @@ -52,19 +52,19 @@ public class ExperimentalClassServiceTest { public void addExperimentalClass() { ExperimentalClass experimentalClass = new ExperimentalClass(); experimentalClass.setExperimentalClassName("测试"); - experimentalClass.setClassSize(12); + experimentalClass.setClassSize(120); experimentalClass.setFounder("测试"); - experimentalClass.setCourseId(2); - experimentalClass.setUserId(2); - experimentalClass.setSchoolId(2); + experimentalClass.setCourseId(77); + experimentalClass.setUserId(452); + experimentalClass.setSchoolId(2043); HashMap map = experimentalClassService.addExperimentalClass(experimentalClass); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } @Test public void queryExperimentalClass() { - Integer schoolId = 1; - Integer courseId = 2; + Integer schoolId = 2043; + Integer courseId = 77; HashMap map = experimentalClassService.queryExperimentalClass(schoolId, courseId); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } @@ -72,7 +72,7 @@ public class ExperimentalClassServiceTest { //查询实验班级专业 @Test public void queryExperimentalClassSP() { - Integer experimentalClassId = 1; + Integer experimentalClassId = 56; HashMap map = experimentalClassService.queryExperimentalClassSP(experimentalClassId); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } @@ -80,7 +80,7 @@ public class ExperimentalClassServiceTest { //查询学生行政班级 @Test public void queryStudentClass() { - Integer experimentalClassId = 1; + Integer experimentalClassId = 56; HashMap map = experimentalClassService.queryStudentClass(experimentalClassId); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } @@ -91,7 +91,7 @@ public class ExperimentalClassServiceTest { @Test public void queryExperimentalClassDetails() { Student student = new Student(); - Integer courseId = 1; + Integer courseId = 56; HashMap map = experimentalClassService.queryExperimentalClassDetails(student, courseId); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } @@ -99,7 +99,7 @@ public class ExperimentalClassServiceTest { //新增学生显示数据 @Test public void queryexperimentalClass() { - Integer experimentalClassId = 1; + Integer experimentalClassId = 56; HashMap map = experimentalClassService.queryexperimentalClass(experimentalClassId); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } @@ -107,7 +107,7 @@ public class ExperimentalClassServiceTest { //专业下拉框 @Test public void getProfessionals() { - Integer experimentalClassId = 1; + Integer experimentalClassId = 56; HashMap map = experimentalClassService.getProfessionals(experimentalClassId); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } @@ -115,7 +115,7 @@ public class ExperimentalClassServiceTest { //班级下拉框 @Test public void getStudentClass() { - Integer experimentalClassId = 1; + Integer experimentalClassId = 56; HashMap map = experimentalClassService.getStudentClass(experimentalClassId); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } @@ -123,7 +123,7 @@ public class ExperimentalClassServiceTest { @Test @Transactional public void deleteExperimentalClass() { - Integer experimentalClassId = 1; + Integer experimentalClassId = 56; HashMap map = experimentalClassService.deleteExperimentalClass(experimentalClassId); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } @@ -132,6 +132,13 @@ public class ExperimentalClassServiceTest { @Transactional public void updateExperimentalClass() { ExperimentalClass experimentalClass = new ExperimentalClass(); + experimentalClass.setExperimentalClassName("测试"); + experimentalClass.setClassSize(120); + experimentalClass.setFounder("测试"); + experimentalClass.setCourseId(77); + experimentalClass.setUserId(452); + experimentalClass.setSchoolId(2043); + experimentalClass.setExperimentalClassId(56); HashMap map = experimentalClassService.updateExperimentalClass(experimentalClass); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } @@ -141,6 +148,13 @@ public class ExperimentalClassServiceTest { @Transactional public void updateExperimentClassName() { ExperimentalClass experimentalClass = new ExperimentalClass(); + experimentalClass.setExperimentalClassName("测试"); + experimentalClass.setClassSize(120); + experimentalClass.setFounder("测试"); + experimentalClass.setCourseId(77); + experimentalClass.setUserId(452); + experimentalClass.setSchoolId(2043); + experimentalClass.setExperimentalClassId(56); HashMap map = experimentalClassService.updateExperimentalClass(experimentalClass); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } @@ -148,7 +162,7 @@ public class ExperimentalClassServiceTest { //——————————————————————————————全承珠 @Test public void queryGetByExperimentalClassName() { - String experimentalClassName = ""; + String experimentalClassName = "测试"; HashMap map = experimentalClassService.queryGetByExperimentalClassName(experimentalClassName); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } diff --git a/src/test/java/com/yipin/liuwanr/OrderServiceTest.java b/src/test/java/com/yipin/liuwanr/OrderServiceTest.java new file mode 100644 index 0000000..0c19a77 --- /dev/null +++ b/src/test/java/com/yipin/liuwanr/OrderServiceTest.java @@ -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 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 map = orderService.addContractInformation(contractInformation); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); + } + + //添加课程权限 + @Test + @Transactional + public void addCoursePermissionss() throws ParseException { + List 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 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 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 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 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 rows = (List) 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 map = orderService.queryOrderDetails(orderId); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); + } + + @Test + @Transactional + public void deleteOrder() { + List orderId = new ArrayList<>(); + orderId.add(1); + orderId.add(2); + orderId.add(3); + HashMap 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 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 map = orderService.deleteCoursePermissions(orderId); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); + } + + @Test + @Transactional + public void updateCoursePermissions() { + List coursePermissionss = new ArrayList<>(); + CoursePermissions coursePermissions = new CoursePermissions(); + coursePermissionss.add(coursePermissions); + HashMap 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 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 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 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 map = orderService.queryOrderCustomerContact(customerId); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); + } + + //查询订单课程列表 + @Test + @Transactional + public void queryCourseList() { + String searchContent = ""; + List courseId = new ArrayList<>(); + Integer pageNo = 1; + Integer pageSize = 10; + HashMap 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 rows = (List) pageResult.getRows(); + rows.forEach(item -> System.out.println(item.toString())); + } else { + String msg = (String) map.get("retvalue"); + System.out.println(msg); + } + } + +} diff --git a/src/test/java/com/yipin/liuwanr/ServiceConfigServiceTest.java b/src/test/java/com/yipin/liuwanr/ServiceConfigServiceTest.java new file mode 100644 index 0000000..47a8e21 --- /dev/null +++ b/src/test/java/com/yipin/liuwanr/ServiceConfigServiceTest.java @@ -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 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 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 rows = (List) 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 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 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 map = serviceConfigService.updateServiceConfig(serviceConfig); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); + } + +}