From 832e40a8249ae15a5b2a7f01c78da4edc06cd55e Mon Sep 17 00:00:00 2001 From: rk <94314517@qq.com> Date: 星期一, 13 十月 2025 15:54:57 +0800 Subject: [PATCH] 定时自动叫号 与 WMS获取车辆是否在园接口开发 --- server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/openapi/HkOpenApiController.java | 56 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 45 insertions(+), 11 deletions(-) diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/openapi/HkOpenApiController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/openapi/HkOpenApiController.java index f1f9590..5f591d0 100644 --- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/openapi/HkOpenApiController.java +++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/openapi/HkOpenApiController.java @@ -1,10 +1,12 @@ package com.doumee.cloud.openapi; +import com.alibaba.fastjson.JSONObject; import com.doumee.api.BaseController; import com.doumee.biz.system.SystemDictDataBiz; import com.doumee.config.annotation.LoginNoRequired; import com.doumee.core.annotation.pr.PreventRepeat; -import com.doumee.core.model.ApiResponse; +import com.doumee.core.exception.BusinessException; +import com.doumee.service.business.third.model.ApiResponse; import com.doumee.core.utils.Constants; import com.doumee.core.utils.DESUtil; import com.doumee.dao.openapi.request.*; @@ -14,12 +16,12 @@ import com.doumee.service.system.SystemUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; -import java.net.URLDecoder; import java.util.*; /** @@ -28,11 +30,14 @@ */ @Api(tags = "鎻愪緵瀹夐槻骞冲彴瀵规帴鎺ュ彛锛堟暟鎹ぇ灞忓熀纭�鏁版嵁绛夛級") @RestController +@Slf4j @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/hk/api") public class HkOpenApiController extends BaseController { @Autowired private PlatformService platformService; + @Autowired + private InterfaceLogService interfaceLogService; @Autowired private PlatformLogService platformLogService; @@ -59,17 +64,28 @@ @ApiOperation("token瑙f瀽") @GetMapping("/water/decodeToken") public Map<String,Object> decodeToken(@RequestParam String token) { + log.info("銆愬畨闃插钩鍙板崟鐐圭櫥褰晅oken瑙f瀽銆�================="+token); + int success = Constants.ZERO; + Map<String,Object> result = new HashMap<>() ; try { - token = URLDecoder.decode(token,"UTF-8"); + HkBaseTokenRequest hkBaseTokenRequest = new HkBaseTokenRequest(); + hkBaseTokenRequest.setToken(token); + result = this.decodeTokenForHk(hkBaseTokenRequest); + }catch (BusinessException e){ + log.error("銆愬畨闃插钩鍙般�戝崟鐐圭櫥褰晅oken瑙�===澶辫触锛�"+e.getMessage()); + success = Constants.ONE; }catch (Exception e){ - + log.error("銆愬畨闃插钩鍙般�戝崟鐐圭櫥褰晅oken瑙f瀽===澶辫触锛�"+e.getMessage()); + e.printStackTrace(); + success = Constants.ONE; + }finally { + interfaceLogService.saveInterfaceLog("/hk/api/water/decodeToken", "銆愬畨闃插钩鍙般�戝崟鐐圭櫥褰晅oken瑙f瀽",token, + success, JSONObject.toJSONString(result),Constants.ZERO); } - HkBaseTokenRequest hkBaseTokenRequest = new HkBaseTokenRequest(); - hkBaseTokenRequest.setToken(token); - return this.decodeTokenForHk(hkBaseTokenRequest); + return result; } - public Map<String,Object> decodeTokenForHk(HkBaseTokenRequest hkBaseTokenRequest){ + public Map<String,Object> decodeTokenForHk(HkBaseTokenRequest hkBaseTokenRequest) { Map<String,Object> result = new HashMap<>(); result.put("code","0"); result.put("msg","success"); @@ -84,7 +100,7 @@ result.put("msg","token鏃犳晥!"); return result; } - String userName = DESUtil.verifyHkToken(hkBaseTokenRequest.getToken()); + String userName = DESUtil.verifyHkToken( redisToken);; if(StringUtils.isBlank(userName)){ result.put("code","-1"); result.put("msg","token鍙傛暟涓虹┖"); @@ -123,10 +139,27 @@ @LoginNoRequired @PreventRepeat + @ApiOperation("銆愮敤姘撮噺銆戣繎12涓湀鐢ㄦ按閲忎俊鎭垪琛�") + @PostMapping("/water/lastMonthsDataList") + public ApiResponse<List<PlatformLastMonthListResponse>> lastMonthsWaterList() { + return ApiResponse.success(platformWaterGasService.getPlatformLastMonthListResponse(Constants.ZERO)); + } + + @LoginNoRequired + @PreventRepeat @ApiOperation("銆愮敤姘旈噺銆戞湰鏈堛�佷笂鏈堝拰鍘诲勾鍚屾湀") @PostMapping("/gas/dataByMonth") public ApiResponse<GasByMonthResponse> gasDataByMonth(@RequestBody GasByMonthRequest param) { return ApiResponse.success(platformWaterGasService.gasDataByMonth(param)); + } + + + @LoginNoRequired + @PreventRepeat + @ApiOperation("銆愮敤姘旈噺銆戣繎12涓湀鐢ㄦ皵閲忎俊鎭垪琛�") + @PostMapping("/gas/lastMonthsDataList") + public ApiResponse<List<PlatformLastMonthListResponse>> lastMonthsGasList () { + return ApiResponse.success(platformWaterGasService.getPlatformLastMonthListResponse(Constants.ONE)); } @LoginNoRequired @@ -151,7 +184,7 @@ @PreventRepeat @ApiOperation("銆愭湀鍙般�戞湀鍙板綋鍓嶄綔涓氫俊鎭垪琛�") @PostMapping("/platform/workingDataList") - public ApiResponse<List<PlatformDataListResponse>> platformWorkingDataList(@RequestBody PlatformDataListRequest param) { + public ApiResponse<List<PlatformDataListResponse>> workingDataList(@RequestBody PlatformDataListRequest param) { return ApiResponse.success(platformJobService.platformWorkingDataList(param)); } @@ -159,7 +192,7 @@ @PreventRepeat @ApiOperation("銆愭湀鍙般�戞湀鍙颁綔涓氳鎯呬俊鎭�") @PostMapping("/platform/workDataInfo") - public ApiResponse<PlatformDataInfoResponse> platformWorkingDataList(@RequestBody PlatformDataInfoRequest param) { + public ApiResponse<PlatformDataInfoResponse> workDataInfo(@RequestBody PlatformDataInfoRequest param) { return ApiResponse.success(platformJobService.platformWorkingDataList(param)); } @@ -203,4 +236,5 @@ public ApiResponse<List<PlatformStatusListResponse>> getStatusList() { return ApiResponse.success(platformService.getPlatformStatusList()); } + } -- Gitblit v1.9.3