|  | @ -2,6 +2,7 @@ package com.yihu.jw.healthyhouse.controller.user;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.exception.business.ManageException;
 |  | import com.yihu.jw.exception.business.ManageException;
 | 
												
													
														
															|  | import com.yihu.jw.healthyhouse.cache.WlyyRedisVerifyCodeService;
 |  | import com.yihu.jw.healthyhouse.cache.WlyyRedisVerifyCodeService;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.healthyhouse.model.facility.Facility;
 | 
												
													
														
															|  | import com.yihu.jw.healthyhouse.model.user.User;
 |  | import com.yihu.jw.healthyhouse.model.user.User;
 | 
												
													
														
															|  | import com.yihu.jw.healthyhouse.service.user.UserService;
 |  | import com.yihu.jw.healthyhouse.service.user.UserService;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.Envelop;
 |  | import com.yihu.jw.restmodel.web.Envelop;
 | 
												
											
												
													
														
															|  | @ -26,9 +27,11 @@ import org.springframework.web.bind.annotation.*;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import javax.servlet.http.HttpServletResponse;
 |  | import javax.servlet.http.HttpServletResponse;
 | 
												
													
														
															|  | import java.io.OutputStream;
 |  | import java.io.OutputStream;
 | 
												
													
														
															|  | 
 |  | import java.text.ParseException;
 | 
												
													
														
															|  | import java.util.HashMap;
 |  | import java.util.HashMap;
 | 
												
													
														
															|  | import java.util.List;
 |  | import java.util.List;
 | 
												
													
														
															|  | import java.util.Map;
 |  | import java.util.Map;
 | 
												
													
														
															|  | 
 |  | import java.util.regex.Pattern;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | /**
 |  | /**
 | 
												
													
														
															|  |  *  用户相关 接口
 |  |  *  用户相关 接口
 | 
												
											
												
													
														
															|  | @ -45,22 +48,23 @@ public class UserController  extends EnvelopRestEndpoint {
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private WlyyRedisVerifyCodeService wlyyRedisVerifyCodeService;
 |  |     private WlyyRedisVerifyCodeService wlyyRedisVerifyCodeService;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @GetMapping("/userList")
 |  |     @GetMapping("/userList")
 | 
												
													
														
															|  |     @ApiOperation(value = "获取用户列表")
 |  |     @ApiOperation(value = "获取用户列表")
 | 
												
													
														
															|  |     public PageEnvelop userList(
 |  |     public PageEnvelop userList(
 | 
												
													
														
															|  |             @ApiParam(name = "page", value = "页数", required = true)@RequestParam(required = true, name = "page") Integer page,
 |  | 
 | 
												
													
														
															|  |             @ApiParam(name = "pageSize", value = "每页数量", required = true)@RequestParam(required = true, name = "pageSize") Integer pageSize,
 |  | 
 | 
												
													
														
															|  |             @ApiParam(name = "city", value = "所在市区", required = false)@RequestParam(required = false, name = "city") String city,
 |  | 
 | 
												
													
														
															|  |             @ApiParam(name = "activated", value = "用户状态", required = false)@RequestParam(required = false, name = "activated") String activated ,
 |  | 
 | 
												
													
														
															|  |             @ApiParam(name = "name", value = "姓名/手机号", required = false)@RequestParam(required = false, name = "name") String name ,
 |  | 
 | 
												
													
														
															|  |             @ApiParam(name = "order", value = "使用次数排序", required = false)@RequestParam(required = false, name = "order") String order  ) throws ManageException {
 |  | 
 | 
												
													
														
															|  |         Map<String, String> map = new HashMap<>();
 |  | 
 | 
												
													
														
															|  |         map.put("cityCode",city);
 |  | 
 | 
												
													
														
															|  |         map.put("activated",activated);
 |  | 
 | 
												
													
														
															|  |         map.put("name",name);
 |  | 
 | 
												
													
														
															|  |         map.put("telephone",name);
 |  | 
 | 
												
													
														
															|  |         Page<User> users = userService.userList(page, pageSize, map, order);
 |  | 
 | 
												
													
														
															|  |         return PageEnvelop.getSuccessListWithPage("列表获取成功",users.getContent(),page,pageSize,users.getTotalElements());
 |  | 
 | 
												
													
														
															|  | 
 |  |             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "")
 | 
												
													
														
															|  | 
 |  |             @RequestParam(value = "fields", required = false) String fields,
 | 
												
													
														
															|  | 
 |  |             @ApiParam(name = "filters", value = "过滤器", defaultValue = "")
 | 
												
													
														
															|  | 
 |  |             @RequestParam(value = "filters", required = false) String filters,
 | 
												
													
														
															|  | 
 |  |             @ApiParam(name = "sorts", value = "排序", defaultValue = "")
 | 
												
													
														
															|  | 
 |  |             @RequestParam(value = "sorts", required = false) String sorts,
 | 
												
													
														
															|  | 
 |  |             @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
 | 
												
													
														
															|  | 
 |  |             @RequestParam(value = "size", required = false) Integer size,
 | 
												
													
														
															|  | 
 |  |             @ApiParam(name = "page", value = "页码", defaultValue = "1")
 | 
												
													
														
															|  | 
 |  |             @RequestParam(value = "page", required = false) Integer page ) throws ManageException, ParseException {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<User> userList = userService.search(fields, filters, sorts, page, size);
 | 
												
													
														
															|  | 
 |  |         return success(userList, userList == null ? 0 : userList.size(), page, size);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -75,8 +79,7 @@ public class UserController  extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @GetMapping("/usedFacilityCount")
 |  |     @GetMapping("/usedFacilityCount")
 | 
												
													
														
															|  |     @ApiOperation(value = "获取用户统计信息")
 |  |     @ApiOperation(value = "获取用户统计信息")
 | 
												
													
														
															|  |     public ObjEnvelop usedFacilityCount(
 |  | 
 | 
												
													
														
															|  |             @ApiParam(name = "userId", value = "用户id", required = true)@RequestParam(required = true, name = "userId") String userId ) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop usedFacilityCount() {
 | 
												
													
														
															|  |         Map<String, Long> userStatistics = userService.findUserStatistics();
 |  |         Map<String, Long> userStatistics = userService.findUserStatistics();
 | 
												
													
														
															|  |         return ObjEnvelop.getSuccess("获取成功",userStatistics);
 |  |         return ObjEnvelop.getSuccess("获取成功",userStatistics);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
											
												
													
														
															|  | @ -103,16 +106,6 @@ public class UserController  extends EnvelopRestEndpoint {
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @PostMapping("/facilityUseUpdate")
 |  | 
 | 
												
													
														
															|  |     @ApiOperation(value = "更新设施使用次数")
 |  | 
 | 
												
													
														
															|  |     public Envelop facilityUseUpdate(
 |  | 
 | 
												
													
														
															|  |             @ApiParam(name = "userId", value = "用户Id", required = true)@RequestParam(required = true, name = "userId") String userId ,
 |  | 
 | 
												
													
														
															|  |             @ApiParam(name = "facilityId", value = "设施Id", required = true)@RequestParam(required = true, name = "facilityId") String facilityId ) throws ManageException {
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         userService.updateFacilityUse(userId,facilityId);
 |  | 
 | 
												
													
														
															|  |         return ObjEnvelop.getSuccess("更新用户使用设施次数成功");
 |  | 
 | 
												
													
														
															|  |     }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @PostMapping("/updatePwd")
 |  |     @PostMapping("/updatePwd")
 | 
												
													
														
															|  |     @ApiOperation(value = "更新密码")
 |  |     @ApiOperation(value = "更新密码")
 | 
												
													
														
															|  |     public Envelop updatePwd(
 |  |     public Envelop updatePwd(
 | 
												
											
												
													
														
															|  | @ -141,6 +134,16 @@ public class UserController  extends EnvelopRestEndpoint {
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping("/checkIdCardNo")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = "用户身份证号码认证")
 | 
												
													
														
															|  | 
 |  |     public Envelop checkIdCardNo(
 | 
												
													
														
															|  | 
 |  |             @ApiParam(name = "userId", value = "用户Id", required = true)@RequestParam(required = true, name = "userId") String userId ,
 | 
												
													
														
															|  | 
 |  |             @ApiParam(name = "idCardNo", value = "身份证号码", required = true)@RequestParam(required = true, name = "idCardNo") String idCardNo ) throws ManageException {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         userService.checkIdCardNo(userId, idCardNo);
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("身份证认证完成!");
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @GetMapping("/exportToExcel")
 |  |     @GetMapping("/exportToExcel")
 | 
												
													
														
															|  |     @ApiOperation(value = "用户列表导出excel")
 |  |     @ApiOperation(value = "用户列表导出excel")
 | 
												
											
												
													
														
															|  | @ -163,9 +166,4 @@ public class UserController  extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | }
 |  | }
 |