From 7809d3861ba70b8751f739d1ddaca3a60109fe1a Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期四, 05 十月 2023 15:19:27 +0800 Subject: [PATCH] 添加获取令牌、获取企业信息接口 --- src/main/java/com/smartearth/poiexcel/controller/EntController.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/smartearth/poiexcel/controller/EntController.java b/src/main/java/com/smartearth/poiexcel/controller/EntController.java index debf3ae..450d4ac 100644 --- a/src/main/java/com/smartearth/poiexcel/controller/EntController.java +++ b/src/main/java/com/smartearth/poiexcel/controller/EntController.java @@ -1,6 +1,9 @@ package com.smartearth.poiexcel.controller; +import com.smartearth.poiexcel.entity.EntEntity; import com.smartearth.poiexcel.entity.ResponseMsg; +import com.smartearth.poiexcel.service.EntService; +import com.smartearth.poiexcel.utils.StringHelper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -8,6 +11,9 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; /** * 浼佷笟鎺у埗鍣� @@ -18,17 +24,49 @@ @RestController @RequestMapping("/ent") public class EntController extends BaseController { - @ApiOperation(value = "鏌ヨ璁板綍鏁�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", required = false, example = "") - }) - @GetMapping({"/selectCount"}) - public ResponseMsg<Integer> selectCount(String name) { + @Resource + EntService entService; + + @ApiOperation(value = "鏌ヨ浠ょ墝") + @GetMapping({"/selectToken"}) + public ResponseMsg<Object> selectToken() { try { - //Result<TokenResult> rs = new Result<>(); + String token = entService.selectToken(); + return success(StringHelper.isEmpty(token) ? 0 : 1, token); + } catch (Exception ex) { + return fail(ex, -1); + } + } - return success(0); + @ApiOperation(value = "鏌ヨ浼佷笟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "浠ょ墝", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "startDate", value = "寮�濮嬫棩鏈�", dataType = "String", paramType = "query", example = "2023-06-29"), + @ApiImplicitParam(name = "endDate", value = "缁撴潫鏃ユ湡", dataType = "String", paramType = "query", example = "2023-06-30"), + @ApiImplicitParam(name = "qylabel", value = "鏍囩", dataType = "Integer", paramType = "query", example = "寮�涓�"), + @ApiImplicitParam(name = "showCount", value = "鏄剧ず璁板綍鏁�", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "currentPage", value = "褰撳墠鍒嗛〉鏁�", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping({"/selectEnts"}) + public ResponseMsg<Object> selectEnts(String token, String startDate, String endDate, String qylabel, Integer showCount, Integer currentPage) { + try { + if (StringHelper.isEmpty(token)) { + token = entService.selectToken(); + } + if (StringHelper.isEmpty(token)) { + return fail("鏌ヨ浠ょ墝澶辫触"); + } + if (null == showCount || showCount < 1) { + showCount = 10; + } + if (null == currentPage || currentPage < 1) { + currentPage = 1; + } + + List<EntEntity> list = entService.selectEnts(token, startDate, endDate, qylabel, showCount, currentPage); + + return success(null == list || list.isEmpty() ? 0 : list.size(), list); } catch (Exception ex) { return fail(ex, -1); } -- Gitblit v1.9.3