修复订单、用户接口

master
zhiyong.ning 4 years ago
parent 6a805bd30a
commit 439c56f842
  1. 2
      src/main/java/com/yipin/liuwanr/controller/OrderController.java
  2. 11
      src/main/java/com/yipin/liuwanr/controller/UserController.java
  3. 2
      src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java
  4. 13
      src/main/java/com/yipin/liuwanr/mapper/OrderMapper.java
  5. 16
      src/main/java/com/yipin/liuwanr/service/OrderService.java
  6. 19
      src/main/java/com/yipin/liuwanr/service/UserService.java

@ -196,6 +196,8 @@ public class OrderController {
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
int orderId = order.getOrderId();
HashMap<String, Object> ret0 = orderService.deleteCoursePermissions(orderId);
HashMap<String, Object> ret1 = orderService.updateCoursePermissions(coursePermissionss);
int status1 = (int) ret1.get("retcode");
if (status1 == 200) {

@ -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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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);

@ -34,7 +34,7 @@ public interface CustomerMapper {
" <if test='countries!=null'>and c.countries = #{countries} </if>",
" <if test='provinceId!=null'>and c.provinceId = #{provinceId} </if>",
" <if test='cityId!=null'>and c.cityId = #{cityId} </if>",
" <if test='searchContent!=null'> and c.customerName like CONCAT('%',#{searchContent},'%')</if>",
" <if test='searchContent!=null'> and c.customerName like CONCAT('%',#{searchContent},'%') or c.adminName like CONCAT('%',#{searchContent},'%') or c.adminPhone like CONCAT('%',#{searchContent},'%')</if>",
"GROUP BY c.customerId",
"</script> "})
List<Customer> queryCustomer(Customer customer);

@ -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;
@ -101,6 +93,9 @@ 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);

@ -189,11 +189,25 @@ public class OrderService {
return resp;
}
public HashMap<String, Object> deleteCoursePermissions(Integer orderId){
HashMap<String, Object> resp = new HashMap<String, Object>();
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<String, Object> updateCoursePermissions(List<CoursePermissions> coursePermissionss){
HashMap<String, Object> resp = new HashMap<String, Object>();
int size = coursePermissionss.size();
if (coursePermissionss.isEmpty()) {
//缺少删除逻辑
resp.put("retcode", 200);
}else {
try {
for (int i = 0; i < size; i++) {

@ -104,12 +104,15 @@ public class UserService {
public HashMap<String, Object> addUser(UserM user){
HashMap<String, Object> resp = new HashMap<String, Object>();
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;

Loading…
Cancel
Save