|  |  |  | 
|---|
|  |  |  | import com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.config.annotation.LoginNoRequired; | 
|---|
|  |  |  | import com.doumee.core.annotation.trace.Trace; | 
|---|
|  |  |  | import com.doumee.core.constants.ResponseStatus; | 
|---|
|  |  |  | import com.doumee.core.exception.BusinessException; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.business.model.VisitReason; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Visits; | 
|---|
|  |  |  | import com.doumee.dao.web.reqeust.CheckVisitedDTO; | 
|---|
|  |  |  | import com.doumee.dao.web.response.MemberVO; | 
|---|
|  |  |  | import com.doumee.dao.web.response.VisitDetailVO; | 
|---|
|  |  |  | import com.doumee.dao.web.response.VisitRecordVO; | 
|---|
|  |  |  | import com.doumee.dao.web.response.WxAuthorizeVO; | 
|---|
|  |  |  | import com.doumee.service.business.MemberService; | 
|---|
|  |  |  | import com.doumee.service.business.VisitReasonService; | 
|---|
|  |  |  | import com.doumee.service.business.VisitsService; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParams; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.validation.Valid; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * Created by IntelliJ IDEA. | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private VisitsService visitsService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private VisitReasonService visitReasonService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "访客微信授权", notes = "访客微信授权获取openId") | 
|---|
|  |  |  | @GetMapping("/wxAuthorize") | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "查询被访问人信息", notes = "查询被访问人信息") | 
|---|
|  |  |  | @PostMapping("/getVisitedMember") | 
|---|
|  |  |  | public ApiResponse<MemberVO> getVisitedMember(@Valid @RequestBody CheckVisitedDTO checkVisitedDTO) { | 
|---|
|  |  |  | public ApiResponse<List<MemberVO>> getVisitedMember(@Valid @RequestBody CheckVisitedDTO checkVisitedDTO) { | 
|---|
|  |  |  | return ApiResponse.success("查询成功", memberService.getVisitedMember(checkVisitedDTO)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "来访事由", notes = "来访事由") | 
|---|
|  |  |  | @PostMapping("/visitReason") | 
|---|
|  |  |  | public ApiResponse<List<VisitReason>> visitReason() { | 
|---|
|  |  |  | return ApiResponse.success("查询成功", visitReasonService.findList(null)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "访客记录详情", notes = "访客记录详情") | 
|---|
|  |  |  | @GetMapping("/detail") | 
|---|
|  |  |  | public ApiResponse<VisitDetailVO> detail(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success("查询成功", visitsService.getVisitDetail(id,getLoginUser(token).getMemberId())); | 
|---|
|  |  |  | public ApiResponse<VisitDetailVO> detail(@RequestParam Integer id) { | 
|---|
|  |  |  | return ApiResponse.success("查询成功", visitsService.getVisitDetail(id,null)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("访客记录 - 分页列表") | 
|---|
|  |  |  | @PostMapping("/visitPage") | 
|---|
|  |  |  | public ApiResponse<PageData<Visits>> visitPage (@RequestBody PageWrap<Visits> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = getLoginUser(token); | 
|---|
|  |  |  | pageWrap.getModel().setMemberId(loginUserInfo.getMemberId()); | 
|---|
|  |  |  | public ApiResponse<PageData<Visits>> visitPage (@RequestBody PageWrap<Visits> pageWrap) { | 
|---|
|  |  |  | return ApiResponse.success(visitsService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|