Просмотр исходного кода

Merge branch '2.0.0' of http://git.ycjcjy.com/fuxingfan/smartCommunity into 2.0.0

魏熙美 6 лет назад
Родитель
Сommit
9f1c4787f1
30 измененных файлов: 1876 добавлений и 385 удалений
  1. 2
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TpHotelController.java
  2. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TpRentalHouseController.java
  3. 6
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TpShopController.java
  4. 28
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpHotelRoomMapper.java
  5. 15
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpHotel.java
  6. 172
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpHotelRoom.java
  7. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/TpShopServicel.java
  8. 8
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TpHotelServiceimpl.java
  9. 10
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TpRentalHouseServicelImpl.java
  10. 12
    5
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TpShopServicelmpl.java
  11. 197
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TpHotelRoomMapper.xml
  12. 33
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/TpShopController.java
  13. 20
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/TpShopImgController.java
  14. 19
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TpShopImgMapper.java
  15. 19
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpShop.java
  16. 51
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpShopImg.java
  17. 16
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/ITpShopImgService.java
  18. 15
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/ITpShopService.java
  19. 20
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpShopImgServiceImpl.java
  20. 95
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpShopServiceImpl.java
  21. 13
    0
      CODE/smart-community/property-api/src/main/resources/mapper/TpShopImgMapper.xml
  22. 0
    2
      VUECODE/smart-property-manage/index.html
  23. 15
    0
      VUECODE/smart-property-manage/src/api/shopType.js
  24. 14
    0
      VUECODE/smart-property-manage/src/router/index.js
  25. 19
    1
      VUECODE/smart-property-manage/src/store/modules/shopType.js
  26. 315
    0
      VUECODE/smart-property-manage/src/views/shop/shopAdd.vue
  27. 330
    0
      VUECODE/smart-property-manage/src/views/shop/shopEdit.vue
  28. 4
    15
      VUECODE/smart-property-manage/src/views/shop/shopIndex.vue
  29. 213
    177
      文档/MYSQL/smartCommunity.pdb
  30. 213
    177
      文档/MYSQL/smartCommunity.pdm

+ 2
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TpHotelController.java Просмотреть файл

35
     private TpHotelServicel tpHotelServicel;
35
     private TpHotelServicel tpHotelServicel;
36
 
36
 
37
 
37
 
38
-    @ApiOperation(value = "获取所有酒店", notes = "获取所有酒店")
38
+    @ApiOperation(value = "获取本小区酒店", notes = "获取本小区酒店")
39
     @ApiImplicitParams({
39
     @ApiImplicitParams({
40
-            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
40
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
41
     })
41
     })
42
     @RequestMapping(value = "/hotel",method = RequestMethod.GET)
42
     @RequestMapping(value = "/hotel",method = RequestMethod.GET)
43
     public Object getHotel(HttpSession session){
43
     public Object getHotel(HttpSession session){

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TpRentalHouseController.java Просмотреть файл

50
                                     @RequestParam(value = "rentalPriceValue",required = false) Integer rentalPriceValue,
50
                                     @RequestParam(value = "rentalPriceValue",required = false) Integer rentalPriceValue,
51
                                     @RequestParam(value = "priceFluctuateValue",required = false) Integer priceFluctuateValue,
51
                                     @RequestParam(value = "priceFluctuateValue",required = false) Integer priceFluctuateValue,
52
                                  @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
52
                                  @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
53
-                                 @RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize){
53
+                                 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
54
         UserElement userElement = getUserElement(session);
54
         UserElement userElement = getUserElement(session);
55
         ResponseBean responseBean = tpRentalHouseServicel.getRentalHouse(userElement,houseName,rentalTypeValue,houseTypeValue,rentalPriceValue,priceFluctuateValue,pageNum,pageSize);
55
         ResponseBean responseBean = tpRentalHouseServicel.getRentalHouse(userElement,houseName,rentalTypeValue,houseTypeValue,rentalPriceValue,priceFluctuateValue,pageNum,pageSize);
56
         return responseBean;
56
         return responseBean;

+ 6
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TpShopController.java Просмотреть файл

35
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
35
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
36
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "shopName",value = "搜所名称"),
36
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "shopName",value = "搜所名称"),
37
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "tpShopTypeId",value = "商铺类型"),
37
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "tpShopTypeId",value = "商铺类型"),
38
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
39
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
38
     })
40
     })
39
     @RequestMapping(value = "/shop",method = RequestMethod.GET)
41
     @RequestMapping(value = "/shop",method = RequestMethod.GET)
40
     public Object getShop(HttpSession session,
42
     public Object getShop(HttpSession session,
41
                           @RequestParam(value = "shopName",required = false ) String houseName,
43
                           @RequestParam(value = "shopName",required = false ) String houseName,
42
-                          @RequestParam(value = "tpShopTypeId",required = false ) Integer tpShopTypeId){
44
+                          @RequestParam(value = "tpShopTypeId",required = false ) Integer tpShopTypeId,
45
+                          @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
46
+                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
43
         UserElement userElement = getUserElement(session);
47
         UserElement userElement = getUserElement(session);
44
-        ResponseBean responseBean = tpShopServicel.getShop(userElement,houseName,tpShopTypeId);
48
+        ResponseBean responseBean = tpShopServicel.getShop(userElement,houseName,tpShopTypeId,pageNum,pageSize);
45
         return responseBean;
49
         return responseBean;
46
     }
50
     }
47
 
51
 

+ 28
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpHotelRoomMapper.java Просмотреть файл

1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TpHotelRoom;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+@Mapper
10
+public interface TpHotelRoomMapper {
11
+    int deleteByPrimaryKey(Integer id);
12
+
13
+    int insert(TpHotelRoom record);
14
+
15
+    int insertSelective(TpHotelRoom record);
16
+
17
+    TpHotelRoom selectByPrimaryKey(Integer id);
18
+
19
+    int updateByPrimaryKeySelective(TpHotelRoom record);
20
+
21
+    int updateByPrimaryKey(TpHotelRoom record);
22
+
23
+    /**
24
+     * 获取当前所有房间
25
+     * @return
26
+     */
27
+    List<TpHotelRoom> selectHotelRoomList(@Param("communityId") Integer communityId,@Param("hotelId") Integer hotelId);
28
+}

+ 15
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpHotel.java Просмотреть файл

1
 package com.community.huiju.model;
1
 package com.community.huiju.model;
2
 
2
 
3
 import java.util.Date;
3
 import java.util.Date;
4
+import java.util.List;
4
 
5
 
5
 public class TpHotel {
6
 public class TpHotel {
6
     private Integer id;
7
     private Integer id;
53
      */
54
      */
54
     private String hotelIntroduction;
55
     private String hotelIntroduction;
55
 
56
 
57
+    /**
58
+     * 房间
59
+     * @return
60
+     */
61
+    private List<TpHotelRoom> tpHotelRoomsList;
62
+
63
+    public void setTpHotelRoomsList(List<TpHotelRoom> tpHotelRoomsList) {
64
+        this.tpHotelRoomsList = tpHotelRoomsList;
65
+    }
66
+
67
+    public List<TpHotelRoom> getTpHotelRoomsList() {
68
+        return tpHotelRoomsList;
69
+    }
70
+
56
     public Integer getId() {
71
     public Integer getId() {
57
         return id;
72
         return id;
58
     }
73
     }

+ 172
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpHotelRoom.java Просмотреть файл

1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class TpHotelRoom {
6
+
7
+    private Integer id;
8
+
9
+    /**
10
+     * 小区ID
11
+     */
12
+    private Integer communityId;
13
+
14
+    /**
15
+     * 酒店ID
16
+      */
17
+    private Integer hotelId;
18
+
19
+    /**
20
+     * 房间编号
21
+     */
22
+    private String roomNo;
23
+
24
+    /**
25
+     * 房间名称
26
+     */
27
+    private String roomName;
28
+
29
+    /**
30
+     * 排序(权重)
31
+     */
32
+    private Integer sort;
33
+
34
+    /**
35
+     * 房间价格
36
+     */
37
+    private String price;
38
+
39
+    /**
40
+     * 上架状态 1 是已上架 2是已下架
41
+     */
42
+    private String roomStatus;
43
+
44
+    /**
45
+     * 房间备注
46
+     */
47
+    private String remark;
48
+
49
+    /**
50
+     * 创建时间
51
+     */
52
+    private Date createDate;
53
+
54
+    /**
55
+     * 创建人
56
+     */
57
+    private Integer createUser;
58
+
59
+    /**
60
+     * 更新时间
61
+     */
62
+    private Date updateDate;
63
+
64
+    /**
65
+     * 更新人
66
+     */
67
+    private Integer updateUser;
68
+
69
+    public Integer getId() {
70
+        return id;
71
+    }
72
+
73
+    public void setId(Integer id) {
74
+        this.id = id;
75
+    }
76
+
77
+    public Integer getCommunityId() {
78
+        return communityId;
79
+    }
80
+
81
+    public void setCommunityId(Integer communityId) {
82
+        this.communityId = communityId;
83
+    }
84
+
85
+    public Integer getHotelId() {
86
+        return hotelId;
87
+    }
88
+
89
+    public void setHotelId(Integer hotelId) {
90
+        this.hotelId = hotelId;
91
+    }
92
+
93
+    public String getRoomNo() {
94
+        return roomNo;
95
+    }
96
+
97
+    public void setRoomNo(String roomNo) {
98
+        this.roomNo = roomNo == null ? null : roomNo.trim();
99
+    }
100
+
101
+    public String getRoomName() {
102
+        return roomName;
103
+    }
104
+
105
+    public void setRoomName(String roomName) {
106
+        this.roomName = roomName == null ? null : roomName.trim();
107
+    }
108
+
109
+    public Integer getSort() {
110
+        return sort;
111
+    }
112
+
113
+    public void setSort(Integer sort) {
114
+        this.sort = sort;
115
+    }
116
+
117
+    public String getPrice() {
118
+        return price;
119
+    }
120
+
121
+    public void setPrice(String price) {
122
+        this.price = price == null ? null : price.trim();
123
+    }
124
+
125
+    public String getRoomStatus() {
126
+        return roomStatus;
127
+    }
128
+
129
+    public void setRoomStatus(String roomStatus) {
130
+        this.roomStatus = roomStatus == null ? null : roomStatus.trim();
131
+    }
132
+
133
+    public String getRemark() {
134
+        return remark;
135
+    }
136
+
137
+    public void setRemark(String remark) {
138
+        this.remark = remark == null ? null : remark.trim();
139
+    }
140
+
141
+    public Date getCreateDate() {
142
+        return createDate;
143
+    }
144
+
145
+    public void setCreateDate(Date createDate) {
146
+        this.createDate = createDate;
147
+    }
148
+
149
+    public Integer getCreateUser() {
150
+        return createUser;
151
+    }
152
+
153
+    public void setCreateUser(Integer createUser) {
154
+        this.createUser = createUser;
155
+    }
156
+
157
+    public Date getUpdateDate() {
158
+        return updateDate;
159
+    }
160
+
161
+    public void setUpdateDate(Date updateDate) {
162
+        this.updateDate = updateDate;
163
+    }
164
+
165
+    public Integer getUpdateUser() {
166
+        return updateUser;
167
+    }
168
+
169
+    public void setUpdateUser(Integer updateUser) {
170
+        this.updateUser = updateUser;
171
+    }
172
+}

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/TpShopServicel.java Просмотреть файл

17
      * @param userElement
17
      * @param userElement
18
      * @return
18
      * @return
19
      */
19
      */
20
-    ResponseBean getShop(UserElement userElement,String houseName,Integer tpShopTypeId);
20
+    ResponseBean getShop(UserElement userElement,String houseName,Integer tpShopTypeId,Integer pageNum,Integer pageSize);
21
 
21
 
22
     /**
22
     /**
23
      * 获取线下商铺详情
23
      * 获取线下商铺详情

+ 8
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TpHotelServiceimpl.java Просмотреть файл

4
 import com.community.commom.session.UserElement;
4
 import com.community.commom.session.UserElement;
5
 import com.community.huiju.dao.TpHotelImgMapper;
5
 import com.community.huiju.dao.TpHotelImgMapper;
6
 import com.community.huiju.dao.TpHotelMapper;
6
 import com.community.huiju.dao.TpHotelMapper;
7
+import com.community.huiju.dao.TpHotelRoomMapper;
7
 import com.community.huiju.model.TpHotel;
8
 import com.community.huiju.model.TpHotel;
8
 import com.community.huiju.model.TpHotelImg;
9
 import com.community.huiju.model.TpHotelImg;
10
+import com.community.huiju.model.TpHotelRoom;
9
 import com.community.huiju.service.TpHotelServicel;
11
 import com.community.huiju.service.TpHotelServicel;
10
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.beans.factory.annotation.Autowired;
11
 import org.springframework.stereotype.Service;
13
 import org.springframework.stereotype.Service;
32
     @Autowired
34
     @Autowired
33
     private TpHotelImgMapper tpHotelImgMapper;
35
     private TpHotelImgMapper tpHotelImgMapper;
34
 
36
 
37
+    @Autowired
38
+    private TpHotelRoomMapper tpHotelRoomMapper;
39
+
35
     @Override
40
     @Override
36
     public ResponseBean getHotel(UserElement userElement) {
41
     public ResponseBean getHotel(UserElement userElement) {
37
        ResponseBean responseBean= new ResponseBean<>();
42
        ResponseBean responseBean= new ResponseBean<>();
38
         // 每个小区只有一个酒店
43
         // 每个小区只有一个酒店
39
         TpHotel tpHotel= tpHotelMapper.selectCommunityHotel(userElement.getCommunityId());
44
         TpHotel tpHotel= tpHotelMapper.selectCommunityHotel(userElement.getCommunityId());
40
         if (null != tpHotel) {
45
         if (null != tpHotel) {
46
+            // 获取当前酒店所有房间
47
+            List<TpHotelRoom> tpHotelRoom = tpHotelRoomMapper.selectHotelRoomList(userElement.getCommunityId(),tpHotel.getId());
48
+            tpHotel.setTpHotelRoomsList(tpHotelRoom);
41
             // 查询当前酒店所有的banner图
49
             // 查询当前酒店所有的banner图
42
             List<String> img = tpHotelImgMapper.selectHotelImg(tpHotel.getId(), userElement.getCommunityId());
50
             List<String> img = tpHotelImgMapper.selectHotelImg(tpHotel.getId(), userElement.getCommunityId());
43
             Map map = new HashMap<>();
51
             Map map = new HashMap<>();

+ 10
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TpRentalHouseServicelImpl.java Просмотреть файл

5
 import com.community.commom.session.UserElement;
5
 import com.community.commom.session.UserElement;
6
 import com.community.huiju.dao.TpRentalHouseImgMapper;
6
 import com.community.huiju.dao.TpRentalHouseImgMapper;
7
 import com.community.huiju.dao.TpRentalHouseMapper;
7
 import com.community.huiju.dao.TpRentalHouseMapper;
8
+import com.community.huiju.model.TpAnnouncement;
8
 import com.community.huiju.model.TpRentalHouse;
9
 import com.community.huiju.model.TpRentalHouse;
9
 import com.community.huiju.model.TpRentalHouseImg;
10
 import com.community.huiju.model.TpRentalHouseImg;
10
 import com.community.huiju.service.TpRentalHouseServicel;
11
 import com.community.huiju.service.TpRentalHouseServicel;
12
+import com.github.pagehelper.Page;
13
+import com.github.pagehelper.PageHelper;
14
+import com.google.common.collect.Maps;
11
 import org.springframework.beans.factory.annotation.Autowired;
15
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.stereotype.Service;
16
 import org.springframework.stereotype.Service;
13
 
17
 
34
     @Override
38
     @Override
35
     public ResponseBean getRentalHouse(UserElement userElement, String houseName, Integer rentalType, Integer houseType, Integer rentalPrice, Integer priceFluctuate,Integer pageNum,Integer pageSize) {
39
     public ResponseBean getRentalHouse(UserElement userElement, String houseName, Integer rentalType, Integer houseType, Integer rentalPrice, Integer priceFluctuate,Integer pageNum,Integer pageSize) {
36
         ResponseBean response= new ResponseBean<>();
40
         ResponseBean response= new ResponseBean<>();
37
-
41
+        Map<String, Object> parameter = Maps.newHashMap();
42
+        //使用分页插件
43
+        Page<TpRentalHouse> pageTpRentalHouseList = PageHelper.startPage(pageNum, pageSize);
38
         List<TpRentalHouse> tpRentalHouseList= tpRentalHouseMapper.getRentalHouse(houseName,rentalType,houseType,rentalPrice,priceFluctuate);
44
         List<TpRentalHouse> tpRentalHouseList= tpRentalHouseMapper.getRentalHouse(houseName,rentalType,houseType,rentalPrice,priceFluctuate);
39
         for (TpRentalHouse tpRentalHouse:tpRentalHouseList){
45
         for (TpRentalHouse tpRentalHouse:tpRentalHouseList){
40
             // 根据 tpRentalHouse.getId()和img_type为2查询列表图
46
             // 根据 tpRentalHouse.getId()和img_type为2查询列表图
45
                  }
51
                  }
46
              }
52
              }
47
         }
53
         }
48
-        response.addSuccess(tpRentalHouseList);
54
+        parameter.put("total", pageTpRentalHouseList.getTotal());
55
+        parameter.put("list", tpRentalHouseList);
56
+        response.addSuccess(parameter);
49
         return response;
57
         return response;
50
     }
58
     }
51
 
59
 

+ 12
- 5
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TpShopServicelmpl.java Просмотреть файл

5
 import com.community.huiju.dao.TpShopImgMapper;
5
 import com.community.huiju.dao.TpShopImgMapper;
6
 import com.community.huiju.dao.TpShopMapper;
6
 import com.community.huiju.dao.TpShopMapper;
7
 import com.community.huiju.dao.TpShopTypeMapper;
7
 import com.community.huiju.dao.TpShopTypeMapper;
8
+import com.community.huiju.model.TpAnnouncement;
8
 import com.community.huiju.model.TpShop;
9
 import com.community.huiju.model.TpShop;
9
 import com.community.huiju.model.TpShopImg;
10
 import com.community.huiju.model.TpShopImg;
10
 import com.community.huiju.model.TpShopType;
11
 import com.community.huiju.model.TpShopType;
11
 import com.community.huiju.service.TpShopServicel;
12
 import com.community.huiju.service.TpShopServicel;
13
+import com.github.pagehelper.Page;
14
+import com.github.pagehelper.PageHelper;
15
+import com.google.common.collect.Maps;
12
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.beans.factory.annotation.Autowired;
13
 import org.springframework.stereotype.Service;
17
 import org.springframework.stereotype.Service;
14
 
18
 
36
     @Autowired
40
     @Autowired
37
     private TpShopImgMapper tpShopImgMapper;
41
     private TpShopImgMapper tpShopImgMapper;
38
     @Override
42
     @Override
39
-    public ResponseBean getShop(UserElement userElement,String houseName,Integer tpShopTypeId) {
43
+    public ResponseBean getShop(UserElement userElement,String houseName,Integer tpShopTypeId,Integer pageNum,Integer pageSize) {
40
         ResponseBean responseBean= new ResponseBean<>();
44
         ResponseBean responseBean= new ResponseBean<>();
45
+        Map<String, Object> parameter = Maps.newHashMap();
46
+        //使用分页插件
47
+        Page<TpShop> pageShopList = PageHelper.startPage(pageNum, pageSize);
41
         List<TpShop> tpShopList= tpShopMapper.selectcommunityIdShop(userElement.getCommunityId(),houseName,tpShopTypeId);
48
         List<TpShop> tpShopList= tpShopMapper.selectcommunityIdShop(userElement.getCommunityId(),houseName,tpShopTypeId);
42
         if (null != tpShopList) {
49
         if (null != tpShopList) {
43
             for (TpShop tpShop : tpShopList) {
50
             for (TpShop tpShop : tpShopList) {
49
             }
56
             }
50
         }
57
         }
51
         List<TpShopType> tpShopTypeList = tpShopTypeMapper.selectCommunityIdShop(userElement.getCommunityId());
58
         List<TpShopType> tpShopTypeList = tpShopTypeMapper.selectCommunityIdShop(userElement.getCommunityId());
52
-        Map map= new HashMap<>();
53
-        map.put("tpShopTypeList",tpShopTypeList);
54
-        map.put("tpShopList",tpShopList);
55
-        responseBean.addSuccess(map);
59
+        parameter.put("total", pageShopList.getTotal());
60
+        parameter.put("list", tpShopList);
61
+        parameter.put("tpShopTypeList",tpShopTypeList);
62
+        responseBean.addSuccess(parameter);
56
         return responseBean;
63
         return responseBean;
57
     }
64
     }
58
 
65
 

+ 197
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpHotelRoomMapper.xml Просмотреть файл

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.community.huiju.dao.TpHotelRoomMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpHotelRoom" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="hotel_id" property="hotelId" jdbcType="INTEGER" />
8
+    <result column="room_no" property="roomNo" jdbcType="VARCHAR" />
9
+    <result column="room_name" property="roomName" jdbcType="VARCHAR" />
10
+    <result column="sort" property="sort" jdbcType="INTEGER" />
11
+    <result column="price" property="price" jdbcType="VARCHAR" />
12
+    <result column="room_status" property="roomStatus" jdbcType="VARCHAR" />
13
+    <result column="remark" property="remark" jdbcType="VARCHAR" />
14
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
15
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
16
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
17
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
18
+  </resultMap>
19
+  <sql id="Base_Column_List" >
20
+    id, community_id, hotel_id, room_no, room_name, sort, price, room_status, remark, 
21
+    create_date, create_user, update_date, update_user
22
+  </sql>
23
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
24
+    select 
25
+    <include refid="Base_Column_List" />
26
+    from tp_hotel_room
27
+    where id = #{id,jdbcType=INTEGER}
28
+  </select>
29
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
30
+    delete from tp_hotel_room
31
+    where id = #{id,jdbcType=INTEGER}
32
+  </delete>
33
+  <insert id="insert" parameterType="com.community.huiju.model.TpHotelRoom" >
34
+    insert into tp_hotel_room (id, community_id, hotel_id, 
35
+      room_no, room_name, sort, 
36
+      price, room_status, remark, 
37
+      create_date, create_user, update_date, 
38
+      update_user)
39
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{hotelId,jdbcType=INTEGER}, 
40
+      #{roomNo,jdbcType=VARCHAR}, #{roomName,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, 
41
+      #{price,jdbcType=VARCHAR}, #{roomStatus,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, 
42
+      #{createDate,jdbcType=TIMESTAMP}, #{createUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP}, 
43
+      #{updateUser,jdbcType=INTEGER})
44
+  </insert>
45
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpHotelRoom" >
46
+    insert into tp_hotel_room
47
+    <trim prefix="(" suffix=")" suffixOverrides="," >
48
+      <if test="id != null" >
49
+        id,
50
+      </if>
51
+      <if test="communityId != null" >
52
+        community_id,
53
+      </if>
54
+      <if test="hotelId != null" >
55
+        hotel_id,
56
+      </if>
57
+      <if test="roomNo != null" >
58
+        room_no,
59
+      </if>
60
+      <if test="roomName != null" >
61
+        room_name,
62
+      </if>
63
+      <if test="sort != null" >
64
+        sort,
65
+      </if>
66
+      <if test="price != null" >
67
+        price,
68
+      </if>
69
+      <if test="roomStatus != null" >
70
+        room_status,
71
+      </if>
72
+      <if test="remark != null" >
73
+        remark,
74
+      </if>
75
+      <if test="createDate != null" >
76
+        create_date,
77
+      </if>
78
+      <if test="createUser != null" >
79
+        create_user,
80
+      </if>
81
+      <if test="updateDate != null" >
82
+        update_date,
83
+      </if>
84
+      <if test="updateUser != null" >
85
+        update_user,
86
+      </if>
87
+    </trim>
88
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
89
+      <if test="id != null" >
90
+        #{id,jdbcType=INTEGER},
91
+      </if>
92
+      <if test="communityId != null" >
93
+        #{communityId,jdbcType=INTEGER},
94
+      </if>
95
+      <if test="hotelId != null" >
96
+        #{hotelId,jdbcType=INTEGER},
97
+      </if>
98
+      <if test="roomNo != null" >
99
+        #{roomNo,jdbcType=VARCHAR},
100
+      </if>
101
+      <if test="roomName != null" >
102
+        #{roomName,jdbcType=VARCHAR},
103
+      </if>
104
+      <if test="sort != null" >
105
+        #{sort,jdbcType=INTEGER},
106
+      </if>
107
+      <if test="price != null" >
108
+        #{price,jdbcType=VARCHAR},
109
+      </if>
110
+      <if test="roomStatus != null" >
111
+        #{roomStatus,jdbcType=VARCHAR},
112
+      </if>
113
+      <if test="remark != null" >
114
+        #{remark,jdbcType=VARCHAR},
115
+      </if>
116
+      <if test="createDate != null" >
117
+        #{createDate,jdbcType=TIMESTAMP},
118
+      </if>
119
+      <if test="createUser != null" >
120
+        #{createUser,jdbcType=INTEGER},
121
+      </if>
122
+      <if test="updateDate != null" >
123
+        #{updateDate,jdbcType=TIMESTAMP},
124
+      </if>
125
+      <if test="updateUser != null" >
126
+        #{updateUser,jdbcType=INTEGER},
127
+      </if>
128
+    </trim>
129
+  </insert>
130
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpHotelRoom" >
131
+    update tp_hotel_room
132
+    <set >
133
+      <if test="communityId != null" >
134
+        community_id = #{communityId,jdbcType=INTEGER},
135
+      </if>
136
+      <if test="hotelId != null" >
137
+        hotel_id = #{hotelId,jdbcType=INTEGER},
138
+      </if>
139
+      <if test="roomNo != null" >
140
+        room_no = #{roomNo,jdbcType=VARCHAR},
141
+      </if>
142
+      <if test="roomName != null" >
143
+        room_name = #{roomName,jdbcType=VARCHAR},
144
+      </if>
145
+      <if test="sort != null" >
146
+        sort = #{sort,jdbcType=INTEGER},
147
+      </if>
148
+      <if test="price != null" >
149
+        price = #{price,jdbcType=VARCHAR},
150
+      </if>
151
+      <if test="roomStatus != null" >
152
+        room_status = #{roomStatus,jdbcType=VARCHAR},
153
+      </if>
154
+      <if test="remark != null" >
155
+        remark = #{remark,jdbcType=VARCHAR},
156
+      </if>
157
+      <if test="createDate != null" >
158
+        create_date = #{createDate,jdbcType=TIMESTAMP},
159
+      </if>
160
+      <if test="createUser != null" >
161
+        create_user = #{createUser,jdbcType=INTEGER},
162
+      </if>
163
+      <if test="updateDate != null" >
164
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
165
+      </if>
166
+      <if test="updateUser != null" >
167
+        update_user = #{updateUser,jdbcType=INTEGER},
168
+      </if>
169
+    </set>
170
+    where id = #{id,jdbcType=INTEGER}
171
+  </update>
172
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpHotelRoom" >
173
+    update tp_hotel_room
174
+    set community_id = #{communityId,jdbcType=INTEGER},
175
+      hotel_id = #{hotelId,jdbcType=INTEGER},
176
+      room_no = #{roomNo,jdbcType=VARCHAR},
177
+      room_name = #{roomName,jdbcType=VARCHAR},
178
+      sort = #{sort,jdbcType=INTEGER},
179
+      price = #{price,jdbcType=VARCHAR},
180
+      room_status = #{roomStatus,jdbcType=VARCHAR},
181
+      remark = #{remark,jdbcType=VARCHAR},
182
+      create_date = #{createDate,jdbcType=TIMESTAMP},
183
+      create_user = #{createUser,jdbcType=INTEGER},
184
+      update_date = #{updateDate,jdbcType=TIMESTAMP},
185
+      update_user = #{updateUser,jdbcType=INTEGER}
186
+    where id = #{id,jdbcType=INTEGER}
187
+  </update>
188
+
189
+  <select id="selectHotelRoomList" resultType="com.community.huiju.model.TpHotelRoom">
190
+    select
191
+    <include refid="Base_Column_List" />
192
+    from tp_hotel_room
193
+    where  community_id = #{communityId,jdbcType=INTEGER}
194
+    and hotel_id = #{hotelId,jdbcType=INTEGER}
195
+    and room_status = 1
196
+  </select>
197
+</mapper>

+ 33
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/TpShopController.java Просмотреть файл

4
 import com.community.commom.mode.ResponseBean;
4
 import com.community.commom.mode.ResponseBean;
5
 import com.community.commom.session.UserElement;
5
 import com.community.commom.session.UserElement;
6
 import com.community.huiju.common.base.BaseController;
6
 import com.community.huiju.common.base.BaseController;
7
+import com.community.huiju.model.TpShop;
8
+import com.community.huiju.model.TpShopType;
7
 import com.community.huiju.service.ITpShopService;
9
 import com.community.huiju.service.ITpShopService;
10
+import com.netflix.ribbon.proxy.annotation.Http;
8
 import io.swagger.annotations.ApiImplicitParam;
11
 import io.swagger.annotations.ApiImplicitParam;
9
 import io.swagger.annotations.ApiImplicitParams;
12
 import io.swagger.annotations.ApiImplicitParams;
10
 import io.swagger.annotations.ApiOperation;
13
 import io.swagger.annotations.ApiOperation;
11
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.web.bind.annotation.PathVariable;
16
+import org.springframework.web.bind.annotation.RequestBody;
12
 import org.springframework.web.bind.annotation.RequestMapping;
17
 import org.springframework.web.bind.annotation.RequestMapping;
13
 import org.springframework.web.bind.annotation.RequestMethod;
18
 import org.springframework.web.bind.annotation.RequestMethod;
14
 import org.springframework.web.bind.annotation.RequestParam;
19
 import org.springframework.web.bind.annotation.RequestParam;
15
 import org.springframework.web.bind.annotation.RestController;
20
 import org.springframework.web.bind.annotation.RestController;
16
 
21
 
17
 import javax.servlet.http.HttpSession;
22
 import javax.servlet.http.HttpSession;
23
+import java.time.LocalDateTime;
18
 
24
 
19
 /**
25
 /**
20
  * <p>
26
  * <p>
54
 		responseBean = shopService.getShopList(id,shopName,shopTypeId,shopStatus,userElement,pageNum,pageSize);
60
 		responseBean = shopService.getShopList(id,shopName,shopTypeId,shopStatus,userElement,pageNum,pageSize);
55
 		return responseBean;
61
 		return responseBean;
56
 	}
62
 	}
63
+	
64
+	@ApiOperation(value = "添加商铺", notes = "添加商铺")
65
+	@ApiImplicitParams({
66
+			@ApiImplicitParam(paramType = "body", dataType = "TpShop", name = "shop", value = "商铺"),
67
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
68
+	})
69
+	@RequestMapping(value = "/shop/add",method = RequestMethod.POST)
70
+	public ResponseBean saveShop(@RequestBody TpShop shop, HttpSession session){
71
+		ResponseBean responseBean = new ResponseBean();
72
+		UserElement userElement = getUserElement(session);
73
+		responseBean = shopService.saveShop(shop,userElement);
74
+		return responseBean;
75
+	}
76
+	
77
+	@ApiOperation(value = "获取商铺信息", notes = "获取商铺信息")
78
+	@ApiImplicitParams({
79
+			@ApiImplicitParam(paramType = "path", dataType = "Integer", name = "id", value = "商铺Id"),
80
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
81
+	})
82
+	@RequestMapping(value = "/shop/get/{id}",method = RequestMethod.GET)
83
+	public ResponseBean getShop(@PathVariable Integer id, HttpSession session){
84
+		ResponseBean responseBean = new ResponseBean();
85
+		UserElement userElement = getUserElement(session);
86
+		TpShop tpShop = shopService.getShopById(id);
87
+		responseBean.addSuccess(tpShop);
88
+		return responseBean;
89
+	}
57
 }
90
 }

+ 20
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/TpShopImgController.java Просмотреть файл

1
+package com.community.huiju.controller;
2
+
3
+
4
+import com.community.huiju.common.base.BaseController;
5
+import org.springframework.web.bind.annotation.RequestMapping;
6
+import org.springframework.web.bind.annotation.RestController;
7
+
8
+/**
9
+ * <p>
10
+ * 商铺图片 前端控制器
11
+ * </p>
12
+ *
13
+ * @author jobob
14
+ * @since 2019-05-10
15
+ */
16
+@RestController
17
+@RequestMapping("/")
18
+public class TpShopImgController extends BaseController {
19
+
20
+}

+ 19
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TpShopImgMapper.java Просмотреть файл

1
+package com.community.huiju.dao;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.community.huiju.model.TpShopImg;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * <p>
10
+ * 商铺图片 Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author jobob
14
+ * @since 2019-05-10
15
+ */
16
+public interface TpShopImgMapper extends BaseMapper<TpShopImg> {
17
+	
18
+	int batchSave(List<TpShopImg> carouselList);
19
+}

+ 19
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpShop.java Просмотреть файл

9
 
9
 
10
 import java.io.Serializable;
10
 import java.io.Serializable;
11
 import java.time.LocalDateTime;
11
 import java.time.LocalDateTime;
12
+import java.util.List;
12
 
13
 
13
 /**
14
 /**
14
  * <p>
15
  * <p>
125
      */
126
      */
126
     @TableField(exist = false)
127
     @TableField(exist = false)
127
     private String userName;
128
     private String userName;
129
+    
130
+    /**
131
+     * 首页图片地址
132
+     */
133
+    @TableField(exist = false)
134
+    private String appIndexImg;
135
+    
136
+    /**
137
+     * app列表展示图
138
+     */
139
+    @TableField(exist = false)
140
+    private String appListImg;
141
+    
142
+    /**
143
+     * app商铺轮播图
144
+     */
145
+    @TableField(exist = false)
146
+    private List<String> appCarouselImg;
128
 }
147
 }

+ 51
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpShopImg.java Просмотреть файл

1
+package com.community.huiju.model;
2
+
3
+import lombok.Data;
4
+import lombok.EqualsAndHashCode;
5
+import lombok.experimental.Accessors;
6
+
7
+import java.io.Serializable;
8
+import java.time.LocalDateTime;
9
+
10
+/**
11
+ * <p>
12
+ * 商铺图片
13
+ * </p>
14
+ *
15
+ * @author jobob
16
+ * @since 2019-05-10
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = false)
20
+@Accessors(chain = true)
21
+public class TpShopImg implements Serializable {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 小区ID
27
+     */
28
+    private Integer communityId;
29
+
30
+    /**
31
+     * 商铺ID
32
+     */
33
+    private Integer shopId;
34
+
35
+    /**
36
+     * 商铺图片地址
37
+     */
38
+    private String imgUrl;
39
+
40
+    /**
41
+     * 商铺图片类型 1是app首页图片每个商铺唯一,2是app列表图片,3是app商铺轮播图
42
+     */
43
+    private String imgType;
44
+
45
+    /**
46
+     * 创建时间
47
+     */
48
+    private LocalDateTime createDate;
49
+
50
+
51
+}

+ 16
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/ITpShopImgService.java Просмотреть файл

1
+package com.community.huiju.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.community.huiju.model.TpShopImg;
5
+
6
+/**
7
+ * <p>
8
+ * 商铺图片 服务类
9
+ * </p>
10
+ *
11
+ * @author jobob
12
+ * @since 2019-05-10
13
+ */
14
+public interface ITpShopImgService extends IService<TpShopImg> {
15
+
16
+}

+ 15
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/ITpShopService.java Просмотреть файл

27
 	 * @return
27
 	 * @return
28
 	 */
28
 	 */
29
 	ResponseBean getShopList(Integer id, String shopName, Integer shopTypeId, String shopStatus, UserElement userElement, Integer pageNum, Integer pageSize);
29
 	ResponseBean getShopList(Integer id, String shopName, Integer shopTypeId, String shopStatus, UserElement userElement, Integer pageNum, Integer pageSize);
30
+	
31
+	/**
32
+	 * 保存商铺
33
+	 * @param shop
34
+	 * @param userElement
35
+	 * @return
36
+	 */
37
+	ResponseBean saveShop(TpShop shop, UserElement userElement);
38
+	
39
+	/**
40
+	 * 获取商铺信息
41
+	 * @param id
42
+	 * @return
43
+	 */
44
+	TpShop getShopById(Integer id);
30
 }
45
 }

+ 20
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpShopImgServiceImpl.java Просмотреть файл

1
+package com.community.huiju.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.community.huiju.dao.TpShopImgMapper;
5
+import com.community.huiju.model.TpShopImg;
6
+import com.community.huiju.service.ITpShopImgService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 商铺图片 服务实现类
12
+ * </p>
13
+ *
14
+ * @author jobob
15
+ * @since 2019-05-10
16
+ */
17
+@Service
18
+public class TpShopImgServiceImpl extends ServiceImpl<TpShopImgMapper, TpShopImg> implements ITpShopImgService {
19
+
20
+}

+ 95
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpShopServiceImpl.java Просмотреть файл

1
 package com.community.huiju.service.impl;
1
 package com.community.huiju.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
 import com.community.commom.mode.ResponseBean;
6
 import com.community.commom.mode.ResponseBean;
6
 import com.community.commom.session.UserElement;
7
 import com.community.commom.session.UserElement;
8
+import com.community.huiju.dao.TpShopImgMapper;
7
 import com.community.huiju.dao.TpShopMapper;
9
 import com.community.huiju.dao.TpShopMapper;
8
 import com.community.huiju.model.TpShop;
10
 import com.community.huiju.model.TpShop;
11
+import com.community.huiju.model.TpShopImg;
9
 import com.community.huiju.service.ITpShopService;
12
 import com.community.huiju.service.ITpShopService;
10
 import org.springframework.beans.factory.annotation.Autowired;
13
 import org.springframework.beans.factory.annotation.Autowired;
11
 import org.springframework.stereotype.Service;
14
 import org.springframework.stereotype.Service;
12
 
15
 
16
+import java.time.LocalDateTime;
17
+import java.util.ArrayList;
13
 import java.util.HashMap;
18
 import java.util.HashMap;
14
 import java.util.List;
19
 import java.util.List;
15
 import java.util.Map;
20
 import java.util.Map;
28
 	@Autowired
33
 	@Autowired
29
 	private TpShopMapper shopMapper;
34
 	private TpShopMapper shopMapper;
30
 	
35
 	
36
+	@Autowired
37
+	private TpShopImgMapper shopImgMapper;
38
+	
31
 	/**
39
 	/**
32
 	 * 根据条件查询商铺列表
40
 	 * 根据条件查询商铺列表
33
 	 *
41
 	 *
57
 		responseBean.addSuccess(map);
65
 		responseBean.addSuccess(map);
58
 		return responseBean;
66
 		return responseBean;
59
 	}
67
 	}
68
+	
69
+	/**
70
+	 * 保存商铺
71
+	 *
72
+	 * @param shop
73
+	 * @param userElement
74
+	 * @return
75
+	 */
76
+	@Override
77
+	public ResponseBean saveShop(TpShop shop, UserElement userElement) {
78
+		ResponseBean responseBean = new ResponseBean();
79
+		//添加商铺信息
80
+		Integer communityId = userElement.getCommunityId();
81
+		LocalDateTime localDateTime = LocalDateTime.now();
82
+		shop.setCommunityId(communityId);
83
+		shop.setCreateUser(userElement.getId());
84
+		shop.setUpdateDate(localDateTime);
85
+		shopMapper.insert(shop);
86
+		//添加商铺app首页图片信息
87
+		TpShopImg appIndexShopImg = new TpShopImg();
88
+		appIndexShopImg.setCommunityId(communityId);
89
+		appIndexShopImg.setCreateDate(localDateTime);
90
+		appIndexShopImg.setImgType("1");
91
+		appIndexShopImg.setShopId(shop.getId());
92
+		appIndexShopImg.setImgUrl(shop.getAppIndexImg());
93
+		shopImgMapper.insert(appIndexShopImg);
94
+		//添加商铺app列表图片信息
95
+		TpShopImg appListShopImg = new TpShopImg();
96
+		appListShopImg.setCommunityId(communityId);
97
+		appListShopImg.setCreateDate(localDateTime);
98
+		appListShopImg.setImgType("2");
99
+		appListShopImg.setShopId(shop.getId());
100
+		appListShopImg.setImgUrl(shop.getAppListImg());
101
+		shopImgMapper.insert(appListShopImg);
102
+		//批量添加app轮播图片
103
+		List<String> list = shop.getAppCarouselImg();
104
+		List<TpShopImg> carouselList = new ArrayList<>();
105
+		list.stream().forEach(e -> {
106
+			TpShopImg appCarouselImg = new TpShopImg();
107
+			appCarouselImg.setCommunityId(communityId);
108
+			appCarouselImg.setCreateDate(localDateTime);
109
+			appCarouselImg.setImgType("3");
110
+			appCarouselImg.setShopId(shop.getId());
111
+			appCarouselImg.setImgUrl(e);
112
+			carouselList.add(appCarouselImg);
113
+		});
114
+		shopImgMapper.batchSave(carouselList);
115
+		responseBean.addSuccess("添加成功");
116
+		return responseBean;
117
+	}
118
+	
119
+	/**
120
+	 * 获取商铺信息
121
+	 *
122
+	 * @param id
123
+	 * @return
124
+	 */
125
+	@Override
126
+	public TpShop getShopById(Integer id) {
127
+		TpShop tpShop = shopMapper.selectById(id);
128
+		//获取商铺app首页图片信息
129
+		QueryWrapper<TpShopImg> tpShopImgQueryWrapper = new QueryWrapper<>();
130
+		tpShopImgQueryWrapper.eq("community_id",tpShop.getCommunityId());
131
+		tpShopImgQueryWrapper.eq("shop_id",tpShop.getId());
132
+		tpShopImgQueryWrapper.eq("img_type","1");
133
+		TpShopImg tpShopImg = shopImgMapper.selectOne(tpShopImgQueryWrapper);
134
+		tpShop.setAppIndexImg(tpShopImg.getImgUrl());
135
+		//获取商铺APP列表图片信息
136
+		QueryWrapper<TpShopImg> tpShopImgListWrapper = new QueryWrapper<>();
137
+		tpShopImgListWrapper.eq("community_id",tpShop.getCommunityId());
138
+		tpShopImgListWrapper.eq("shop_id",tpShop.getId());
139
+		tpShopImgListWrapper.eq("img_type","2");
140
+		TpShopImg listShopImg = shopImgMapper.selectOne(tpShopImgListWrapper);
141
+		tpShop.setAppListImg(listShopImg.getImgUrl());
142
+		//获取商铺轮播图列表
143
+		QueryWrapper<TpShopImg> tpShopImgCarouselWrapper = new QueryWrapper<>();
144
+		tpShopImgCarouselWrapper.eq("community_id",tpShop.getCommunityId());
145
+		tpShopImgCarouselWrapper.eq("shop_id",tpShop.getId());
146
+		tpShopImgCarouselWrapper.eq("img_type","3");
147
+		List<TpShopImg> carouselList = shopImgMapper.selectList(tpShopImgCarouselWrapper);
148
+		List<String> carouselUrlList = new ArrayList<>();
149
+		carouselList.stream().forEach(e -> {
150
+			carouselUrlList.add(e.getImgUrl());
151
+		});
152
+		tpShop.setAppCarouselImg(carouselUrlList);
153
+		return tpShop;
154
+	}
60
 }
155
 }

+ 13
- 0
CODE/smart-community/property-api/src/main/resources/mapper/TpShopImgMapper.xml Просмотреть файл

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.community.huiju.dao.TpShopImgMapper">
4
+
5
+    <insert id="batchSave" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.ArrayList">
6
+        insert into tp_shop_img(community_id,shop_id,img_url,img_type,create_date)
7
+        VALUES
8
+        <foreach collection="list" item="item" index="index" separator=",">
9
+            (#{item.communityId},#{item.shopId},#{item.imgUrl},#{item.imgType},#{item.createDate})
10
+        </foreach>
11
+    </insert>
12
+
13
+</mapper>

+ 0
- 2
VUECODE/smart-property-manage/index.html Просмотреть файл

4
     <meta charset="utf-8">
4
     <meta charset="utf-8">
5
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
5
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
6
     <title>智慧社区物业平台</title>
6
     <title>智慧社区物业平台</title>
7
-    <script src="//webapi.amap.com/maps?v=1.4.10&key=81f5560856a88eb5b3da440f18a97845&plugin=AMap.DistrictLayer"></script>
8
-    <script src="//webapi.amap.com/ui/1.0/main.js"></script>
9
   </head>
7
   </head>
10
   <body>
8
   <body>
11
     <div id="app"></div>
9
     <div id="app"></div>

+ 15
- 0
VUECODE/smart-property-manage/src/api/shopType.js Просмотреть файл

26
   })
26
   })
27
 }
27
 }
28
 
28
 
29
+export function addShop(listQuery) {
30
+  return request({
31
+    url: '/shop/add',
32
+    method: 'post',
33
+    data: listQuery
34
+  })
35
+}
36
+
29
 export function getShopType(id) {
37
 export function getShopType(id) {
30
   return request({
38
   return request({
31
     url: '/shop/get/type/' + id,
39
     url: '/shop/get/type/' + id,
33
   })
41
   })
34
 }
42
 }
35
 
43
 
44
+export function getShop(id) {
45
+  return request({
46
+    url: '/shop/get/' + id,
47
+    method: 'get'
48
+  })
49
+}
50
+
36
 export function updateShopType(listQuery) {
51
 export function updateShopType(listQuery) {
37
   return request({
52
   return request({
38
     url: '/shop/update/type',
53
     url: '/shop/update/type',

+ 14
- 0
VUECODE/smart-property-manage/src/router/index.js Просмотреть файл

400
         component: () => import('@/views/shop/shopIndex'),
400
         component: () => import('@/views/shop/shopIndex'),
401
         name: 'shop-index',
401
         name: 'shop-index',
402
         meta: { title: '商铺列表', icon: 'table' }
402
         meta: { title: '商铺列表', icon: 'table' }
403
+      },
404
+      {
405
+        path: '/shop/add',
406
+        component: () => import('@/views/shop/shopAdd'),
407
+        name: 'shop-add',
408
+        hidden: true,
409
+        meta: { title: '添加商铺信息', icon: 'table' }
410
+      },
411
+      {
412
+        path: '/shop/edit',
413
+        component: () => import('@/views/shop/shopEdit'),
414
+        name: 'shop-edit',
415
+        hidden: true,
416
+        meta: { title: '修改商铺信息', icon: 'table' }
403
       }
417
       }
404
     ]
418
     ]
405
   },
419
   },

+ 19
- 1
VUECODE/smart-property-manage/src/store/modules/shopType.js Просмотреть файл

1
-import { fetchShopTypeList, changeShopSetting, addShopType, getShopType, updateShopType, deleteShopType, fetchShopList, fetchShopTypeSelect } from '@/api/shopType'
1
+import { fetchShopTypeList, changeShopSetting, addShopType, getShopType, updateShopType, deleteShopType, fetchShopList, fetchShopTypeSelect, addShop, getShop } from '@/api/shopType'
2
 
2
 
3
 const transaction = {
3
 const transaction = {
4
   namespaced: true,
4
   namespaced: true,
39
         })
39
         })
40
       })
40
       })
41
     },
41
     },
42
+    AddShop({ commit }, listQuery) {
43
+      return new Promise((resolve, reject) => {
44
+        addShop(listQuery).then(response => {
45
+          resolve(response)
46
+        }).catch(error => {
47
+          reject(error)
48
+        })
49
+      })
50
+    },
42
     GetShopType({ commit }, id) {
51
     GetShopType({ commit }, id) {
43
       return new Promise((resolve, reject) => {
52
       return new Promise((resolve, reject) => {
44
         getShopType(id).then(response => {
53
         getShopType(id).then(response => {
48
         })
57
         })
49
       })
58
       })
50
     },
59
     },
60
+    GetShop({ commit }, id) {
61
+      return new Promise((resolve, reject) => {
62
+        getShop(id).then(response => {
63
+          resolve(response)
64
+        }).catch(error => {
65
+          reject(error)
66
+        })
67
+      })
68
+    },
51
     UpdateShopType({ commit }, listQuery) {
69
     UpdateShopType({ commit }, listQuery) {
52
       return new Promise((resolve, reject) => {
70
       return new Promise((resolve, reject) => {
53
         updateShopType(listQuery).then(response => {
71
         updateShopType(listQuery).then(response => {

+ 315
- 0
VUECODE/smart-property-manage/src/views/shop/shopAdd.vue Просмотреть файл

1
+<template>
2
+  <div class="root">
3
+    <el-form ref="ruleForm" :model="listData" :rules="rules" label-width="150px" class="add-ruleForm">
4
+      <el-form-item label="商铺名称" prop="shopName">
5
+        <el-input v-model="listData.shopName"/>
6
+      </el-form-item>
7
+      <el-form-item label="商铺说明" prop="remark">
8
+        <el-input v-model="listData.remark"/>
9
+      </el-form-item>
10
+      <el-form-item label="app首页展示图" prop="appIndexImg">
11
+        <el-upload
12
+          class="avatar-uploader"
13
+          name="uploadFiles"
14
+          :action="uploadImgUrl"
15
+          :show-file-list="false"
16
+          :on-success="handleAppIndexSuccess"
17
+          :before-upload="beforeAvatarUpload">
18
+          <img v-if="listData.appIndexImg" :src="listData.appIndexImg" class="avatar">
19
+          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
20
+        </el-upload>
21
+      </el-form-item>
22
+      <el-form-item label="app列表展示图" prop="appListImg">
23
+        <el-upload
24
+          class="avatar-uploader"
25
+          name="uploadFiles"
26
+          :action="uploadImgUrl"
27
+          :show-file-list="false"
28
+          :on-success="handleAppListSuccess"
29
+          :before-upload="beforeAvatarUpload">
30
+          <img v-if="listData.appListImg" :src="listData.appListImg" class="avatar">
31
+          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
32
+        </el-upload>
33
+      </el-form-item>
34
+      <el-form-item label="app商铺轮播图" prop="appCarouselImg">
35
+        <el-upload
36
+          name="uploadFiles"
37
+          :limit="6"
38
+          :action="uploadImgUrl"
39
+          list-type="picture-card"
40
+          :on-preview="handlePictureCardPreview"
41
+          :on-remove="handleRemove"
42
+          :on-success="handleSuccessCarouselImg">
43
+          <i class="el-icon-plus"></i>
44
+        </el-upload>
45
+        <el-dialog :visible.sync="dialogVisible">
46
+          <img width="100%" :src="dialogImageUrl" alt="">
47
+        </el-dialog>
48
+      </el-form-item>
49
+      <el-form-item label="权重" prop="sort">
50
+        <el-input v-model="listData.sort"/>
51
+      </el-form-item>
52
+      <el-form-item label="商铺类型" prop="shopTypeId">
53
+        <el-select v-model="listData.shopTypeId" placeholder="商铺类型" clearable class="filter-item">
54
+          <el-option v-for="item in shopTypeList" :key="item.id" :value="item.id" :label="item.typeName"/>
55
+        </el-select>
56
+      </el-form-item>
57
+      <el-form-item label="上架状态" prop="shopStatus">
58
+        <el-select v-model="listData.shopStatus" placeholder="请选择">
59
+          <el-option label="已上架" value="1"/>
60
+          <el-option label="已下架" value="2"/>
61
+        </el-select>
62
+      </el-form-item>
63
+      <el-form-item label="联系电话" prop="shopTel">
64
+        <el-input v-model="listData.shopTel"/>
65
+      </el-form-item>
66
+      <el-form-item label="商铺地址" prop="shopAddress">
67
+        <el-input v-model="listData.shopAddress"/>
68
+      </el-form-item>
69
+      <el-form-item label="人均消费" prop="averagePrice">
70
+        <el-input v-model="listData.averagePrice"/>
71
+      </el-form-item>
72
+      <el-form-item label="高德坐标">
73
+        <el-input placeholder="经度" v-model="listData.shopLongitude" style="width: 150px;" />
74
+        <el-input placeholder="纬度" v-model="listData.shopLatitude" style="width: 150px;" />
75
+      </el-form-item>
76
+      <el-form-item label="">
77
+         <!-- 地图 -->
78
+        <div style="width:100%;height:300px;" class="amap-page-container">
79
+          <el-amap-search-box :search-option="searchOption" :on-search-result="onSearchResult" class="search-box"/>
80
+          <el-amap ref="map" :events="events" :center="mapCenter" :zoom="12" class="amap-demo" vid="amapDemo">
81
+            <el-amap-marker v-for="(item,index) in markers" :key="index" :position="item" />
82
+          </el-amap>
83
+        </div>
84
+      </el-form-item>
85
+      <el-form-item label="商铺介绍">
86
+          <!-- <el-input v-model="addForm.bannerContent" placeholder="内容详情"/> -->
87
+          <div id="father">
88
+            <wangeditor @wangeditorEvent="wangeditorValue"/>
89
+          </div>
90
+        </el-form-item>
91
+      <el-form-item>
92
+        <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
93
+        <el-button @click="resetForm('ruleForm')">重置</el-button>
94
+      </el-form-item>
95
+    </el-form>
96
+  </div>
97
+</template>
98
+
99
+<script>
100
+import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
101
+import Wangeditor from '@/components/Wangeditor'
102
+
103
+export default {
104
+  components: { Pagination, Wangeditor },
105
+  data() {
106
+    return {
107
+      events: {
108
+        click: e => {
109
+          // _self.postData.Coordinate = e.lnglat.lat + ',' + e.lnglat.lng
110
+          this.listData.shopLongitude = e.lnglat.lng
111
+          this.listData.shopLatitude = e.lnglat.lat
112
+        }
113
+      },
114
+      listData: {
115
+        shopName: '',
116
+        remark: '',
117
+        appIndexImg: '',
118
+        appListImg: '',
119
+        appCarouselImg: [],
120
+        sort: '',
121
+        shopTypeId: '',
122
+        shopStatus: '',
123
+        shopTel: '',
124
+        shopAddress: '',
125
+        averagePrice: '',
126
+        shopLongitude: '',
127
+        shopLatitude: '',
128
+        shopIntroduction: ''
129
+      },
130
+      dialogImageUrl: '',
131
+      dialogVisible: false,
132
+      uploadImgUrl: process.env.BASE_API + '/uploadimage',
133
+      markers: [],
134
+      shopTypeList: [],
135
+      searchOption: {
136
+        city: '南京',
137
+        citylimit: false
138
+      },
139
+      mapCenter: [118.789509, 32.019989],
140
+      tableKey: 0,
141
+      rules: {
142
+        typeName: [
143
+          { required: true, message: '请输入商铺名称', trigger: 'blur' }
144
+        ],
145
+        remark: [
146
+          { required: true, message: '请输入商铺说明', trigger: 'blur' }
147
+        ],
148
+        shopTel: [
149
+          { required: true, message: '请输入联系电话', trigger: 'blur' }
150
+        ],
151
+        shopAddress: [
152
+          { required: true, message: '请输入商铺地址', trigger: 'blur' }
153
+        ],
154
+        appIndexImg: [
155
+          { required: true, message: 'app首页展示图', trigger: 'blur' }
156
+        ],
157
+        appListImg: [
158
+          { required: true, message: 'app列表展示图', trigger: 'blur' }
159
+        ],
160
+        appCarouselImg: [
161
+          { required: true, message: 'app商铺轮播图', trigger: 'blur' }
162
+        ],
163
+      }
164
+    }
165
+  },
166
+  mounted() {
167
+    this.getShopTypeList()
168
+  },
169
+  methods: {
170
+     addMarker() {
171
+      const lng = 121.5 + Math.round(Math.random() * 1000) / 10000
172
+      const lat = 31.197646 + Math.round(Math.random() * 500) / 10000
173
+      this.markers.push([lng, lat])
174
+    },
175
+    beforeAvatarUpload(file) {
176
+    },
177
+    handleAppIndexSuccess(res, file) {
178
+      this.listData.appIndexImg = res.data[0]
179
+    },
180
+    handleAppListSuccess(res, file) {
181
+      this.listData.appListImg = res.data[0]
182
+    },
183
+    handleRemove(file, fileList) {
184
+      this.listData.appCarouselImg = []
185
+      for (let i = 0; i < fileList.length; i++) {
186
+        this.listData.appCarouselImg.push(fileList[i].response.data[0])
187
+      }
188
+    },
189
+    handleSuccessCarouselImg(response, file, fileList) { // 活动配图上传成功时回调
190
+      const resImg = response.data[0]
191
+      this.listData.appCarouselImg.push(resImg)
192
+    },
193
+    handlePictureCardPreview(file) {
194
+      this.dialogImageUrl = file.url;
195
+      this.dialogVisible = true;
196
+    },
197
+    getShopTypeList() {
198
+      this.$store.dispatch('shopType/FetchShopTypeSelect', this.listData).then((res) => {
199
+        this.shopTypeList = res.data
200
+      }).catch(() => {
201
+        console.log('error ListAnnouncement')
202
+      })
203
+    },
204
+    onSearchResult(pois) {
205
+      // 搜索地图
206
+      let latSum = 0
207
+      let lngSum = 0
208
+      if (pois.length > 0) {
209
+        pois.forEach(poi => {
210
+          const { lng, lat } = poi
211
+          lngSum += lng
212
+          latSum += lat
213
+          this.markers.push([poi.lng, poi.lat])
214
+        })
215
+        const center = {
216
+          lng: lngSum / pois.length,
217
+          lat: latSum / pois.length
218
+        }
219
+        this.mapCenter = [center.lng, center.lat]
220
+      }
221
+    },
222
+    wangeditorValue(value) {
223
+      this.listData.shopIntroduction = value // 在这里接受子组件传过来的参数,赋值给data里的参数
224
+    },
225
+    submitForm(formName) { // 提交
226
+      this.$refs[formName].validate((valid) => {
227
+        if (valid) {
228
+          this.addShop()
229
+        } else {
230
+          console.log('error submit!!')
231
+          return false
232
+        }
233
+      })
234
+    },
235
+    resetForm(formName) { // 重置
236
+      // 重置为未注册
237
+      this.isRegistered = true
238
+      // 重置为非户主
239
+      this.roleDisabled = false
240
+
241
+      console.log(this.isRegistered)
242
+      this.$refs[formName].resetFields()
243
+    },
244
+    addShop() {
245
+      // 加载框
246
+      const loading = this.$loading({
247
+        lock: true,
248
+        text: 'Loading',
249
+        spinner: 'el-icon-loading',
250
+        background: 'rgba(0, 0, 0, 0.7)'
251
+      })
252
+      this.$store.dispatch('shopType/AddShop', this.listData).then((res) => {
253
+        if (res.code === '0') {
254
+          this.$message({
255
+            message: res.message,
256
+            type: 'success'
257
+          })
258
+          this.$router.push({ name: 'shop-index' })
259
+          loading.close()
260
+          return
261
+        }
262
+        this.$message.error(res.message)
263
+        loading.close()
264
+      }).catch(() => {
265
+        loading.close()
266
+        console.log('error AddBuilding')
267
+      })
268
+    }
269
+  }
270
+}
271
+</script>
272
+
273
+<style>
274
+.avatar-uploader .el-upload {
275
+    border: 1px dashed #d9d9d9;
276
+    border-radius: 6px;
277
+    cursor: pointer;
278
+    position: relative;
279
+    overflow: hidden;
280
+  }
281
+  .avatar-uploader .el-upload:hover {
282
+    border-color: #409EFF;
283
+  }
284
+  .avatar-uploader-icon {
285
+    font-size: 28px;
286
+    color: #8c939d;
287
+    width: 178px;
288
+    height: 178px;
289
+    line-height: 178px;
290
+    text-align: center;
291
+  }
292
+  .avatar {
293
+    width: 178px;
294
+    height: 178px;
295
+    display: block;
296
+  }
297
+  
298
+.add-ruleForm{
299
+  width: 800px;
300
+  margin-left: auto;
301
+  margin-right: auto;
302
+  margin-top: 50px;
303
+}
304
+</style>
305
+<style scoped>
306
+.search-box {
307
+  position: absolute;
308
+  top: 25px;
309
+  left: 20px;
310
+}
311
+
312
+.amap-page-container {
313
+  position: relative;
314
+}
315
+</style>

+ 330
- 0
VUECODE/smart-property-manage/src/views/shop/shopEdit.vue Просмотреть файл

1
+<template>
2
+  <div class="root">
3
+    <el-form ref="ruleForm" :model="listData" :rules="rules" label-width="150px" class="add-ruleForm">
4
+      <el-form-item label="商铺名称" prop="shopName">
5
+        <el-input v-model="listData.shopName"/>
6
+      </el-form-item>
7
+      <el-form-item label="商铺说明" prop="remark">
8
+        <el-input v-model="listData.remark"/>
9
+      </el-form-item>
10
+      <el-form-item label="app首页展示图" prop="appIndexImg">
11
+        <el-upload
12
+          class="avatar-uploader"
13
+          name="uploadFiles"
14
+          :action="uploadImgUrl"
15
+          :show-file-list="false"
16
+          :on-success="handleAppIndexSuccess"
17
+          :before-upload="beforeAvatarUpload">
18
+          <img v-if="listData.appIndexImg" :src="listData.appIndexImg" class="avatar">
19
+          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
20
+        </el-upload>
21
+      </el-form-item>
22
+      <el-form-item label="app列表展示图" prop="appListImg">
23
+        <el-upload
24
+          class="avatar-uploader"
25
+          name="uploadFiles"
26
+          :action="uploadImgUrl"
27
+          :show-file-list="false"
28
+          :on-success="handleAppListSuccess"
29
+          :before-upload="beforeAvatarUpload">
30
+          <img v-if="listData.appListImg" :src="listData.appListImg" class="avatar">
31
+          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
32
+        </el-upload>
33
+      </el-form-item>
34
+      <el-form-item label="app商铺轮播图" prop="appCarouselImg">
35
+        <el-upload
36
+          name="uploadFiles"
37
+          :limit="6"
38
+          :action="uploadImgUrl"
39
+          list-type="picture-card"
40
+          :file-list="displayAppCarouselImg"
41
+          :on-preview="handlePictureCardPreview"
42
+          :on-remove="handleRemove"
43
+          :on-success="handleSuccessCarouselImg">
44
+          <i class="el-icon-plus"></i>
45
+        </el-upload>
46
+        <el-dialog :visible.sync="dialogVisible">
47
+          <img width="100%" :src="dialogImageUrl" alt="">
48
+        </el-dialog>
49
+      </el-form-item>
50
+      <el-form-item label="权重" prop="sort">
51
+        <el-input v-model="listData.sort"/>
52
+      </el-form-item>
53
+      <el-form-item label="商铺类型" prop="shopTypeId">
54
+        <el-select v-model="listData.shopTypeId" placeholder="商铺类型" clearable class="filter-item">
55
+          <el-option v-for="item in shopTypeList" :key="item.id" :value="item.id" :label="item.typeName"/>
56
+        </el-select>
57
+      </el-form-item>
58
+      <el-form-item label="上架状态" prop="shopStatus">
59
+        <el-select v-model="listData.shopStatus" placeholder="请选择">
60
+          <el-option label="已上架" value="1"/>
61
+          <el-option label="已下架" value="2"/>
62
+        </el-select>
63
+      </el-form-item>
64
+      <el-form-item label="联系电话" prop="shopTel">
65
+        <el-input v-model="listData.shopTel"/>
66
+      </el-form-item>
67
+      <el-form-item label="商铺地址" prop="shopAddress">
68
+        <el-input v-model="listData.shopAddress"/>
69
+      </el-form-item>
70
+      <el-form-item label="人均消费" prop="averagePrice">
71
+        <el-input v-model="listData.averagePrice"/>
72
+      </el-form-item>
73
+      <el-form-item label="高德坐标">
74
+        <el-input placeholder="经度" v-model="listData.shopLongitude" style="width: 150px;" />
75
+        <el-input placeholder="纬度" v-model="listData.shopLatitude" style="width: 150px;" />
76
+      </el-form-item>
77
+      <el-form-item label="">
78
+         <!-- 地图 -->
79
+        <div style="width:100%;height:300px;" class="amap-page-container">
80
+          <el-amap-search-box :search-option="searchOption" :on-search-result="onSearchResult" class="search-box"/>
81
+          <el-amap ref="map" :events="events" :center="mapCenter" :zoom="12" class="amap-demo" vid="amapDemo">
82
+            <el-amap-marker v-for="(item,index) in markers" :key="index" :position="item" />
83
+          </el-amap>
84
+        </div>
85
+      </el-form-item>
86
+      <el-form-item label="商铺介绍">
87
+          <!-- <el-input v-model="addForm.bannerContent" placeholder="内容详情"/> -->
88
+          <div id="father">
89
+            <wangeditor :content="listData.shopIntroduction" @wangeditorEvent="wangeditorValue"/>
90
+          </div>
91
+        </el-form-item>
92
+      <el-form-item>
93
+        <el-button type="primary" @click="submitForm('ruleForm')">修改</el-button>
94
+      </el-form-item>
95
+    </el-form>
96
+  </div>
97
+</template>
98
+
99
+<script>
100
+import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
101
+import Wangeditor from '@/components/Wangeditor'
102
+
103
+export default {
104
+  components: { Pagination, Wangeditor },
105
+  data() {
106
+    return {
107
+      events: {
108
+        click: e => {
109
+          // _self.postData.Coordinate = e.lnglat.lat + ',' + e.lnglat.lng
110
+          this.listData.shopLongitude = e.lnglat.lng
111
+          this.listData.shopLatitude = e.lnglat.lat
112
+        }
113
+      },
114
+      listData: {
115
+        id: '',
116
+        shopName: '',
117
+        remark: '',
118
+        appIndexImg: '',
119
+        appListImg: '',
120
+        appCarouselImg: [],
121
+        sort: '',
122
+        shopTypeId: '',
123
+        shopStatus: '',
124
+        shopTel: '',
125
+        shopAddress: '',
126
+        averagePrice: '',
127
+        shopLongitude: '',
128
+        shopLatitude: '',
129
+        shopIntroduction: ''
130
+      },
131
+      displayAppCarouselImg: [],
132
+      dialogImageUrl: '',
133
+      dialogVisible: false,
134
+      uploadImgUrl: process.env.BASE_API + '/uploadimage',
135
+      markers: [],
136
+      shopTypeList: [],
137
+      searchOption: {
138
+        city: '南京',
139
+        citylimit: false
140
+      },
141
+      mapCenter: [118.789509, 32.019989],
142
+      tableKey: 0,
143
+      rules: {
144
+        typeName: [
145
+          { required: true, message: '请输入商铺名称', trigger: 'blur' }
146
+        ],
147
+        remark: [
148
+          { required: true, message: '请输入商铺说明', trigger: 'blur' }
149
+        ],
150
+        shopTel: [
151
+          { required: true, message: '请输入联系电话', trigger: 'blur' }
152
+        ],
153
+        shopAddress: [
154
+          { required: true, message: '请输入商铺地址', trigger: 'blur' }
155
+        ],
156
+        appIndexImg: [
157
+          { required: true, message: 'app首页展示图', trigger: 'blur' }
158
+        ],
159
+        appListImg: [
160
+          { required: true, message: 'app列表展示图', trigger: 'blur' }
161
+        ],
162
+        appCarouselImg: [
163
+          { required: true, message: 'app商铺轮播图', trigger: 'blur' }
164
+        ],
165
+      }
166
+    }
167
+  },
168
+  created() {
169
+    this.listData.id = this.$route.query.id
170
+    this.getById()
171
+    this.getShopTypeList()
172
+  },
173
+  methods: {
174
+     addMarker() {
175
+      const lng = 121.5 + Math.round(Math.random() * 1000) / 10000
176
+      const lat = 31.197646 + Math.round(Math.random() * 500) / 10000
177
+      this.markers.push([lng, lat])
178
+    },
179
+    getById() {
180
+      this.$store.dispatch('shopType/GetShop', this.listData.id).then((res) => {
181
+        const shopData = res.data
182
+        this.listData = shopData
183
+        alert(this.listData.shopIntroduction)
184
+        // 多张图片进行遍历
185
+        for (let i = 0; i < shopData.appCarouselImg.length; i++) {
186
+          this.displayAppCarouselImg.push({ url: shopData.appCarouselImg[i] })
187
+        }
188
+      })
189
+    },
190
+    beforeAvatarUpload(file) {
191
+    },
192
+    handleAppIndexSuccess(res, file) {
193
+      this.listData.appIndexImg = res.data[0]
194
+    },
195
+    handleAppListSuccess(res, file) {
196
+      this.listData.appListImg = res.data[0]
197
+    },
198
+    handleRemove(file, fileList) {
199
+      this.listData.appCarouselImg = []
200
+      for (let i = 0; i < fileList.length; i++) {
201
+        this.listData.appCarouselImg.push(fileList[i].response.data[0])
202
+      }
203
+    },
204
+    handleSuccessCarouselImg(response, file, fileList) { // 活动配图上传成功时回调
205
+      const resImg = response.data[0]
206
+      this.listData.appCarouselImg.push(resImg)
207
+    },
208
+    handlePictureCardPreview(file) {
209
+      this.dialogImageUrl = file.url;
210
+      this.dialogVisible = true;
211
+    },
212
+    getShopTypeList() {
213
+      this.$store.dispatch('shopType/FetchShopTypeSelect', this.listData).then((res) => {
214
+        this.shopTypeList = res.data
215
+      }).catch(() => {
216
+        console.log('error ListAnnouncement')
217
+      })
218
+    },
219
+    onSearchResult(pois) {
220
+      // 搜索地图
221
+      let latSum = 0
222
+      let lngSum = 0
223
+      if (pois.length > 0) {
224
+        pois.forEach(poi => {
225
+          const { lng, lat } = poi
226
+          lngSum += lng
227
+          latSum += lat
228
+          this.markers.push([poi.lng, poi.lat])
229
+        })
230
+        const center = {
231
+          lng: lngSum / pois.length,
232
+          lat: latSum / pois.length
233
+        }
234
+        this.mapCenter = [center.lng, center.lat]
235
+      }
236
+    },
237
+    wangeditorValue(value) {
238
+      this.listData.shopIntroduction = value // 在这里接受子组件传过来的参数,赋值给data里的参数
239
+    },
240
+    submitForm(formName) { // 提交
241
+      this.$refs[formName].validate((valid) => {
242
+        if (valid) {
243
+          this.addShop()
244
+        } else {
245
+          console.log('error submit!!')
246
+          return false
247
+        }
248
+      })
249
+    },
250
+    resetForm(formName) { // 重置
251
+      // 重置为未注册
252
+      this.isRegistered = true
253
+      // 重置为非户主
254
+      this.roleDisabled = false
255
+
256
+      console.log(this.isRegistered)
257
+      this.$refs[formName].resetFields()
258
+    },
259
+    addShop() {
260
+      // 加载框
261
+      const loading = this.$loading({
262
+        lock: true,
263
+        text: 'Loading',
264
+        spinner: 'el-icon-loading',
265
+        background: 'rgba(0, 0, 0, 0.7)'
266
+      })
267
+      this.$store.dispatch('shopType/AddShop', this.listData).then((res) => {
268
+        if (res.code === '0') {
269
+          this.$message({
270
+            message: res.message,
271
+            type: 'success'
272
+          })
273
+          this.$router.push({ name: 'shop-index' })
274
+          loading.close()
275
+          return
276
+        }
277
+        this.$message.error(res.message)
278
+        loading.close()
279
+      }).catch(() => {
280
+        loading.close()
281
+        console.log('error AddBuilding')
282
+      })
283
+    }
284
+  }
285
+}
286
+</script>
287
+
288
+<style>
289
+.avatar-uploader .el-upload {
290
+    border: 1px dashed #d9d9d9;
291
+    border-radius: 6px;
292
+    cursor: pointer;
293
+    position: relative;
294
+    overflow: hidden;
295
+  }
296
+  .avatar-uploader .el-upload:hover {
297
+    border-color: #409EFF;
298
+  }
299
+  .avatar-uploader-icon {
300
+    font-size: 28px;
301
+    color: #8c939d;
302
+    width: 178px;
303
+    height: 178px;
304
+    line-height: 178px;
305
+    text-align: center;
306
+  }
307
+  .avatar {
308
+    width: 178px;
309
+    height: 178px;
310
+    display: block;
311
+  }
312
+  
313
+.add-ruleForm{
314
+  width: 800px;
315
+  margin-left: auto;
316
+  margin-right: auto;
317
+  margin-top: 50px;
318
+}
319
+</style>
320
+<style scoped>
321
+.search-box {
322
+  position: absolute;
323
+  top: 25px;
324
+  left: 20px;
325
+}
326
+
327
+.amap-page-container {
328
+  position: relative;
329
+}
330
+</style>

+ 4
- 15
VUECODE/smart-property-manage/src/views/shop/shopIndex.vue Просмотреть файл

27
     <div class="button">
27
     <div class="button">
28
       <el-button type="primary" @click="add">添加</el-button>
28
       <el-button type="primary" @click="add">添加</el-button>
29
       <el-button type="warning" @click="edit">修改</el-button>
29
       <el-button type="warning" @click="edit">修改</el-button>
30
-      <el-button type="danger" @click="deleteAnnouncement">作废</el-button>
30
+      <el-button type="danger" @click="deleteAnnouncement">下架商铺</el-button>
31
+      <el-button type="danger" @click="deleteAnnouncement">上架商铺</el-button>
31
     </div>
32
     </div>
32
     <el-table
33
     <el-table
33
       v-loading="listLoading"
34
       v-loading="listLoading"
182
     },
183
     },
183
     // 添加公告
184
     // 添加公告
184
     add() {
185
     add() {
185
-      this.$router.push({ name: 'announcement-add' })
186
+      this.$router.push({ name: 'shop-add' })
186
     },
187
     },
187
     edit(){// 编辑公告
188
     edit(){// 编辑公告
188
       const ids = this.deleteIds
189
       const ids = this.deleteIds
196
       }
197
       }
197
        let ide= this.deleteIds[0]
198
        let ide= this.deleteIds[0]
198
        this.listQuery.id = ide
199
        this.listQuery.id = ide
199
-      this.$store.dispatch('AnnouncementById', this.listQuery).then((res) => {
200
-        const resData = res.data
201
-        const announcement = resData.tpAnnouncement
202
-        const imgList = resData.studentList
203
-        this.listQuery = announcement
204
-        this.listQuery.announcementTitle = ''
205
-        console.log("1",this.listQuery.status)
206
-        if(this.listQuery.status == 0){
207
-          this.$message.error('已作废不可以修改')
208
-          return
209
-        } 
210
-       this.$router.push({ name: 'announcement-edit', query: { id: ide }})
211
-      }) 
200
+       this.$router.push({ name: 'shop-edit', query: { id: ide }})
212
       },
201
       },
213
     deleteAnnouncement(){
202
     deleteAnnouncement(){
214
        let ide= this.deleteIds[0]
203
        let ide= this.deleteIds[0]

+ 213
- 177
文档/MYSQL/smartCommunity.pdb
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 213
- 177
文档/MYSQL/smartCommunity.pdm
Разница между файлами не показана из-за своего большого размера
Просмотреть файл