张延森 пре 3 година
родитељ
комит
5b0e65bbbb
24 измењених фајлова са 339 додато и 4 уклоњено
  1. 72
    0
      src/main/java/com/yunzhi/shigongli/controller/TaHotelController.java
  2. 90
    1
      src/main/java/com/yunzhi/shigongli/controller/TaPersonController.java
  3. 23
    0
      src/main/java/com/yunzhi/shigongli/controller/TaShopWorkerController.java
  4. 6
    0
      src/main/java/com/yunzhi/shigongli/entity/TaHotelAccount.java
  5. 3
    0
      src/main/java/com/yunzhi/shigongli/entity/TaPersonRole.java
  6. 5
    1
      src/main/java/com/yunzhi/shigongli/mapper/TaHotelAccountLogMapper.java
  7. 4
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaHotelMapper.java
  8. 3
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaHotelWorkerMapper.java
  9. 3
    0
      src/main/java/com/yunzhi/shigongli/mapper/TaShopWorkerMapper.java
  10. 2
    0
      src/main/java/com/yunzhi/shigongli/service/ITaHotelAccountService.java
  11. 3
    0
      src/main/java/com/yunzhi/shigongli/service/ITaHotelService.java
  12. 7
    0
      src/main/java/com/yunzhi/shigongli/service/ITaHotelWorkerService.java
  13. 3
    0
      src/main/java/com/yunzhi/shigongli/service/ITaPersonRoleService.java
  14. 7
    0
      src/main/java/com/yunzhi/shigongli/service/ITaShopWorkerService.java
  15. 18
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaHotelAccountServiceImpl.java
  16. 6
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaHotelServiceImpl.java
  17. 19
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaHotelWorkerServiceImpl.java
  18. 12
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaPersonRoleServiceImpl.java
  19. 19
    0
      src/main/java/com/yunzhi/shigongli/service/impl/TaShopWorkerServiceImpl.java
  20. 2
    2
      src/main/java/com/yunzhi/shigongli/service/impl/TaTouristServiceImpl.java
  21. 9
    0
      src/main/resources/mapper/TaHotelAccountLogMapper.xml
  22. 11
    0
      src/main/resources/mapper/TaHotelMapper.xml
  23. 6
    0
      src/main/resources/mapper/TaHotelWorkerMapper.xml
  24. 6
    0
      src/main/resources/mapper/TaShopWorkerMapper.xml

+ 72
- 0
src/main/java/com/yunzhi/shigongli/controller/TaHotelController.java Прегледај датотеку

@@ -7,6 +7,9 @@ import com.yunzhi.shigongli.common.BaseController;
7 7
 import com.yunzhi.shigongli.common.Constants;
8 8
 import com.yunzhi.shigongli.common.ResponseBean;
9 9
 import com.yunzhi.shigongli.common.StringUtils;
10
+import com.yunzhi.shigongli.entity.TaHotelAccount;
11
+import com.yunzhi.shigongli.entity.TaPerson;
12
+import com.yunzhi.shigongli.service.ITaHotelAccountService;
10 13
 import com.yunzhi.shigongli.vo.HotelListVO;
11 14
 import io.swagger.annotations.Api;
12 15
 import io.swagger.annotations.ApiOperation;
@@ -23,7 +26,10 @@ import com.yunzhi.shigongli.service.ITaHotelService;
23 26
 import com.yunzhi.shigongli.entity.TaHotel;
24 27
 import org.springframework.web.bind.annotation.RestController;
25 28
 
29
+import java.util.HashMap;
26 30
 import java.util.List;
31
+import java.util.Map;
32
+import java.util.Optional;
27 33
 
28 34
 /**
29 35
  * <p>
@@ -44,6 +50,9 @@ public class TaHotelController extends BaseController {
44 50
     @Autowired
45 51
     public ITaHotelService iTaHotelService;
46 52
 
53
+    @Autowired
54
+    public ITaHotelAccountService iTaHotelAccountService;
55
+
47 56
 
48 57
     /**
49 58
      * 分页查询列表
@@ -140,4 +149,67 @@ public class TaHotelController extends BaseController {
140 149
     public ResponseBean getWxDetail(@ApiParam("对象ID") @PathVariable String id) throws Exception{
141 150
         return ResponseBean.success(iTaHotelService.getById(id));
142 151
     }
152
+
153
+    /**
154
+     * 民宿小程序首页
155
+     */
156
+    @RequestMapping(value="/wx/hotel/manage/index",method= RequestMethod.GET)
157
+    @ApiOperation(value="民宿小程序首页", notes = "民宿小程序首页", httpMethod = "GET", response = ResponseBean.class)
158
+    public ResponseBean getWxManageIndex() throws Exception{
159
+        TaPerson taPerson = getCurrentPerson();
160
+        if (!Constants.TARGET_HOTEL.equals(taPerson.getPersonRole())) {
161
+            return ResponseBean.error("请先进行人员身份绑定", ResponseBean.ERROR_ILLEGAL_PARAMS);
162
+        }
163
+
164
+        // 获取所有的民宿信息
165
+        List<TaHotel> hotelList = iTaHotelService.getListByPerson(taPerson);
166
+        if (null == hotelList || hotelList.size() < 1) {
167
+            return ResponseBean.error("数据异常, 未找到关联民宿", ResponseBean.ERROR_UNAVAILABLE);
168
+        }
169
+
170
+        // 默认获取第一个店铺信息
171
+        TaHotel taHotel = hotelList.get(0);
172
+        TaHotelAccount taHotelAccount = iTaHotelAccountService.getAccountInfoBy(taHotel.getHotelId());
173
+
174
+        Map<String, Object> result = new HashMap<>();
175
+        result.put("hotelList", hotelList);
176
+        result.put("hotel", taHotel);
177
+        result.put("account", taHotelAccount);
178
+
179
+        return ResponseBean.success(result);
180
+    }
181
+
182
+    /**
183
+     * 民宿小程序首页
184
+     */
185
+    @RequestMapping(value="/wx/hotel/manage/{id}",method= RequestMethod.GET)
186
+    @ApiOperation(value="民宿小程序首页", notes = "民宿小程序首页", httpMethod = "GET", response = ResponseBean.class)
187
+    public ResponseBean getWxManageHotel(@ApiParam("民宿ID") @PathVariable String id) throws Exception{
188
+        TaPerson taPerson = getCurrentPerson();
189
+        if (!Constants.TARGET_HOTEL.equals(taPerson.getPersonRole())) {
190
+            return ResponseBean.error("请先进行人员身份绑定", ResponseBean.ERROR_ILLEGAL_PARAMS);
191
+        }
192
+
193
+        // 获取所有的民宿信息
194
+        List<TaHotel> hotelList = iTaHotelService.getListByPerson(taPerson);
195
+        if (null == hotelList || hotelList.size() < 1) {
196
+            return ResponseBean.error("数据异常, 未找到关联民宿", ResponseBean.ERROR_UNAVAILABLE);
197
+        }
198
+
199
+        Optional<TaHotel> first = hotelList.stream().filter(x -> x.getHotelId().equals(id)).findFirst();
200
+        if (!first.isPresent()) {
201
+            return ResponseBean.error("数据异常, 未找到关联民宿", ResponseBean.ERROR_UNAVAILABLE);
202
+        }
203
+
204
+        // 默认获取第一个店铺信息
205
+        TaHotel taHotel = first.get();
206
+        TaHotelAccount taHotelAccount = iTaHotelAccountService.getAccountInfoBy(taHotel.getHotelId());
207
+
208
+        Map<String, Object> result = new HashMap<>();
209
+        result.put("hotel", taHotel);
210
+        result.put("account", taHotelAccount);
211
+
212
+        return ResponseBean.success(result);
213
+    }
214
+
143 215
 }

+ 90
- 1
src/main/java/com/yunzhi/shigongli/controller/TaPersonController.java Прегледај датотеку

@@ -4,7 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.yunzhi.shigongli.common.BaseController;
7
+import com.yunzhi.shigongli.common.Constants;
7 8
 import com.yunzhi.shigongli.common.ResponseBean;
9
+import com.yunzhi.shigongli.common.StringUtils;
10
+import com.yunzhi.shigongli.entity.TaHotelWorker;
11
+import com.yunzhi.shigongli.entity.TaPersonRole;
12
+import com.yunzhi.shigongli.entity.TaShopWorker;
13
+import com.yunzhi.shigongli.service.*;
8 14
 import io.swagger.annotations.Api;
9 15
 import io.swagger.annotations.ApiOperation;
10 16
 import io.swagger.annotations.ApiParam;
@@ -16,10 +22,12 @@ import org.springframework.web.bind.annotation.RequestBody;
16 22
 import org.springframework.web.bind.annotation.RequestMapping;
17 23
 import org.springframework.web.bind.annotation.RequestMethod;
18 24
 import org.springframework.web.bind.annotation.RequestParam;
19
-import com.yunzhi.shigongli.service.ITaPersonService;
20 25
 import com.yunzhi.shigongli.entity.TaPerson;
21 26
 import org.springframework.web.bind.annotation.RestController;
22 27
 
28
+import java.util.ArrayList;
29
+import java.util.List;
30
+
23 31
 /**
24 32
  * <p>
25 33
     * 小程序人员表 前端控制器
@@ -39,6 +47,15 @@ public class TaPersonController extends BaseController {
39 47
     @Autowired
40 48
     public ITaPersonService iTaPersonService;
41 49
 
50
+    @Autowired
51
+    public ITaPersonRoleService iTaPersonRoleService;
52
+
53
+    @Autowired
54
+    public ITaShopWorkerService iTaShopWorkerService;
55
+
56
+    @Autowired
57
+    public ITaHotelWorkerService iTaHotelWorkerService;
58
+
42 59
 
43 60
     /**
44 61
      * 分页查询列表
@@ -58,6 +75,78 @@ public class TaPersonController extends BaseController {
58 75
             IPage<TaPerson> result = iTaPersonService.page(pg, queryWrapper);
59 76
             return ResponseBean.success(result);
60 77
     }
78
+
79
+
80
+    /**
81
+     * 绑定人员身份
82
+     * @param targetType
83
+     * @return
84
+     */
85
+    @RequestMapping(value="/wx/person-role/{targetType}",method= RequestMethod.POST)
86
+    @ApiOperation(value="绑定人员身份", notes = "绑定人员身份", httpMethod = "POST", response = ResponseBean.class)
87
+    public ResponseBean savePersonRole(@ApiParam("身份类型") @PathVariable String targetType) throws Exception{
88
+        TaPerson taPerson = getCurrentPerson();
89
+        if (StringUtils.isEmpty(taPerson.getPhone())) {
90
+            return ResponseBean.error("请先授权手机号", ResponseBean.ERROR_ILLEGAL_PARAMS);
91
+        }
92
+
93
+        taPerson.setPersonRole(targetType);
94
+
95
+        // 绑定普通用户身份不需要操作任何内容
96
+        if ("normal".equals(targetType)) {
97
+            iTaPersonService.updateById(taPerson);
98
+            return ResponseBean.success(taPerson);
99
+        }
100
+
101
+        TaPersonRole taPersonRole = iTaPersonRoleService.getPersonRole(taPerson, targetType);
102
+        if (null != taPersonRole) {
103
+            if (Constants.STATUS_NORMAL.equals(taPersonRole.getStatus())) {
104
+                iTaPersonService.updateById(taPerson);
105
+
106
+                return ResponseBean.success(taPersonRole);
107
+            } else {
108
+                return ResponseBean.error("绑定数据异常, 请联系管理人员", ResponseBean.ERROR_ILLEGAL_PARAMS);
109
+            }
110
+        }
111
+
112
+        List<String> targetTypeList = new ArrayList<String>(){{
113
+            add(Constants.TARGET_SHOP);
114
+            add(Constants.TARGET_HOTEL);
115
+        }};
116
+        if (!targetTypeList.contains(targetType)) {
117
+            return ResponseBean.error("暂不支持的身份类型", ResponseBean.ERROR_ILLEGAL_PARAMS);
118
+        }
119
+
120
+        taPersonRole = new TaPersonRole();
121
+        taPersonRole.setPersonId(taPerson.getPersonId());
122
+        taPersonRole.setTargetType(targetType);
123
+        taPersonRole.setStatus(Constants.STATUS_NORMAL);
124
+
125
+        // 如果是商铺
126
+        if (Constants.TARGET_SHOP.equals(targetType)) {
127
+            List<TaShopWorker> shopWorkers = iTaShopWorkerService.getByPhone(taPerson.getPhone());
128
+            if (null == shopWorkers || shopWorkers.size() < 1) {
129
+                return ResponseBean.error("未找到有效的身份对应信息", ResponseBean.ERROR_ILLEGAL_PARAMS);
130
+            }
131
+            iTaShopWorkerService.updateByPerson(taPerson);
132
+        }
133
+
134
+        // 如果是商铺
135
+        if (Constants.TARGET_HOTEL.equals(targetType)) {
136
+            List<TaHotelWorker> shopWorkers = iTaHotelWorkerService.getByPhone(taPerson.getPhone());
137
+            if (null == shopWorkers || shopWorkers.size() < 1) {
138
+                return ResponseBean.error("未找到有效的身份对应信息", ResponseBean.ERROR_ILLEGAL_PARAMS);
139
+            }
140
+            iTaHotelWorkerService.updateByPerson(taPerson);
141
+        }
142
+
143
+        iTaPersonRoleService.save(taPersonRole);
144
+        iTaPersonService.updateById(taPerson);
145
+
146
+        return ResponseBean.success(taPerson);
147
+    }
148
+
149
+
61 150
 //
62 151
 //    /**
63 152
 //     * 保存对象

+ 23
- 0
src/main/java/com/yunzhi/shigongli/controller/TaShopWorkerController.java Прегледај датотеку

@@ -7,10 +7,14 @@ import com.yunzhi.shigongli.common.BaseController;
7 7
 import com.yunzhi.shigongli.common.Constants;
8 8
 import com.yunzhi.shigongli.common.ResponseBean;
9 9
 import com.yunzhi.shigongli.common.StringUtils;
10
+import com.yunzhi.shigongli.entity.TaPerson;
11
+import com.yunzhi.shigongli.entity.TaPersonRole;
10 12
 import com.yunzhi.shigongli.entity.TaShopWorker;
13
+import com.yunzhi.shigongli.service.ITaPersonRoleService;
11 14
 import com.yunzhi.shigongli.service.ITaShopWorkerService;
12 15
 import com.yunzhi.shigongli.vo.ShopWorkerListVO;
13 16
 import io.swagger.annotations.Api;
17
+import io.swagger.annotations.ApiModelProperty;
14 18
 import io.swagger.annotations.ApiOperation;
15 19
 import io.swagger.annotations.ApiParam;
16 20
 import org.slf4j.Logger;
@@ -37,6 +41,9 @@ public class TaShopWorkerController extends BaseController {
37 41
     @Autowired
38 42
     public ITaShopWorkerService iTaShopWorkerService;
39 43
 
44
+    @Autowired
45
+    public ITaPersonRoleService iTaPersonRoleService;
46
+
40 47
 
41 48
     /**
42 49
      * 分页查询列表
@@ -113,4 +120,20 @@ public class TaShopWorkerController extends BaseController {
113 120
     public ResponseBean taShopWorkerGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
114 121
         return ResponseBean.success(iTaShopWorkerService.getById(id));
115 122
     }
123
+
124
+    @RequestMapping(value = "/wx/shop/manager/index", method= RequestMethod.GET)
125
+    @ApiOperation(value = "微信商铺端详情", notes = "微信商铺端详情", httpMethod = "GET", response = ResponseBean.class)
126
+    public ResponseBean getWxShopManager() throws Exception {
127
+        TaPerson taPerson = getCurrentPerson();
128
+
129
+        // 校验是否店主
130
+        TaPersonRole taPersonRole = iTaPersonRoleService.getPersonRole(taPerson, Constants.TARGET_SHOP);
131
+        if (null == taPersonRole) {
132
+            return ResponseBean.error("当前人员非店主", ResponseBean.ERROR_ILLEGAL_PARAMS);
133
+        }
134
+
135
+        return ResponseBean.success(null);
136
+
137
+    }
138
+
116 139
 }

+ 6
- 0
src/main/java/com/yunzhi/shigongli/entity/TaHotelAccount.java Прегледај датотеку

@@ -3,6 +3,8 @@ package com.yunzhi.shigongli.entity;
3 3
 import java.math.BigDecimal;
4 4
 import com.baomidou.mybatisplus.annotation.IdType;
5 5
 import java.time.LocalDateTime;
6
+
7
+import com.baomidou.mybatisplus.annotation.TableField;
6 8
 import com.baomidou.mybatisplus.annotation.TableId;
7 9
 import java.io.Serializable;
8 10
 import io.swagger.annotations.ApiModel;
@@ -43,6 +45,10 @@ public class TaHotelAccount implements Serializable {
43 45
     @ApiModelProperty(value = "已结佣金;单位分")
44 46
     private Integer paidCharges;
45 47
 
48
+    @ApiModelProperty(value = "创建日期")
46 49
     private LocalDateTime createDate;
47 50
 
51
+    @ApiModelProperty(value = "当前区间金额")
52
+    @TableField(exist = false)
53
+    private Integer currentCharges;
48 54
 }

+ 3
- 0
src/main/java/com/yunzhi/shigongli/entity/TaPersonRole.java Прегледај датотеку

@@ -40,6 +40,9 @@ public class TaPersonRole implements Serializable {
40 40
     @ApiModelProperty(value = "是否管理员")
41 41
     private Integer isManager;
42 42
 
43
+    @ApiModelProperty(value = "状态")
44
+    private Integer status;
45
+
43 46
     @ApiModelProperty(value = "映射类型")
44 47
     private String targetType;
45 48
 

+ 5
- 1
src/main/java/com/yunzhi/shigongli/mapper/TaHotelAccountLogMapper.java Прегледај датотеку

@@ -1,8 +1,12 @@
1 1
 package com.yunzhi.shigongli.mapper;
2 2
 
3
+import com.yunzhi.shigongli.entity.TaHotelAccount;
3 4
 import com.yunzhi.shigongli.entity.TaHotelAccountLog;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+import java.time.LocalDateTime;
6 10
 
7 11
 /**
8 12
  * <p>
@@ -14,5 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
14 18
  */
15 19
 @Mapper
16 20
 public interface TaHotelAccountLogMapper extends BaseMapper<TaHotelAccountLog> {
17
-
21
+    Integer sumChargesBy(@Param("accountId") String accountId, @Param("from") LocalDateTime from, @Param("to") LocalDateTime to);
18 22
 }

+ 4
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaHotelMapper.java Прегледај датотеку

@@ -7,6 +7,8 @@ import com.yunzhi.shigongli.vo.HotelListVO;
7 7
 import org.apache.ibatis.annotations.Mapper;
8 8
 import org.apache.ibatis.annotations.Param;
9 9
 
10
+import java.util.List;
11
+
10 12
 /**
11 13
  * <p>
12 14
  * 民宿 Mapper 接口
@@ -19,4 +21,6 @@ import org.apache.ibatis.annotations.Param;
19 21
 public interface TaHotelMapper extends BaseMapper<TaHotel> {
20 22
 
21 23
     IPage<HotelListVO> getVOListBy(IPage<TaHotel> pg, @Param("hotelName") String hotelName);
24
+
25
+    List<TaHotel> getListByPerson(@Param("personId") String personId);
22 26
 }

+ 3
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaHotelWorkerMapper.java Прегледај датотеку

@@ -3,6 +3,7 @@ package com.yunzhi.shigongli.mapper;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.shigongli.entity.TaHotelWorker;
5 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.yunzhi.shigongli.entity.TaPerson;
6 7
 import com.yunzhi.shigongli.vo.HotelWorkerListVO;
7 8
 import org.apache.ibatis.annotations.Mapper;
8 9
 import org.apache.ibatis.annotations.Param;
@@ -19,4 +20,6 @@ import org.apache.ibatis.annotations.Param;
19 20
 public interface TaHotelWorkerMapper extends BaseMapper<TaHotelWorker> {
20 21
 
21 22
     IPage<HotelWorkerListVO> getPagedListBy(IPage<HotelWorkerListVO> pg, @Param("hotelId") String hotelId);
23
+
24
+    int updateByPerson(@Param("person") TaPerson taPerson);
22 25
 }

+ 3
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaShopWorkerMapper.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.yunzhi.shigongli.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.yunzhi.shigongli.entity.TaPerson;
5 6
 import com.yunzhi.shigongli.entity.TaShopWorker;
6 7
 import com.yunzhi.shigongli.vo.ShopWorkerListVO;
7 8
 import org.apache.ibatis.annotations.Mapper;
@@ -19,4 +20,6 @@ import org.apache.ibatis.annotations.Param;
19 20
 public interface TaShopWorkerMapper extends BaseMapper<TaShopWorker> {
20 21
 
21 22
     IPage<ShopWorkerListVO> getPagedListBy(IPage<ShopWorkerListVO> pg, @Param("shopId") String shopId);
23
+
24
+    int updateByPerson(@Param("person") TaPerson taPerson);
22 25
 }

+ 2
- 0
src/main/java/com/yunzhi/shigongli/service/ITaHotelAccountService.java Прегледај датотеку

@@ -18,4 +18,6 @@ public interface ITaHotelAccountService extends IBaseService<TaHotelAccount> {
18 18
     TaHotelAccount getByHotel(String hotelId);
19 19
 
20 20
     boolean commissionSettlement(TaHotelAccount taHotelAccount, Integer charges) throws Exception;
21
+
22
+    TaHotelAccount getAccountInfoBy(String hotelId);
21 23
 }

+ 3
- 0
src/main/java/com/yunzhi/shigongli/service/ITaHotelService.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.yunzhi.shigongli.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.shigongli.entity.TaHotel;
5
+import com.yunzhi.shigongli.entity.TaPerson;
5 6
 import com.yunzhi.shigongli.vo.HotelListVO;
6 7
 
7 8
 import java.util.List;
@@ -21,4 +22,6 @@ public interface ITaHotelService extends IBaseService<TaHotel> {
21 22
     boolean createNew(TaHotel taHotel) throws Exception;
22 23
 
23 24
     IPage<HotelListVO> getVOListBy(IPage<TaHotel> pg, String hotelName);
25
+
26
+    List<TaHotel> getListByPerson(TaPerson taPerson);
24 27
 }

+ 7
- 0
src/main/java/com/yunzhi/shigongli/service/ITaHotelWorkerService.java Прегледај датотеку

@@ -2,8 +2,11 @@ package com.yunzhi.shigongli.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.shigongli.entity.TaHotelWorker;
5
+import com.yunzhi.shigongli.entity.TaPerson;
5 6
 import com.yunzhi.shigongli.vo.HotelWorkerListVO;
6 7
 
8
+import java.util.List;
9
+
7 10
 
8 11
 /**
9 12
  * <p>
@@ -16,4 +19,8 @@ import com.yunzhi.shigongli.vo.HotelWorkerListVO;
16 19
 public interface ITaHotelWorkerService extends IBaseService<TaHotelWorker> {
17 20
 
18 21
     IPage<HotelWorkerListVO> getPagedListBy(IPage<HotelWorkerListVO> pg, String hotelId);
22
+
23
+    List<TaHotelWorker> getByPhone(String phone);
24
+
25
+    void updateByPerson(TaPerson taPerson) throws Exception;
19 26
 }

+ 3
- 0
src/main/java/com/yunzhi/shigongli/service/ITaPersonRoleService.java Прегледај датотеку

@@ -1,5 +1,6 @@
1 1
 package com.yunzhi.shigongli.service;
2 2
 
3
+import com.yunzhi.shigongli.entity.TaPerson;
3 4
 import com.yunzhi.shigongli.entity.TaPersonRole;
4 5
 
5 6
 import java.util.List;
@@ -16,4 +17,6 @@ import java.util.List;
16 17
 public interface ITaPersonRoleService extends IBaseService<TaPersonRole> {
17 18
 
18 19
     List<TaPersonRole> getListByPerson(String personId);
20
+
21
+    TaPersonRole getPersonRole(TaPerson taPerson, String targetType);
19 22
 }

+ 7
- 0
src/main/java/com/yunzhi/shigongli/service/ITaShopWorkerService.java Прегледај датотеку

@@ -2,9 +2,12 @@ package com.yunzhi.shigongli.service;
2 2
 
3 3
 
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.yunzhi.shigongli.entity.TaPerson;
5 6
 import com.yunzhi.shigongli.entity.TaShopWorker;
6 7
 import com.yunzhi.shigongli.vo.ShopWorkerListVO;
7 8
 
9
+import java.util.List;
10
+
8 11
 /**
9 12
  * <p>
10 13
  * 民宿员工 服务类
@@ -16,4 +19,8 @@ import com.yunzhi.shigongli.vo.ShopWorkerListVO;
16 19
 public interface ITaShopWorkerService extends IBaseService<TaShopWorker> {
17 20
 
18 21
     IPage<ShopWorkerListVO> getPagedListBy(IPage<ShopWorkerListVO> pg, String shopId);
22
+
23
+    List<TaShopWorker> getByPhone(String phone);
24
+
25
+    void updateByPerson(TaPerson taPerson) throws Exception;
19 26
 }

+ 18
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaHotelAccountServiceImpl.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.yunzhi.shigongli.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4
 import com.yunzhi.shigongli.common.Constants;
5
+import com.yunzhi.shigongli.common.DateUtils;
5 6
 import com.yunzhi.shigongli.entity.TaHotelAccount;
6 7
 import com.yunzhi.shigongli.entity.TaHotelAccountLog;
7 8
 import com.yunzhi.shigongli.mapper.TaHotelAccountLogMapper;
@@ -77,4 +78,21 @@ public class TaHotelAccountServiceImpl extends BaseServiceImpl<TaHotelAccountMap
77 78
 
78 79
         return true;
79 80
     }
81
+
82
+    @Override
83
+    public TaHotelAccount getAccountInfoBy(String hotelId) {
84
+        TaHotelAccount account = getByHotel(hotelId);
85
+
86
+        LocalDateTime now = LocalDateTime.now();
87
+        String curMonth = DateUtils.toString(now, "yyyy-MM");
88
+        LocalDateTime from = DateUtils.from(curMonth + "-01", "yyyy-MM-dd");
89
+
90
+        Integer charges = taHotelAccountLogMapper.sumChargesBy(account.getAccountId(), from, now);
91
+        if (null == charges) {
92
+            charges = 0;
93
+        }
94
+        account.setCurrentCharges(charges);
95
+
96
+        return account;
97
+    }
80 98
 }

+ 6
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaHotelServiceImpl.java Прегледај датотеку

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.yunzhi.shigongli.common.Constants;
6 6
 import com.yunzhi.shigongli.entity.TaHotel;
7 7
 import com.yunzhi.shigongli.entity.TaHotelAccount;
8
+import com.yunzhi.shigongli.entity.TaPerson;
8 9
 import com.yunzhi.shigongli.mapper.TaHotelAccountMapper;
9 10
 import com.yunzhi.shigongli.mapper.TaHotelMapper;
10 11
 import com.yunzhi.shigongli.service.ITaHotelService;
@@ -58,4 +59,9 @@ public class TaHotelServiceImpl extends BaseServiceImpl<TaHotelMapper, TaHotel>
58 59
     public IPage<HotelListVO> getVOListBy(IPage<TaHotel> pg, String hotelName) {
59 60
         return hotelMapper.getVOListBy(pg, hotelName);
60 61
     }
62
+
63
+    @Override
64
+    public List<TaHotel> getListByPerson(TaPerson taPerson) {
65
+        return hotelMapper.getListByPerson(taPerson.getPersonId());
66
+    }
61 67
 }

+ 19
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaHotelWorkerServiceImpl.java Прегледај датотеку

@@ -1,7 +1,10 @@
1 1
 package com.yunzhi.shigongli.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
3 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.yunzhi.shigongli.common.Constants;
4 6
 import com.yunzhi.shigongli.entity.TaHotelWorker;
7
+import com.yunzhi.shigongli.entity.TaPerson;
5 8
 import com.yunzhi.shigongli.mapper.TaHotelWorkerMapper;
6 9
 import com.yunzhi.shigongli.service.ITaHotelWorkerService;
7 10
 
@@ -9,6 +12,8 @@ import com.yunzhi.shigongli.vo.HotelWorkerListVO;
9 12
 import org.springframework.beans.factory.annotation.Autowired;
10 13
 import org.springframework.stereotype.Service;
11 14
 
15
+import java.util.List;
16
+
12 17
 /**
13 18
  * <p>
14 19
  * 民宿员工 服务实现类
@@ -27,4 +32,18 @@ public class TaHotelWorkerServiceImpl extends BaseServiceImpl<TaHotelWorkerMappe
27 32
     public IPage<HotelWorkerListVO> getPagedListBy(IPage<HotelWorkerListVO> pg, String hotelId) {
28 33
         return hotelWorkerMapper.getPagedListBy(pg, hotelId);
29 34
     }
35
+
36
+    @Override
37
+    public List<TaHotelWorker> getByPhone(String phone) {
38
+        LambdaQueryWrapper<TaHotelWorker> queryWrapper = new LambdaQueryWrapper<>();
39
+        queryWrapper.eq(TaHotelWorker::getPhone, phone);
40
+        queryWrapper.gt(TaHotelWorker::getStatus, Constants.STATUS_DELETED);
41
+
42
+        return list(queryWrapper);
43
+    }
44
+
45
+    @Override
46
+    public void updateByPerson(TaPerson taPerson) throws Exception {
47
+        hotelWorkerMapper.updateByPerson(taPerson);
48
+    }
30 49
 }

+ 12
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaPersonRoleServiceImpl.java Прегледај датотеку

@@ -1,6 +1,8 @@
1 1
 package com.yunzhi.shigongli.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
+import com.yunzhi.shigongli.common.Constants;
5
+import com.yunzhi.shigongli.entity.TaPerson;
4 6
 import com.yunzhi.shigongli.entity.TaPersonRole;
5 7
 import com.yunzhi.shigongli.mapper.TaPersonRoleMapper;
6 8
 import com.yunzhi.shigongli.service.ITaPersonRoleService;
@@ -26,4 +28,14 @@ public class TaPersonRoleServiceImpl extends BaseServiceImpl<TaPersonRoleMapper,
26 28
 
27 29
         return list(queryWrapper);
28 30
     }
31
+
32
+    @Override
33
+    public TaPersonRole getPersonRole(TaPerson taPerson, String targetType) {
34
+        LambdaQueryWrapper<TaPersonRole> queryWrapper = new LambdaQueryWrapper<>();
35
+        queryWrapper.eq(TaPersonRole::getPersonId, taPerson.getPersonId());
36
+        queryWrapper.eq(TaPersonRole::getTargetType, targetType);
37
+        queryWrapper.gt(TaPersonRole::getStatus, Constants.STATUS_DELETED);
38
+
39
+        return getOne(queryWrapper);
40
+    }
29 41
 }

+ 19
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaShopWorkerServiceImpl.java Прегледај датотеку

@@ -1,7 +1,10 @@
1 1
 package com.yunzhi.shigongli.service.impl;
2 2
 
3 3
 
4
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
6
+import com.yunzhi.shigongli.common.Constants;
7
+import com.yunzhi.shigongli.entity.TaPerson;
5 8
 import com.yunzhi.shigongli.entity.TaShopWorker;
6 9
 import com.yunzhi.shigongli.mapper.TaShopWorkerMapper;
7 10
 import com.yunzhi.shigongli.service.ITaShopWorkerService;
@@ -9,6 +12,8 @@ import com.yunzhi.shigongli.vo.ShopWorkerListVO;
9 12
 import org.springframework.beans.factory.annotation.Autowired;
10 13
 import org.springframework.stereotype.Service;
11 14
 
15
+import java.util.List;
16
+
12 17
 /**
13 18
  * <p>
14 19
  * 民宿员工 服务实现类
@@ -27,4 +32,18 @@ public class TaShopWorkerServiceImpl extends BaseServiceImpl<TaShopWorkerMapper,
27 32
     public IPage<ShopWorkerListVO> getPagedListBy(IPage<ShopWorkerListVO> pg, String shopId) {
28 33
         return shopWorkerMapper.getPagedListBy(pg, shopId);
29 34
     }
35
+
36
+    @Override
37
+    public List<TaShopWorker> getByPhone(String phone) {
38
+        LambdaQueryWrapper<TaShopWorker> queryWrapper = new LambdaQueryWrapper<>();
39
+        queryWrapper.eq(TaShopWorker::getPhone, phone);
40
+        queryWrapper.gt(TaShopWorker::getStatus, Constants.STATUS_DELETED);
41
+
42
+        return list(queryWrapper);
43
+    }
44
+
45
+    @Override
46
+    public void updateByPerson(TaPerson taPerson) throws Exception {
47
+        shopWorkerMapper.updateByPerson(taPerson);
48
+    }
30 49
 }

+ 2
- 2
src/main/java/com/yunzhi/shigongli/service/impl/TaTouristServiceImpl.java Прегледај датотеку

@@ -50,7 +50,7 @@ public class TaTouristServiceImpl extends BaseServiceImpl<TaTouristMapper, TaTou
50 50
         // 图片
51 51
         if (null != taTourist.getImageList()) {
52 52
             for (TaImage image: taTourist.getImageList()) {
53
-                image.setTargetType(Constants.TARGET_SHOP);
53
+                image.setTargetType(Constants.TARGET_TOURIST);
54 54
                 image.setTargetId(taTourist.getTouristId());
55 55
                 imagesMapper.insert(image);
56 56
             }
@@ -59,7 +59,7 @@ public class TaTouristServiceImpl extends BaseServiceImpl<TaTouristMapper, TaTou
59 59
         // 分类标签
60 60
         if (null != taTourist.getTypeList()) {
61 61
             for (TaTargetType type: taTourist.getTypeList()) {
62
-                type.setTargetType(Constants.TARGET_SHOP);
62
+                type.setTargetType(Constants.TARGET_TOURIST);
63 63
                 type.setTargetId(taTourist.getTouristId());
64 64
                 targetTypeMapper.insert(type);
65 65
             }

+ 9
- 0
src/main/resources/mapper/TaHotelAccountLogMapper.xml Прегледај датотеку

@@ -2,4 +2,13 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.yunzhi.shigongli.mapper.TaHotelAccountLogMapper">
4 4
 
5
+    <select id="sumChargesBy" resultType="java.lang.Integer">
6
+        SELECT
7
+            sum( s.amount )
8
+        FROM
9
+            ta_hotel_account_log s
10
+        WHERE
11
+            s.account_id = #{accountId}
12
+          AND ( s.create_date BETWEEN #{from} AND #{to} )
13
+    </select>
5 14
 </mapper>

+ 11
- 0
src/main/resources/mapper/TaHotelMapper.xml Прегледај датотеку

@@ -20,4 +20,15 @@
20 20
         ORDER BY
21 21
             t.create_date DESC
22 22
     </select>
23
+    <select id="getListByPerson" resultType="com.yunzhi.shigongli.entity.TaHotel">
24
+        SELECT
25
+            t.*
26
+        FROM
27
+            ta_hotel t
28
+        WHERE
29
+            EXISTS ( SELECT * FROM ta_hotel_worker s WHERE s.hotel_id = t.hotel_id AND s.person_id = #{personId} AND s.`status` = 1 )
30
+          AND t.`status` = 1
31
+        ORDER BY
32
+            t.create_date DESC
33
+    </select>
23 34
 </mapper>

+ 6
- 0
src/main/resources/mapper/TaHotelWorkerMapper.xml Прегледај датотеку

@@ -1,6 +1,12 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.yunzhi.shigongli.mapper.TaHotelWorkerMapper">
4
+    <update id="updateByPerson">
5
+        UPDATE ta_hotel_worker t
6
+        SET t.person_id = #{person.personId}
7
+        WHERE
8
+            t.phone = #{person.phone}
9
+    </update>
4 10
 
5 11
     <select id="getPagedListBy" resultType="com.yunzhi.shigongli.vo.HotelWorkerListVO">
6 12
         SELECT

+ 6
- 0
src/main/resources/mapper/TaShopWorkerMapper.xml Прегледај датотеку

@@ -1,6 +1,12 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.yunzhi.shigongli.mapper.TaShopWorkerMapper">
4
+    <update id="updateByPerson">
5
+        UPDATE ta_shop_worker t
6
+        SET t.person_id = #{person.personId}
7
+        WHERE
8
+            t.phone = #{person.phone}
9
+    </update>
4 10
 
5 11
     <select id="getPagedListBy" resultType="com.yunzhi.shigongli.vo.ShopWorkerListVO">
6 12
         SELECT