weiximei 6 år sedan
förälder
incheckning
784eaadb07

+ 2
- 0
whole-estate/src/main/java/com/example/wholeestate/controller/ActivityController.java Visa fil

21
 import javax.servlet.http.HttpServletRequest;
21
 import javax.servlet.http.HttpServletRequest;
22
 import java.text.DateFormat;
22
 import java.text.DateFormat;
23
 import java.text.SimpleDateFormat;
23
 import java.text.SimpleDateFormat;
24
+import java.time.LocalDateTime;
24
 import java.util.Date;
25
 import java.util.Date;
25
 
26
 
26
 /**
27
 /**
99
         Activity activity = JSONObject.parseObject(parameter, Activity.class);
100
         Activity activity = JSONObject.parseObject(parameter, Activity.class);
100
         activity.setStatus(0);
101
         activity.setStatus(0);
101
         activity.setActivityId(idGen.nextId()+"");
102
         activity.setActivityId(idGen.nextId()+"");
103
+        activity.setCreateDate(LocalDateTime.now());
102
         iActivityService.save(activity);
104
         iActivityService.save(activity);
103
         return responseBean;
105
         return responseBean;
104
     }
106
     }

+ 14
- 0
whole-estate/src/main/java/com/example/wholeestate/controller/AppointmentController.java Visa fil

40
         return responseBean;
40
         return responseBean;
41
     }
41
     }
42
 
42
 
43
+    @RequestMapping(value = "/wx/appointment/{openid}", method = RequestMethod.POST)
44
+    @ApiOperation(value = "根据openid 添加 预约记录", notes = "根据openid 添加 预约记录")
45
+    @ApiImplicitParams({
46
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "buildingId楼盘编号;appointmentDate预约时间;customerName姓名;phone手机;remark备注"),
47
+            @ApiImplicitParam(paramType = "path", dataTypeClass = String.class, name = "openid", value = "openid")
48
+    })
49
+    public ResponseBean openidAppointementList(@PathVariable("openid") String openid, @RequestBody String parameter) {
50
+        ResponseBean responseBean = new ResponseBean();
51
+        responseBean = iAppointmentService.addAppointment(openid, parameter);
52
+        return responseBean;
53
+    }
54
+
55
+
56
+
43
 }
57
 }

+ 47
- 0
whole-estate/src/main/java/com/example/wholeestate/controller/DictController.java Visa fil

1
+package com.example.wholeestate.controller;
2
+
3
+
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
+import com.example.wholeestate.common.base.BaseController;
6
+import com.example.wholeestate.common.resp.ResponseBean;
7
+import com.example.wholeestate.model.Dict;
8
+import com.example.wholeestate.service.IDictService;
9
+import io.swagger.annotations.Api;
10
+import io.swagger.annotations.ApiImplicitParam;
11
+import io.swagger.annotations.ApiImplicitParams;
12
+import io.swagger.annotations.ApiOperation;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RequestMethod;
16
+import org.springframework.web.bind.annotation.RestController;
17
+
18
+import java.util.List;
19
+
20
+/**
21
+ * <p>
22
+ *  字典表 前端控制器
23
+ * </p>
24
+ *
25
+ * @author weiximei
26
+ * @since 2019-03-21
27
+ */
28
+@RestController
29
+@RequestMapping("/")
30
+@Api(value = "字典 API", description = "字典 API")
31
+public class DictController extends BaseController {
32
+
33
+    @Autowired
34
+    private IDictService iDictService;
35
+
36
+    @RequestMapping(value = "/dict", method = RequestMethod.GET)
37
+    @ApiOperation(value = "获取字典", notes = "获取字典")
38
+    public ResponseBean getDictList() {
39
+        ResponseBean responseBean = new ResponseBean();
40
+        QueryWrapper<Dict> dictQueryWrapper = new QueryWrapper<>();
41
+        dictQueryWrapper.eq("status", 1);
42
+        List<Dict> list = iDictService.list(dictQueryWrapper);
43
+        responseBean.addSuccess(list);
44
+        return responseBean;
45
+    }
46
+
47
+}

+ 16
- 0
whole-estate/src/main/java/com/example/wholeestate/dao/DictMapper.java Visa fil

1
+package com.example.wholeestate.dao;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.example.wholeestate.model.Dict;
5
+
6
+/**
7
+ * <p>
8
+ *  Mapper 接口
9
+ * </p>
10
+ *
11
+ * @author weiximei
12
+ * @since 2019-03-21
13
+ */
14
+public interface DictMapper extends BaseMapper<Dict> {
15
+
16
+}

+ 35
- 0
whole-estate/src/main/java/com/example/wholeestate/model/Dict.java Visa fil

1
+package com.example.wholeestate.model;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableName;
4
+import lombok.Data;
5
+import lombok.EqualsAndHashCode;
6
+import lombok.experimental.Accessors;
7
+
8
+import java.io.Serializable;
9
+
10
+/**
11
+ * <p>
12
+ * 
13
+ * </p>
14
+ *
15
+ * @author weiximei
16
+ * @since 2019-03-21
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = false)
20
+@Accessors(chain = true)
21
+@TableName("td_dict")
22
+public class Dict implements Serializable {
23
+
24
+    private static final long serialVersionUID = 1L;
25
+
26
+    private String id;
27
+
28
+    private String type;
29
+
30
+    private String name;
31
+
32
+    private Integer status;
33
+
34
+
35
+}

+ 8
- 0
whole-estate/src/main/java/com/example/wholeestate/service/IAppointmentService.java Visa fil

23
      */
23
      */
24
     ResponseBean getOpenidAppointmentList(String openid, Integer pageNum, Integer pageSize);
24
     ResponseBean getOpenidAppointmentList(String openid, Integer pageNum, Integer pageSize);
25
 
25
 
26
+    /**
27
+     * 添加 预约记录
28
+     * @param openid
29
+     * @param parameter
30
+     * @return
31
+     */
32
+    ResponseBean addAppointment(String openid, String parameter);
33
+
26
 }
34
 }

+ 16
- 0
whole-estate/src/main/java/com/example/wholeestate/service/IDictService.java Visa fil

1
+package com.example.wholeestate.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.example.wholeestate.model.Dict;
5
+
6
+/**
7
+ * <p>
8
+ *  服务类
9
+ * </p>
10
+ *
11
+ * @author weiximei
12
+ * @since 2019-03-21
13
+ */
14
+public interface IDictService extends IService<Dict> {
15
+
16
+}

+ 28
- 0
whole-estate/src/main/java/com/example/wholeestate/service/impl/AppointmentServiceImpl.java Visa fil

1
 package com.example.wholeestate.service.impl;
1
 package com.example.wholeestate.service.impl;
2
 
2
 
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
 import com.example.wholeestate.common.resp.ResponseBean;
8
 import com.example.wholeestate.common.resp.ResponseBean;
9
+import com.example.wholeestate.common.uuid.IdGen;
7
 import com.example.wholeestate.dao.AppointmentMapper;
10
 import com.example.wholeestate.dao.AppointmentMapper;
11
+import com.example.wholeestate.dao.CustomerMapper;
12
+import com.example.wholeestate.model.Activity;
8
 import com.example.wholeestate.model.Appointment;
13
 import com.example.wholeestate.model.Appointment;
14
+import com.example.wholeestate.model.Customer;
15
+import com.example.wholeestate.model.Dict;
9
 import com.example.wholeestate.service.IAppointmentService;
16
 import com.example.wholeestate.service.IAppointmentService;
10
 import org.springframework.beans.factory.annotation.Autowired;
17
 import org.springframework.beans.factory.annotation.Autowired;
11
 import org.springframework.stereotype.Service;
18
 import org.springframework.stereotype.Service;
24
     @Autowired
31
     @Autowired
25
     private AppointmentMapper appointmentMapper;
32
     private AppointmentMapper appointmentMapper;
26
 
33
 
34
+    @Autowired
35
+    private CustomerMapper customerMapper;
36
+
37
+    private IdGen idGen = IdGen.get();
38
+
27
     @Override
39
     @Override
28
     public ResponseBean getOpenidAppointmentList(String openid, Integer pageNum, Integer pageSize) {
40
     public ResponseBean getOpenidAppointmentList(String openid, Integer pageNum, Integer pageSize) {
29
         ResponseBean responseBean = new ResponseBean();
41
         ResponseBean responseBean = new ResponseBean();
35
         responseBean.addSuccess(openidAppendableList);
47
         responseBean.addSuccess(openidAppendableList);
36
         return responseBean;
48
         return responseBean;
37
     }
49
     }
50
+
51
+    @Override
52
+    public ResponseBean addAppointment(String openid, String parameter) {
53
+        ResponseBean responseBean = new ResponseBean();
54
+        Appointment appointment = JSONObject.parseObject(parameter, Appointment.class);
55
+
56
+        QueryWrapper<Customer> customerQueryWrapper = new QueryWrapper<>();
57
+        customerQueryWrapper.eq("openid", openid);
58
+        Customer customer = customerMapper.selectOne(customerQueryWrapper);
59
+
60
+        appointment.setCustomerId(customer.getCustomerId());
61
+        appointment.setAppointmentId(idGen.nextId() + "");
62
+        appointmentMapper.insert(appointment);
63
+        responseBean.addSuccess("操作成功!");
64
+        return responseBean;
65
+    }
38
 }
66
 }

+ 20
- 0
whole-estate/src/main/java/com/example/wholeestate/service/impl/DictServiceImpl.java Visa fil

1
+package com.example.wholeestate.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.example.wholeestate.dao.DictMapper;
5
+import com.example.wholeestate.model.Dict;
6
+import com.example.wholeestate.service.IDictService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ *  服务实现类
12
+ * </p>
13
+ *
14
+ * @author weiximei
15
+ * @since 2019-03-21
16
+ */
17
+@Service
18
+public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements IDictService {
19
+
20
+}

+ 5
- 0
whole-estate/src/main/resources/mapper/DictMapper.xml Visa fil

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.example.wholeestate.dao.DictMapper">
4
+
5
+</mapper>