From 660ea8a344a91d7be146bf73541f681647760efa Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 05 十月 2023 10:51:16 +0800
Subject: [PATCH] 添加 企业 控制器

---
 src/main/java/com/smartearth/poiexcel/service/EntService.java        |   19 +++
 src/main/resources/application.properties                            |    1 
 src/main/java/com/smartearth/poiexcel/mapper/EntMapper.java          |   15 ++
 src/main/java/com/smartearth/poiexcel/controller/EntController.java  |   35 +++++
 src/main/java/com/smartearth/poiexcel/entity/ResponseMsg.java        |  107 +++++++++++++++++
 src/main/java/com/smartearth/poiexcel/entity/EntEntity.java          |   15 ++
 src/main/java/com/smartearth/poiexcel/entity/HttpStatus.java         |  105 +++++++++++++++++
 src/main/java/com/smartearth/poiexcel/controller/BaseController.java |   44 +++++++
 8 files changed, 341 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/smartearth/poiexcel/controller/BaseController.java b/src/main/java/com/smartearth/poiexcel/controller/BaseController.java
new file mode 100644
index 0000000..f147091
--- /dev/null
+++ b/src/main/java/com/smartearth/poiexcel/controller/BaseController.java
@@ -0,0 +1,44 @@
+package com.smartearth.poiexcel.controller;
+
+import com.smartearth.poiexcel.entity.HttpStatus;
+import com.smartearth.poiexcel.entity.ResponseMsg;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Controller鍩虹被
+ * @author WWW
+ */
+public class BaseController {
+    public Log log = LogFactory.getLog(getClass());
+
+    public <T> ResponseMsg<T> success(T result) {
+        return new ResponseMsg<T>(HttpStatus.OK, result);
+    }
+
+    public <T> ResponseMsg<T> success(String msg, T result) {
+        return new ResponseMsg<T>(HttpStatus.OK, msg, result);
+    }
+
+    public <T> ResponseMsg<T> success(long count, T result) {
+        return new ResponseMsg<T>(HttpStatus.OK, count, result);
+    }
+
+    public <T> ResponseMsg<T> success(String msg, long count, T result) {
+        return new ResponseMsg<T>(HttpStatus.OK, msg, count, result);
+    }
+
+    public <T> ResponseMsg<T> fail(T result) {
+        return new ResponseMsg<T>(HttpStatus.ERROR, result);
+    }
+
+    public <T> ResponseMsg<T> fail(String msg, T result) {
+        return new ResponseMsg<T>(HttpStatus.ERROR, msg, result);
+    }
+
+    public <T> ResponseMsg<T> fail(Exception ex, T result) {
+        log.error(ex.getMessage(), ex);
+
+        return new ResponseMsg<T>(HttpStatus.ERROR, ex.getMessage(), result);
+    }
+}
diff --git a/src/main/java/com/smartearth/poiexcel/controller/EntController.java b/src/main/java/com/smartearth/poiexcel/controller/EntController.java
new file mode 100644
index 0000000..6057bab
--- /dev/null
+++ b/src/main/java/com/smartearth/poiexcel/controller/EntController.java
@@ -0,0 +1,35 @@
+package com.smartearth.poiexcel.controller;
+
+import com.smartearth.poiexcel.entity.ResponseMsg;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 浼佷笟鎺у埗鍣�
+ * @author WWW
+ * @date 2023-10-05
+ */
+@Api(tags = "浼佷笟鎺у埗鍣�")
+@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) {
+        try {
+
+
+            return success(0);
+        } catch (Exception ex) {
+            return fail(ex, -1);
+        }
+    }
+}
diff --git a/src/main/java/com/smartearth/poiexcel/entity/EntEntity.java b/src/main/java/com/smartearth/poiexcel/entity/EntEntity.java
new file mode 100644
index 0000000..a1e6423
--- /dev/null
+++ b/src/main/java/com/smartearth/poiexcel/entity/EntEntity.java
@@ -0,0 +1,15 @@
+package com.smartearth.poiexcel.entity;
+
+import java.io.Serializable;
+
+/**
+ * 浼佷笟瀹炰綋绫�
+ * @author WWW
+ * @date 2023-10-05
+ */
+public class EntEntity implements Serializable {
+    private static final long serialVersionUID = -8624235184539814990L;
+
+    public EntEntity() {
+    }
+}
diff --git a/src/main/java/com/smartearth/poiexcel/entity/HttpStatus.java b/src/main/java/com/smartearth/poiexcel/entity/HttpStatus.java
new file mode 100644
index 0000000..d801575
--- /dev/null
+++ b/src/main/java/com/smartearth/poiexcel/entity/HttpStatus.java
@@ -0,0 +1,105 @@
+package com.smartearth.poiexcel.entity;
+
+/**
+ * Http鐘舵�佺爜绫�
+ * @author WWW
+ * @date 2023-10-05
+ */
+public enum HttpStatus {
+    /**
+     * 璇锋眰鎴愬姛
+     */
+    OK(200, "璇锋眰鎴愬姛"),
+
+    /**
+     * 璇锋眰鏃犳晥
+     */
+    BAD_REQUEST(400, "璇锋眰鏃犳晥"),
+
+    /**
+     * 鏈粡鎺堟潈璁块棶
+     */
+    UNAUTHORIZED(401, "鏈粡鎺堟潈璁块棶"),
+
+    /**
+     * 鏈嶅姟璇锋眰鏈壘鍒�
+     */
+    NOT_FOUND(404, "鏈嶅姟璇锋眰鏈壘鍒�"),
+
+    /**
+     * 绯荤粺閿欒
+     */
+    ERROR(500, "绯荤粺閿欒"),
+
+    /**
+     * 瀛樺湪閲嶅鐨勬暟鎹�
+     */
+    UNIQUE_ERROR(500100, "瀛樺湪閲嶅鐨勬暟鎹�"),
+
+    /**
+     * 鍙傛暟鏍¢獙閿欒
+     */
+    VALIDATE_ERROR(500101, "鍙傛暟鏍¢獙閿欒"),
+
+    /**
+     * token閿欒
+     */
+    TOKEN_ERROR(500102, "token閿欒"),
+
+    /**
+     * 鐢ㄦ埛鏈櫥闄�
+     */
+    NO_LOGIN_ERROR(500104, "鐢ㄦ埛鏈櫥闄�"),
+
+    /**
+     * 鐧婚檰澶辫触
+     */
+    LOGIN_ERROR(500105, "鐧婚檰澶辫触"),
+
+    /**
+     * 鏃犳潈闄愯闂�
+     */
+    NO_AUTH_ERROR(500106, "鏃犳潈闄愯闂�"),
+
+    /**
+     * 鐢ㄦ埛鍚嶉敊璇�
+     */
+    LOGIN_USER_ERROR(500107, "鐢ㄦ埛鍚嶉敊璇�"),
+
+    /**
+     * 瀵嗙爜閿欒
+     */
+    LOGIN_PWD_ERROR(500108, "瀵嗙爜閿欒"),
+
+    /**
+     * 鐢ㄦ埛琚攣瀹�
+     */
+    USER_LOCK_ERROR(500109, "鐢ㄦ埛琚攣瀹�"),
+
+    /**
+     * 瀵嗙爜涓嶅悎瑙勮寖
+     */
+    PWD_NONSTANDARD(500111, "瀵嗙爜涓嶅悎瑙勮寖"),
+
+    /**
+     * 瀵嗙爜杩囨湡
+     */
+    LOGIN_PWD_EXPIRE(500116, "瀵嗙爜杩囨湡");
+
+    private HttpStatus(int value, String msg) {
+        this.value = value;
+        this.msg = msg;
+    }
+
+    private int value;
+
+    private String msg;
+
+    public int getValue() {
+        return value;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+}
diff --git a/src/main/java/com/smartearth/poiexcel/entity/ResponseMsg.java b/src/main/java/com/smartearth/poiexcel/entity/ResponseMsg.java
new file mode 100644
index 0000000..7bda24b
--- /dev/null
+++ b/src/main/java/com/smartearth/poiexcel/entity/ResponseMsg.java
@@ -0,0 +1,107 @@
+package com.smartearth.poiexcel.entity;
+
+/**
+ * 鍝嶅簲娑堟伅绫�
+ * @author www
+ * @param <T> 娉涘瀷
+ */
+public class ResponseMsg<T> {
+    public ResponseMsg() {
+        this.time = System.currentTimeMillis();
+    }
+
+    public ResponseMsg(HttpStatus code, T result) {
+        this.code = code.getValue();
+        this.msg = this.code == 200 ? "鎴愬姛" : "澶辫触";
+        this.result = result;
+        this.time = System.currentTimeMillis();
+    }
+
+    public ResponseMsg(HttpStatus code, String msg, T result) {
+        this.code = code.getValue();
+        this.msg = msg;
+        this.result = result;
+        this.time = System.currentTimeMillis();
+    }
+
+    public ResponseMsg(int code, String msg, T result, long time) {
+        this.code = code;
+        this.msg = msg;
+        this.result = result;
+        this.time = time;
+    }
+
+    public ResponseMsg(HttpStatus code, long count, T result) {
+        this.code = code.getValue();
+        this.msg = this.code == 200 ? "鎴愬姛" : "澶辫触";
+        this.count = count;
+        this.result = result;
+        this.time = System.currentTimeMillis();
+    }
+
+    public ResponseMsg(HttpStatus code, String msg, long count, T result) {
+        this.code = code.getValue();
+        this.msg = msg;
+        this.count = count;
+        this.result = result;
+        this.time = System.currentTimeMillis();
+    }
+
+    public ResponseMsg(int code, String msg, long count, T result, long time) {
+        this.code = code;
+        this.msg = msg;
+        this.count = count;
+        this.result = result;
+        this.time = time;
+    }
+
+    private int code;
+
+    private String msg;
+
+    private long count;
+
+    private T result;
+
+    private long time;
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public long getCount() {
+        return count;
+    }
+
+    public void setCount(long count) {
+        this.count = count;
+    }
+
+    public T getResult() {
+        return result;
+    }
+
+    public void setResult(T result) {
+        this.result = result;
+    }
+
+    public long getTime() {
+        return time;
+    }
+
+    public void setTime(long time) {
+        this.time = time;
+    }
+}
diff --git a/src/main/java/com/smartearth/poiexcel/mapper/EntMapper.java b/src/main/java/com/smartearth/poiexcel/mapper/EntMapper.java
new file mode 100644
index 0000000..98920ca
--- /dev/null
+++ b/src/main/java/com/smartearth/poiexcel/mapper/EntMapper.java
@@ -0,0 +1,15 @@
+package com.smartearth.poiexcel.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 浼佷笟鎺ュ彛鏄犲皠绫�
+ * @author WWW
+ * @date 2023-10-05
+ */
+@Mapper
+@Repository
+public interface EntMapper {
+
+}
diff --git a/src/main/java/com/smartearth/poiexcel/service/EntService.java b/src/main/java/com/smartearth/poiexcel/service/EntService.java
new file mode 100644
index 0000000..3315d09
--- /dev/null
+++ b/src/main/java/com/smartearth/poiexcel/service/EntService.java
@@ -0,0 +1,19 @@
+package com.smartearth.poiexcel.service;
+
+import com.smartearth.poiexcel.mapper.EntMapper;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * 浼佷笟鏈嶅姟绫�
+ * @author WWW
+ * @date 2023-10-05
+ */
+@Service
+public class EntService implements EntMapper {
+    @Resource
+    EntMapper entMapper;
+
+    //
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 164d484..6c45932 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -13,3 +13,4 @@
 spring.datasource.username=root
 spring.datasource.password=mysql
 
+qylweb.url=https://qylweb.bda.gov.cn/yqfwg

--
Gitblit v1.9.3