diff --git a/src/main/java/com/yipin/liuwanr/controller/OrderController.java b/src/main/java/com/yipin/liuwanr/controller/OrderController.java index 782aea5..19ab635 100644 --- a/src/main/java/com/yipin/liuwanr/controller/OrderController.java +++ b/src/main/java/com/yipin/liuwanr/controller/OrderController.java @@ -196,6 +196,8 @@ public class OrderController { if (200 == status) { resp.setStatus(status); resp.setMessage(ret.get("retvalue")); + int orderId = order.getOrderId(); + HashMap ret0 = orderService.deleteCoursePermissions(orderId); HashMap ret1 = orderService.updateCoursePermissions(coursePermissionss); int status1 = (int) ret1.get("retcode"); if (status1 == 200) { diff --git a/src/main/java/com/yipin/liuwanr/controller/UserController.java b/src/main/java/com/yipin/liuwanr/controller/UserController.java index 1b058b5..9928e73 100644 --- a/src/main/java/com/yipin/liuwanr/controller/UserController.java +++ b/src/main/java/com/yipin/liuwanr/controller/UserController.java @@ -106,9 +106,6 @@ public class UserController { resp.setStatus(300); resp.setErrmessage("Parameter Invalid"); } else { - user.setPassword("huoran123");//设置默认密码 - String uniqueIdentificationAccount = System.currentTimeMillis()+""; - user.setUniqueIdentificationAccount(uniqueIdentificationAccount); HashMap ret = userService.addUser(user); int status = (int) ret.get("retcode"); if (200 == status) { @@ -185,7 +182,7 @@ public class UserController { Response resp = new Response(); if (user.getUser().isEmpty()) { resp.setStatus(300); - resp.setErrmessage("Parameter Invalid"); + resp.setErrmessage("参数有误,删除用户失败!"); } else { HashMap ret = userService.deleteUser(user); int status = (int) ret.get("retcode"); @@ -208,7 +205,7 @@ public class UserController { Response resp = new Response(); if (user.getUserId()==null) { resp.setStatus(300); - resp.setErrmessage("Parameter Invalid"); + resp.setErrmessage("用户ID为空,修改用户失败!"); } else { HashMap ret = userService.updateUser(user); int status = (int) ret.get("retcode"); @@ -258,11 +255,11 @@ public class UserController { Response resp = new Response(); if (userId==null) {//前台传来的值是否为空 resp.setStatus(300); - resp.setErrmessage("Parameter Invalid"); + resp.setErrmessage("用户id为空!查询失败!"); }else { HashMap ret = userService.queryUserDetails(userId); resp.setStatus(200); - resp.setErrmessage("Parameter effective"); + resp.setErrmessage("查询成功!"); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); diff --git a/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java b/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java index 55ef72a..0228765 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java @@ -34,7 +34,7 @@ public interface CustomerMapper { " and c.countries = #{countries} ", " and c.provinceId = #{provinceId} ", " and c.cityId = #{cityId} ", - " and c.customerName like CONCAT('%',#{searchContent},'%')", + " and c.customerName like CONCAT('%',#{searchContent},'%') or c.adminName like CONCAT('%',#{searchContent},'%') or c.adminPhone like CONCAT('%',#{searchContent},'%')", "GROUP BY c.customerId", " "}) List queryCustomer(Customer customer); diff --git a/src/main/java/com/yipin/liuwanr/mapper/OrderMapper.java b/src/main/java/com/yipin/liuwanr/mapper/OrderMapper.java index d4b87c6..f8b2ffa 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/OrderMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/OrderMapper.java @@ -2,15 +2,7 @@ package com.yipin.liuwanr.mapper; import java.util.List; -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Many; -import org.apache.ibatis.annotations.One; -import org.apache.ibatis.annotations.Options; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Result; -import org.apache.ibatis.annotations.Results; -import org.apache.ibatis.annotations.Select; -import org.apache.ibatis.annotations.Update; +import org.apache.ibatis.annotations.*; import com.yipin.liuwanr.entity.ApplicationPermissions; import com.yipin.liuwanr.entity.ContractInformation; @@ -100,7 +92,10 @@ public interface OrderMapper { @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); diff --git a/src/main/java/com/yipin/liuwanr/service/OrderService.java b/src/main/java/com/yipin/liuwanr/service/OrderService.java index f046ed5..dd5614b 100644 --- a/src/main/java/com/yipin/liuwanr/service/OrderService.java +++ b/src/main/java/com/yipin/liuwanr/service/OrderService.java @@ -188,12 +188,26 @@ public class OrderService { } 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++) { diff --git a/src/main/java/com/yipin/liuwanr/service/UserService.java b/src/main/java/com/yipin/liuwanr/service/UserService.java index 65fbd6f..51311c3 100644 --- a/src/main/java/com/yipin/liuwanr/service/UserService.java +++ b/src/main/java/com/yipin/liuwanr/service/UserService.java @@ -104,12 +104,15 @@ public class UserService { public HashMap addUser(UserM user){ HashMap resp = new HashMap(); try { + user.setPassword("huoran123");//设置默认密码 + String uniqueIdentificationAccount = System.currentTimeMillis()+""; + user.setUniqueIdentificationAccount(uniqueIdentificationAccount); userMapper.addUser(user); resp.put("retcode", 200); } catch (RuntimeException e) { logger.error(e.getMessage()); resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); + resp.put("retvalue", "添加用户失败!"); return resp; } return resp; @@ -139,7 +142,7 @@ public class UserService { } catch (RuntimeException e) { logger.error(e.getMessage()); resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); + resp.put("retvalue", "查询用户失败!"); return resp; } return resp; @@ -153,7 +156,7 @@ public class UserService { } catch (RuntimeException e) { logger.error(e.getMessage()); resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); + resp.put("retvalue", "删除用户失败"); return resp; } return resp; @@ -167,7 +170,7 @@ public class UserService { } catch (RuntimeException e) { logger.error(e.getMessage()); resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); + resp.put("retvalue", "更新用户失败!"); return resp; } return resp; @@ -180,14 +183,14 @@ public class UserService { resp.put("retvalue", userMapper.logins(user)); if (resp.get("retvalue")==null) { resp.put("retcode", 300); - resp.put("retvalue", "Inquiry Failed"); + resp.put("retvalue", "登录失败,账号密码有误或不存在!"); }else { resp.put("retcode", 200); } } catch (RuntimeException e) { logger.error(e.getMessage()); resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); + resp.put("retvalue", "登录异常,请稍后再试!"); return resp; } return resp; @@ -201,7 +204,7 @@ public class UserService { } catch (RuntimeException e) { logger.error(e.getMessage()); resp.put("retcode", 500); - resp.put("retvalue", "Inquiry Failed"); + resp.put("retvalue", "查询用户详情失败!"); return resp; } return resp; @@ -225,7 +228,7 @@ public class UserService { } catch (Exception e) { logger.info(e.getMessage()); resp.put("retcode", 500); - resp.put("retvalue", "Upload Fail"); + resp.put("retvalue", "修改头像失败!"); return resp; } return resp;