| | |
| | | package com.doumee.api.web; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.config.annotation.ErpLoginRequired; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | |
| | | import com.doumee.dao.web.reqeust.ErpVisitDTO; |
| | | import com.doumee.service.business.VisitsService; |
| | | import com.doumee.service.business.ext.ERPSyncService; |
| | | import com.google.gson.JsonObject; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | @ApiImplicitParam(paramType = "query", dataType = "String", name = "accessSecret", value = "访问秘钥,由访客端提供", required = true) |
| | | }) |
| | | public ApiResponse<AccessTokenResponse> accesstoken(@RequestParam String accessKey, @RequestParam String accessSecret) { |
| | | return ApiResponse.success(erpSyncService.createERPToken(accessKey,accessSecret)); |
| | | ApiResponse response = ApiResponse.success(null); |
| | | try { |
| | | response.setData(erpSyncService.createERPToken(accessKey,accessSecret)); |
| | | }catch (BusinessException e){ |
| | | response = ApiResponse.failed(e.getCode(), e.getMessage()); |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | Map<String,String> param = new HashMap<>(); |
| | | param.put("accessKey",accessKey); |
| | | param.put("accessSecret",accessSecret); |
| | | erpSyncService.saveInterfaceLog(param,"/visitbiz/accesstoken", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | | @ErpLoginRequired |
| | |
| | | }) |
| | | public ApiResponse<List<RoleListResponse>> roleList(@RequestBody RoleListRequest param) { |
| | | param.setToken(this.getToken()); |
| | | return ApiResponse.success(erpSyncService.erpQueryDeviceList(param)); |
| | | ApiResponse response = ApiResponse.success(null); |
| | | try { |
| | | response.setData(erpSyncService.erpQueryDeviceList(param)); |
| | | }catch (BusinessException e){ |
| | | response = ApiResponse.failed(e.getCode(), e.getMessage()); |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | erpSyncService.saveInterfaceLog(param,"/visitbiz/resource/role/lis", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | | @ErpLoginRequired |
| | |
| | | }) |
| | | public ApiResponse<List<ParkListResponse>> parkList(@RequestBody ParkListRequest param) { |
| | | param.setToken(this.getToken()); |
| | | return ApiResponse.success(erpSyncService.parkList(param)); |
| | | ApiResponse response = ApiResponse.success(null); |
| | | try { |
| | | response.setData(erpSyncService.parkList(param)); |
| | | }catch (BusinessException e){ |
| | | response = ApiResponse.failed(e.getCode(), e.getMessage()); |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | erpSyncService.saveInterfaceLog(param,"/visitbiz/resource/role/list", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | | @ErpLoginRequired |
| | |
| | | }) |
| | | public ApiResponse<PageData<VisitEventListResponse>> visitList (@RequestBody PageWrap<VisitListRequest> pageWrap) { |
| | | pageWrap.getModel().setToken(this.getToken()); |
| | | return ApiResponse.success(erpSyncService.visitListPage(pageWrap)); |
| | | ApiResponse response = ApiResponse.success(null); |
| | | try { |
| | | response.setData(erpSyncService.visitListPage(pageWrap)); |
| | | }catch (BusinessException e){ |
| | | response = ApiResponse.failed(e.getCode(), e.getMessage()); |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | erpSyncService.saveInterfaceLog(pageWrap,"/visitbiz/resource/visit/list", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | | @ErpLoginRequired |
| | |
| | | }) |
| | | public ApiResponse<PageData<DoorEventListResponse>> doorEventList (@RequestBody PageWrap<DoorEventListRequest> pageWrap) { |
| | | pageWrap.getModel().setToken(this.getToken()); |
| | | return ApiResponse.success(erpSyncService.doorEventListPage(pageWrap)); |
| | | ApiResponse response = ApiResponse.success(null); |
| | | try { |
| | | response.setData(erpSyncService.doorEventListPage(pageWrap)); |
| | | }catch (BusinessException e){ |
| | | response = ApiResponse.failed(e.getCode(), e.getMessage()); |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | erpSyncService.saveInterfaceLog(pageWrap,"/visitbiz/resource/doorEvent/list", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | | @ErpLoginRequired |
| | |
| | | }) |
| | | public ApiResponse<PageData<CarEventListResponse>> carEventList (@RequestBody PageWrap<CarEventListRequest> pageWrap) { |
| | | pageWrap.getModel().setToken(this.getToken()); |
| | | return ApiResponse.success(erpSyncService.carEventList(pageWrap)); |
| | | ApiResponse response = ApiResponse.success(null); |
| | | try { |
| | | response.setData(erpSyncService.carEventList(pageWrap)); |
| | | }catch (BusinessException e){ |
| | | response = ApiResponse.failed(e.getCode(), e.getMessage()); |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | erpSyncService.saveInterfaceLog(pageWrap,"/visitbiz/resource/carvisit/list", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | | @ErpLoginRequired |
| | |
| | | }) |
| | | public ApiResponse orgUpdate(@RequestBody OrgUpdateRequest param) { |
| | | param.setToken(this.getToken()); |
| | | erpSyncService.orgUpdate(param); |
| | | return ApiResponse.success(null); |
| | | ApiResponse response = ApiResponse.success(null); |
| | | try { |
| | | erpSyncService.orgUpdate(param); |
| | | }catch (BusinessException e){ |
| | | response = ApiResponse.failed(e.getCode(), e.getMessage()); |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | erpSyncService.saveInterfaceLog(param,"/visitbiz/event/org/update", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | | @ErpLoginRequired |
| | |
| | | }) |
| | | public ApiResponse userUpdate(@RequestBody UserUpdateRequest param) { |
| | | param.setToken(this.getToken()); |
| | | erpSyncService.userUpdate(param); |
| | | return ApiResponse.success(null); |
| | | ApiResponse response = ApiResponse.success(null); |
| | | try { |
| | | erpSyncService.userUpdate(param); |
| | | }catch (BusinessException e){ |
| | | response = ApiResponse.failed(e.getCode(), e.getMessage()); |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | erpSyncService.saveInterfaceLog(param,"/visitbiz/event/user/update", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | | @ErpLoginRequired |
| | |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "授权token值", required = true) |
| | | }) |
| | | public ApiResponse roleUserAuthor(@RequestBody UserAuthorRequest param) { |
| | | erpSyncService.roleUserAuthor(param); |
| | | return ApiResponse.success(null); |
| | | ApiResponse response = ApiResponse.success(null); |
| | | try { |
| | | erpSyncService.roleUserAuthor(param); |
| | | }catch (BusinessException e){ |
| | | response = ApiResponse.failed(e.getCode(), e.getMessage()); |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | erpSyncService.saveInterfaceLog(param,"/visitbiz/event/role/userAuthor", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | | @ErpLoginRequired |
| | |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | //-----TODO-------记日志-------start----- |
| | | |
| | | //-----TODO-------记日志-------end----- |
| | | erpSyncService.saveInterfaceLog(param,"/visitbiz/event/park/carAuthor", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | |
| | | }) |
| | | public ApiResponse approveApply(@RequestBody ApproveNoticeRequest param) { |
| | | param.setToken(this.getToken()); |
| | | erpSyncService.approveApply(param); |
| | | return ApiResponse.success(null); |
| | | ApiResponse response = ApiResponse.success(null); |
| | | try { |
| | | erpSyncService.approveApply(param); |
| | | }catch (BusinessException e){ |
| | | response = ApiResponse.failed(e.getCode(), e.getMessage()); |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | erpSyncService.saveInterfaceLog(param,"/visitbiz/event/approve/notice", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | | @ErpLoginRequired |
| | |
| | | }) |
| | | public ApiResponse createVisit(@Valid @RequestBody ErpVisitDTO param) { |
| | | param.setToken(this.getToken()); |
| | | visitsService.createFKForErp(param); |
| | | return ApiResponse.success("操作成功"); |
| | | ApiResponse response = ApiResponse.success(null); |
| | | try { |
| | | visitsService.createFKForErp(param); |
| | | }catch (BusinessException e){ |
| | | response = ApiResponse.failed(e.getCode(), e.getMessage()); |
| | | }catch (Exception e){ |
| | | response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage()); |
| | | } |
| | | erpSyncService.saveInterfaceLog(param,"/visitbiz/resource/createVisit", JSONObject.toJSONString(response),Constants.ZERO); |
| | | return response; |
| | | } |
| | | |
| | | |