zjxpcyc hace 6 años
padre
commit
18bbd65abe

+ 8
- 1
whole-estate/src/main/java/com/example/wholeestate/controller/AppointmentController.java Ver fichero

@@ -52,6 +52,13 @@ public class AppointmentController extends BaseController {
52 52
         return responseBean;
53 53
     }
54 54
 
55
-
55
+    @RequestMapping(value = "/wx/appointment/of/{appointmentId}", method = RequestMethod.DELETE)
56
+    @ApiOperation(value = "微信小程序 删除预约记录", notes = "微信小程序 删除预约记录")
57
+    @ApiImplicitParams({
58
+            @ApiImplicitParam(paramType = "path", dataTypeClass = String.class, name = "appointmentId", value = "预约ID")
59
+    })
60
+    public ResponseBean wxDelete(@PathVariable("appointmentId") String appointmentId) {
61
+        return iAppointmentService.deleteWxAppointment(appointmentId);
62
+    }
56 63
 
57 64
 }

+ 1
- 1
whole-estate/src/main/java/com/example/wholeestate/dao/AppointmentMapper.java Ver fichero

@@ -30,7 +30,7 @@ public interface AppointmentMapper extends BaseMapper<Appointment> {
30 30
             "ta_appointment taa " +
31 31
             "LEFT JOIN ta_building tab ON taa.building_id = tab.building_id " +
32 32
             "LEFT JOIN ta_customer tac ON taa.customer_id = tac.customer_id " +
33
-            "WHERE tac.openid = #{openid}")
33
+            "WHERE tac.openid = #{openid} and taa.status = 1")
34 34
     IPage<Appointment> getOpenidAppendableList(Page<Appointment> page, @Param("openid") String openid);
35 35
 
36 36
     IPage<Appointment> appendableList(Page page, @Param("buildingId") String buildingId, @Param("username")String username,@Param("phone") String phone,@Param("status") String status);

+ 2
- 0
whole-estate/src/main/java/com/example/wholeestate/service/IAppointmentService.java Ver fichero

@@ -31,4 +31,6 @@ public interface IAppointmentService extends IService<Appointment> {
31 31
      */
32 32
     ResponseBean addWxAppointment(String openid, String parameter);
33 33
 
34
+
35
+    ResponseBean deleteWxAppointment(String appointmentId);
34 36
 }

+ 29
- 0
whole-estate/src/main/java/com/example/wholeestate/service/impl/AppointmentServiceImpl.java Ver fichero

@@ -2,6 +2,7 @@ package com.example.wholeestate.service.impl;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
5 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
6 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -14,6 +15,7 @@ import com.example.wholeestate.model.Appointment;
14 15
 import com.example.wholeestate.model.Customer;
15 16
 import com.example.wholeestate.model.Dict;
16 17
 import com.example.wholeestate.service.IAppointmentService;
18
+import org.apache.http.HttpStatus;
17 19
 import org.springframework.beans.factory.annotation.Autowired;
18 20
 import org.springframework.stereotype.Service;
19 21
 
@@ -64,4 +66,31 @@ public class AppointmentServiceImpl extends ServiceImpl<AppointmentMapper, Appoi
64 66
         responseBean.addSuccess("操作成功!");
65 67
         return responseBean;
66 68
     }
69
+
70
+    @Override
71
+    public ResponseBean deleteWxAppointment(String appointmentId) {
72
+        ResponseBean responseBean = new ResponseBean();
73
+
74
+        QueryWrapper<Appointment> queryWrapper = new QueryWrapper<>();
75
+        queryWrapper.eq("appointment_id", appointmentId);
76
+        Appointment appointment = appointmentMapper.selectOne(queryWrapper);
77
+        if (null == appointment) {
78
+            responseBean.addError(HttpStatus.SC_BAD_REQUEST, "未找到需要删除的数据");
79
+            return responseBean;
80
+        }
81
+
82
+        // todo 一些删除校验
83
+
84
+        UpdateWrapper<Appointment> updateWrapper = new UpdateWrapper<>();
85
+        updateWrapper.set("status", -1);
86
+        updateWrapper.eq("appointment_id", appointmentId);
87
+
88
+        int rows = appointmentMapper.update(appointment, updateWrapper);
89
+        if (rows < 1) {
90
+            responseBean.addError(HttpStatus.SC_INTERNAL_SERVER_ERROR, "删数据失败");
91
+            return responseBean;
92
+        }
93
+
94
+        return responseBean;
95
+    }
67 96
 }

+ 2
- 2
whole-estate/src/main/java/com/example/wholeestate/service/impl/CustomerServiceImpl.java Ver fichero

@@ -145,12 +145,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
145 145
         updateWrapper.set("customer_name", customer.getCustomerName());
146 146
         updateWrapper.set("name", customer.getName());
147 147
         updateWrapper.set("phone", customer.getPhone());
148
-        updateWrapper.set("idNum", customer.getIdNum());
148
+        updateWrapper.set("id_num", customer.getIdNum());
149 149
         updateWrapper.set("remark", customer.getRemark());
150 150
         updateWrapper.eq("customer_id", customer.getCustomerId());
151 151
 
152 152
         int success = customerMapper.update(customer, updateWrapper);
153
-        if (success >= 0) {
153
+        if (success < 1) {
154 154
             responseBean.addError(HttpStatus.SC_INTERNAL_SERVER_ERROR, "更新用户信息失败");
155 155
         }
156 156