张延森 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
 import com.yunzhi.shigongli.common.Constants;
7
 import com.yunzhi.shigongli.common.Constants;
8
 import com.yunzhi.shigongli.common.ResponseBean;
8
 import com.yunzhi.shigongli.common.ResponseBean;
9
 import com.yunzhi.shigongli.common.StringUtils;
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
 import com.yunzhi.shigongli.vo.HotelListVO;
13
 import com.yunzhi.shigongli.vo.HotelListVO;
11
 import io.swagger.annotations.Api;
14
 import io.swagger.annotations.Api;
12
 import io.swagger.annotations.ApiOperation;
15
 import io.swagger.annotations.ApiOperation;
23
 import com.yunzhi.shigongli.entity.TaHotel;
26
 import com.yunzhi.shigongli.entity.TaHotel;
24
 import org.springframework.web.bind.annotation.RestController;
27
 import org.springframework.web.bind.annotation.RestController;
25
 
28
 
29
+import java.util.HashMap;
26
 import java.util.List;
30
 import java.util.List;
31
+import java.util.Map;
32
+import java.util.Optional;
27
 
33
 
28
 /**
34
 /**
29
  * <p>
35
  * <p>
44
     @Autowired
50
     @Autowired
45
     public ITaHotelService iTaHotelService;
51
     public ITaHotelService iTaHotelService;
46
 
52
 
53
+    @Autowired
54
+    public ITaHotelAccountService iTaHotelAccountService;
55
+
47
 
56
 
48
     /**
57
     /**
49
      * 分页查询列表
58
      * 分页查询列表
140
     public ResponseBean getWxDetail(@ApiParam("对象ID") @PathVariable String id) throws Exception{
149
     public ResponseBean getWxDetail(@ApiParam("对象ID") @PathVariable String id) throws Exception{
141
         return ResponseBean.success(iTaHotelService.getById(id));
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
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.yunzhi.shigongli.common.BaseController;
6
 import com.yunzhi.shigongli.common.BaseController;
7
+import com.yunzhi.shigongli.common.Constants;
7
 import com.yunzhi.shigongli.common.ResponseBean;
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
 import io.swagger.annotations.Api;
14
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.ApiOperation;
15
 import io.swagger.annotations.ApiOperation;
10
 import io.swagger.annotations.ApiParam;
16
 import io.swagger.annotations.ApiParam;
16
 import org.springframework.web.bind.annotation.RequestMapping;
22
 import org.springframework.web.bind.annotation.RequestMapping;
17
 import org.springframework.web.bind.annotation.RequestMethod;
23
 import org.springframework.web.bind.annotation.RequestMethod;
18
 import org.springframework.web.bind.annotation.RequestParam;
24
 import org.springframework.web.bind.annotation.RequestParam;
19
-import com.yunzhi.shigongli.service.ITaPersonService;
20
 import com.yunzhi.shigongli.entity.TaPerson;
25
 import com.yunzhi.shigongli.entity.TaPerson;
21
 import org.springframework.web.bind.annotation.RestController;
26
 import org.springframework.web.bind.annotation.RestController;
22
 
27
 
28
+import java.util.ArrayList;
29
+import java.util.List;
30
+
23
 /**
31
 /**
24
  * <p>
32
  * <p>
25
     * 小程序人员表 前端控制器
33
     * 小程序人员表 前端控制器
39
     @Autowired
47
     @Autowired
40
     public ITaPersonService iTaPersonService;
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
             IPage<TaPerson> result = iTaPersonService.page(pg, queryWrapper);
75
             IPage<TaPerson> result = iTaPersonService.page(pg, queryWrapper);
59
             return ResponseBean.success(result);
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
 import com.yunzhi.shigongli.common.Constants;
7
 import com.yunzhi.shigongli.common.Constants;
8
 import com.yunzhi.shigongli.common.ResponseBean;
8
 import com.yunzhi.shigongli.common.ResponseBean;
9
 import com.yunzhi.shigongli.common.StringUtils;
9
 import com.yunzhi.shigongli.common.StringUtils;
10
+import com.yunzhi.shigongli.entity.TaPerson;
11
+import com.yunzhi.shigongli.entity.TaPersonRole;
10
 import com.yunzhi.shigongli.entity.TaShopWorker;
12
 import com.yunzhi.shigongli.entity.TaShopWorker;
13
+import com.yunzhi.shigongli.service.ITaPersonRoleService;
11
 import com.yunzhi.shigongli.service.ITaShopWorkerService;
14
 import com.yunzhi.shigongli.service.ITaShopWorkerService;
12
 import com.yunzhi.shigongli.vo.ShopWorkerListVO;
15
 import com.yunzhi.shigongli.vo.ShopWorkerListVO;
13
 import io.swagger.annotations.Api;
16
 import io.swagger.annotations.Api;
17
+import io.swagger.annotations.ApiModelProperty;
14
 import io.swagger.annotations.ApiOperation;
18
 import io.swagger.annotations.ApiOperation;
15
 import io.swagger.annotations.ApiParam;
19
 import io.swagger.annotations.ApiParam;
16
 import org.slf4j.Logger;
20
 import org.slf4j.Logger;
37
     @Autowired
41
     @Autowired
38
     public ITaShopWorkerService iTaShopWorkerService;
42
     public ITaShopWorkerService iTaShopWorkerService;
39
 
43
 
44
+    @Autowired
45
+    public ITaPersonRoleService iTaPersonRoleService;
46
+
40
 
47
 
41
     /**
48
     /**
42
      * 分页查询列表
49
      * 分页查询列表
113
     public ResponseBean taShopWorkerGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
120
     public ResponseBean taShopWorkerGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
114
         return ResponseBean.success(iTaShopWorkerService.getById(id));
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
 import java.math.BigDecimal;
3
 import java.math.BigDecimal;
4
 import com.baomidou.mybatisplus.annotation.IdType;
4
 import com.baomidou.mybatisplus.annotation.IdType;
5
 import java.time.LocalDateTime;
5
 import java.time.LocalDateTime;
6
+
7
+import com.baomidou.mybatisplus.annotation.TableField;
6
 import com.baomidou.mybatisplus.annotation.TableId;
8
 import com.baomidou.mybatisplus.annotation.TableId;
7
 import java.io.Serializable;
9
 import java.io.Serializable;
8
 import io.swagger.annotations.ApiModel;
10
 import io.swagger.annotations.ApiModel;
43
     @ApiModelProperty(value = "已结佣金;单位分")
45
     @ApiModelProperty(value = "已结佣金;单位分")
44
     private Integer paidCharges;
46
     private Integer paidCharges;
45
 
47
 
48
+    @ApiModelProperty(value = "创建日期")
46
     private LocalDateTime createDate;
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
     @ApiModelProperty(value = "是否管理员")
40
     @ApiModelProperty(value = "是否管理员")
41
     private Integer isManager;
41
     private Integer isManager;
42
 
42
 
43
+    @ApiModelProperty(value = "状态")
44
+    private Integer status;
45
+
43
     @ApiModelProperty(value = "映射类型")
46
     @ApiModelProperty(value = "映射类型")
44
     private String targetType;
47
     private String targetType;
45
 
48
 

+ 5
- 1
src/main/java/com/yunzhi/shigongli/mapper/TaHotelAccountLogMapper.java 查看文件

1
 package com.yunzhi.shigongli.mapper;
1
 package com.yunzhi.shigongli.mapper;
2
 
2
 
3
+import com.yunzhi.shigongli.entity.TaHotelAccount;
3
 import com.yunzhi.shigongli.entity.TaHotelAccountLog;
4
 import com.yunzhi.shigongli.entity.TaHotelAccountLog;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import org.apache.ibatis.annotations.Mapper;
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
  * <p>
12
  * <p>
14
  */
18
  */
15
 @Mapper
19
 @Mapper
16
 public interface TaHotelAccountLogMapper extends BaseMapper<TaHotelAccountLog> {
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
 import org.apache.ibatis.annotations.Mapper;
7
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Param;
8
 import org.apache.ibatis.annotations.Param;
9
 
9
 
10
+import java.util.List;
11
+
10
 /**
12
 /**
11
  * <p>
13
  * <p>
12
  * 民宿 Mapper 接口
14
  * 民宿 Mapper 接口
19
 public interface TaHotelMapper extends BaseMapper<TaHotel> {
21
 public interface TaHotelMapper extends BaseMapper<TaHotel> {
20
 
22
 
21
     IPage<HotelListVO> getVOListBy(IPage<TaHotel> pg, @Param("hotelName") String hotelName);
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
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.yunzhi.shigongli.entity.TaHotelWorker;
4
 import com.yunzhi.shigongli.entity.TaHotelWorker;
5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.yunzhi.shigongli.entity.TaPerson;
6
 import com.yunzhi.shigongli.vo.HotelWorkerListVO;
7
 import com.yunzhi.shigongli.vo.HotelWorkerListVO;
7
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Param;
9
 import org.apache.ibatis.annotations.Param;
19
 public interface TaHotelWorkerMapper extends BaseMapper<TaHotelWorker> {
20
 public interface TaHotelWorkerMapper extends BaseMapper<TaHotelWorker> {
20
 
21
 
21
     IPage<HotelWorkerListVO> getPagedListBy(IPage<HotelWorkerListVO> pg, @Param("hotelId") String hotelId);
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
 
2
 
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.yunzhi.shigongli.entity.TaPerson;
5
 import com.yunzhi.shigongli.entity.TaShopWorker;
6
 import com.yunzhi.shigongli.entity.TaShopWorker;
6
 import com.yunzhi.shigongli.vo.ShopWorkerListVO;
7
 import com.yunzhi.shigongli.vo.ShopWorkerListVO;
7
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Mapper;
19
 public interface TaShopWorkerMapper extends BaseMapper<TaShopWorker> {
20
 public interface TaShopWorkerMapper extends BaseMapper<TaShopWorker> {
20
 
21
 
21
     IPage<ShopWorkerListVO> getPagedListBy(IPage<ShopWorkerListVO> pg, @Param("shopId") String shopId);
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
     TaHotelAccount getByHotel(String hotelId);
18
     TaHotelAccount getByHotel(String hotelId);
19
 
19
 
20
     boolean commissionSettlement(TaHotelAccount taHotelAccount, Integer charges) throws Exception;
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
 
2
 
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.yunzhi.shigongli.entity.TaHotel;
4
 import com.yunzhi.shigongli.entity.TaHotel;
5
+import com.yunzhi.shigongli.entity.TaPerson;
5
 import com.yunzhi.shigongli.vo.HotelListVO;
6
 import com.yunzhi.shigongli.vo.HotelListVO;
6
 
7
 
7
 import java.util.List;
8
 import java.util.List;
21
     boolean createNew(TaHotel taHotel) throws Exception;
22
     boolean createNew(TaHotel taHotel) throws Exception;
22
 
23
 
23
     IPage<HotelListVO> getVOListBy(IPage<TaHotel> pg, String hotelName);
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
 
2
 
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.yunzhi.shigongli.entity.TaHotelWorker;
4
 import com.yunzhi.shigongli.entity.TaHotelWorker;
5
+import com.yunzhi.shigongli.entity.TaPerson;
5
 import com.yunzhi.shigongli.vo.HotelWorkerListVO;
6
 import com.yunzhi.shigongli.vo.HotelWorkerListVO;
6
 
7
 
8
+import java.util.List;
9
+
7
 
10
 
8
 /**
11
 /**
9
  * <p>
12
  * <p>
16
 public interface ITaHotelWorkerService extends IBaseService<TaHotelWorker> {
19
 public interface ITaHotelWorkerService extends IBaseService<TaHotelWorker> {
17
 
20
 
18
     IPage<HotelWorkerListVO> getPagedListBy(IPage<HotelWorkerListVO> pg, String hotelId);
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
 package com.yunzhi.shigongli.service;
1
 package com.yunzhi.shigongli.service;
2
 
2
 
3
+import com.yunzhi.shigongli.entity.TaPerson;
3
 import com.yunzhi.shigongli.entity.TaPersonRole;
4
 import com.yunzhi.shigongli.entity.TaPersonRole;
4
 
5
 
5
 import java.util.List;
6
 import java.util.List;
16
 public interface ITaPersonRoleService extends IBaseService<TaPersonRole> {
17
 public interface ITaPersonRoleService extends IBaseService<TaPersonRole> {
17
 
18
 
18
     List<TaPersonRole> getListByPerson(String personId);
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
 
2
 
3
 
3
 
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.yunzhi.shigongli.entity.TaPerson;
5
 import com.yunzhi.shigongli.entity.TaShopWorker;
6
 import com.yunzhi.shigongli.entity.TaShopWorker;
6
 import com.yunzhi.shigongli.vo.ShopWorkerListVO;
7
 import com.yunzhi.shigongli.vo.ShopWorkerListVO;
7
 
8
 
9
+import java.util.List;
10
+
8
 /**
11
 /**
9
  * <p>
12
  * <p>
10
  * 民宿员工 服务类
13
  * 民宿员工 服务类
16
 public interface ITaShopWorkerService extends IBaseService<TaShopWorker> {
19
 public interface ITaShopWorkerService extends IBaseService<TaShopWorker> {
17
 
20
 
18
     IPage<ShopWorkerListVO> getPagedListBy(IPage<ShopWorkerListVO> pg, String shopId);
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
 
2
 
3
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
3
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
 import com.yunzhi.shigongli.common.Constants;
4
 import com.yunzhi.shigongli.common.Constants;
5
+import com.yunzhi.shigongli.common.DateUtils;
5
 import com.yunzhi.shigongli.entity.TaHotelAccount;
6
 import com.yunzhi.shigongli.entity.TaHotelAccount;
6
 import com.yunzhi.shigongli.entity.TaHotelAccountLog;
7
 import com.yunzhi.shigongli.entity.TaHotelAccountLog;
7
 import com.yunzhi.shigongli.mapper.TaHotelAccountLogMapper;
8
 import com.yunzhi.shigongli.mapper.TaHotelAccountLogMapper;
77
 
78
 
78
         return true;
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
 import com.yunzhi.shigongli.common.Constants;
5
 import com.yunzhi.shigongli.common.Constants;
6
 import com.yunzhi.shigongli.entity.TaHotel;
6
 import com.yunzhi.shigongli.entity.TaHotel;
7
 import com.yunzhi.shigongli.entity.TaHotelAccount;
7
 import com.yunzhi.shigongli.entity.TaHotelAccount;
8
+import com.yunzhi.shigongli.entity.TaPerson;
8
 import com.yunzhi.shigongli.mapper.TaHotelAccountMapper;
9
 import com.yunzhi.shigongli.mapper.TaHotelAccountMapper;
9
 import com.yunzhi.shigongli.mapper.TaHotelMapper;
10
 import com.yunzhi.shigongli.mapper.TaHotelMapper;
10
 import com.yunzhi.shigongli.service.ITaHotelService;
11
 import com.yunzhi.shigongli.service.ITaHotelService;
58
     public IPage<HotelListVO> getVOListBy(IPage<TaHotel> pg, String hotelName) {
59
     public IPage<HotelListVO> getVOListBy(IPage<TaHotel> pg, String hotelName) {
59
         return hotelMapper.getVOListBy(pg, hotelName);
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
 package com.yunzhi.shigongli.service.impl;
1
 package com.yunzhi.shigongli.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.yunzhi.shigongli.common.Constants;
4
 import com.yunzhi.shigongli.entity.TaHotelWorker;
6
 import com.yunzhi.shigongli.entity.TaHotelWorker;
7
+import com.yunzhi.shigongli.entity.TaPerson;
5
 import com.yunzhi.shigongli.mapper.TaHotelWorkerMapper;
8
 import com.yunzhi.shigongli.mapper.TaHotelWorkerMapper;
6
 import com.yunzhi.shigongli.service.ITaHotelWorkerService;
9
 import com.yunzhi.shigongli.service.ITaHotelWorkerService;
7
 
10
 
9
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.stereotype.Service;
13
 import org.springframework.stereotype.Service;
11
 
14
 
15
+import java.util.List;
16
+
12
 /**
17
 /**
13
  * <p>
18
  * <p>
14
  * 民宿员工 服务实现类
19
  * 民宿员工 服务实现类
27
     public IPage<HotelWorkerListVO> getPagedListBy(IPage<HotelWorkerListVO> pg, String hotelId) {
32
     public IPage<HotelWorkerListVO> getPagedListBy(IPage<HotelWorkerListVO> pg, String hotelId) {
28
         return hotelWorkerMapper.getPagedListBy(pg, hotelId);
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
 package com.yunzhi.shigongli.service.impl;
1
 package com.yunzhi.shigongli.service.impl;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
3
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
+import com.yunzhi.shigongli.common.Constants;
5
+import com.yunzhi.shigongli.entity.TaPerson;
4
 import com.yunzhi.shigongli.entity.TaPersonRole;
6
 import com.yunzhi.shigongli.entity.TaPersonRole;
5
 import com.yunzhi.shigongli.mapper.TaPersonRoleMapper;
7
 import com.yunzhi.shigongli.mapper.TaPersonRoleMapper;
6
 import com.yunzhi.shigongli.service.ITaPersonRoleService;
8
 import com.yunzhi.shigongli.service.ITaPersonRoleService;
26
 
28
 
27
         return list(queryWrapper);
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
 package com.yunzhi.shigongli.service.impl;
1
 package com.yunzhi.shigongli.service.impl;
2
 
2
 
3
 
3
 
4
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.core.metadata.IPage;
6
+import com.yunzhi.shigongli.common.Constants;
7
+import com.yunzhi.shigongli.entity.TaPerson;
5
 import com.yunzhi.shigongli.entity.TaShopWorker;
8
 import com.yunzhi.shigongli.entity.TaShopWorker;
6
 import com.yunzhi.shigongli.mapper.TaShopWorkerMapper;
9
 import com.yunzhi.shigongli.mapper.TaShopWorkerMapper;
7
 import com.yunzhi.shigongli.service.ITaShopWorkerService;
10
 import com.yunzhi.shigongli.service.ITaShopWorkerService;
9
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.stereotype.Service;
13
 import org.springframework.stereotype.Service;
11
 
14
 
15
+import java.util.List;
16
+
12
 /**
17
 /**
13
  * <p>
18
  * <p>
14
  * 民宿员工 服务实现类
19
  * 民宿员工 服务实现类
27
     public IPage<ShopWorkerListVO> getPagedListBy(IPage<ShopWorkerListVO> pg, String shopId) {
32
     public IPage<ShopWorkerListVO> getPagedListBy(IPage<ShopWorkerListVO> pg, String shopId) {
28
         return shopWorkerMapper.getPagedListBy(pg, shopId);
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
         // 图片
50
         // 图片
51
         if (null != taTourist.getImageList()) {
51
         if (null != taTourist.getImageList()) {
52
             for (TaImage image: taTourist.getImageList()) {
52
             for (TaImage image: taTourist.getImageList()) {
53
-                image.setTargetType(Constants.TARGET_SHOP);
53
+                image.setTargetType(Constants.TARGET_TOURIST);
54
                 image.setTargetId(taTourist.getTouristId());
54
                 image.setTargetId(taTourist.getTouristId());
55
                 imagesMapper.insert(image);
55
                 imagesMapper.insert(image);
56
             }
56
             }
59
         // 分类标签
59
         // 分类标签
60
         if (null != taTourist.getTypeList()) {
60
         if (null != taTourist.getTypeList()) {
61
             for (TaTargetType type: taTourist.getTypeList()) {
61
             for (TaTargetType type: taTourist.getTypeList()) {
62
-                type.setTargetType(Constants.TARGET_SHOP);
62
+                type.setTargetType(Constants.TARGET_TOURIST);
63
                 type.setTargetId(taTourist.getTouristId());
63
                 type.setTargetId(taTourist.getTouristId());
64
                 targetTypeMapper.insert(type);
64
                 targetTypeMapper.insert(type);
65
             }
65
             }

+ 9
- 0
src/main/resources/mapper/TaHotelAccountLogMapper.xml 查看文件

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.yunzhi.shigongli.mapper.TaHotelAccountLogMapper">
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
 </mapper>
14
 </mapper>

+ 11
- 0
src/main/resources/mapper/TaHotelMapper.xml 查看文件

20
         ORDER BY
20
         ORDER BY
21
             t.create_date DESC
21
             t.create_date DESC
22
     </select>
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
 </mapper>
34
 </mapper>

+ 6
- 0
src/main/resources/mapper/TaHotelWorkerMapper.xml 查看文件

1
 <?xml version="1.0" encoding="UTF-8"?>
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">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.yunzhi.shigongli.mapper.TaHotelWorkerMapper">
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
     <select id="getPagedListBy" resultType="com.yunzhi.shigongli.vo.HotelWorkerListVO">
11
     <select id="getPagedListBy" resultType="com.yunzhi.shigongli.vo.HotelWorkerListVO">
6
         SELECT
12
         SELECT

+ 6
- 0
src/main/resources/mapper/TaShopWorkerMapper.xml 查看文件

1
 <?xml version="1.0" encoding="UTF-8"?>
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">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.yunzhi.shigongli.mapper.TaShopWorkerMapper">
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
     <select id="getPagedListBy" resultType="com.yunzhi.shigongli.vo.ShopWorkerListVO">
11
     <select id="getPagedListBy" resultType="com.yunzhi.shigongli.vo.ShopWorkerListVO">
6
         SELECT
12
         SELECT