From ee4515cc893919da1b00770cb6d7b2dc8dd4738d Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 05 七月 2025 13:26:29 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/utils/Arith.java | 78 +++++
src/main/java/com/zy/common/config/CoolExceptionHandler.java | 4
src/main/java/com/zy/core/thread/impl/NyShuttleThread.java | 46 ++-
src/main/java/com/zy/core/utils/DeviceMsgUtils.java | 14
src/main/java/com/zy/core/cache/MessageQueue.java | 11
src/main/java/com/zy/common/utils/RandomValidateCodeUtil.java | 2
pom.xml | 68 ----
src/main/java/com/zy/common/exception/CoolException.java | 11
src/main/java/com/zy/common/utils/DateUtils.java | 160 +++++++++++
src/main/java/com/zy/core/ServerBootstrap.java | 89 +++--
src/main/java/com/zy/common/Cools.java | 55 +++
/dev/null | 12
src/main/java/com/zy/common/SpringUtils.java | 34 ++
src/main/java/com/zy/common/utils/Synchro.java | 2
src/main/java/com/zy/core/properties/DeviceConfig.java | 18 +
src/main/java/com/zy/Boot.java | 16
src/main/java/com/zy/common/R.java | 53 +++
src/main/java/com/zy/core/cache/OutputQueue.java | 2
src/main/java/com/zy/core/enums/RedisKeyType.java | 3
src/main/java/com/zy/core/thread/impl/LfdZyForkLiftMasterThread.java | 32 +-
src/main/resources/application.yml | 80 -----
src/main/java/com/zy/core/News.java | 1
22 files changed, 541 insertions(+), 250 deletions(-)
diff --git a/pom.xml b/pom.xml
index f7253a1..2d6e0a1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,17 +9,13 @@
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.zy</groupId>
- <artifactId>rcs</artifactId>
+ <artifactId>gateway</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<properties>
<java.version>1.8</java.version>
- <cool.version>3.4.0</cool.version>
- <mysql-driver.version>5.1.47</mysql-driver.version>
- <mybatis-plus.version>2.3.2</mybatis-plus.version>
<fastjson.version>1.2.58</fastjson.version>
- <springfox.version>2.7.0</springfox.version>
</properties>
<dependencies>
@@ -37,44 +33,9 @@
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
- <groupId>cn.cool</groupId>
- <artifactId>framework</artifactId>
- <version>${cool.version}</version>
- </dependency>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.46</version>
- </dependency>
- <dependency>
- <groupId>com.microsoft.sqlserver</groupId>
- <artifactId>mssql-jdbc</artifactId>
- <version>8.2.2.jre8</version>
- </dependency>
- <dependency>
- <groupId>com.baomidou</groupId>
- <artifactId>mybatis-plus-boot-starter</artifactId>
- <version>${mybatis-plus.version}</version>
- </dependency>
- <dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <version>${springfox.version}</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- <version>${springfox.version}</version>
- </dependency>
- <dependency>
- <groupId>com.github.xiaoymin</groupId>
- <artifactId>swagger-bootstrap-ui</artifactId>
- <version>1.8.9</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
@@ -105,37 +66,12 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-websocket</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
</dependencies>
<build>
- <finalName>rcs</finalName>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webResources>
- <resource>
- <directory>src/main/resources/lib</directory>
- <targetPath>WEB-INF/lib/</targetPath>
- <includes>
- <include>**/*.jar</include>
- </includes>
- </resource>
- </webResources>
- </configuration>
- </plugin>
- </plugins>
+ <finalName>gateway</finalName>
</build>
</project>
diff --git a/src/main/java/com/zy/Boot.java b/src/main/java/com/zy/Boot.java
index a616580..d4eeb22 100644
--- a/src/main/java/com/zy/Boot.java
+++ b/src/main/java/com/zy/Boot.java
@@ -1,9 +1,11 @@
package com.zy;
+import com.zy.common.SpringUtils;
import com.zy.common.utils.RandomValidateCodeUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@@ -14,17 +16,7 @@
public static void main(String[] args) {
RandomValidateCodeUtil.init();
- SpringApplication.run(Boot.class, args);
-// new Thread(()-> {
-// ServerBootstrap serverBootstrap = SpringUtils.getBean(ServerBootstrap.class);
-// serverBootstrap.init();
-// }).start();
-
+ ConfigurableApplicationContext applicationContext = SpringApplication.run(Boot.class, args);
+ SpringUtils.init(applicationContext);
}
-
-// @Override
-// protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
-// return builder.sources(Boot.class);
-// }
-
}
diff --git a/src/main/java/com/zy/asrs/domain/NotifyDto.java b/src/main/java/com/zy/asrs/domain/NotifyDto.java
deleted file mode 100644
index eb15f4b..0000000
--- a/src/main/java/com/zy/asrs/domain/NotifyDto.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.zy.asrs.domain;
-
-import lombok.Data;
-
-@Data
-public class NotifyDto {
-
- private Long id;
-
- //閫氱煡绫诲瀷
- private String notifyType;
-
- //璁惧鍙�
- private Integer device;
-
- //宸ヤ綔鍙�
- private String taskNo;
-
- //涓婄骇绯荤粺宸ヤ綔鍙�
- private String superTaskNo;
-
- //娑堟伅绫诲瀷
- private String msgType;
-
- //娑堟伅鎻忚堪
- private String msgDesc;
-
- //娑堟伅鏁版嵁
- private String data;
-
- //澶辫触閲嶈瘯娆℃暟
- private Integer failTimes = 3;
-
- //閲嶈瘯娆℃暟
- private Integer retryTimes = 0;
-
- //閲嶈瘯闂撮殧榛樿30s
- private Integer retryTime = 30;
-
- //涓婃閲嶈瘯鏃堕棿
- private Long lastRetryTime = 0L;
-
-}
diff --git a/src/main/java/com/zy/asrs/domain/enums/NotifyMsgType.java b/src/main/java/com/zy/asrs/domain/enums/NotifyMsgType.java
deleted file mode 100644
index 49505dd..0000000
--- a/src/main/java/com/zy/asrs/domain/enums/NotifyMsgType.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.zy.asrs.domain.enums;
-
-public enum NotifyMsgType {
- SHUTTLE_START_TAKE("shuttle_start_take", "灏忚溅寮�濮嬪彇璐�"),
- SHUTTLE_TRANSPORT("shuttle_transport", "灏忚溅閫佽揣涓�"),
- SHUTTLE_DELIVERY("shuttle_delivery", "灏忚溅鏀捐揣瀹屾垚"),
- SHUTTLE_MOVING("shuttle_moving", "灏忚溅绉诲姩涓�"),
- SHUTTLE_MOVE_COMPLETE("shuttle_move_complete", "灏忚溅绉诲姩瀹屾垚"),
- SHUTTLE_POWER_LOW("shuttle_power_low", "灏忚溅浣庣數閲�"),
- SHUTTLE_POWER_START("shuttle_power_start", "灏忚溅寮�濮嬪厖鐢�"),
- SHUTTLE_POWER_COMPLETE("shuttle_power_complete", "灏忚溅鍏呯數瀹屾垚"),
- SHUTTLE_ERROR("shuttle_error", "灏忚溅寮傚父"),
- FORK_LIFT_ERROR("fork_lift_error", "璐у弶鎻愬崌鏈哄紓甯�"),
-
- //浠诲姟
- TASK_COMPLETE("task_complete", "浠诲姟瀹屾垚"),
- TASK_CHARGE_COMPLETE("task_charge_complete", "鍏呯數浠诲姟瀹屾垚"),
- TASK_CANCEL("task_cancel", "浠诲姟鍙栨秷"),
- ;
-
- public String flag;
- public String desc;
-
- NotifyMsgType(String flag, String desc) {
- this.flag = flag;
- this.desc = desc;
- }
-
- public static NotifyMsgType get(String flag) {
- if (null == flag) {
- return null;
- }
- for (NotifyMsgType type : NotifyMsgType.values()) {
- if (type.flag.equals(flag)) {
- return type;
- }
- }
- return null;
- }
-
- public static NotifyMsgType get(NotifyMsgType type) {
- if (null == type) {
- return null;
- }
- for (NotifyMsgType type2 : NotifyMsgType.values()) {
- if (type2 == type) {
- return type2;
- }
- }
- return null;
- }
-}
diff --git a/src/main/java/com/zy/asrs/task/NotifyScheduler.java b/src/main/java/com/zy/asrs/task/NotifyScheduler.java
deleted file mode 100644
index 675e9ce..0000000
--- a/src/main/java/com/zy/asrs/task/NotifyScheduler.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package com.zy.asrs.task;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.zy.asrs.domain.NotifyDto;
-import com.zy.asrs.utils.NotifyUtils;
-import com.zy.common.utils.HttpHandler;
-import com.zy.common.utils.RedisUtil;
-import com.zy.core.enums.SlaveType;
-import com.zy.core.model.ForkLiftSlave;
-import com.zy.core.model.ShuttleSlave;
-import com.zy.core.properties.SlaveProperties;
-import com.zy.system.entity.Config;
-import com.zy.system.service.ConfigService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import java.util.Date;
-import java.util.List;
-
-@Component
-@Slf4j
-public class NotifyScheduler {
-
- @Autowired
- private RedisUtil redisUtil;
- @Autowired
- private NotifyUtils notifyUtils;
- @Autowired
- private SlaveProperties slaveProperties;
- @Autowired
- private ConfigService configService;
-
- @Scheduled(cron = "0/3 * * * * ? ")
- public synchronized void notifyShuttle(){
- for (ShuttleSlave slave : slaveProperties.getShuttle()) {
- notifyMsg(String.valueOf(SlaveType.Shuttle), slave.getId());
- }
- }
-
- @Scheduled(cron = "0/3 * * * * ? ")
- public synchronized void notifyForkLift(){
- for (ForkLiftSlave slave : slaveProperties.getForkLift()) {
- notifyMsg(String.valueOf(SlaveType.ForkLift), slave.getId());
- }
- }
-
- @Scheduled(cron = "0/3 * * * * ? ")
- public synchronized void notifyTask(){
- notifyMsg("task", 1);
- }
-
- private synchronized void notifyMsg(String notifyType, Integer device) {
- Config notifyEnableConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyEnable"));
- if(notifyEnableConfig == null){
- return;
- }
- String notifyEnable = notifyEnableConfig.getValue();
- if (!notifyEnable.equals("Y")) {
- return;
- }
-
- Config notifyUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyUri"));
- if(notifyUriConfig == null){
- return;
- }
- String notifyUri = notifyUriConfig.getValue();
-
- Config notifyUriPathConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyUriPath"));
- if(notifyUriPathConfig == null){
- return;
- }
- String notifyUriPath = notifyUriPathConfig.getValue();
-
- List<String> keys = notifyUtils.takeKeys(notifyType, device);
- if(keys == null){
- return;
- }
-
- if (keys.isEmpty()) {
- return;
- }
-
- for (String key : keys) {
- Object object = redisUtil.get(key);
- if (object == null) {
- continue;
- }
- NotifyDto notifyDto = (NotifyDto) object;
-
- if (System.currentTimeMillis() - notifyDto.getLastRetryTime() < 1000 * notifyDto.getRetryTime()) {
- continue;
- }
-
-// HttpRequestLog httpRequestLog = new HttpRequestLog();
-// httpRequestLog.setName(notifyUri + notifyUriPath);
-// httpRequestLog.setRequest(JSON.toJSONString(notifyDto));
-// httpRequestLog.setCreateTime(new Date());
-
- try {
- //瑙﹀彂閫氱煡
- String response = new HttpHandler.Builder()
- .setUri(notifyUri)
- .setPath(notifyUriPath)
- .setJson(JSON.toJSONString(notifyDto))
- .build()
- .doPost();
-// httpRequestLog.setResponse(response);
-
- JSONObject jsonObject = JSON.parseObject(response);
- Integer code = jsonObject.getInteger("code");
- if(code == 200){
- //閫氱煡鎴愬姛
- redisUtil.del(key);
-
- continue;
- }
- }catch (Exception e){
- e.printStackTrace();
- }finally {
- //淇濆瓨璁板綍
-// httpRequestLogService.insert(httpRequestLog);
- }
-
- //閫氱煡澶辫触
- int times = notifyDto.getRetryTimes() + 1;
- if (times >= notifyDto.getFailTimes()) {
- //瓒呰繃娆℃暟
- redisUtil.del(key);
- continue;
- }
-
- notifyDto.setLastRetryTime(System.currentTimeMillis());
- notifyDto.setRetryTimes(times);
- redisUtil.set(key, notifyDto);
- continue;
- }
- }
-
-}
diff --git a/src/main/java/com/zy/asrs/utils/NotifyUtils.java b/src/main/java/com/zy/asrs/utils/NotifyUtils.java
deleted file mode 100644
index ba4e618..0000000
--- a/src/main/java/com/zy/asrs/utils/NotifyUtils.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.zy.asrs.utils;
-
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.core.common.SnowflakeIdWorker;
-import com.zy.asrs.domain.NotifyDto;
-import com.zy.asrs.domain.enums.NotifyMsgType;
-import com.zy.common.utils.RedisUtil;
-import com.zy.core.enums.RedisKeyType;
-import com.zy.core.enums.SlaveType;
-import com.zy.system.entity.Config;
-import com.zy.system.service.ConfigService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-@Component
-public class NotifyUtils {
-
- @Autowired
- private RedisUtil redisUtil;
- @Autowired
- private SnowflakeIdWorker snowflakeIdWorker;
- @Autowired
- private ConfigService configService;
-
- public synchronized boolean notify(String notifyType, Integer device, String taskNo, String superTaskNo, NotifyMsgType msgType) {
- return append(notifyType, device, taskNo, superTaskNo, msgType, null);
- }
-
- public synchronized boolean notify(String notifyType, Integer device, String taskNo, String superTaskNo, NotifyMsgType msgType, String data) {
- return append(notifyType, device, taskNo, superTaskNo, msgType, data);
- }
-
- public synchronized List<String> takeKeys(String notifyType, Integer device) {
- String key = getKey(notifyType, device);
- if(key == null){
- return null;
- }
-
- Set keys = redisUtil.keys(key + "*");
- if (keys == null) {
- return null;
- }
-
- List<String> list = new ArrayList<>();
- for (Object object : keys) {
- list.add(object.toString());
- }
- return list;
- }
-
- public String getKey(String notifyType, Integer device) {
- String key = null;
- if (notifyType.equals(String.valueOf(SlaveType.Shuttle))) {
- key = RedisKeyType.QUEUE_SHUTTLE.key + device;
- } else if (notifyType.equals(String.valueOf(SlaveType.ForkLift))) {
- key = RedisKeyType.QUEUE_FORK_LIFT.key + device;
- } else if (notifyType.equals("task")) {
- key = RedisKeyType.QUEUE_TASK.key + device;
- } else {
- return null;
- }
-
- return key;
- }
-
- private boolean append(String notifyType, Integer device, String taskNo, String superTaskNo, NotifyMsgType msgType, String data) {
- String key = getKey(notifyType, device);
- if (key == null) {
- return false;
- }
-
- NotifyDto dto = new NotifyDto();
- dto.setId(snowflakeIdWorker.nextId());
- dto.setNotifyType(notifyType);
- dto.setDevice(device);
- dto.setMsgType(msgType.flag);
- dto.setMsgDesc(msgType.desc);
- dto.setData(data);
- dto.setTaskNo(taskNo);
- dto.setSuperTaskNo(superTaskNo);
-
- //閲嶈瘯娆℃暟
- Config notifyFailTimesConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyFailTimes"));
- if (notifyFailTimesConfig != null) {
- dto.setFailTimes(Integer.parseInt(notifyFailTimesConfig.getValue()));
- }
-
- //閲嶈瘯闂撮殧
- Config notifyRetryTimeConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyRetryTime"));
- if (notifyRetryTimeConfig != null) {
- dto.setRetryTime(Integer.parseInt(notifyRetryTimeConfig.getValue()));
- }
-
- redisUtil.set(key + "_" + dto.getId(), dto);
- return true;
- }
-
-}
diff --git a/src/main/java/com/zy/common/CodeBuilder.java b/src/main/java/com/zy/common/CodeBuilder.java
deleted file mode 100644
index d8243bc..0000000
--- a/src/main/java/com/zy/common/CodeBuilder.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.zy.common;
-
-import com.core.generators.CoolGenerator;
-import com.core.generators.constant.SqlOsType;
-
-/**
- * Created by vincent on 2019-06-04
- */
-public class CodeBuilder {
-
- public static void main(String[] args) throws Exception {
- CoolGenerator generator = new CoolGenerator();
- // mysql
- generator.sqlOsType = SqlOsType.MYSQL;
- generator.url="localhost:3306/shuttle_rcs";
- generator.username="root";
- generator.password="root";
- generator.table="asr_bas_shuttle_charge";
- // sqlserver
-// generator.sqlOsType = SqlOsType.SQL_SERVER;
-// generator.url="127.0.0.1:1433;databasename=tzskasrs";
-// generator.username="sa";
-// generator.password="sa@123";
-// generator.table="asr_bas_shuttle";
- generator.packagePath="com.zy.asrs";
-
- generator.controller = true;
- generator.html = true;
- generator.js = true;
- generator.htmlDetail = true;
- generator.sql = true;
- generator.build();
- }
-
-}
diff --git a/src/main/java/com/zy/common/CodeRes.java b/src/main/java/com/zy/common/CodeRes.java
deleted file mode 100644
index 694fe93..0000000
--- a/src/main/java/com/zy/common/CodeRes.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.common;
-
-import com.core.common.BaseRes;
-
-public interface CodeRes extends BaseRes {
-
- // user
- String USER_10001 = "10001-璐﹀彿涓嶅瓨鍦�";
- String USER_10002 = "10002-璐﹀彿宸茶绂佺敤";
- String USER_10003 = "10003-瀵嗙爜閿欒";
-
-}
diff --git a/src/main/java/com/zy/common/Cools.java b/src/main/java/com/zy/common/Cools.java
new file mode 100644
index 0000000..ac89f61
--- /dev/null
+++ b/src/main/java/com/zy/common/Cools.java
@@ -0,0 +1,55 @@
+package com.zy.common;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class Cools {
+ private static char[] hexDigits = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+
+ public static boolean isEmpty(Object... objects) {
+ for(Object obj : objects) {
+ if (isEmpty(obj)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public static boolean isEmpty(Object o) {
+ if (o == null) {
+ return true;
+ } else {
+ if (o instanceof String) {
+ if (o.toString().trim().equals("")) {
+ return true;
+ }
+ } else if (o instanceof List) {
+ if (((List)o).size() == 0) {
+ return true;
+ }
+ } else if (o instanceof Map) {
+ if (((Map)o).size() == 0) {
+ return true;
+ }
+ } else if (o instanceof Set) {
+ if (((Set)o).size() == 0) {
+ return true;
+ }
+ } else if (o instanceof Object[]) {
+ if (((Object[])((Object[])o)).length == 0) {
+ return true;
+ }
+ } else if (o instanceof int[]) {
+ if (((int[])((int[])o)).length == 0) {
+ return true;
+ }
+ } else if (o instanceof long[] && ((long[])((long[])o)).length == 0) {
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/src/main/java/com/zy/common/ExecuteSupport.java b/src/main/java/com/zy/common/ExecuteSupport.java
deleted file mode 100644
index 436ca53..0000000
--- a/src/main/java/com/zy/common/ExecuteSupport.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.zy.common;
-
-public interface ExecuteSupport {
-
- Boolean judgement();
-
-}
diff --git a/src/main/java/com/zy/common/Main.java b/src/main/java/com/zy/common/Main.java
deleted file mode 100644
index c158631..0000000
--- a/src/main/java/com/zy/common/Main.java
+++ /dev/null
@@ -1,454 +0,0 @@
-package com.zy.common;
-
-import HslCommunication.Core.Net.NetHandle;
-import HslCommunication.Core.Transfer.DataFormat;
-import HslCommunication.Core.Types.ActionOperateExThree;
-import HslCommunication.Core.Types.ActionOperateExTwo;
-import HslCommunication.Core.Types.OperateResult;
-import HslCommunication.Core.Types.OperateResultExOne;
-import HslCommunication.Enthernet.ComplexNet.NetComplexClient;
-import HslCommunication.Enthernet.PushNet.NetPushClient;
-import HslCommunication.Enthernet.SimplifyNet.NetSimplifyClient;
-import HslCommunication.ModBus.ModbusTcpNet;
-import HslCommunication.Profinet.Melsec.MelsecA1ENet;
-import HslCommunication.Profinet.Melsec.MelsecMcAsciiNet;
-import HslCommunication.Profinet.Melsec.MelsecMcNet;
-import HslCommunication.Profinet.Siemens.SiemensPLCS;
-import HslCommunication.Profinet.Siemens.SiemensS7Net;
-
-import java.util.Arrays;
-
-public class Main {
-
-// public static void main(String[] args) throws InterruptedException {
-// SiemesTest();
-// try {
-// //Constructor[] aa = Integer.class.getDeclaredConstructors();
-// //int i = (Integer) (aa[1].newInstance("1"));
-// //System.out.println(Utilities.bytes2HexString( Utilities.getBytes(String.format("%04x",100),"ASCII")));
-// //System.out.println(i);
-//
-// //System.out.println(Arrays.toString("123".split("\\." )));
-// //ModbusTcpTets();
-// //MelsecMcNet melsec_net = new MelsecMcNet("192.168.8.12", 6001);
-// //System.out.println(melsec_net.ReadInt16("D100").Content);
-//
-// SiemensS7Net siemensS7Net = new SiemensS7Net(SiemensPLCS.S1200,"192.168.8.12");
-// OperateResult write = siemensS7Net.Write("M200",(short)200);
-//
-// if(!write.IsSuccess){
-// System.out.println("Write failed:"+write.Message);
-// }
-//
-// OperateResultExOne<Short> read = siemensS7Net.ReadInt16("M200");
-// if(read.IsSuccess){
-// System.out.println("Value:"+read.Content.toString());
-// }
-// else {
-// System.out.println("Read failed:"+read.Message);
-// }
-// }
-// catch (Exception ex){
-// System.out.println(ex.getMessage());
-// }
-// Thread.sleep(1000);
-// }
-
-
- public static void main(String[] args) {
- SiemensS7Net siemens_net = new SiemensS7Net(SiemensPLCS.S300,"192.168.6.1");
- siemens_net.setSlot((byte) 2);
- siemens_net.setRack((byte) 0);
- OperateResult connect = siemens_net.ConnectServer();
- if(connect.IsSuccess){
- System.out.println("connect success!");
- }
- else {
- System.out.println("failed:"+connect.Message);
- }
- siemens_net.ConnectClose();
-
- short[] array = new short[] {9999,20,31,40,50};
- OperateResult db100 = siemens_net.Write("DB8.18", array);
- if (db100.IsSuccess) {
- System.out.println("鍐欏叆鎴愬姛");
- } else {
- System.out.println("鍐欏叆澶辫触");
- }
-// OperateResultExOne<Short> shortOperateResultExOne = siemens_net.ReadInt16("DB100.2");
-// System.out.println(shortOperateResultExOne.Content);
-
- OperateResultExOne<byte[]> read = siemens_net.Read("DB8.18", (short) 10);
- if (read.IsSuccess) {
-// for (int i = 0; i<10; i=i+2) {
-// System.out.println(siemens_net.getByteTransform().TransInt16(read.Content, i));
-// }
- System.out.println(siemens_net.getByteTransform().TransInt16(read.Content, 0));
- System.out.println(siemens_net.getByteTransform().TransInt16(read.Content, 2));
- System.out.println(siemens_net.getByteTransform().TransInt16(read.Content, 4));
- System.out.println(siemens_net.getByteTransform().TransInt16(read.Content, 6));
- System.out.println(siemens_net.getByteTransform().TransInt16(read.Content, 8));
- }
-
-// // 涓婇潰鏄垵濮嬪寲
-// System.out.println(siemens_net.ReadByte("M100").Content);
-//
-// byte m100_byte = siemens_net.ReadByte("M100").Content;
-// short m100_short = siemens_net.ReadInt16("M100").Content;
-// int m100_int = siemens_net.ReadInt32("M100").Content;
-// long m100_long = siemens_net.ReadInt64("M100").Content;
-// float m100_float = siemens_net.ReadFloat("M100").Content;
-// double m100_double = siemens_net.ReadDouble("M100").Content;
-// String m100_string = siemens_net.ReadString("M100",(short) 10).Content;
-//
-// siemens_net.Write("M100",(byte) 123);
-// siemens_net.Write("M100",(short) 123);
-// siemens_net.Write("M100",(int) 123);
-// siemens_net.Write("M100",(long) 123);
-// siemens_net.Write("M100", 123.456f);
-// siemens_net.Write("M100", 123.456d);
-// siemens_net.Write("M100","1234567890");
-//
-// OperateResultExOne<byte[]> read = siemens_net.Read( "M100", (short) 10 );
-// {
-// if(read.IsSuccess)
-// {
-// byte m100 = read.Content[0];
-// byte m101 = read.Content[1];
-// byte m102 = read.Content[2];
-// byte m103 = read.Content[3];
-// byte m104 = read.Content[4];
-// byte m105 = read.Content[5];
-// byte m106 = read.Content[6];
-// byte m107 = read.Content[7];
-// byte m108 = read.Content[8];
-// byte m109 = read.Content[9];
-// }
-// else
-// {
-// // 鍙戠敓浜嗗紓甯�
-// }
-// }
-
-
- }
-
- /**
- * 绠�鍗曠綉缁滃鎴风
- */
- public static void NetSimplifyClientTest() {
- NetSimplifyClient client = new NetSimplifyClient("127.0.0.1", 12345);
- OperateResultExOne<String> read = client.ReadFromServer(new NetHandle(2), "娴嬭瘯鏁版嵁");
- if (read.IsSuccess) {
- System.out.println(read.Content);
- } else {
- System.out.println("璇诲彇澶辫触锛�" + read.Message);
- }
- }
-
- /**
- * 涓夎彵 A
- */
- private static void MelsecA1ETest() {
- MelsecA1ENet melsec_net = new MelsecA1ENet("192.168.0.100", 5000);
- melsec_net.SetPersistentConnection();
-
- boolean[] M100 = melsec_net.ReadBool("M100", (short) 1).Content; // 璇诲彇M100鏄惁閫氾紝鍗佽繘鍒跺湴鍧�
- boolean[] X20 = melsec_net.ReadBool("X20", (short) 1).Content; // 璇诲彇X20鏄惁閫氾紝鍏繘鍒跺湴鍧�
- boolean[] Y20 = melsec_net.ReadBool("Y20", (short) 1).Content; // 璇诲彇Y20鏄惁閫氾紝鍏繘鍒跺湴鍧�
- short short_D1000 = melsec_net.ReadInt16("D1000").Content; // 璇诲彇D1000鐨剆hort鍊�
- int int_D1000 = melsec_net.ReadInt32("D1000").Content; // 璇诲彇D1000-D1001缁勬垚鐨刬nt鏁版嵁
- float float_D1000 = melsec_net.ReadFloat("D1000").Content; // 璇诲彇D1000-D1001缁勬垚鐨刦loat鏁版嵁
- long long_D1000 = melsec_net.ReadInt64("D1000").Content; // 璇诲彇D1000-D1003缁勬垚鐨刲ong鏁版嵁
- double double_D1000 = melsec_net.ReadDouble("D1000").Content; // 璇诲彇D1000-D1003缁勬垚鐨刣ouble鏁版嵁
- String str_D1000 = melsec_net.ReadString("D1000", (short) 10).Content; // 璇诲彇D1000-D1009缁勬垚鐨勬潯鐮佹暟鎹�
-
-
- melsec_net.Write("M100", new boolean[]{true}); // 鍐欏叆M100涓洪��
- melsec_net.Write("Y20", new boolean[]{true}); // 鍐欏叆Y20涓洪��
- melsec_net.Write("X20", new boolean[]{true}); // 鍐欏叆X20涓洪��
- melsec_net.Write("D1000", (short) 1234); // 鍐欏叆D1000 short鍊� ,W3C0,R3C0 鏁堟灉鏄竴鏍风殑
- melsec_net.Write("D1000", 1234566); // 鍐欏叆D1000 int鍊�
- melsec_net.Write("D1000", 123.456f); // 鍐欏叆D1000 float鍊�
- melsec_net.Write("D1000", 123.456d); // 鍐欏叆D1000 double鍊�
- melsec_net.Write("D1000", 123456661235123534L); // 鍐欏叆D1000 long鍊�
- melsec_net.Write("D1000", "K123456789"); // 鍐欏叆D1000 string鍊�
-
-
- OperateResultExOne<boolean[]> read = melsec_net.ReadBool("M100", (short) 10);
- if (read.IsSuccess) {
- boolean m100 = read.Content[0];
- boolean m101 = read.Content[1];
- boolean m102 = read.Content[2];
- boolean m103 = read.Content[3];
- boolean m104 = read.Content[4];
- boolean m105 = read.Content[5];
- boolean m106 = read.Content[6];
- boolean m107 = read.Content[7];
- boolean m108 = read.Content[8];
- boolean m109 = read.Content[9];
- } else {
- System.out.print("璇诲彇澶辫触锛�" + read.Message);
- }
-
-
- OperateResultExOne<byte[]> read1 = melsec_net.Read("D100", (short) 5);
- if (read1.IsSuccess) {
- short D100 = melsec_net.getByteTransform().TransInt16(read1.Content, 0);
- short D101 = melsec_net.getByteTransform().TransInt16(read1.Content, 2);
- short D102 = melsec_net.getByteTransform().TransInt16(read1.Content, 4);
- short D103 = melsec_net.getByteTransform().TransInt16(read1.Content, 6);
- short D104 = melsec_net.getByteTransform().TransInt16(read1.Content, 8);
- } else {
- System.out.print("璇诲彇澶辫触锛�" + read1.Message);
- }
-
-
- //瑙f瀽澶嶆潅鏁版嵁
- OperateResultExOne<byte[]> read3 = melsec_net.Read("D4000", (short) 10);
- if (read3.IsSuccess) {
- double 娓╁害 = melsec_net.getByteTransform().TransInt16(read3.Content, 0) / 10d;//绱㈠紩寰堥噸瑕�
- double 鍘嬪姏 = melsec_net.getByteTransform().TransInt16(read3.Content, 2) / 100d;
- boolean IsRun = melsec_net.getByteTransform().TransInt16(read3.Content, 4) == 1;
- int 浜ч噺 = melsec_net.getByteTransform().TransInt32(read3.Content, 6);
- String 瑙勬牸 = melsec_net.getByteTransform().TransString(read3.Content, 10, 10, "ascii");
- } else {
- System.out.print("璇诲彇澶辫触锛�" + read3.Message);
- }
-
- // 鍐欏叆娴嬭瘯锛孧100-M104 鍐欏叆娴嬭瘯 姝ゅ鍐欏叆鍚嶮100:閫� M101:鏂� M102:鏂� M103:閫� M104:閫�
- boolean[] values = new boolean[]{true, false, false, true, true};
- OperateResult write = melsec_net.Write("M100", values);
- if (write.IsSuccess) {
- System.out.print("鍐欏叆鎴愬姛");
- } else {
- System.out.print("鍐欏叆澶辫触锛�" + write.Message);
- }
-
-
- OperateResultExOne<Boolean> read2 = melsec_net.ReadBool("M100");
- if (read2.IsSuccess) {
- System.out.println(read2.Content);
- } else {
- System.out.println("璇诲彇澶辫触锛�" + read.Message);
- }
- }
-
- /**
- * 涓夎彵 Q
- */
- private static void MelsecTest() {
- MelsecMcNet melsec_net = new MelsecMcNet("192.168.1.192", 6001);
-
-
- boolean[] M100 = melsec_net.ReadBool("M100", (short) 1).Content; // 璇诲彇M100鏄惁閫氾紝鍗佽繘鍒跺湴鍧�
- boolean[] X1A0 = melsec_net.ReadBool("X1A0", (short) 1).Content; // 璇诲彇X1A0鏄惁閫氾紝鍗佸叚杩涘埗鍦板潃
- boolean[] Y1A0 = melsec_net.ReadBool("Y1A0", (short) 1).Content; // 璇诲彇Y1A0鏄惁閫氾紝鍗佸叚杩涘埗鍦板潃
- boolean[] B1A0 = melsec_net.ReadBool("B1A0", (short) 1).Content; // 璇诲彇B1A0鏄惁閫氾紝鍗佸叚杩涘埗鍦板潃
- short short_D1000 = melsec_net.ReadInt16("D1000").Content; // 璇诲彇D1000鐨剆hort鍊� ,W3C0,R3C0 鏁堟灉鏄竴鏍风殑
- int int_D1000 = melsec_net.ReadInt32("D1000").Content; // 璇诲彇D1000-D1001缁勬垚鐨刬nt鏁版嵁
- float float_D1000 = melsec_net.ReadFloat("D1000").Content; // 璇诲彇D1000-D1001缁勬垚鐨刦loat鏁版嵁
- long long_D1000 = melsec_net.ReadInt64("D1000").Content; // 璇诲彇D1000-D1003缁勬垚鐨刲ong鏁版嵁
- double double_D1000 = melsec_net.ReadDouble("D1000").Content; // 璇诲彇D1000-D1003缁勬垚鐨刣ouble鏁版嵁
- String str_D1000 = melsec_net.ReadString("D1000", (short) 10).Content; // 璇诲彇D1000-D1009缁勬垚鐨勬潯鐮佹暟鎹�
-
-
- melsec_net.Write("M100", new boolean[]{true}); // 鍐欏叆M100涓洪��
- melsec_net.Write("Y1A0", new boolean[]{true}); // 鍐欏叆Y1A0涓洪��
- melsec_net.Write("X1A0", new boolean[]{true}); // 鍐欏叆X1A0涓洪��
- melsec_net.Write("B1A0", new boolean[]{true}); // 鍐欏叆B1A0涓洪��
- melsec_net.Write("D1000", (short) 1234); // 鍐欏叆D1000 short鍊� ,W3C0,R3C0 鏁堟灉鏄竴鏍风殑
- melsec_net.Write("D1000", 1234566); // 鍐欏叆D1000 int鍊�
- melsec_net.Write("D1000", 123.456f); // 鍐欏叆D1000 float鍊�
- melsec_net.Write("D1000", 123.456d); // 鍐欏叆D1000 double鍊�
- melsec_net.Write("D1000", 123456661235123534L); // 鍐欏叆D1000 long鍊�
- melsec_net.Write("D1000", "K123456789"); // 鍐欏叆D1000 string鍊�
-
-
- OperateResultExOne<boolean[]> read = melsec_net.ReadBool("M100", (short) 10);
- if (read.IsSuccess) {
- boolean m100 = read.Content[0];
- boolean m101 = read.Content[1];
- boolean m102 = read.Content[2];
- boolean m103 = read.Content[3];
- boolean m104 = read.Content[4];
- boolean m105 = read.Content[5];
- boolean m106 = read.Content[6];
- boolean m107 = read.Content[7];
- boolean m108 = read.Content[8];
- boolean m109 = read.Content[9];
- } else {
- System.out.print("璇诲彇澶辫触锛�" + read.Message);
- }
-
-
- OperateResultExOne<byte[]> read1 = melsec_net.Read("D100", (short) 5);
- if (read1.IsSuccess) {
- short D100 = melsec_net.getByteTransform().TransByte(read1.Content, 0);
- short D101 = melsec_net.getByteTransform().TransByte(read1.Content, 2);
- short D102 = melsec_net.getByteTransform().TransByte(read1.Content, 4);
- short D103 = melsec_net.getByteTransform().TransByte(read1.Content, 6);
- short D104 = melsec_net.getByteTransform().TransByte(read1.Content, 8);
- } else {
- System.out.print("璇诲彇澶辫触锛�" + read1.Message);
- }
-
-
- //瑙f瀽澶嶆潅鏁版嵁
- OperateResultExOne<byte[]> read3 = melsec_net.Read("D4000", (short) 10);
- if (read3.IsSuccess) {
- double 娓╁害 = melsec_net.getByteTransform().TransInt16(read3.Content, 0) / 10d;//绱㈠紩寰堥噸瑕�
- double 鍘嬪姏 = melsec_net.getByteTransform().TransInt16(read3.Content, 2) / 100d;
- boolean IsRun = melsec_net.getByteTransform().TransInt16(read3.Content, 4) == 1;
- int 浜ч噺 = melsec_net.getByteTransform().TransInt32(read3.Content, 6);
- String 瑙勬牸 = melsec_net.getByteTransform().TransString(read3.Content, 10, 10, "ascii");
- } else {
- System.out.print("璇诲彇澶辫触锛�" + read3.Message);
- }
-
- // 鍐欏叆娴嬭瘯锛孧100-M104 鍐欏叆娴嬭瘯 姝ゅ鍐欏叆鍚嶮100:閫� M101:鏂� M102:鏂� M103:閫� M104:閫�
- boolean[] values = new boolean[]{true, false, false, true, true};
- OperateResult write = melsec_net.Write("M100", values);
- if (write.IsSuccess) {
- System.out.print("鍐欏叆鎴愬姛");
- } else {
- System.out.print("鍐欏叆澶辫触锛�" + write.Message);
- }
-
-
- OperateResultExOne<Boolean> read2 = melsec_net.ReadBool("M100");
- if (read2.IsSuccess) {
- System.out.println(read2.Content);
- } else {
- System.out.println("璇诲彇澶辫触锛�" + read.Message);
- }
- }
-
- /**
- * 涓夎彵 Q ASCII閫氳鏍煎紡
- */
- private static void MelsecAsciiTest(){
-
- MelsecMcAsciiNet melsec = new MelsecMcAsciiNet("192.168.1.192",6001);
- OperateResultExOne<short[]> read = melsec.ReadInt16("D100",(short) 2);
- if(read.IsSuccess)
- {
- System.out.println(Arrays.toString(read.Content));
- }
- else {
- System.out.println(read.ToMessageShowString());
- }
- }
-
-
- /**
- * 瑗块棬瀛�
- */
- private static void SiemesTest(){
- SiemensS7Net siemens_net = new SiemensS7Net(SiemensPLCS.S1200,"192.168.1.195");
- OperateResult connect = siemens_net.ConnectServer();
- if(connect.IsSuccess){
- System.out.println("connect success!");
- }
- else {
- System.out.println("failed:"+connect.Message);
- }
- siemens_net.ConnectClose();
-
- // 涓婇潰鏄垵濮嬪寲
- System.out.println(siemens_net.ReadByte("M100").Content);
-
- byte m100_byte = siemens_net.ReadByte("M100").Content;
- short m100_short = siemens_net.ReadInt16("M100").Content;
- int m100_int = siemens_net.ReadInt32("M100").Content;
- long m100_long = siemens_net.ReadInt64("M100").Content;
- float m100_float = siemens_net.ReadFloat("M100").Content;
- double m100_double = siemens_net.ReadDouble("M100").Content;
- String m100_string = siemens_net.ReadString("M100",(short) 10).Content;
-
- siemens_net.Write("M100",(byte) 123);
- siemens_net.Write("M100",(short) 123);
- siemens_net.Write("M100",(int) 123);
- siemens_net.Write("M100",(long) 123);
- siemens_net.Write("M100", 123.456f);
- siemens_net.Write("M100", 123.456d);
- siemens_net.Write("M100","1234567890");
-
- OperateResultExOne<byte[]> read = siemens_net.Read( "M100", (short) 10 );
- {
- if(read.IsSuccess)
- {
- byte m100 = read.Content[0];
- byte m101 = read.Content[1];
- byte m102 = read.Content[2];
- byte m103 = read.Content[3];
- byte m104 = read.Content[4];
- byte m105 = read.Content[5];
- byte m106 = read.Content[6];
- byte m107 = read.Content[7];
- byte m108 = read.Content[8];
- byte m109 = read.Content[9];
- }
- else
- {
- // 鍙戠敓浜嗗紓甯�
- }
- }
-
- }
-
- private static void PushNetTest() {
- NetPushClient client = new NetPushClient("127.0.0.1", 23467, "A");
- OperateResult connect = client.CreatePush(new ActionOperateExTwo<NetPushClient,String>(){
- @Override
- public void Action(NetPushClient content1, String content2) {
- System.out.println(content2);
- }
- });
- if (connect.IsSuccess) {
- System.out.println("杩炴帴鎴愬姛!");
- } else {
- System.out.println("杩炴帴澶辫触!"+connect.Message);
- }
- }
-
- private static void ModbusTcpTets(){
- ModbusTcpNet modbusTcpNet = new ModbusTcpNet("127.0.0.1",502,(byte) 0x01);
- // 褰撲綘闇�瑕佹寚瀹氭牸寮忕殑鏁版嵁瑙f瀽鏃讹紝灏遍渶瑕佽缃笅闈㈢殑杩欎釜淇℃伅
- modbusTcpNet.setDataFormat(DataFormat.BADC);
- OperateResultExOne<Double> read = modbusTcpNet.ReadDouble("s=2;x=4;200");
- if(read.IsSuccess){
- System.out.println(read.Content);
- }
- else {
- System.out.println(read.Message);
- }
-
- modbusTcpNet.Write("100",new int[]{12345,-12345});
- }
-
- private static void NetComplexClientTest(){
- System.out.println("Hello World!绛夊緟10s鍏抽棴");
- NetComplexClient client = new NetComplexClient();
- client.setIpAddress("127.0.0.1");
- client.setPort(12346);
- client.setClientAlias("娴嬭瘯1");
- client.AcceptString= new ActionOperateExThree<NetComplexClient,NetHandle,String>(){
- @Override
- public void Action(NetComplexClient content1, NetHandle content2, String content3) {
- System.out.println("Handle:"+content2.get_CodeValue()+" Value:"+content3);
- }
- };
-
-
- client.ClientStart();
-
-// client.Send(new NetHandle(1),"asdasdi闃挎柉杈鹃樋鏂揪");
-// System.out.println(client.getDelayTime());
-// Thread.sleep(100000);
-// client.ClientClose();
-
-
- }
-
-}
diff --git a/src/main/java/com/zy/common/R.java b/src/main/java/com/zy/common/R.java
new file mode 100644
index 0000000..7635f38
--- /dev/null
+++ b/src/main/java/com/zy/common/R.java
@@ -0,0 +1,53 @@
+package com.zy.common;
+
+import java.util.HashMap;
+
+public class R extends HashMap<String, Object> {
+ private static final long serialVersionUID = 1L;
+ private static final String CODE = "code";
+ private static final String MSG = "msg";
+ private static final String DATA = "data";
+
+ public R(Integer code, String msg) {
+ super.put("code", code);
+ super.put("msg", msg);
+ }
+
+ public static R ok() {
+ return parse("200-鎿嶄綔鎴愬姛");
+ }
+
+ public static R ok(String msg) {
+ R r = ok();
+ r.put("msg", msg);
+ return r;
+ }
+
+ public static R ok(Object obj) {
+ return parse("200-鎿嶄綔鎴愬姛").add(obj);
+ }
+
+ public static R error() {
+ return parse("500-鏈嶅姟鍣ㄩ敊璇�");
+ }
+
+ public static R error(String msg) {
+ R r = error();
+ r.put("msg", msg);
+ return r;
+ }
+
+ public R add(Object obj) {
+ this.put("data", obj);
+ return this;
+ }
+
+ public static R parse(String message) {
+ if (Cools.isEmpty(message)) {
+ return parse("500-鏈嶅姟鍣ㄩ敊璇�");
+ } else {
+ String[] msg = message.split("-");
+ return msg.length == 2 ? new R(Integer.parseInt(msg[0]), msg[1]) : parse("500-".concat(message));
+ }
+ }
+}
diff --git a/src/main/java/com/zy/common/SpringUtils.java b/src/main/java/com/zy/common/SpringUtils.java
new file mode 100644
index 0000000..579353b
--- /dev/null
+++ b/src/main/java/com/zy/common/SpringUtils.java
@@ -0,0 +1,34 @@
+package com.zy.common;
+
+import com.zy.common.exception.CoolException;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+public class SpringUtils implements ApplicationContextAware {
+ private static ApplicationContext application;
+
+ public static void init(ApplicationContext context) {
+ application = context;
+ }
+
+ public void setApplicationContext(ApplicationContext context) throws BeansException {
+ application = context;
+ }
+
+ private static ApplicationContext getApplicationContext() {
+ if (application == null) {
+ throw new CoolException("500-鏈嶅姟鍣ㄩ敊璇�");
+ } else {
+ return application;
+ }
+ }
+
+ public static <T> T getBean(Class<T> prototype) {
+ return (T)getApplicationContext().getBean(prototype);
+ }
+
+ public static Object getBean(String name) {
+ return getApplicationContext().getBean(name);
+ }
+}
diff --git a/src/main/java/com/zy/common/annotations/OpenApiLog.java b/src/main/java/com/zy/common/annotations/OpenApiLog.java
deleted file mode 100644
index b476711..0000000
--- a/src/main/java/com/zy/common/annotations/OpenApiLog.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.zy.common.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target({ElementType.TYPE, ElementType.METHOD})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface OpenApiLog {
- boolean value() default true;
-
- String memo() default "";
-}
diff --git a/src/main/java/com/zy/common/config/AdminInterceptor.java b/src/main/java/com/zy/common/config/AdminInterceptor.java
deleted file mode 100644
index c435cd3..0000000
--- a/src/main/java/com/zy/common/config/AdminInterceptor.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package com.zy.common.config;
-
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.core.annotations.ManagerAuth;
-import com.core.common.BaseRes;
-import com.core.common.Cools;
-import com.zy.common.utils.Http;
-import com.zy.system.entity.*;
-import com.zy.system.service.*;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.lang.Nullable;
-import org.springframework.stereotype.Component;
-import org.springframework.web.method.HandlerMethod;
-import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.lang.reflect.Method;
-
-/**
- * Created by vincent on 2019-06-13
- */
-@Component
-public class AdminInterceptor extends HandlerInterceptorAdapter {
-
- @Value("${super.pwd}")
- private String superPwd;
- @Autowired
- private UserService userService;
- @Autowired
- private UserLoginService userLoginService;
- @Autowired
- private OperateLogService operateLogService;
- @Autowired
- private PermissionService permissionService;
- @Autowired
- private RolePermissionService rolePermissionService;
-
- @Override
- public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
- cors(response);
- if (handler instanceof org.springframework.web.servlet.resource.ResourceHttpRequestHandler) {
- return true;
- }
- // super璐﹀彿
- String token = request.getHeader("token");
- if (token!=null) {
- String deToken = Cools.deTokn(token, superPwd);
- if (deToken!=null){
- long timestamp = Long.parseLong(deToken.substring(0, 13));
- // 1澶╁悗杩囨湡
- if (System.currentTimeMillis() - timestamp > 86400000){
- Http.response(response, BaseRes.DENIED);
- return false;
- }
- if ("super".equals(deToken.substring(13))) {
- request.setAttribute("userId", 9527);
- return true;
- }
- }
- }
- // 璺ㄥ煙璁剧疆
- // response.setHeader("Access-Control-Allow-Origin", "*");
- HandlerMethod handlerMethod = (HandlerMethod) handler;
- Method method = handlerMethod.getMethod();
- if (method.isAnnotationPresent(ManagerAuth.class)){
- ManagerAuth annotation = method.getAnnotation(ManagerAuth.class);
- if (annotation.value().equals(ManagerAuth.Auth.CHECK)){
- return check(request, response, annotation.memo());
- }
- }
- return true;
- }
-
- @Override
- public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable ModelAndView modelAndView) {
-// Object obj = request.getAttribute("operateLog");
-// if (obj instanceof OperateLog) {
-// OperateLog operate = (OperateLog) obj;
-// operate.setResponse(String.valueOf(response.getStatus()));
-// operateLogService.insert(operate);
-// }
- }
-
- private boolean check(HttpServletRequest request, HttpServletResponse response, String memo) {
- try {
- String token = request.getHeader("token");
- UserLogin userLogin = userLoginService.selectOne(new EntityWrapper<UserLogin>().eq("token", token).eq("system", "WCS"));
- if (null == userLogin){
- Http.response(response, BaseRes.DENIED);
- return false;
- }
- User user = userService.selectById(userLogin.getUserId());
- String deToken = Cools.deTokn(token, user.getPassword());
- long timestamp = Long.parseLong(deToken.substring(0, 13));
- // 1澶╁悗杩囨湡
- if (System.currentTimeMillis() - timestamp > 86400000){
- Http.response(response, BaseRes.DENIED);
- return false;
- }
- // 鏉冮檺鏍¢獙
- if (!limit(request.getRequestURI(), user)) {
- Http.response(response, BaseRes.LIMIT);
- return false;
- }
- // 鎿嶄綔鏃ュ織
- OperateLog operateLog = new OperateLog();
- operateLog.setAction(Cools.isEmpty(memo)?request.getRequestURI():memo);
- operateLog.setIp(request.getRemoteAddr());
- operateLog.setUserId(user.getId());
- operateLog.setRequest(JSON.toJSONString(request.getParameterMap()));
- operateLog.setResponse(JSON.toJSONString(request.getRequestURI()));
- operateLogService.insert(operateLog);
- // 璇锋眰缂撳瓨
- request.setAttribute("userId", user.getId());
-// request.setAttribute("operateLog", operateLog);
- return true;
- } catch (Exception e){
- Http.response(response, BaseRes.DENIED);
- return false;
- }
-
- }
-
- /**
- * 鏉冮檺鎷︽埅
- * @return false:鏃犳潈闄�; true:璁よ瘉閫氳繃
- */
- private boolean limit(String action, User user) {
- Permission permission = new Permission();
- permission.setAction(action);
- permission.setStatus((short) 1);
- Permission one = permissionService.selectOne(new EntityWrapper<>(permission));
- if (!Cools.isEmpty(one)) {
- RolePermission rolePermission = rolePermissionService.selectOne(new EntityWrapper<>(new RolePermission(user.getRoleId(), permission.getId())));
- return !Cools.isEmpty(rolePermission);
- }
- return true;
- }
-
- /**
- * 璺ㄥ煙
- */
- private void cors(HttpServletResponse response){
- // 璺ㄥ煙璁剧疆
- response.setHeader("Access-Control-Allow-Origin", "*");
- response.setHeader("Access-Control-Allow-Credentials", "true");
- response.setHeader("Access-Control-Allow-Methods", "*");
- response.setHeader("Access-Control-Allow-Headers", "Content-Type,Access-Token");
- response.setHeader("Access-Control-Expose-Headers", "*");
-
- }
-
-}
diff --git a/src/main/java/com/zy/common/config/CoolExceptionHandler.java b/src/main/java/com/zy/common/config/CoolExceptionHandler.java
index 9a6fe2d..67e1d8c 100644
--- a/src/main/java/com/zy/common/config/CoolExceptionHandler.java
+++ b/src/main/java/com/zy/common/config/CoolExceptionHandler.java
@@ -1,7 +1,7 @@
package com.zy.common.config;
-import com.core.common.R;
-import com.core.exception.CoolException;
+import com.zy.common.R;
+import com.zy.common.exception.CoolException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
diff --git a/src/main/java/com/zy/common/config/WebConfig.java b/src/main/java/com/zy/common/config/WebConfig.java
deleted file mode 100644
index 11bb6b2..0000000
--- a/src/main/java/com/zy/common/config/WebConfig.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.zy.common.config;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-/**
- * Created by vincent on 2019-06-13
- */
-@Configuration
-public class WebConfig implements WebMvcConfigurer {
-
- @Autowired
- private AdminInterceptor adminInterceptor;
-
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- registry.addInterceptor(adminInterceptor)
- .addPathPatterns("/**")
- ;
- }
-
-}
diff --git a/src/main/java/com/zy/common/config/WebSocketConfig.java b/src/main/java/com/zy/common/config/WebSocketConfig.java
deleted file mode 100644
index 32c1bd6..0000000
--- a/src/main/java/com/zy/common/config/WebSocketConfig.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.zy.common.config;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
-import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
-import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
-import org.springframework.web.socket.server.standard.ServerEndpointExporter;
-
-@Configuration
-@EnableWebSocketMessageBroker
-public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
-
- @Bean
- public ServerEndpointExporter serverEndpointExporter() {
- return new ServerEndpointExporter();
- }
-
- @Override
- public void registerStompEndpoints(StompEndpointRegistry registry) {
- registry.addEndpoint("/api/socket");
- }
-}
-
diff --git a/src/main/java/com/zy/common/entity/Parameter.java b/src/main/java/com/zy/common/entity/Parameter.java
deleted file mode 100644
index 548158f..0000000
--- a/src/main/java/com/zy/common/entity/Parameter.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.zy.common.entity;
-
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.core.common.Cools;
-import com.core.common.SpringUtils;
-import com.zy.system.entity.Config;
-import com.zy.system.service.ConfigService;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 鍩虹閰嶇疆涓績銆傚彲閫氳繃鍒锋柊鎸囧畾鎺ュ彛鍒锋柊鐩稿叧閰嶇疆
- */
-public class Parameter {
-
- private volatile static Parameter instance = null;
-
- private Parameter(){
- }
-
- public static Parameter get(){
- if (instance == null){
- synchronized (Parameter.class){
- instance = reset();
- return instance;
- }
- }
- return instance;
- }
-
- /**
- * 閲嶇疆
- */
- public static Parameter reset() {
- ConfigService configService = SpringUtils.getBean(ConfigService.class);
- List<Config> configs = configService.selectList(new EntityWrapper<Config>().eq("status", "1"));
- Map<String, Object> data = new HashMap<>();
- for (Config config : configs) {
- if (config.getType() == 1) {
- data.put(config.getCode(), String.valueOf(config.getValue()));
- } else {
- data.put(config.getCode(), JSON.parse(config.getValue()));
- }
- }
- instance = Cools.conver(data, Parameter.class);
- return instance;
- }
-
- // 楠岃瘉鐮佸紑鍏�
- private String codeSwitch;
-
- public String getCodeSwitch() {
- return codeSwitch;
- }
-
- public void setCodeSwitch(String codeSwitch) {
- this.codeSwitch = codeSwitch;
- }
-
- private String ledDefaultMsg;
-
- public String getLedDefaultMsg() {
- return ledDefaultMsg;
- }
-
- public void setLedDefaultMsg(String ledDefaultMsg) {
- this.ledDefaultMsg = ledDefaultMsg;
- }
-
-}
diff --git a/src/main/java/com/zy/common/exception/CoolException.java b/src/main/java/com/zy/common/exception/CoolException.java
new file mode 100644
index 0000000..39c943d
--- /dev/null
+++ b/src/main/java/com/zy/common/exception/CoolException.java
@@ -0,0 +1,11 @@
+package com.zy.common.exception;
+
+public class CoolException extends RuntimeException {
+ public CoolException(Throwable e) {
+ super(e);
+ }
+
+ public CoolException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/com/zy/common/model/PageParam.java b/src/main/java/com/zy/common/model/PageParam.java
deleted file mode 100644
index a2f24e6..0000000
--- a/src/main/java/com/zy/common/model/PageParam.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.zy.common.model;
-
-import io.swagger.annotations.ApiModelProperty;
-
-/**
- * 鍒嗛〉鍙傛暟
- * Created by vincent on 2020-04-10
- */
-public class PageParam {
-
- @ApiModelProperty(value="鍒嗛〉绱㈠紩",required=true)
- private int page = 1;
-
- @ApiModelProperty(value="鍗曢〉鏁伴噺",required=true)
- private int size = 10;
-
- public Integer getPage() {
- return page;
- }
-
- public void setPage(Integer page) {
- this.page = page;
- }
-
- public Integer getSize() {
- return size;
- }
-
- public void setSize(Integer size) {
- this.size = size;
- }
-
-}
diff --git a/src/main/java/com/zy/common/model/PowerDto.java b/src/main/java/com/zy/common/model/PowerDto.java
deleted file mode 100644
index a060fe2..0000000
--- a/src/main/java/com/zy/common/model/PowerDto.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.zy.common.model;
-
-import java.util.List;
-
-/**
- * Created by vincent on 2020-05-12
- */
-public class PowerDto {
-
- private String two;
-
- private List<String> three;
-
- public String getTwo() {
- return two;
- }
-
- public void setTwo(String two) {
- this.two = two;
- }
-
- public List<String> getThree() {
- return three;
- }
-
- public void setThree(List<String> three) {
- this.three = three;
- }
-}
diff --git a/src/main/java/com/zy/common/model/Shelves.java b/src/main/java/com/zy/common/model/Shelves.java
deleted file mode 100644
index de2aa46..0000000
--- a/src/main/java/com/zy/common/model/Shelves.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.zy.common.model;
-
-import com.alibaba.fastjson.JSON;
-import com.core.exception.CoolException;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * <strong>绔嬪簱璐ф灦瀹炰綋绫�</strong>
- * Created by vincent on 2020/6/11
- */
-public class Shelves {
-
- // 璐ф灦鎺掓暟閲�
- public final int size;
-
- // 璐ф灦缁勬暟閲�
- public final int group;
-
- // 鍋忕Щ閲廩default:0]
- public final int offset;
-
- // 璐ф灦瀹炰緥鑺傜偣闆嗗悎
- public List<List<Integer>> nodes;
-
- public Shelves(int size, int group) {
- this(size, group, 0);
- }
-
- /**
- * @param size 璐ф灦鍗曟帓鎬绘暟
- * @param group 璐ф灦缁勬暟閲�
- * @param offset 搴忓垪鍙峰亸绉婚噺
- */
- public Shelves(int size, int group, int offset) {
- this.size = size;
- this.group = group;
- this.offset = offset;
- init();
- }
-
- /**
- * 鍒濆鍖栨柟娉曘�愮鏈夈��
- */
- private void init(){
- if (group == 0 || size%group != 0) {
- throw new RuntimeException("shelves init fail!");
- }
- nodes = new ArrayList<>();
- for (int g = 1; g <= this.group; g++){
- int unit = size/group;
- List<Integer> node = new ArrayList<>();
- for (int i = (g-1)*unit+1+offset ; i <= g*unit+offset; i++){
- node.add(i);
- }
- nodes.add(node);
- }
- }
-
- /**
- * 寮�濮嬭绠� =======>>>
- *
- * 璐ф灦鍛戒腑瑙勫垯濡備笅锛�
- * 瀹夎浣嶇疆锛� [1] [2] | [3] [4] -------- [5] [6] | [7] [8]
- * 鍛戒腑椤哄簭锛� 1 -> 5 -> 4 -> 8 -> 2 -> 6 -> 3 -> 7 -> 1 ...
- *
- * 1.璇ヨ鍒欓�備笉闄愬埗璐ф灦鏁伴噺锛屾�绘暟涓庣粍鍒湪鏋勯�犲櫒涓缃�
- * 2.濡傛湁搴忓垪鍙疯捣濮嬮棶棰橈紝鐢ㄥ亸绉婚噺瑙勯伩鍗冲彲
- *
- * @param curSeq 褰撳墠璐ф灦鍙�
- * @return 瑙勫垯鍛戒腑璐ф灦鍙�
- */
- public int start(int curSeq){
- Iterator<List<Integer>> iterator = nodes.iterator();
- while (iterator.hasNext()){
- List<Integer> node = iterator.next();
- if (node.contains(curSeq)) {
- int idx = node.indexOf(curSeq);
- // 鏄惁涓烘湯灏捐揣鏋�
- if (iterator.hasNext()) {
- return iterator.next().get(idx);
- } else {
- List<Integer> first = nodes.get(0);
- int val = first.get(idx);
- int res = size / group + 1 + offset - val;
- // 鍙嶅悜鍛戒腑璐ф灦鏃朵笉鍐嶆槸瀵圭珛涓嬫爣锛堢浉瀵逛簬宸烽亾锛�
- if (res < val) {
- // 杞鎵�鏈夎揣鏋跺悗閲嶆柊寮�濮嬪畾浣�
- if (val - res - offset == 1) {
- return first.get(0);
- }
- res = res + 1;
- }
- return res + offset;
- }
- }
- }
- return -1;
- }
-
- public Integer get(Integer curRow) {
- for (List<Integer> node : nodes){
- if (node.contains(curRow)) {
- return nodes.indexOf(node) + 1;
- }
- }
- throw new CoolException("璐ф帓妫�绱㈢郴缁熸姤閿欙紝 node:" + JSON.toJSONString(nodes) + ", curRow:" + curRow);
- }
-
- public static void main(String[] args) throws InterruptedException {
- Shelves shelves = new Shelves(8,2);
- System.out.println(shelves.nodes.toString());
- int start = 1;
- while (true) {
- System.out.println(start);
- start = shelves.start(start);
- Thread.sleep(500L);
- }
- }
-
-}
-
diff --git a/src/main/java/com/zy/common/model/annotations/bit.java b/src/main/java/com/zy/common/model/annotations/bit.java
deleted file mode 100644
index b8452db..0000000
--- a/src/main/java/com/zy/common/model/annotations/bit.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.zy.common.model.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 鏍囪瘑娉ㄨВ绫�
- * @author vincent
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD})
-public @interface bit {
- int value();
-}
diff --git a/src/main/java/com/zy/common/model/annotations/expr.java b/src/main/java/com/zy/common/model/annotations/expr.java
deleted file mode 100644
index 06e4da7..0000000
--- a/src/main/java/com/zy/common/model/annotations/expr.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.zy.common.model.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 鏍囪瘑娉ㄨВ绫�
- * @author vincent
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD})
-public @interface expr {
- String value();
-}
diff --git a/src/main/java/com/zy/common/model/annotations/flag.java b/src/main/java/com/zy/common/model/annotations/flag.java
deleted file mode 100644
index 03fc98a..0000000
--- a/src/main/java/com/zy/common/model/annotations/flag.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.zy.common.model.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 鏍囪瘑娉ㄨВ绫�
- * @author vincent
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD})
-public @interface flag {
- String value();
-}
diff --git a/src/main/java/com/zy/common/model/annotations/little.java b/src/main/java/com/zy/common/model/annotations/little.java
deleted file mode 100644
index 9bbc47f..0000000
--- a/src/main/java/com/zy/common/model/annotations/little.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.zy.common.model.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 灏忕妯″紡娉ㄨВ绫�
- * @author vincent
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD})
-public @interface little {}
\ No newline at end of file
diff --git a/src/main/java/com/zy/common/model/annotations/size.java b/src/main/java/com/zy/common/model/annotations/size.java
deleted file mode 100644
index 1b84242..0000000
--- a/src/main/java/com/zy/common/model/annotations/size.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.zy.common.model.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 鏍囪瘑娉ㄨВ绫�
- * @author vincent
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD})
-public @interface size {
- int value();
-}
diff --git a/src/main/java/com/zy/common/model/enums/NavigationMapType.java b/src/main/java/com/zy/common/model/enums/NavigationMapType.java
deleted file mode 100644
index 99cc6ac..0000000
--- a/src/main/java/com/zy/common/model/enums/NavigationMapType.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.zy.common.model.enums;
-
-public enum NavigationMapType {
-
- NONE(-1, "鏃犺繃婊�"),
- DFX(1, "杩囨护搴撲綅鐘舵�丏FX"),
- NORMAL(2, "杩囨护搴撲綅鐘舵�乆"),
- ;
-
- public Integer id;
- public String desc;
-
- NavigationMapType(Integer id, String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static NavigationMapType get(Short id) {
- if (null == id) {
- return null;
- }
- for (NavigationMapType type : NavigationMapType.values()) {
- if (type.id.equals(id.intValue())) {
- return type;
- }
- }
- return null;
- }
-
- public static NavigationMapType get(NavigationMapType type) {
- if (null == type) {
- return null;
- }
- for (NavigationMapType type1 : NavigationMapType.values()) {
- if (type1 == type) {
- return type1;
- }
- }
- return null;
- }
-
-}
diff --git a/src/main/java/com/zy/common/utils/Arith.java b/src/main/java/com/zy/common/utils/Arith.java
new file mode 100644
index 0000000..301fe10
--- /dev/null
+++ b/src/main/java/com/zy/common/utils/Arith.java
@@ -0,0 +1,78 @@
+package com.zy.common.utils;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+public class Arith {
+ public static double add(int dot, Number... numbers) {
+ return getAirth(dot, Arith.ArithType.ADD.getValue(), numbers);
+ }
+
+ public static double subtract(int dot, Number... numbers) {
+ return getAirth(dot, Arith.ArithType.SUBTRACT.getValue(), numbers);
+ }
+
+ public static double multiplys(int dot, Number... numbers) {
+ return getAirth(dot, Arith.ArithType.MULTIPLY.getValue(), numbers);
+ }
+
+ public static double divides(int dot, Number... numbers) {
+ return getAirth(dot, Arith.ArithType.DIVIDE.getValue(), numbers);
+ }
+
+ public static int percentage(Number... numbers) {
+ return (int) (divides(2, numbers) * (double) 100.0F);
+ }
+
+ public static double remainder(Number... numbers) {
+ return (new BigDecimal(numbers[0].toString())).remainder(new BigDecimal(String.valueOf(numbers[1]))).doubleValue();
+ }
+
+ private static double getAirth(int dot, int arithType, Number... numbers) {
+ if (numbers != null && numbers.length != 0) {
+ BigDecimal bigDecimal = new BigDecimal(numbers[0].toString());
+
+ for (int i = 1; i < numbers.length; ++i) {
+ switch (arithType) {
+ case 0:
+ bigDecimal = bigDecimal.add(new BigDecimal(String.valueOf(numbers[i])));
+ break;
+ case 1:
+ bigDecimal = bigDecimal.divide(new BigDecimal(String.valueOf(numbers[i])), dot, RoundingMode.HALF_UP);
+ break;
+ case 2:
+ bigDecimal = bigDecimal.subtract(new BigDecimal(String.valueOf(numbers[i])));
+ break;
+ case 3:
+ bigDecimal = bigDecimal.multiply(new BigDecimal(String.valueOf(numbers[i])));
+ break;
+ default:
+ return (double) 0.0F;
+ }
+ }
+
+ return bigDecimal.setScale(dot, RoundingMode.HALF_UP).doubleValue();
+ } else {
+ return (double) 0.0F;
+ }
+ }
+
+ private static enum ArithType {
+ ADD("add", 0),
+ DIVIDE("divide", 1),
+ SUBTRACT("subtract", 2),
+ MULTIPLY("multiply", 3);
+
+ private String key;
+ private int value;
+
+ private ArithType(String key, int value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public int getValue() {
+ return this.value;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/zy/common/utils/CollectionUtils.java b/src/main/java/com/zy/common/utils/CollectionUtils.java
deleted file mode 100644
index 4f0fe4c..0000000
--- a/src/main/java/com/zy/common/utils/CollectionUtils.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.zy.common.utils;
-
-import java.util.Set;
-
-/**
- * Created by vincent on 2020/9/3
- */
-public class CollectionUtils {
-
- public static boolean equals(Set<?> set1, Set<?> set2) {
- if(set1 == null || set2 ==null){
- return false;
- }
- if(set1.size()!=set2.size()){
- return false;
- }
- return set1.containsAll(set2);
- }
-
-}
diff --git a/src/main/java/com/zy/common/utils/CommonUtils.java b/src/main/java/com/zy/common/utils/CommonUtils.java
deleted file mode 100644
index 411cc44..0000000
--- a/src/main/java/com/zy/common/utils/CommonUtils.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.zy.common.utils;
-
-import com.core.common.RadixTools;
-
-import java.math.BigDecimal;
-
-/**
- * Created by vincent on 2020-06-03
- */
-public class CommonUtils {
-
- public static Integer parseInt(Object value){
- if(null == value){
- return null;
- }
- String name = value.getClass().getSimpleName().toLowerCase();
- if(name.equals("float")){
- return ((Float)value).intValue();
- } else if(name.equals("double")){
- return ((Double)value).intValue();
- } else if(name.equals("bigdecimal")) {
- return ((BigDecimal)value).intValue();
- } else if(name.equals("long")) {
- return ((Long)value).intValue();
- } else if(name.contains("int")) {
- return (Integer)value;
- } else {
- return Double.valueOf(""+value).intValue();
- }
- }
-
- //int杞瑂hort鏁扮粍
- public static short[] intToShorts(int num) {
- //鍏堝皢int杞负byte鏁扮粍锛屽啀灏哹yte鏁扮粍杞垚涓や釜short锛屽垎鍒崰鐢�4鍜�5绌洪棿
- byte[] bytes = RadixTools.intToBytes(num);
- byte[] tmp1 = {bytes[0], bytes[1]};
- short byteToShort = RadixTools.byteToShort(tmp1);
- byte[] tmp2 = {bytes[2], bytes[3]};
- short byteToShort2 = RadixTools.byteToShort(tmp2);
- return new short[]{byteToShort, byteToShort2};
- }
-
- public static boolean intToBoolean(Integer num) {
- return num != 0;
- }
-
- public static boolean shortToBoolean(Short num) {
- return num != 0;
- }
-
- //浠巖ow銆乥ay銆乴ev鍙傛暟鑾峰彇瀹屾暣搴撲綅鍙�
- public static String getLocNoFromRBL(Integer row, Integer bay, Integer lev) {
- StringBuffer sb = new StringBuffer();
- if (row < 10) {
- sb.append("0");
- }
- sb.append(row);
- if (bay < 10) {
- sb.append("00");
- } else if (bay < 100) {
- sb.append("0");
- }
- sb.append(bay);
- if (lev < 10) {
- sb.append("0");
- }
- sb.append(lev);
- return sb.toString();
- }
-
- public static int[] byteToBits(byte by) {
- StringBuffer sb = new StringBuffer();
- sb.append((by >> 0) & 0x1);
- sb.append((by >> 1) & 0x1);
- sb.append((by >> 2) & 0x1);
- sb.append((by >> 3) & 0x1);
- sb.append((by >> 4) & 0x1);
- sb.append((by >> 5) & 0x1);
- sb.append((by >> 6) & 0x1);
- sb.append((by >> 7) & 0x1);
-
- int[] data = new int[8];
- for (int i = 0; i < sb.length(); i++) {
- data[i] = Integer.parseInt(String.valueOf(sb.charAt(i)));
- }
-
- return data;
- }
-
- public static String bytesToBarcode(byte[] bytes) {
- StringBuffer sb = new StringBuffer();
- for (byte by : bytes) {
- sb.append(by);
- }
- return sb.toString();
- }
-
-}
diff --git a/src/main/java/com/zy/common/utils/DateUtils.java b/src/main/java/com/zy/common/utils/DateUtils.java
new file mode 100644
index 0000000..bb2b18d
--- /dev/null
+++ b/src/main/java/com/zy/common/utils/DateUtils.java
@@ -0,0 +1,160 @@
+package com.zy.common.utils;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
+public class DateUtils {
+ public static final String yyyyMMdd_C = "yyyy骞碝M鏈坉d鏃�";
+ public static final String yyyyMM_F = "yyyy-MM";
+ public static final String yyyyMMdd_F = "yyyy-MM-dd";
+ public static final String yyyyMMddHHmmss_F = "yyyy-MM-dd HH:mm:ss";
+ public static final String yyyyMMddHHmmsssss_F = "yyyy-MM-dd HH:mm:ss,SSS";
+ public static final String yyyy = "yyyy";
+ public static final String yyyyMM = "yyyyMM";
+ public static final String yyyyMMdd = "yyyyMMdd";
+ public static final String yyyyMMddHH = "yyyyMMddHH";
+ public static final String yyyyMMddHHmmss = "yyyyMMddHHmmss";
+ public static final String YYMMDDHHMMSS = "YYMMDDHHMMSS";
+ public static final String yyyyMMddHHmmsssss = "yyyyMMddHHmmssSSS";
+
+ public static String convert(Date date, String pattern) {
+ return (new SimpleDateFormat(pattern)).format(date);
+ }
+
+ public static String convert(Date date) {
+ return convert(date, "yyyy-MM-dd HH:mm:ss");
+ }
+
+ public static Date convert(String str, String pattern) {
+ if (str.length() < pattern.length()) {
+ throw new RuntimeException("鏃堕棿瑙f瀽澶辫触 ==>> " + str);
+ } else {
+ if (str.length() > pattern.length()) {
+ str = str.substring(0, pattern.length());
+ }
+
+ SimpleDateFormat format = new SimpleDateFormat(pattern);
+
+ try {
+ Date date = format.parse(str);
+ return date;
+ } catch (ParseException var5) {
+ throw new RuntimeException("鏃堕棿瑙f瀽澶辫触 ==>> " + str);
+ }
+ }
+ }
+
+ public static Date convert(String str) {
+ return convert(str, "yyyy-MM-dd HH:mm:ss");
+ }
+
+ public static int diff(Date date1, Date date2) {
+ return getDaysByTimestamp(Math.abs(date2.getTime() - date1.getTime()));
+ }
+
+ public static long diffToMinute(Date date1, Date date2) {
+ return Math.abs(date2.getTime() - date1.getTime()) / 1000L / 60L;
+ }
+
+ public static long diffToSeconds(Date date1, Date date2) {
+ return Math.abs(date2.getTime() - date1.getTime()) / 1000L;
+ }
+
+ private static int getDaysByTimestamp(long timestamp) {
+ double daysPoint = Arith.divides(2, new Number[]{timestamp, 86400000});
+ int daysPoint1 = (int)daysPoint;
+ double daysPoint2 = (double)daysPoint1;
+ return daysPoint > daysPoint2 ? daysPoint1 + 1 : daysPoint1;
+ }
+
+ public static int diffToNow(Date date) {
+ long diff = (new Date()).getTime() - date.getTime();
+ return (int)(Math.abs(diff) / 1000L);
+ }
+
+ public static String createTimeStamp() {
+ return Long.toString(System.currentTimeMillis() / 1000L);
+ }
+
+ public static Date calculate(Date date, Long val, TimeUnit timeUnit, boolean subtraction) {
+ return !Objects.isNull(date) && !Objects.isNull(val) && !Objects.isNull(timeUnit) ? new Date(subtraction ? date.getTime() - timeUnit.toMillis(val) : date.getTime() + timeUnit.toMillis(val)) : null;
+ }
+
+ public static Date calculate(Date date, Long val, TimeUnit timeUnit) {
+ return calculate(date, val, timeUnit, false);
+ }
+
+ public static DateEntity getDateEntity(Date date) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ DateEntity dateEntity = new DateEntity();
+ dateEntity.setYear(cal.get(1));
+ dateEntity.setMonth(cal.get(2));
+ dateEntity.setDay(cal.get(5));
+ dateEntity.setHour(cal.get(11));
+ dateEntity.setMinute(cal.get(12));
+ dateEntity.setSecond(cal.get(13));
+ return dateEntity;
+ }
+
+ static class DateEntity {
+ int year;
+ int month;
+ int day;
+ int hour;
+ int minute;
+ int second;
+
+ public int getYear() {
+ return this.year;
+ }
+
+ public void setYear(int year) {
+ this.year = year;
+ }
+
+ public int getMonth() {
+ return this.month;
+ }
+
+ public void setMonth(int month) {
+ this.month = month + 1;
+ }
+
+ public int getDay() {
+ return this.day;
+ }
+
+ public void setDay(int day) {
+ this.day = day;
+ }
+
+ public int getHour() {
+ return this.hour;
+ }
+
+ public void setHour(int hour) {
+ this.hour = hour;
+ }
+
+ public int getMinute() {
+ return this.minute;
+ }
+
+ public void setMinute(int minute) {
+ this.minute = minute;
+ }
+
+ public int getSecond() {
+ return this.second;
+ }
+
+ public void setSecond(int second) {
+ this.second = second;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/zy/common/utils/Http.java b/src/main/java/com/zy/common/utils/Http.java
deleted file mode 100644
index b0f9672..0000000
--- a/src/main/java/com/zy/common/utils/Http.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.zy.common.utils;
-
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.core.common.R;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.PrintWriter;
-
-/**
- * Created by vincent on 2019-08-01
- */
-public class Http {
-
- public static void response(HttpServletResponse response, String baseRes){
- response.setCharacterEncoding("utf-8");
- response.setContentType("application/json; charset=utf-8");
- try (PrintWriter out = response.getWriter()) {
- R r = R.parse(baseRes);
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("total", "0");
- jsonObject.put("record", "");
- r.add(jsonObject);
- out.print(JSON.toJSONString(r));
- out.flush();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/src/main/java/com/zy/common/utils/QrCode.java b/src/main/java/com/zy/common/utils/QrCode.java
deleted file mode 100644
index 174d713..0000000
--- a/src/main/java/com/zy/common/utils/QrCode.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.zy.common.utils;
-
-import com.google.zxing.BarcodeFormat;
-import com.google.zxing.EncodeHintType;
-import com.google.zxing.MultiFormatWriter;
-import com.google.zxing.WriterException;
-import com.google.zxing.common.BitMatrix;
-import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
-
-import javax.imageio.ImageIO;
-import java.awt.image.BufferedImage;
-import java.io.*;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Created by vincent on 2020-03-23
- */
-public class QrCode {
-
- private static final String CHARSET = "utf-8";
- private static final String FORMAT_NAME = "JPG";
- // 浜岀淮鐮佸昂瀵�
- private static final int QRCODE_SIZE = 60;
-
-
- public static BufferedImage createImg(String content) throws WriterException {
- ConcurrentHashMap hints = new ConcurrentHashMap();
- hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
- hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
- hints.put(EncodeHintType.MARGIN, 1);
- BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints);
- int width = bitMatrix.getWidth();
- int height = bitMatrix.getHeight();
- BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
- for (int x = 0; x < width; x++) {
- for (int y = 0; y < height; y++) {
- image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000 : 0xFFFFFFFF);
- }
- }
- for (int x = 0; x < width; x++) {
- for (int y = 0; y < height; y++) {
- image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000 : 0xFFFFFFFF);
- }
- }
- return image;
- }
-
- private static InputStream convert(BufferedImage image){
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- try {
- ImageIO.write(image, FORMAT_NAME, os);
- return new ByteArrayInputStream(os.toByteArray());
- } catch (IOException e) {
- System.err.println(e);
- }
- return null;
- }
-
- public static void inputstreamtofile(InputStream ins, File file) {
- try {
- OutputStream os = new FileOutputStream(file);
- int bytesRead = 0;
- byte[] buffer = new byte[8192];
- while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
- os.write(buffer, 0, bytesRead);
- }
- os.close();
- ins.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public static void main(String[] args) throws WriterException {
- String text = "1234567890";
- String destPath = "/Users/vincent/Desktop/jam.jpg";
- BufferedImage img = QrCode.createImg(text);
- InputStream inputStream = convert(img);
- inputstreamtofile(inputStream, new File(destPath));
-
-// BufferedImage img = QrCode.createImg(String.valueOf(id));
-// if (!ImageIO.write(img, "jpg", response.getOutputStream())) {
-// throw new IOException("Could not write an image of format jpg");
-// }
-// response.getOutputStream().flush();
-// response.getOutputStream().close();
- }
-
-
-
-}
diff --git a/src/main/java/com/zy/common/utils/RandomValidateCodeUtil.java b/src/main/java/com/zy/common/utils/RandomValidateCodeUtil.java
index fd04503..ba38a18 100644
--- a/src/main/java/com/zy/common/utils/RandomValidateCodeUtil.java
+++ b/src/main/java/com/zy/common/utils/RandomValidateCodeUtil.java
@@ -11,7 +11,7 @@
public class RandomValidateCodeUtil {
public static final Map<String, String> code = new ConcurrentHashMap<>();
-
+
private static String randString = "0123456789ABCDEFGHJKLMNPRSTUVWXYZ";//闅忔満浜х敓鏁板瓧涓庡瓧姣嶇粍鍚堢殑瀛楃涓�
private static int width = 60;// 鍥剧墖瀹�
private static int height = 27;// 鍥剧墖楂�
diff --git a/src/main/java/com/zy/common/utils/ReflectUtils.java b/src/main/java/com/zy/common/utils/ReflectUtils.java
deleted file mode 100644
index 470e6e0..0000000
--- a/src/main/java/com/zy/common/utils/ReflectUtils.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.zy.common.utils;
-
-import com.core.common.Cools;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * 鍙嶅皠宸ュ叿绫�
- * Created by vincent on 2019/1/3
- */
-public class ReflectUtils {
-
- /**
- * 鑾峰彇鎸囧畾Class锛堝強鍏禨uperClass锛夌殑鎴愬憳鍙橀噺
- */
- public static Field[] getAllFields(Class<?> cls){
- return getAllFields(cls, null);
- }
-
- /**
- * 閫掑綊鍚堝苟鍩虹被Field
- */
- private static Field[] getAllFields(Class<?> cls, Field[] params){
- Field[] fields = (params == null) ? cls.getDeclaredFields() : params;
- Class<?> superCls = cls.getSuperclass();
- if (superCls == null || superCls == Object.class){
- return fields;
- }
- Field[] superClsFields = superCls.getDeclaredFields();
- fields = Cools.addAll(fields, superClsFields);
- return getAllFields(superCls, fields);
- }
-
- /**
- * 鍒犻櫎Field鏁扮粍鐨勯潤鎬佹垚鍛樺彉閲�
- */
- public static Field[] removeStaticField(Field[] params){
- List<Field> fields = new ArrayList<>(Arrays.asList(params));
- if (fields.size() == 0){
- return null;
- }
- for (int i = fields.size() - 1; i >= 0; i--) {
- if(fields.get(i) == null){
- fields.remove(i);
- } else if (Modifier.isStatic(fields.get(i).getModifiers())) {
- fields.remove(i);
- i++;
- }
- }
- return fields.toArray(new Field[0]);
- }
-
- /**
- * 閫掑綊鑾峰彇鎴愬憳鍙橀噺瀵硅薄锛堝寘鍚叾鍩虹被锛�
- */
- public static Field getField(Class<?> cls, String fieldName){
- Field field;
- try {
- field = cls.getDeclaredField(fieldName);
- } catch (NoSuchFieldException e) {
- Class<?> superCls = cls.getSuperclass();
- if (superCls == null || superCls == Object.class){
- return null;
- }
- return getField(superCls, fieldName);
-
- }
- return field;
- }
-
-}
diff --git a/src/main/java/com/zy/common/utils/Struct.java b/src/main/java/com/zy/common/utils/Struct.java
deleted file mode 100644
index 0ee0939..0000000
--- a/src/main/java/com/zy/common/utils/Struct.java
+++ /dev/null
@@ -1,507 +0,0 @@
-package com.zy.common.utils;
-
-import com.zy.common.model.annotations.*;
-import org.springframework.expression.EvaluationContext;
-import org.springframework.expression.Expression;
-import org.springframework.expression.ExpressionParser;
-import org.springframework.expression.spel.standard.SpelExpressionParser;
-import org.springframework.expression.spel.support.StandardEvaluationContext;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.nio.charset.StandardCharsets;
-import java.util.*;
-
-/**
- * Tcp鍗忚鎶ユ枃鍩虹被
- * @author vincent
- */
-public class Struct implements java.io.Serializable {
-
- private transient Map<String,byte[]> decodeByteMapping = new HashMap<>();
- private transient Map<String,byte[]> encodeByteMapping = new HashMap<>();
- // 瑙g爜鍓嶇殑鍘熺敓瀛楄妭鏁扮粍
- private transient byte[] dataBytes = null;
- private transient byte[] decodeBytes = null;
- private transient byte[] encodeBytes = null;
- private transient byte[] unusedBytes = null;
-
- public Class getClassType(String name){
- return null;
- }
-
- /**
- * 鍒ゆ柇澶у皬绔�
- * @return true: 灏忕 / false: 澶х
- */
- public boolean isReverse() {
- return this.getClass().getAnnotation(little.class)!=null;
- }
-
- /**
- * 鑾峰彇瀛楄妭鏁扮粍
- */
- public byte[] toBytes() throws Exception {
- return encode(this);
- }
-
- public Map<String,String> toDecodeHexMapping() throws Exception{
- if(this.decodeByteMapping==null)this.decodeByteMapping=new HashMap<>();
- Map<String, String> mapping = getHex(this.decodeByteMapping);
- if(this.decodeBytes!=null){
- mapping.put("byte[]", Struct.toHex(this.decodeBytes));
- }
- return mapping;
- }
- public Map<String,String> toEncodeHexMapping() throws Exception{
- if(this.encodeBytes==null)this.encode(this);
- if(this.encodeByteMapping==null)this.encodeByteMapping=new HashMap<>();
- Map<String, String> mapping = getHex(this.encodeByteMapping);
- mapping.put("byte[]", Struct.toHex(this.encodeBytes));
- return mapping;
- }
- public Map<String,String> getHex(Map<String,byte[]> bytemapping) throws Exception {
- Map<String,String> map = new LinkedHashMap<>();
- Field[] fields = this.getClass().getFields();
- for (Field field : fields) {
- byte[] bytes = bytemapping.get(field.getName());
- if(bytes!=null){
- map.put(field.getName(), Struct.toHex(bytes));
- }
- }
- return map;
- }
-
- // 杞琷ava瀵硅薄鍒版暟缁�
- public byte[] encode(Struct entity) throws Exception {
- ByteArrayOutputStream baOs = new ByteArrayOutputStream();
- write(new DataOutputStream(baOs), entity);
- entity.encodeBytes = baOs.toByteArray();
- return entity.encodeBytes;
- }
-
- /**
- * 鍐欐暟鎹埌杈撳嚭娴�
- *
- * @param dos
- * @param entity
- */
- public void write(DataOutputStream dos, Struct entity) throws Exception {
- if(entity==null)return;
- if(entity.encodeByteMapping==null)entity.encodeByteMapping=new HashMap<>();
- Field[] fields = entity.getClass().getFields();
- EvaluationContext context = new StandardEvaluationContext();
- for (Field field : Objects.requireNonNull(ReflectUtils.removeStaticField(fields))) {
- field.setAccessible(true);
-
- String name = field.getName();
- Class<?> type = field.getType();
- String typeName = type.getSimpleName();
- if(typeName.equals("Struct")){
- if(entity.getClassType(name)!=null){
- type = entity.getClassType(name);
- typeName = type.getSimpleName();
- }else if(field.get(entity)!=null){
- type = field.get(entity).getClass();
- typeName = type.getSimpleName();
- }
- }
-
- size size = field.getAnnotation(size.class);
- bit bit = field.getAnnotation(bit.class);
- expr expr = field.getAnnotation(expr.class);
- flag flag = field.getAnnotation(flag.class);
- if(size==null && bit==null && expr==null){
- continue;
- }
-
- int bited = 0;//宸插啓浣嶆暟
- int length = 0;//瀹氫箟鐨勯暱搴�
- if(size!=null){
- length = size.value();
- bited+=size.value()*8;
- }else if(bit!=null){
- //鎸変綅鍐欐柟寮忔湭瀹炵幇澶勭悊
- throw new RuntimeException("鎸変綅鍐欐柟寮忔湭瀹炵幇澶勭悊");
- }else if(expr!=null){
- ExpressionParser parser = new SpelExpressionParser();
- Expression exp = parser.parseExpression(expr.value());
- Integer len = null;
- try{
- len = CommonUtils.parseInt(exp.getValue(context, entity));
- }catch (Exception e){
- len = 0;
- }
- if(len!=null){
- if(len==-1)continue;
- length = len;
- bited+=len*8;
- }
- }
- context.setVariable(name, field.get(entity));
-
- byte[] bytes = new byte[length];
-
- if (typeName.equals("int") || typeName.equals("Integer")){
- dos.write(bytes=convert(length,field.getInt(entity)));
- }else if (typeName.equals("long") || typeName.equals("Long")){
- dos.write(bytes=convert(length,field.getLong(entity)));
- }else if (typeName.equals("short") || typeName.equals("Short")){
- dos.write(bytes=convert(length,field.getShort(entity)));
- }else if (typeName.equals("byte") || typeName.equals("Byte")){
- dos.write(bytes=convert(length,field.getByte(entity)));
- }else if (typeName.equals("String")) {
- String str = (String) field.get(entity);
- if (str == null)
- str = "";
- str = str.replaceAll("銆�", " ");
-
- byte[] bts = null;
- if(flag!=null && flag.value().equals("ASCII")){
- bts = Struct.StrToAsc(str);
- }else if(flag!=null && flag.value().equals("BCD")){
- bts = Struct.str2Bcd(str);
- }else{
- bts = str.getBytes();
- }
-
- if(length==0){//濡傛灉闀垮害鏈缃紝浠ュ綋鍓嶅疄闄呯殑瀛楄妭涓哄噯
- bytes = new byte[bts.length];
- }
- System.arraycopy(bts, 0, bytes, 0, bts.length);
- dos.write(bytes);
- } else if (typeName.equals("byte[]")) {
- byte[] bts = (byte[]) field.get(entity);
- if(bts!=null){
- if(length==0){//濡傛灉闀垮害鏈缃紝浠ュ綋鍓嶅疄闄呯殑瀛楄妭涓哄噯
- bytes = new byte[bts.length];
- }
- System.arraycopy(bts, 0, bytes, 0, bts.length);
- dos.write(bytes);
- }
- }else if (type.isArray()) {
- ByteArrayOutputStream baOs1 = new ByteArrayOutputStream();
- DataOutputStream dos1 = new DataOutputStream(baOs1);
- for (Object object : (Object[]) field.get(entity)){
- write(dos1, (Struct) object);
- }
- byte[] bts = baOs1.toByteArray();
- if(length==0){//濡傛灉闀垮害鏈缃紝浠ュ綋鍓嶅疄闄呯殑瀛楄妭涓哄噯
- bytes = new byte[bts.length];
- }
- System.arraycopy(bts, 0, bytes, 0, bts.length);
- dos.write(bytes);
- } else {
- byte[] bts = encode((Struct) field.get(entity));
- if(length==0){//濡傛灉闀垮害鏈缃紝浠ュ綋鍓嶅疄闄呯殑瀛楄妭涓哄噯
- bytes = new byte[bts.length];
- }
- System.arraycopy(bts, 0, bytes, 0, bts.length);
- dos.write(bytes);
- }
- entity.encodeByteMapping.put(name, bytes);
- }
- }
-
-
- public byte[] convert(int size, long value) throws Exception{
- ByteArrayOutputStream baOs = new ByteArrayOutputStream();
- DataOutputStream dos = new DataOutputStream(baOs);
- switch(size){
- case 1://byte
- dos.write((byte) value);
- break;
- case 2://short
- dos.writeShort(this.isReverse() ? Short.reverseBytes((short)value) : (short)value);
- break;
- case 4://int
- dos.writeInt(this.isReverse() ? Integer.reverseBytes((int)value) : (int)value);
- break;
- case 8://long
- dos.writeLong(this.isReverse() ? Long.reverseBytes((long)value) : (long)value);
- break;
- }
- return baOs.toByteArray();
- }
-
- public long convertEx(long value,int size) throws Exception{
- switch(size){
- case 1://byte
- return value;
- case 2://short
- return (this.isReverse() ? Short.reverseBytes((short)value) : (short)value);
- case 4://int
- return (this.isReverse() ? Integer.reverseBytes((int)value) : (int)value);
- case 8://long
- return (this.isReverse() ? Long.reverseBytes((long)value) : (long)value);
- }
- return 0;
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public static <T extends Struct> T decode(Class<? extends Struct> cls,byte[] bytes) throws Exception{
- Struct instance = cls.newInstance();
- return instance.decode(bytes);
- }
-
- /**
- * 瑙g爜锛� 瀛楄妭鏁扮粍 ====>> java瀵硅薄
- */
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public <T extends Struct> T decode(byte[] bytes) throws Exception{
- this.dataBytes = bytes;
- Struct instance = this;
- Class<? extends Struct> cls = this.getClass();
- Field[] fields = cls.getFields();
- if(this.decodeByteMapping==null)instance.decodeByteMapping=new HashMap();
- // spring el琛ㄨ揪寮�
- EvaluationContext context = new StandardEvaluationContext();
- context.setVariable("_", bytes.length);
- int bited = 0;//宸茶浣嶆暟
- for(Field field: Objects.requireNonNull(ReflectUtils.removeStaticField(fields))){
- size size = field.getAnnotation(size.class);
- bit bit = field.getAnnotation(bit.class);
- expr expr = field.getAnnotation(expr.class);
- flag flag = field.getAnnotation(flag.class);
- // 娌℃湁size銆乥it銆乪xpr娉ㄨВ鐨勫彉閲忎笉杩涜瑙f瀽
- if(size==null && bit==null && expr==null){
- continue;
- }
- String name = field.getName();
- Class<?> type = field.getType();
- String typeName = type.getSimpleName();
- if(typeName.equals("Struct")){
- if(instance.getClassType(name)!=null){
- type = instance.getClassType(name);
- typeName = type.getSimpleName();
- }
- }
- context.setVariable("__", bytes.length-bited/8);
- byte[] bts = null;
- if(size!=null){
- bts = new byte[size.value()];
- System.arraycopy(bytes, bited/8, bts, 0, size.value());
- bited+=size.value()*8;
- }else if(bit!=null){
- int val = 0;
- String strBin = "";
- for(int i=bited;i<bited+bit.value();i++){//閫愪綅鎵弿
- if((bytes[i/8] & (1 << (i%8))) != 0){//濡傛灉浣嶄负1
- strBin+="1";
- }else{
- strBin+="0";
- }
- val = Integer.parseInt(strBin, 2);
- }
- byte[] result = new byte[4];
- result[3] = (byte)(val);
- result[2] = (byte)(val >> 8);
- result[1] = (byte)(val >> 16);
- result[0] = (byte)(val >> 24);
- bts = new byte[(int)Math.ceil((double)bit.value()/8.0)];
- System.arraycopy(result, result.length-bts.length, bts, 0, bts.length);
- bited+=bit.value();
- }else if(expr!=null){
- ExpressionParser parser = new SpelExpressionParser();
- Expression exp = parser.parseExpression(expr.value());
- Integer len = CommonUtils.parseInt(exp.getValue(context,instance));
- if(len!=null){
- if(len==-1)continue;
- bts = new byte[len];
- System.arraycopy(bytes, bited/8, bts, 0, len);
- bited+=len*8;
- }
- }
- if(bts.length==0)continue;
- DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bts));
- if (typeName.equals("int") || typeName.equals("Integer")){
- field.setInt(instance,(int) convertEx(dis.readInt(),4));
- }else if (typeName.equals("long") || typeName.equals("Long")){
- field.setLong(instance, convertEx(dis.readLong(),8));
- }else if (typeName.equals("short") || typeName.equals("Short")){
- field.setShort(instance, (short) convertEx(dis.readShort(),2));
- }else if (typeName.equals("byte") || typeName.equals("Byte")){
- field.setByte(instance, (byte) convertEx(dis.readByte(),1));
- }else if (typeName.equals("byte[]")){
- field.set(instance, bts);
- }else if (typeName.equals("String")) {
- String strStr = new String(bts, StandardCharsets.UTF_8);
- if(flag!=null && flag.value().equals("BCD")){
- strStr = bcd2Str(bts);
- }else if(flag!=null && flag.value().equals("ASCII")){
- strStr = Struct.AscToStr(bts);
- }
- strStr = strStr.replaceAll("[\u0000]", "");
- field.set(instance, strStr);
- }else if (type.isArray()) {
- byte[] arrayBytes = bts;
- List list = new ArrayList();
- while(arrayBytes.length>0 && list.size()<256){
- Struct item = decode((Class<? extends Struct>) type.getComponentType(),arrayBytes);
- list.add(item);
- arrayBytes = item.unusedBytes;
- }
- Object array = Array.newInstance(type.getComponentType(), list.size());
- for(int i=0;i<list.size();i++){
- Array.set(array, i, list.get(i));
- }
- field.set(instance, array);
- }else if(type==Struct.class || Struct.class.isAssignableFrom(type)){
- byte[] arrayBytes = bts;
- Struct item = decode((Class<? extends Struct>) type,arrayBytes);
- field.set(instance, item);
- }else{
- throw new RuntimeException(cls.getSimpleName()+"瀛楁"+field.getName()+"绫诲瀷鏈煡");
- }
- instance.decodeByteMapping.put(name, bts);
- context.setVariable(name, field.get(instance));
- }
- byte[] useBytes = new byte[bited/8];
- System.arraycopy(bytes, 0 , useBytes, 0, bited/8);
- instance.decodeBytes = useBytes;
- byte[] unusedBytes = new byte[bytes.length-(bited/8)];
- if(unusedBytes.length>0){
- System.arraycopy(bytes, useBytes.length , unusedBytes, 0, unusedBytes.length);
- }
- instance.unusedBytes = unusedBytes;
- return (T) instance;
- }
-
- // 瀛楄妭鏁扮粍 ===>> 杞负鍗佸叚杩涘埗瀛楃涓�
- public static String toHex(byte[] bytes) {
- StringBuilder buf = new StringBuilder(bytes.length * 2);
- for(byte b : bytes) { // 浣跨敤String鐨刦ormat鏂规硶杩涜杞崲
- buf.append(String.format("%02x", b & 0xff));
- }
- return buf.toString().toUpperCase();
- }
- public static byte[] toBytes(String str) {
- if(str == null || str.trim().equals("")) return new byte[0];
- byte[] bytes = new byte[str.length() / 2];
- for(int i = 0; i < str.length() / 2; i++) {
- String subStr = str.substring(i * 2, i * 2 + 2);
- bytes[i] = (byte) Integer.parseInt(subStr, 16);
- }
- return bytes;
- }
-
-
-
- /**
- * @鍔熻兘: BCD鐮佽浆涓�10杩涘埗涓�(闃挎媺浼暟鎹�)
- * @鍙傛暟: BCD鐮�
- * @缁撴灉: 10杩涘埗涓�
- */
- public static String bcd2Str(byte[] bytes) {
- StringBuffer temp = new StringBuffer(bytes.length * 2);
- for (int i = 0; i < bytes.length; i++) {
- temp.append((byte) ((bytes[i] & 0xf0) >>> 4));
- temp.append((byte) (bytes[i] & 0x0f));
- }
- return temp.toString().substring(0, 1).equalsIgnoreCase("0") ? temp
- .toString().substring(1) : temp.toString();
- }
-
- /**
- * @鍔熻兘: 10杩涘埗涓茶浆涓築CD鐮�
- * @鍙傛暟: 10杩涘埗涓�
- * @缁撴灉: BCD鐮�
- */
- public static byte[] str2Bcd(String asc) {
- int len = asc.length();
- int mod = len % 2;
- if (mod != 0) {
- asc = "0" + asc;
- len = asc.length();
- }
- byte abt[] = new byte[len];
- if (len >= 2) {
- len = len / 2;
- }
- byte bbt[] = new byte[len];
- abt = asc.getBytes();
- int j, k;
- for (int p = 0; p < asc.length() / 2; p++) {
- if ((abt[2 * p] >= '0') && (abt[2 * p] <= '9')) {
- j = abt[2 * p] - '0';
- } else if ((abt[2 * p] >= 'a') && (abt[2 * p] <= 'z')) {
- j = abt[2 * p] - 'a' + 0x0a;
- } else {
- j = abt[2 * p] - 'A' + 0x0a;
- }
- if ((abt[2 * p + 1] >= '0') && (abt[2 * p + 1] <= '9')) {
- k = abt[2 * p + 1] - '0';
- } else if ((abt[2 * p + 1] >= 'a') && (abt[2 * p + 1] <= 'z')) {
- k = abt[2 * p + 1] - 'a' + 0x0a;
- } else {
- k = abt[2 * p + 1] - 'A' + 0x0a;
- }
- int a = (j << 4) + k;
- byte b = (byte) a;
- bbt[p] = b;
- }
- return bbt;
- }
-
- public static class TestMessage {
- public @size(1) byte begin = 0x7e;//璧峰绗�
- public @size(2) short type = 0;//娑堟伅ID
- public @bit(2) byte retain;//娑堟伅浣撳睘鎬�>淇濈暀
- public @bit(1) byte subpkg;//娑堟伅浣撳睘鎬�>鏄惁鍒嗗寘,0琛ㄧず涓嶅垎鍖�
- public @bit(3) byte encrypt;//娑堟伅浣撳睘鎬�>鍔犲瘑鏂瑰紡,0琛ㄧず涓嶅姞瀵�
- public @bit(10) short length;//娑堟伅浣撻暱搴�
- public @size(6) @flag("BCD") String number;//鎵嬫満鍙风爜
- public @size(2) short serial;//娑堟伅娴佹按鍙�
- public @expr("#subpkg==1?2:0") short pkgs;//鍒嗗寘鏁�
- public @expr("#subpkg==1?2:0") short index;//鍖呭簭鍙�
- public @expr("#length") byte[] data;//鏁版嵁閮ㄥ垎
- public @size(1) byte verify;//鏍¢獙鐮�
- public @size(1) byte end = 0x7e;//缁撴潫绗�
- }
-
- public static byte getXor(byte[] datas,int start, int end){
- byte temp=datas[start];
- for (int i = start+1; i <end; i++) {
- temp ^=datas[i];
- }
- return temp;
- }
-
-
- /**
- * 姹傛牎楠屽拰鐨勭畻娉�
- * @param b 闇�瑕佹眰鏍¢獙鍜岀殑瀛楄妭鏁扮粍
- * @return 鏍¢獙鍜�
- */
- public static byte sumCheck(byte[] b,int start, int end){
- int sum = 0;
- for(int i = start; i < end; i++){
- sum = sum + b[i];
- }
- return (byte) (sum & 0xff);
- }
-
- //瀛楃涓茶浆鎹负ascii
- public static byte[] StrToAsc(String content){
- try {
- return content.getBytes(StandardCharsets.US_ASCII);
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
-
- //ascii杞崲涓簊tring
- public static String AscToStr(byte[] bytes){
- StringBuffer sbu = new StringBuffer();
- for (byte aByte : bytes) {
- sbu.append(Character.toString((char) aByte));
- }
- return sbu.toString();
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/zy/common/utils/Synchro.java b/src/main/java/com/zy/common/utils/Synchro.java
index c23fbf1..2cd4b58 100644
--- a/src/main/java/com/zy/common/utils/Synchro.java
+++ b/src/main/java/com/zy/common/utils/Synchro.java
@@ -1,6 +1,6 @@
package com.zy.common.utils;
-import com.core.exception.CoolException;
+import com.zy.common.exception.CoolException;
import java.beans.BeanInfo;
import java.beans.Introspector;
diff --git a/src/main/java/com/zy/common/utils/excel/EnInitData.java b/src/main/java/com/zy/common/utils/excel/EnInitData.java
deleted file mode 100644
index e352810..0000000
--- a/src/main/java/com/zy/common/utils/excel/EnInitData.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.zy.common.utils.excel;
-
-import com.alibaba.excel.annotation.ExcelProperty;
-
-/**
- * ExcelProperty涓殑value鍜宨ndex鍙鏈変竴涓涓婂氨鑳借В鏋�
- * Created by vincent on 2019-11-25
- */
-public class EnInitData {
-
- @ExcelProperty(value = "浼佷笟鍚嶇О", index = 0)
- private String enName;
-
- @ExcelProperty(value = "缁熶竴绀句細淇$敤浠g爜", index = 1)
- private String code;
-
- @ExcelProperty(value = "涓荤绋庡姟鏈哄叧", index = 7)
- private String office;
-
- @ExcelProperty(value = "璐熻矗浜虹數璇�", index = 10)
- private String mobile;
-
- public String getEnName() {
- return enName;
- }
-
- public void setEnName(String enName) {
- this.enName = enName;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public String getOffice() {
- return office;
- }
-
- public void setOffice(String office) {
- this.office = office;
- }
-
- public String getMobile() {
- return mobile;
- }
-
- public void setMobile(String mobile) {
- this.mobile = mobile;
- }
-}
diff --git a/src/main/java/com/zy/common/utils/excel/EnInitDataListener.java b/src/main/java/com/zy/common/utils/excel/EnInitDataListener.java
deleted file mode 100644
index 2a54e8f..0000000
--- a/src/main/java/com/zy/common/utils/excel/EnInitDataListener.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.zy.common.utils.excel;
-
-import com.alibaba.excel.context.AnalysisContext;
-import com.alibaba.excel.event.AnalysisEventListener;
-import com.alibaba.fastjson.JSON;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by vincent on 2019-11-25
- */
-public class EnInitDataListener extends AnalysisEventListener<EnInitData> {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(EnInitDataListener.class);
-
- /**
- * 姣忛殧5鏉″瓨鍌ㄦ暟鎹簱锛屽疄闄呬娇鐢ㄤ腑鍙互3000鏉★紝鐒跺悗娓呯悊list 锛屾柟渚垮唴瀛樺洖鏀�
- */
- private static final int BATCH_COUNT = 5;
-
- private List<EnInitData> list = new ArrayList<>();
-
- /**
- * 杩欓噷浼氫竴琛岃鐨勮繑鍥炲ご
- */
- @Override
- public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
- LOGGER.info("瑙f瀽鍒颁竴鏉″ご鏁版嵁:{}", JSON.toJSONString(headMap));
- }
-
- /**
- * 杩欎釜姣忎竴鏉℃暟鎹В鏋愰兘浼氭潵璋冪敤
- */
- @Override
- public void invoke(EnInitData data, AnalysisContext ctx) {
- LOGGER.info("瑙f瀽鍒颁竴鏉℃暟鎹�:{}", JSON.toJSONString(data));
- list.add(data);
- // 杈惧埌BATCH_COUNT浜嗭紝闇�瑕佸幓瀛樺偍涓�娆℃暟鎹簱锛岄槻姝㈡暟鎹嚑涓囨潯鏁版嵁鍦ㄥ唴瀛橈紝瀹规槗OOM
- if (list.size() >= BATCH_COUNT) {
- // 瀛樺偍瀹屾垚娓呯悊 list
- list.clear();
- }
- }
-
- /**
- * 鎵�鏈夋暟鎹В鏋愬畬鎴愪簡璋冪敤
- * 閫傚悎浜嬪姟
- */
- @Override
- public void doAfterAllAnalysed(AnalysisContext ctx) {
- LOGGER.info("鎵�鏈夋暟鎹В鏋愬畬鎴愶紒");
- }
-}
diff --git a/src/main/java/com/zy/common/utils/excel/ExcelUtils.java b/src/main/java/com/zy/common/utils/excel/ExcelUtils.java
deleted file mode 100644
index 0532402..0000000
--- a/src/main/java/com/zy/common/utils/excel/ExcelUtils.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.zy.common.utils.excel;
-
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.read.builder.ExcelReaderBuilder;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by vincent on 2019-11-24
- */
-public class ExcelUtils {
-
- public static void main(String[] args) {
-// new ExcelUtils().simpleRead();
- new ExcelUtils().simpleWrite();
- }
-
- public void simpleRead(){
- ExcelReaderBuilder read = EasyExcel.read("/Users/vincent/Desktop/3869.xls", EnInitData.class, new EnInitDataListener());
- // 璇诲彇绗竴涓猻heet(琛�),鏂囦欢娴佷細鑷姩鍏抽棴
- read.sheet().doRead();
- }
-
- public void simpleWrite(){
- EasyExcel.write("/Users/vincent/Desktop/writeDemo.xls", EnInitData.class).sheet("lxt").doWrite(data());
- }
-
- public static List<EnInitData> data(){
- List<EnInitData> list = new ArrayList<>();
- for (int i = 0; i<1000; i++) {
- EnInitData data = new EnInitData();
- data.setEnName("娴嬭瘯");
- data.setCode("test");
- data.setOffice("鍥藉绋庡姟鎬诲眬鏉窞甯備綑鏉尯绋庡姟灞�浣欐澀绋庡姟鎵�");
- data.setMobile("15988786205");
- list.add(data);
- }
- return list;
- }
-}
diff --git a/src/main/java/com/zy/common/web/AuthController.java b/src/main/java/com/zy/common/web/AuthController.java
deleted file mode 100644
index 7872563..0000000
--- a/src/main/java/com/zy/common/web/AuthController.java
+++ /dev/null
@@ -1,329 +0,0 @@
-package com.zy.common.web;
-
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.mapper.Wrapper;
-import com.core.annotations.ManagerAuth;
-import com.core.common.Cools;
-import com.core.common.R;
-import com.core.exception.CoolException;
-import com.zy.common.CodeRes;
-import com.zy.common.entity.Parameter;
-import com.zy.common.model.PowerDto;
-import com.zy.common.utils.RandomValidateCodeUtil;
-import com.zy.system.entity.*;
-import com.zy.system.service.*;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.*;
-
-/**
- * Created by vincent on 2019-07-30
- */
-@RestController
-public class AuthController extends BaseController {
-
- @Value("${super.pwd}")
- private String superPwd;
- @Autowired
- private UserService userService;
- @Autowired
- private RoleService roleService;
- @Autowired
- private UserLoginService userLoginService;
- @Autowired
- private ResourceService resourceService;
- @Autowired
- private RoleResourceService roleResourceService;
- @Autowired
- private PermissionService permissionService;
- @Autowired
- private RolePermissionService rolePermissionService;
-
- @RequestMapping("/login.action")
- @ManagerAuth(value = ManagerAuth.Auth.NONE, memo = "鐧诲綍")
- public R loginAction(String mobile, String password){
- if (mobile.equals("super") && password.equals(Cools.md5(superPwd))) {
- Map<String, Object> res = new HashMap<>();
- res.put("username", mobile);
- res.put("token", Cools.enToken(System.currentTimeMillis() + mobile, superPwd));
- return R.ok(res);
- }
- EntityWrapper<User> userWrapper = new EntityWrapper<>();
- userWrapper.eq("mobile", mobile);
- User user = userService.selectOne(userWrapper);
- if (Cools.isEmpty(user)){
- return R.parse(CodeRes.USER_10001);
- }
- if (user.getStatus()!=1){
- return R.parse(CodeRes.USER_10002);
- }
- if (!user.getPassword().equals(password)){
- return R.parse(CodeRes.USER_10003);
- }
- String token = Cools.enToken(System.currentTimeMillis() + mobile, user.getPassword());
- userLoginService.delete(new EntityWrapper<UserLogin>().eq("user_id", user.getId()).eq("system", "WCS"));
- UserLogin userLogin = new UserLogin();
- userLogin.setUserId(user.getId());
- userLogin.setToken(token);
- userLogin.setSystem("WCS");
- userLoginService.insert(userLogin);
- Map<String, Object> res = new HashMap<>();
- res.put("username", user.getUsername());
- res.put("token", token);
- return R.ok(res);
- }
-
- @RequestMapping("/code/switch.action")
- public R code() {
- return R.ok().add(Parameter.get().getCodeSwitch());
- }
-
- @RequestMapping("/code.action")
- public void code(@RequestParam String sd, HttpServletResponse response) {
- RandomValidateCodeUtil.getRandcode(sd, response);
- }
-
- @RequestMapping("/code.do")
- public String codeDo(@RequestParam String sd) throws Exception {
- String code = null;
- int time = 0;
- while (time < 3000) {
- code = RandomValidateCodeUtil.code.get(sd);
- if (!Cools.isEmpty(code)){
- break;
- } else {
- Thread.sleep(10);
- time = time + 100;
- }
- }
- RandomValidateCodeUtil.code.remove(sd);
- return code;
- }
-
- @RequestMapping("/user/detail/auth")
- @ManagerAuth
- public R userDetail(){
- return R.ok(userService.selectById(getUserId()));
- }
-
- @RequestMapping("/menu/auth")
- @ManagerAuth(memo = "棣栭〉鑿滃崟")
- public R menu(){
- // 鑾峰彇鎵�鏈変竴绾ц彍鍗�
- List<Resource> oneLevel = resourceService.selectList(new EntityWrapper<Resource>().eq("level", 1).eq("status", 1).orderBy("sort"));
- User user = null;
- Wrapper<Resource> resourceWrapper;
- if (getUserId() == 9527) {
- resourceWrapper = new EntityWrapper<Resource>().eq("level", 2).eq("status", 1).orderBy("sort");
- } else {
- // 鑾峰彇褰撳墠鐢ㄦ埛鐨勬墍鏈変簩绾ц彍鍗�
- user = userService.selectById(getUserId());
- List<RoleResource> roleResources = roleResourceService.selectList(new EntityWrapper<RoleResource>().eq("role_id", user.getRoleId()));
- List<Long> resourceIds = new ArrayList<>();
- roleResources.forEach(roleResource -> resourceIds.add(roleResource.getResourceId()));
- if (resourceIds.isEmpty()){
- return R.ok();
- }
- resourceWrapper = new EntityWrapper<Resource>().in("id", resourceIds).eq("level", 2).eq("status", 1).orderBy("sort");
- }
- List<Resource> twoLevel = resourceService.selectList(resourceWrapper);
- List<Map<String, Object>> result = new ArrayList<>();
- for (Resource menu : oneLevel) {
- Map<String, Object> map = new HashMap<>();
- List<Resource> subMenu = new ArrayList<>();
- Iterator<Resource> iterator = twoLevel.iterator();
- while (iterator.hasNext()) {
- Resource resource = iterator.next();
- if (resource.getResourceId() != null && resource.getResourceId().equals(menu.getId())) {
-
- // 鏄惁鎷ユ湁鏌ョ湅鏉冮檺
- if (getUserId() != 9527) {
- Resource view = resourceService.selectOne(new EntityWrapper<Resource>().eq("resource_id", resource.getId()).like("code", "view"));
- if (!Cools.isEmpty(view)){
- RoleResource param = new RoleResource();
- param.setResourceId(view.getId());
- param.setRoleId(user.getRoleId());
- if (null == roleResourceService.selectOne(new EntityWrapper<>(param))){
- continue;
- }
- }
- }
-
- subMenu.add(resource);
- iterator.remove();
- }
- }
- if (subMenu.isEmpty()) {
- continue;
- }
- map.put("menuId", menu.getId());
- map.put("menuCode", menu.getCode());
- map.put("menu", menu.getName());
- map.put("subMenu", subMenu);
- result.add(map);
- }
- return R.ok(result);
- }
-
- @RequestMapping("/power/list/auth")
- @ManagerAuth
- public R powerList(){
- List<Resource> oneLevels = resourceService.selectList(new EntityWrapper<Resource>().eq("level", 1).eq("status", 1).orderBy("sort"));
- List<Map> result = new ArrayList<>();
- // 涓�绾�
- for (Resource oneLevel : oneLevels){
- List<Map> twoLevelsList = new ArrayList<>();
- Map<String, Object> oneLevelMap = new HashMap<>();
- oneLevelMap.put("title", oneLevel.getName());
- oneLevelMap.put("id", oneLevel.getId());
- oneLevelMap.put("spread", true);
- oneLevelMap.put("children", twoLevelsList);
- List<Resource> twoLevels = resourceService.selectList(new EntityWrapper<Resource>().eq("resource_id", oneLevel.getId()).eq("level", 2).eq("status", 1).orderBy("sort"));
- // 浜岀骇
- for (Resource twoLevel : twoLevels){
- Map<String, Object> twoLevelMap = new HashMap<>();
- twoLevelMap.put("title", twoLevel.getName());
- twoLevelMap.put("id", twoLevel.getId());
- twoLevelMap.put("spread", false);
-
- List<Map> threeLevelsList = new ArrayList<>();
- twoLevelMap.put("children", threeLevelsList);
- // 涓夌骇
- List<Resource> threeLevels = resourceService.selectList(new EntityWrapper<Resource>().eq("resource_id", twoLevel.getId()).eq("level", 3).eq("status", 1).orderBy("sort"));
- for (Resource threeLevel : threeLevels){
- Map<String, Object> threeLevelMap = new HashMap<>();
- threeLevelMap.put("title", threeLevel.getName());
- threeLevelMap.put("id", threeLevel.getId());
- threeLevelMap.put("checked", false);
- threeLevelsList.add(threeLevelMap);
- }
-
- twoLevelsList.add(twoLevelMap);
- }
- result.add(oneLevelMap);
- }
-
- // 鍔熻兘妯″潡
- Map<String, Object> functions = new HashMap<>();
- functions.put("title", "鎸囧畾鍔熻兘");
- functions.put("id", "function");
- functions.put("spread", true);
- List<Map> funcs = new ArrayList<>();
- functions.put("children", funcs);
- List<Permission> permissions = permissionService.selectList(new EntityWrapper<Permission>().eq("status", 1));
- for (Permission permission : permissions) {
- Map<String, Object> func = new HashMap<>();
- func.put("title", permission.getName());
- func.put("id", permission.getAction());
- func.put("spread", true);
- funcs.add(func);
- }
- result.add(functions);
-
- return R.ok(result);
- }
-
- @RequestMapping(value = "/power/{roleId}/auth")
- @ManagerAuth
- public R get(@PathVariable("roleId") Long roleId) {
- List<Object> result = new ArrayList<>();
- // 鑿滃崟
- List<RoleResource> roleResources = roleResourceService.selectList(new EntityWrapper<RoleResource>().eq("role_id", roleId));
- for (RoleResource roleResource : roleResources){
- Resource resource = resourceService.selectById(roleResource.getResourceId());
- if (!Cools.isEmpty(resource)){
- if (resource.getLevel() == 3){
- result.add(resource.getId());
- }
- }
- }
- // 鍔熻兘
- List<RolePermission> rolePermissions = rolePermissionService.selectList(new EntityWrapper<RolePermission>().eq("role_id", roleId));
- for (RolePermission rolePermission : rolePermissions){
- Permission permission = permissionService.selectById(rolePermission.getPermissionId());
- if (!Cools.isEmpty(permission)){
- result.add(permission.getAction());
- }
- }
- return R.ok(result);
- }
-
- @RequestMapping("/power/auth")
- @ManagerAuth(memo = "鎺堟潈")
- @Transactional
- public R power(Long roleId, String powers){
- Role role = roleService.selectById(roleId);
- Long leaderId = role.getLeader();
- roleResourceService.delete(new EntityWrapper<RoleResource>().eq("role_id", roleId));
- rolePermissionService.delete(new EntityWrapper<RolePermission>().eq("role_id", roleId));
- if (!Cools.isEmpty(powers)){
- List<PowerDto> dtos = JSON.parseArray(powers, PowerDto.class);
- for (PowerDto dto : dtos) {
- Resource resource = resourceService.selectOne(new EntityWrapper<Resource>().eq("id", dto.getTwo()).eq("level", 2));
- if (!Cools.isEmpty(resource)) {
- // 鏍¢獙涓婄骇鏉冮檺
- if (leaderId != null) {
- RoleResource roleResource = roleResourceService.selectOne(new EntityWrapper<RoleResource>().eq("role_id", leaderId).eq("resource_id", resource.getId()));
- if (null == roleResource) {
- throw new CoolException(resource.getName().concat("鏃犳硶鎺堟潈缁�").concat(role.getName()));
- }
- }
- RoleResource roleResource = new RoleResource();
- roleResource.setRoleId(roleId);
- roleResource.setResourceId(resource.getId());
- roleResourceService.insert(roleResource);
- } else {
- Permission permission = permissionService.selectOne(new EntityWrapper<Permission>().eq("action", dto.getTwo()));
- if (!Cools.isEmpty(permission)){
- RolePermission rolePermission = new RolePermission();
- rolePermission.setRoleId(roleId);
- rolePermission.setPermissionId(permission.getId());
- rolePermissionService.insert(rolePermission);
- }
- }
- for (String three : dto.getThree()){
- Resource resource1 = resourceService.selectOne(new EntityWrapper<Resource>().eq("id", three).eq("level", 3));
- if (!Cools.isEmpty(resource1)) {
- // 鏍¢獙涓婄骇鏉冮檺
- if (leaderId != null) {
- RoleResource roleResource = roleResourceService.selectOne(new EntityWrapper<RoleResource>().eq("role_id", leaderId).eq("resource_id", resource1.getId()));
- if (null == roleResource) {
- throw new CoolException(resource.getName().concat("鐨�").concat(resource1.getName().concat("鏃犳硶鎺堟潈缁�").concat(role.getName())));
- }
- }
- RoleResource roleResource = new RoleResource();
- roleResource.setRoleId(roleId);
- roleResource.setResourceId(resource1.getId());
- roleResourceService.insert(roleResource);
- }
- }
- }
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/power/menu/{resourceId}/auth")
- @ManagerAuth
- public R buttonResource(@PathVariable("resourceId") Long resourceId) {
- List<Resource> resources;
- if (getUserId() == 9527) {
- resources = resourceService.selectList(new EntityWrapper<Resource>().eq("level", 3).eq("resource_id", resourceId));
- } else {
- resources = roleResourceService.getMenuButtomResource(resourceId, getUserId());
- }
- for (Resource resource : resources) {
- resource.setCode(resource.getCode().split("#")[1]);
- }
- return R.ok(resources);
- }
-
-
-}
diff --git a/src/main/java/com/zy/common/web/BaseController.java b/src/main/java/com/zy/common/web/BaseController.java
deleted file mode 100644
index 1d40c1d..0000000
--- a/src/main/java/com/zy/common/web/BaseController.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.zy.common.web;
-
-import com.baomidou.mybatisplus.annotations.TableField;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.core.common.BaseRes;
-import com.core.common.Cools;
-import com.core.controller.AbstractBaseController;
-import com.core.exception.CoolException;
-import com.zy.system.entity.User;
-import com.zy.system.service.UserService;
-import io.swagger.annotations.ApiModelProperty;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import javax.servlet.http.HttpServletRequest;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Created by vincent on 2019-09-09
- */
-public class BaseController extends AbstractBaseController {
-
- protected static final String RANGE_TIME_LINK = " - ";
-
- @Autowired
- protected HttpServletRequest request;
- @Autowired
- private UserService userService;
-
- protected Long getUserId(){
- return Long.parseLong(String.valueOf(request.getAttribute("userId")));
- }
-
- protected User getUser(){
- User user = userService.selectById(getUserId());
- if (null == user) {
- throw new CoolException(BaseRes.DENIED);
- }
- return user;
- }
-
- protected String getComment(Class<?> cls, String fieldName){
- Field[] fields = Cools.getAllFields(cls);
- for (Field field : fields){
- if (fieldName.equals(field.getName())){
- return field.getAnnotation(ApiModelProperty.class).value();
- }
- }
- return "";
- }
-
- /**
- * 鍏ㄥ瓧娈垫ā绯婃悳绱�
- * @param cls 妯″瀷绫�
- * @param set 鎺掗櫎瀛楁闆嗗悎
- * @param condition 鎼滅储鍐呭
- */
- protected <T> void allLike(Class<T> cls, Set<String> set, EntityWrapper<T> wrapper, String condition){
- if (Cools.isEmpty(condition)) {
- return;
- }
- List<String> columns = new ArrayList<>();
- for (Field field :Cools.getAllFields(cls)){
- if (Modifier.isFinal(field.getModifiers())
- || Modifier.isStatic(field.getModifiers())
- || Modifier.isTransient(field.getModifiers())){
- continue;
- }
- String column = null;
- if (field.isAnnotationPresent(TableField.class)) {
- column = field.getAnnotation(TableField.class).value();
- }
- if (Cools.isEmpty(column)) {
- column = field.getName();
- }
- if (!set.contains(column)) {
- columns.add(column);
- }
- }
- if (columns.isEmpty()) {
- return;
- }
- for (int i=0;i<columns.size();i++){
- if (i==0){
- wrapper.andNew();
- } else {
- wrapper.or();
- }
- wrapper.like(columns.get(i), condition);
- }
- }
-}
diff --git a/src/main/java/com/zy/common/web/FileController.java b/src/main/java/com/zy/common/web/FileController.java
deleted file mode 100644
index f2b7f7a..0000000
--- a/src/main/java/com/zy/common/web/FileController.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.zy.common.web;
-
-import com.alibaba.excel.EasyExcel;
-import com.core.common.R;
-import com.zy.common.utils.excel.EnInitData;
-import com.zy.common.utils.excel.EnInitDataListener;
-import com.zy.common.utils.excel.ExcelUtils;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.net.URLEncoder;
-
-/**
- * todo
- * Created by vincent on 2019-11-25
- */
-@Controller
-@RequestMapping("excel/")
-public class FileController {
-
- /**
- * 鏂囦欢涓婁紶
- */
- @PostMapping("upload")
- @ResponseBody
- public R upload(MultipartFile file) throws IOException {
- EasyExcel.read(file.getInputStream(), EnInitData.class, new EnInitDataListener()).sheet().doRead();
- return R.ok();
- }
-
- /**
- * 鏂囦欢涓嬭浇锛堝け璐ヤ簡浼氳繑鍥炰竴涓湁閮ㄥ垎鏁版嵁鐨凟xcel锛�
- */
- @GetMapping("download")
- public void download(HttpServletResponse response) throws IOException {
- // 杩欓噷娉ㄦ剰 鏈夊悓瀛﹀弽搴斾娇鐢╯wagger 浼氬鑷村悇绉嶉棶棰橈紝璇风洿鎺ョ敤娴忚鍣ㄦ垨鑰呯敤postman
- response.setContentType("application/vnd.ms-excel");
- response.setCharacterEncoding("utf-8");
- // 杩欓噷URLEncoder.encode鍙互闃叉涓枃涔辩爜 褰撶劧鍜宔asyexcel娌℃湁鍏崇郴
- String fileName = URLEncoder.encode("娴嬭瘯", "UTF-8");
- response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
- EasyExcel.write(response.getOutputStream(), EnInitData.class).sheet("妯℃澘").doWrite(ExcelUtils.data());
- }
-
-}
diff --git a/src/main/java/com/zy/core/News.java b/src/main/java/com/zy/core/News.java
index a793e54..917bd1a 100644
--- a/src/main/java/com/zy/core/News.java
+++ b/src/main/java/com/zy/core/News.java
@@ -1,6 +1,5 @@
package com.zy.core;
-import com.core.common.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Array;
diff --git a/src/main/java/com/zy/core/ServerBootstrap.java b/src/main/java/com/zy/core/ServerBootstrap.java
index bfaf4da..35a6250 100644
--- a/src/main/java/com/zy/core/ServerBootstrap.java
+++ b/src/main/java/com/zy/core/ServerBootstrap.java
@@ -1,15 +1,15 @@
package com.zy.core;
-import com.core.exception.CoolException;
+import com.alibaba.fastjson.JSON;
+import com.zy.common.exception.CoolException;
import com.zy.common.utils.RedisUtil;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
-import com.zy.core.model.*;
-import com.zy.core.properties.SlaveProperties;
-import com.zy.core.thread.*;
+import com.zy.core.properties.DeviceConfig;
import com.zy.core.thread.impl.LfdZyForkLiftMasterThread;
import com.zy.core.thread.impl.NyShuttleThread;
+import com.zy.core.utils.DeviceMsgUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
@@ -17,6 +17,7 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
+import java.util.List;
/**
* Created by vincent on 2020/8/4
@@ -26,9 +27,9 @@
public class ServerBootstrap {
@Autowired
- private SlaveProperties slaveProperties;
- @Autowired
private RedisUtil redisUtil;
+ @Autowired
+ private DeviceMsgUtils deviceMsgUtils;
@PostConstruct
@@ -44,43 +45,37 @@
}
private void initMq(){
- // 鍒濆鍖栬揣鍙夋彁鍗囨満mq
- for (Slave forkLift : slaveProperties.getForkLift()) {
- MessageQueue.init(SlaveType.ForkLift, forkLift);
+ // 鍒濆鍖栬澶噈q
+ String deviceConfig = deviceMsgUtils.getDeviceConfig();
+ if(null == deviceConfig){
+ News.error("鍒濆鍖栬澶囨椂鏈娴嬪埌閰嶇疆鏂囦欢...................");
+ return;
}
- // 鍒濆鍖栧洓鍚戠┛姊溅mq
- for (Slave shuttle : slaveProperties.getShuttle()) {
- MessageQueue.init(SlaveType.Shuttle, shuttle);
+
+ List<DeviceConfig> deviceConfigs = JSON.parseArray(deviceConfig, DeviceConfig.class);
+ for (DeviceConfig device : deviceConfigs) {
+ SlaveType type = SlaveType.findInstance(device.getDeviceType());
+ if(null == type){
+ continue;
+ }
+ MessageQueue.init(type, device.getDeviceNo());
}
}
private void initThread(){
- // 鍒濆鍖栬揣鍙夋彁鍗囨満
- for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLiftMaster()) {
- News.info("鍒濆鍖栬揣鍙夋彁鍗囨満Master........................................................");
- ThreadHandler thread = null;
- if (forkLiftSlave.getThreadImpl().equals("LfdZyForkLiftMasterThread")) {
- thread = new LfdZyForkLiftMasterThread(forkLiftSlave, redisUtil);
- } else {
- throw new CoolException("鏈煡鐨勭嚎绋嬪疄鐜�");
- }
-
- new Thread(thread).start();
- SlaveConnection.put(SlaveType.ForkLiftMaster, forkLiftSlave.getId(), thread);
+ String deviceConfig = deviceMsgUtils.getDeviceConfig();
+ if(null == deviceConfig){
+ News.error("鍒濆鍖栬澶囨椂鏈娴嬪埌閰嶇疆鏂囦欢...................");
+ return;
}
- // 鍒濆鍖栧洓鍚戠┛姊溅
- for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
- News.info("鍒濆鍖栧洓鍚戠┛姊溅......................................................");
- ThreadHandler thread = null;
- if (shuttleSlave.getThreadImpl().equals("NyShuttleThread")) {
- thread = new NyShuttleThread(shuttleSlave, redisUtil);
- } else {
- throw new CoolException("鏈煡鐨勭嚎绋嬪疄鐜�");
+ List<DeviceConfig> deviceConfigs = JSON.parseArray(deviceConfig, DeviceConfig.class);
+ for (DeviceConfig device : deviceConfigs) {
+ if (device.getDeviceType().equals(String.valueOf(SlaveType.ForkLift))) {
+ initForkLiftThread(device);
+ } else if (device.getDeviceType().equals(String.valueOf(SlaveType.Shuttle))) {
+ initShuttleThread(device);
}
-
- new Thread(thread).start();
- SlaveConnection.put(SlaveType.Shuttle, shuttleSlave.getId(), thread);
}
}
@@ -89,5 +84,29 @@
public void destroy() {
}
+ private void initForkLiftThread(DeviceConfig deviceConfig) {
+ ThreadHandler thread = null;
+ if (deviceConfig.getThreadImpl().equals("LfdZyForkLiftMasterThread")) {
+ thread = new LfdZyForkLiftMasterThread(deviceConfig, redisUtil);
+ } else {
+ throw new CoolException("鏈煡鐨勭嚎绋嬪疄鐜�");
+ }
+
+ new Thread(thread).start();
+ SlaveConnection.put(SlaveType.ForkLiftMaster, deviceConfig.getDeviceNo(), thread);
+ }
+
+ private void initShuttleThread(DeviceConfig deviceConfig) {
+ ThreadHandler thread = null;
+ if (deviceConfig.getThreadImpl().equals("NyShuttleThread")) {
+ thread = new NyShuttleThread(deviceConfig, redisUtil);
+ } else {
+ throw new CoolException("鏈煡鐨勭嚎绋嬪疄鐜�");
+ }
+
+ new Thread(thread).start();
+ SlaveConnection.put(SlaveType.Shuttle, deviceConfig.getDeviceNo(), thread);
+ }
+
}
diff --git a/src/main/java/com/zy/core/Slave.java b/src/main/java/com/zy/core/Slave.java
deleted file mode 100644
index db9c73f..0000000
--- a/src/main/java/com/zy/core/Slave.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.zy.core;
-
-import lombok.Data;
-
-/**
- * Created by vincent on 2020/8/4
- */
-@Data
-public class Slave {
-
- private Integer id;
-
- private String ip;
-
- private Integer port;
-
- private String threadImpl;
-
-}
diff --git a/src/main/java/com/zy/core/cache/MessageQueue.java b/src/main/java/com/zy/core/cache/MessageQueue.java
index a7a9efd..030fb2d 100644
--- a/src/main/java/com/zy/core/cache/MessageQueue.java
+++ b/src/main/java/com/zy/core/cache/MessageQueue.java
@@ -1,6 +1,5 @@
package com.zy.core.cache;
-import com.zy.core.Slave;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.Task;
@@ -26,19 +25,19 @@
/**
* mq 浜ゆ崲鏈哄垵濮嬪寲
*/
- public static void init(SlaveType type, Slave slave) {
+ public static void init(SlaveType type, Integer id) {
switch (type) {
case Shuttle:
- SHUTTLE_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
+ SHUTTLE_EXCHANGE.put(id, new ConcurrentLinkedQueue<>());
break;
case ForkLift:
- FORK_LIFT_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
+ FORK_LIFT_EXCHANGE.put(id, new ConcurrentLinkedQueue<>());
break;
case ForkLiftMaster:
- FORK_LIFT_MASTER_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
+ FORK_LIFT_MASTER_EXCHANGE.put(id, new ConcurrentLinkedQueue<>());
break;
case Lift:
- LIFT_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
+ LIFT_EXCHANGE.put(id, new ConcurrentLinkedQueue<>());
break;
default:
break;
diff --git a/src/main/java/com/zy/core/cache/OutputQueue.java b/src/main/java/com/zy/core/cache/OutputQueue.java
index edb1923..c0243eb 100644
--- a/src/main/java/com/zy/core/cache/OutputQueue.java
+++ b/src/main/java/com/zy/core/cache/OutputQueue.java
@@ -1,7 +1,5 @@
package com.zy.core.cache;
-import com.alibaba.fastjson.JSONObject;
-
import java.util.concurrent.ArrayBlockingQueue;
/**
diff --git a/src/main/java/com/zy/core/enums/ForkLiftConfirmType.java b/src/main/java/com/zy/core/enums/ForkLiftConfirmType.java
deleted file mode 100644
index 410b0da..0000000
--- a/src/main/java/com/zy/core/enums/ForkLiftConfirmType.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.zy.core.enums;
-
-//璐у弶鎻愬崌鏈轰换鍔$‘璁�
-public enum ForkLiftConfirmType {
- NO(0, "鏈‘璁�"),
- CONFIRM(1, "宸茬‘璁�"),
- ;
-
- public Integer id;
- public String desc;
-
- ForkLiftConfirmType(Integer id, String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static ForkLiftConfirmType get(Integer id) {
- if (null == id) {
- return null;
- }
- for (ForkLiftConfirmType type : ForkLiftConfirmType.values()) {
- if (type.id.equals(id)) {
- return type;
- }
- }
- return null;
- }
-
- public static ForkLiftConfirmType get(ForkLiftConfirmType type) {
- if (null == type) {
- return null;
- }
- for (ForkLiftConfirmType type2 : ForkLiftConfirmType.values()) {
- if (type2 == type) {
- return type2;
- }
- }
- return null;
- }
-}
diff --git a/src/main/java/com/zy/core/enums/ForkLiftIoModeType.java b/src/main/java/com/zy/core/enums/ForkLiftIoModeType.java
deleted file mode 100644
index a2d9a10..0000000
--- a/src/main/java/com/zy/core/enums/ForkLiftIoModeType.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.zy.core.enums;
-
-//璐у弶鎻愬崌鏈哄嚭鍏ュ簱妯″紡
-public enum ForkLiftIoModeType {
- NONE(0, "鏈煡"),
- IN(1, "鍏ュ簱"),
- OUT(2, "鍑哄簱"),
- ;
-
- public Integer id;
- public String desc;
-
- ForkLiftIoModeType(Integer id, String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static ForkLiftIoModeType get(Integer id) {
- if (null == id) {
- return null;
- }
- for (ForkLiftIoModeType type : ForkLiftIoModeType.values()) {
- if (type.id.equals(id)) {
- return type;
- }
- }
- return null;
- }
-
- public static ForkLiftIoModeType get(ForkLiftIoModeType type) {
- if (null == type) {
- return null;
- }
- for (ForkLiftIoModeType type2 : ForkLiftIoModeType.values()) {
- if (type2 == type) {
- return type2;
- }
- }
- return null;
- }
-}
diff --git a/src/main/java/com/zy/core/enums/ForkLiftProtocolStatusType.java b/src/main/java/com/zy/core/enums/ForkLiftProtocolStatusType.java
deleted file mode 100644
index 4bfa221..0000000
--- a/src/main/java/com/zy/core/enums/ForkLiftProtocolStatusType.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.zy.core.enums;
-
-public enum ForkLiftProtocolStatusType {
- NONE(-1, "绂荤嚎"),
- IDLE(0, "绌洪棽"),
- PICK_UP(1, "鍙栬揣涓�"),
- PUT_DOWN(2, "鏀捐揣涓�"),
- MOVING(3, "绉诲姩涓�"),
- WAITING(98, "绛夊緟纭"),
- ERROR(99, "鏁呴殰"),
- ;
-
- public Integer id;
- public String desc;
-
- ForkLiftProtocolStatusType(Integer id, String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static ForkLiftProtocolStatusType get(Integer id) {
- if (null == id) {
- return null;
- }
- for (ForkLiftProtocolStatusType type : ForkLiftProtocolStatusType.values()) {
- if (type.id.equals(id)) {
- return type;
- }
- }
- return null;
- }
-
- public static ForkLiftProtocolStatusType get(ForkLiftProtocolStatusType type) {
- if (null == type) {
- return null;
- }
- for (ForkLiftProtocolStatusType type2 : ForkLiftProtocolStatusType.values()) {
- if (type2 == type) {
- return type2;
- }
- }
- return null;
- }
-}
diff --git a/src/main/java/com/zy/core/enums/ForkLiftTaskModeType.java b/src/main/java/com/zy/core/enums/ForkLiftTaskModeType.java
deleted file mode 100644
index 894c60d..0000000
--- a/src/main/java/com/zy/core/enums/ForkLiftTaskModeType.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.zy.core.enums;
-
-//璐у弶鎻愬崌鏈轰换鍔℃ā寮�
-public enum ForkLiftTaskModeType {
-
- NONE(0, "鏈煡"),
- PICK_UP(1, "鍙栬揣"),
- PUT_DOWN(2, "鏀捐揣"),
- PICK_PUT(3, "鍙栨斁璐�"),
- SHUTTLE_SWITCH(4, "灏忚溅鎹㈠眰"),
- MOVE(5, "鎻愬崌鏈虹Щ鍔�"),
- ;
-
- public Integer id;
- public String desc;
-
- ForkLiftTaskModeType(Integer id, String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static ForkLiftTaskModeType get(Integer id) {
- if (null == id) {
- return null;
- }
- for (ForkLiftTaskModeType type : ForkLiftTaskModeType.values()) {
- if (type.id.equals(id)) {
- return type;
- }
- }
- return null;
- }
-
- public static ForkLiftTaskModeType get(ForkLiftTaskModeType type) {
- if (null == type) {
- return null;
- }
- for (ForkLiftTaskModeType type2 : ForkLiftTaskModeType.values()) {
- if (type2 == type) {
- return type2;
- }
- }
- return null;
- }
-}
diff --git a/src/main/java/com/zy/core/enums/LocStsType.java b/src/main/java/com/zy/core/enums/LocStsType.java
deleted file mode 100644
index b0580f7..0000000
--- a/src/main/java/com/zy/core/enums/LocStsType.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.zy.core.enums;
-
-public enum LocStsType {
-
- D,//绌烘澘
- F,//鍦ㄥ簱
- O,//绌哄簱
- R,//鍑哄簱棰勭害
- S,//鍏ュ簱棰勭害
- X,//绂佺敤
- E,//涓嶅彲鏀捐揣閫氶亾
- W,//姣嶈建閬�
- C,//鍏呯數妗�
- Z,//绔欑偣
- ;
-
- LocStsType() {
- }
-
- public static LocStsType get(String el) {
- for (LocStsType value : LocStsType.values()) {
- if (el.equals(value.toString())) {
- return value;
- }
- }
- return null;
- }
-
-}
diff --git a/src/main/java/com/zy/core/enums/MapNodeType.java b/src/main/java/com/zy/core/enums/MapNodeType.java
deleted file mode 100644
index 15ae607..0000000
--- a/src/main/java/com/zy/core/enums/MapNodeType.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.zy.core.enums;
-
-public enum MapNodeType {
-
- DISABLE(-1, "绂佺敤"),
- NORMAL_PATH(0, "璐т綅"),
- START_POINT(1, "璧风偣"),
- TARGET_POINT(2, "缁堢偣"),
- MAIN_PATH(3, "姣嶈建"),
- CONVEYOR(4, "杈撻�佺珯鐐�"),
- CHARGE(5, "鍏呯數妗�"),
- CONVEYOR_CAR_GO(6, "灏忚溅鍙蛋杈撻�佺珯鐐�"),
- CAR(66, "灏忚溅"),
- LIFT(67, "鎻愬崌鏈�"),
- LOCK(-999, "閿佸畾鑺傜偣"),
- ;
-
- public Integer id;
- public String desc;
-
- MapNodeType(Integer id, String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static MapNodeType get(Short id) {
- if (null == id) {
- return null;
- }
- for (MapNodeType type : MapNodeType.values()) {
- if (type.id.equals(id.intValue())) {
- return type;
- }
- }
- return null;
- }
-
- public static MapNodeType get(MapNodeType type) {
- if (null == type) {
- return null;
- }
- for (MapNodeType type1 : MapNodeType.values()) {
- if (type1 == type) {
- return type1;
- }
- }
- return null;
- }
-}
diff --git a/src/main/java/com/zy/core/enums/RedisKeyType.java b/src/main/java/com/zy/core/enums/RedisKeyType.java
index 4cd2014..0ac7ce7 100644
--- a/src/main/java/com/zy/core/enums/RedisKeyType.java
+++ b/src/main/java/com/zy/core/enums/RedisKeyType.java
@@ -21,6 +21,9 @@
//璁惧鎸囦护娑堟伅KEY
DEVICE_SHUTTLE_COMMAND_MSG_KEY("deviceShuttleCommandMsgKey_"),
DEVICE_FORK_LIFT_COMMAND_MSG_KEY("deviceForkLiftCommandMsgKey_"),
+
+ //璁惧閰嶇疆鏂囦欢
+ DEVICE_CONFIG("deviceConfig"),
;
public String key;
diff --git a/src/main/java/com/zy/core/enums/ShuttleCommandModeType.java b/src/main/java/com/zy/core/enums/ShuttleCommandModeType.java
deleted file mode 100644
index 082aa68..0000000
--- a/src/main/java/com/zy/core/enums/ShuttleCommandModeType.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.zy.core.enums;
-
-/**
- * 鍥涘悜绌挎杞﹀懡浠ょ被鍨�
- */
-public enum ShuttleCommandModeType {
-
- NONE(-1, "鏈煡绫诲瀷"),
- MOVE(1, "绉诲姩"),
- IN_LIFT(2, "杩涙彁鍗囨満"),
- OUT_LIFT(3, "鍑烘彁鍗囨満"),
- CHARGE_OPEN(4, "鍏呯數寮�"),
- CHARGE_CLOSE(5, "鍏呯數鍏�"),
- PALLET_LIFT(6, "鎵樼洏椤跺崌"),
- PALLET_DOWN(7, "鎵樼洏涓嬮檷"),
- RESET(8, "澶嶄綅"),
- UPDATE_LOCATION(9, "鏇存柊鍧愭爣"),
- ;
-
- public Integer id;
- public String desc;
-
- ShuttleCommandModeType(Integer id, String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static ShuttleCommandModeType get(Integer id) {
- if (null == id) {
- return null;
- }
- for (ShuttleCommandModeType type : ShuttleCommandModeType.values()) {
- if (type.id.equals(id)) {
- return type;
- }
- }
- return null;
- }
-
- public static ShuttleCommandModeType get(ShuttleCommandModeType type) {
- if (null == type) {
- return null;
- }
- for (ShuttleCommandModeType type1 : ShuttleCommandModeType.values()) {
- if (type1 == type) {
- return type1;
- }
- }
- return null;
- }
-
-
-}
diff --git a/src/main/java/com/zy/core/enums/ShuttleProtocolStatusType.java b/src/main/java/com/zy/core/enums/ShuttleProtocolStatusType.java
deleted file mode 100644
index f30c523..0000000
--- a/src/main/java/com/zy/core/enums/ShuttleProtocolStatusType.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.zy.core.enums;
-
-/**
- * 鍥涘悜绌挎杞﹀唴閮ㄧ姸鎬佹灇涓�
- */
-public enum ShuttleProtocolStatusType {
-
- IDLE(1, "绌洪棽"),
- WORKING(2, "浣滀笟涓�"),
- WAITING(3, "绛夊緟纭"),
- CHARGING(4, "鍏呯數涓�"),
- CHARGING_WAITING(5, "鍏呯數浠诲姟绛夊緟纭"),
- FIXING(6, "鏁呴殰淇涓�"),
- OFFLINE(7, "绂荤嚎"),
- ;
-
- public Integer id;
- public String desc;
-
- ShuttleProtocolStatusType(Integer id, String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static ShuttleProtocolStatusType get(Integer id) {
- if (null == id) {
- return null;
- }
- for (ShuttleProtocolStatusType type : ShuttleProtocolStatusType.values()) {
- if (type.id.equals(id.intValue())) {
- return type;
- }
- }
- return null;
- }
-
- public static ShuttleProtocolStatusType get(ShuttleProtocolStatusType type) {
- if (null == type) {
- return null;
- }
- for (ShuttleProtocolStatusType type2 : ShuttleProtocolStatusType.values()) {
- if (type2 == type) {
- return type2;
- }
- }
- return null;
- }
-
-}
diff --git a/src/main/java/com/zy/core/enums/ShuttleRunDirection.java b/src/main/java/com/zy/core/enums/ShuttleRunDirection.java
deleted file mode 100644
index ac8b1d7..0000000
--- a/src/main/java/com/zy/core/enums/ShuttleRunDirection.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.zy.core.enums;
-
-/**
- * 鍥涘悜绌挎杞﹁繍琛屾柟鍚�
- */
-public enum ShuttleRunDirection {
-
- TOP((short)2, "璐х墿鏂瑰悜-"),
- BOTTOM((short)1, "璐х墿鏂瑰悜+"),
- LEFT((short)3, "杩囬亾鏂瑰悜-"),
- RIGHT((short)4, "杩囬亾鏂瑰悜+"),
- ;
-
- public Short id;
- public String desc;
-
- ShuttleRunDirection(Short id,String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static ShuttleRunDirection get(String direction) {
- if (null == direction) {
- return null;
- }
- if (direction.equals("top")) {
- return TOP;
- } else if (direction.equals("bottom")) {
- return BOTTOM;
- } else if (direction.equals("left")) {
- return LEFT;
- } else if (direction.equals("right")) {
- return RIGHT;
- }else {
- return null;
- }
- }
-
- public static ShuttleRunDirection get(Short id) {
- if (null == id) {
- return null;
- }
- for (ShuttleRunDirection type : ShuttleRunDirection.values()) {
- if (type.id.equals(id.shortValue())) {
- return type;
- }
- }
- return null;
- }
-
- public static ShuttleRunDirection get(ShuttleRunDirection type) {
- if (null == type) {
- return null;
- }
- for (ShuttleRunDirection shuttleRunDirection : ShuttleRunDirection.values()) {
- if (shuttleRunDirection == type) {
- return shuttleRunDirection;
- }
- }
- return null;
- }
-
-}
diff --git a/src/main/java/com/zy/core/enums/ShuttleStatusType.java b/src/main/java/com/zy/core/enums/ShuttleStatusType.java
deleted file mode 100644
index 5c1f5e7..0000000
--- a/src/main/java/com/zy/core/enums/ShuttleStatusType.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.zy.core.enums;
-
-/**
- * 鍥涘悜绌挎杞�
- */
-public enum ShuttleStatusType {
-
- IDLE(1, "绌洪棽"),
- BUSY(0, "蹇�"),
- ;
-
- public Integer id;
- public String desc;
-
- ShuttleStatusType(Integer id,String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static ShuttleStatusType get(Integer id) {
- if (null == id) {
- return null;
- }
- for (ShuttleStatusType type : ShuttleStatusType.values()) {
- if (type.id == id) {
- return type;
- }
- }
- return BUSY;
- }
-
- public static ShuttleStatusType get(ShuttleStatusType type) {
- if (null == type) {
- return null;
- }
- for (ShuttleStatusType shuttleStatusType : ShuttleStatusType.values()) {
- if (shuttleStatusType == type) {
- return shuttleStatusType;
- }
- }
- return null;
- }
-
-}
diff --git a/src/main/java/com/zy/core/enums/ShuttleTaskModeType.java b/src/main/java/com/zy/core/enums/ShuttleTaskModeType.java
deleted file mode 100644
index 339f7ab..0000000
--- a/src/main/java/com/zy/core/enums/ShuttleTaskModeType.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.zy.core.enums;
-
-public enum ShuttleTaskModeType {
-
- INIT(0, "鍒濆"), // 鍒濆
- PALLET_LIFT(1, "鎵樼洏椤跺崌"),
- PALLET_DOWN(2, "鎵樼洏涓嬮檷"),
- RESET(3, "鐘舵�佸浣�"),
- MOVE_LOC_NO(4, "绉诲姩鍒扮洰鏍囧簱浣�"),
- MOVE_LOC_NO_TASK(5, "绉诲姩鍒扮洰鏍囧簱浣�(鐢熸垚绉诲姩浠诲姟)"),
- CHARGE(6, "鍏呯數"),
- MOVE_LIFT(7, "绉诲姩鍒版彁鍗囨満"),
- AVOID(8, "閬胯浠诲姟"),
- TRANSPORT(9, "鎼繍浠诲姟"),
- SHUTTLE_CONTROL(10, "灏忚溅绠″埗"),
- SHUTTLE_CANCEL_CONTROL(11, "灏忚溅鍙栨秷绠″埗"),
- SHUTTLE_DEMO_OPEN(12, "婕旂ず妯″紡-寮�"),
- SHUTTLE_DEMO_CLOSE(13, "婕旂ず妯″紡-鍏�"),
- UPDATE_LOCATION(14, "鏇存柊鍧愭爣"),
- ;
-
- public Integer id;
- public String desc;
-
- ShuttleTaskModeType(Integer id, String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static ShuttleTaskModeType get(Integer id) {
- if (null == id) {
- return null;
- }
- for (ShuttleTaskModeType type : ShuttleTaskModeType.values()) {
- if (type.id.equals(id)) {
- return type;
- }
- }
- return null;
- }
-
- public static ShuttleTaskModeType get(ShuttleTaskModeType type) {
- if (null == type) {
- return null;
- }
- for (ShuttleTaskModeType shuttleTaskModeType : ShuttleTaskModeType.values()) {
- if (shuttleTaskModeType == type) {
- return shuttleTaskModeType;
- }
- }
- return null;
- }
-
-}
diff --git a/src/main/java/com/zy/core/enums/ShuttleTaskNoType.java b/src/main/java/com/zy/core/enums/ShuttleTaskNoType.java
deleted file mode 100644
index 5f50b41..0000000
--- a/src/main/java/com/zy/core/enums/ShuttleTaskNoType.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.zy.core.enums;
-
-/**
- * 鍥涘悜绌挎杞︿换鍔″彿绫诲瀷
- */
-public enum ShuttleTaskNoType {
-
- IN(1, "鍏ュ簱"),
- OUT(2, "鍑哄簱"),
- MOVE(3, "绉诲姩"),
- CHARGE(4, "鍏呯數"),
- RESET(5, "澶嶄綅"),
- ;
-
- public Integer id;
- public String desc;
-
- ShuttleTaskNoType(Integer id, String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public static ShuttleTaskNoType get(Integer id) {
- if (null == id) {
- return null;
- }
- for (ShuttleTaskNoType type : ShuttleTaskNoType.values()) {
- if (type.id.equals(id)) {
- return type;
- }
- }
- return null;
- }
-
- public static ShuttleTaskNoType get(ShuttleTaskNoType type) {
- if (null == type) {
- return null;
- }
- for (ShuttleTaskNoType type1 : ShuttleTaskNoType.values()) {
- if (type1 == type) {
- return type1;
- }
- }
- return null;
- }
-
-
-}
diff --git a/src/main/java/com/zy/core/enums/WrkIoType.java b/src/main/java/com/zy/core/enums/WrkIoType.java
deleted file mode 100644
index 5926868..0000000
--- a/src/main/java/com/zy/core/enums/WrkIoType.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.zy.core.enums;
-
-import com.core.common.Cools;
-
-public enum WrkIoType {
-
- IN(1, "鍏ュ簱"),
- OUT(101, "鍑哄簱"),
- SHUTTLE_MOVE(200, "灏忚溅绉诲姩"),
- LOC_MOVE(201, "绉诲簱浠诲姟"),
- SHUTTLE_CHARGE(300, "灏忚溅鍏呯數"),
- FORKLIFT_MOVE(98, "鎻愬崌鏈洪璋冨害绉诲姩浠诲姟"),
- MANUAL(99, "鎵嬪姩浠诲姟"),
- ;
-
- WrkIoType(int id, String desc) {
- this.id = id;
- this.desc = desc;
- }
-
- public int id;
-
- public String desc;
-
- public static WrkIoType get(String desc) {
- if (Cools.isEmpty(desc)) {
- return null;
- }
- WrkIoType[] values = WrkIoType.values();
- for (WrkIoType value : values) {
- if (value.desc.equals(desc)) {
- return value;
- }
- }
- return null;
- }
-
- public static WrkIoType get(int id) {
- if (Cools.isEmpty(id)) {
- return null;
- }
- WrkIoType[] values = WrkIoType.values();
- for (WrkIoType value : values) {
- if (value.id == id) {
- return value;
- }
- }
- return null;
- }
-
-}
diff --git a/src/main/java/com/zy/core/enums/WrkStsType.java b/src/main/java/com/zy/core/enums/WrkStsType.java
deleted file mode 100644
index 5b45eda..0000000
--- a/src/main/java/com/zy/core/enums/WrkStsType.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.zy.core.enums;
-
-import com.core.exception.CoolException;
-
-public enum WrkStsType {
-
- NEW_INBOUND(1, "鐢熸垚鍏ュ簱浠诲姟"),
- INBOUND_DEVICE_RUN(2, "璁惧涓婅蛋"),
- INBOUND_LIFT_RUN(3, "鎻愬崌鏈烘惉杩愪腑"),
- INBOUND_LIFT_RUN_COMPLETE(4, "鎻愬崌鏈烘惉杩愬畬鎴�"),
- INBOUND_SHUTTLE_RUN(5, "灏忚溅鎼繍涓�"),
- INBOUND_SHUTTLE_RUN_COMPLETE(6, "灏忚溅鎼繍瀹屾垚"),
- COMPLETE_INBOUND(9, "鍏ュ簱瀹屾垚"),
- SETTLE_INBOUND(10, "鍏ュ簱搴撳瓨鏇存柊"),
-
- NEW_OUTBOUND(101, "鐢熸垚鍑哄簱浠诲姟"),
- OUTBOUND_SHUTTLE_RUN(102, "灏忚溅鎼繍涓�"),
- OUTBOUND_SHUTTLE_RUN_COMPLETE(103, "灏忚溅鎼繍瀹屾垚"),
- OUTBOUND_LIFT_RUN(104, "鎻愬崌鏈烘惉杩愪腑"),
- OUTBOUND_LIFT_RUN_COMPLETE(105, "鎻愬崌鏈烘惉杩愬畬鎴�"),
- COMPLETE_OUTBOUND(109, "鍑哄簱瀹屾垚"),
- SETTLE_OUTBOUND(110, "鍑哄簱搴撳瓨鏇存柊"),
-
- NEW_CHARGE(201, "鐢熸垚鍏呯數浠诲姟"),
- CHARGE_SHUTTLE_RUN(202, "灏忚溅鍓嶅線鍏呯數妗�"),
- CHARGE_SHUTTLE_RUN_COMPLETE(203, "灏忚溅鍒拌揪鍏呯數妗�"),
- CHARGE_SHUTTLE_WORKING(204, "灏忚溅鍏呯數涓�"),
- CHARGE_SHUTTLE_COMPLETE(205, "灏忚溅鍏呯數瀹屾垚"),
- COMPLETE_CHARGE(210, "鍏呯數浠诲姟瀹屾垚"),
-
- NEW_MOVE(301, "鐢熸垚杩佺Щ浠诲姟"),
- MOVE_NEARBY(302, "灏忚溅绉诲姩鑷宠繎鐐逛腑"),
- MOVE_NEARBY_COMPLETE(303, "灏忚溅绉诲姩鑷宠繎鐐瑰畬鎴�"),
- MOVE_IN_LIFT(304, "灏忚溅杩佸叆鎻愬崌鏈轰腑"),
- MOVE_IN_LIFT_COMPLETE(305, "灏忚溅杩佸叆鎻愬崌鏈哄畬鎴�"),
- MOVE_LIFT_RUN(306, "鎻愬崌鏈烘惉杩愪腑"),
- MOVE_LIFT_RUN_COMPLETE(307, "鎻愬崌鏈烘惉杩愬畬鎴�"),
- MOVE_OUT_LIFT(308, "灏忚溅杩佸嚭鎻愬崌鏈轰腑"),
- MOVE_OUT_LIFT_COMPLETE(309, "灏忚溅杩佸嚭鎻愬崌鏈哄畬鎴�"),
- MOVE_SHUTTLE(310, "灏忚溅绉诲姩涓�"),
- COMPLETE_MOVE(311, "灏忚溅绉诲姩瀹屾垚"),
-
- NEW_MANUAL(401, "鐢熸垚鎵嬪姩浠诲姟"),
- ANALYZE_MANUAL(402, "鎵嬪姩浠诲姟瑙f瀽"),
- EXECUTE_MANUAL(403, "鎵ц鎵嬪姩浠诲姟"),
- COMPLETE_MANUAL(410, "鎵嬪姩浠诲姟瀹屾垚"),
-
- NEW_LOC_MOVE(501, "鐢熸垚绉诲簱浠诲姟"),
- LOC_MOVE_SHUTTLE_RUN(502, "灏忚溅鎼繍涓�"),
- COMPLETE_LOC_MOVE(509, "绉诲簱瀹屾垚"),
- ;
-
-
- public long sts;
- public String desc;
-
- WrkStsType(long sts, String desc) {
- this.sts = sts;
- this.desc = desc;
- }
-
- public static WrkStsType query(Long sts) {
- for (WrkStsType value : WrkStsType.values()) {
- if (value.sts == sts) {
- return value;
- }
- }
- throw new CoolException("TaskStsType Error!!!");
- }
-
-}
diff --git a/src/main/java/com/zy/core/model/ForkLiftSlave.java b/src/main/java/com/zy/core/model/ForkLiftSlave.java
deleted file mode 100644
index 4e5e184..0000000
--- a/src/main/java/com/zy/core/model/ForkLiftSlave.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.zy.core.model;
-
-import com.zy.core.Slave;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@EqualsAndHashCode(callSuper = true)
-@Data
-public class ForkLiftSlave extends Slave {
-
- private Integer rack;
-
- private Integer slot;
-
- //涓荤嚎绋媔d(鐢ㄤ簬澶氳澶囧叡鐢ㄤ竴鍧梡lc鎯呭喌)
- private Integer masterId;
-
- //鎻愬崌鏈虹珯鐐�
- private List<Sta> sta = new ArrayList<>();
-
- //杈撻�佺珯鐐规帓
- private Integer staRow;
-
- //杈撻�佺珯鐐瑰垪
- private Integer staBay;
-
- @Data
- public static class Sta {
-
- // 鎻愬崌鏈虹珯鐐瑰彿
- private Integer staNo;
-
- // 灞�
- private Integer lev;
-
- // 鎻愬崌鏈哄彿
- private Integer liftNo;
-
- }
-
-}
diff --git a/src/main/java/com/zy/core/model/LiftSlave.java b/src/main/java/com/zy/core/model/LiftSlave.java
deleted file mode 100644
index 6070ea0..0000000
--- a/src/main/java/com/zy/core/model/LiftSlave.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.zy.core.model;
-
-import com.zy.core.Slave;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@EqualsAndHashCode(callSuper = true)
-@Data
-public class LiftSlave extends Slave {
-
- //鎻愬崌鏈虹珯鐐�
- private List<Sta> sta = new ArrayList<>();
-
- //杈撻�佺珯鐐规帓
- private Integer staRow;
-
- //杈撻�佺珯鐐瑰垪
- private Integer staBay;
-
- @Data
- public static class Sta {
-
- // 鎻愬崌鏈虹珯鐐瑰彿
- private Integer staNo;
-
- // 灞�
- private Integer lev;
-
- // 鎻愬崌鏈哄彿
- private Integer liftNo;
-
- }
-
-}
diff --git a/src/main/java/com/zy/core/model/ShuttleSlave.java b/src/main/java/com/zy/core/model/ShuttleSlave.java
deleted file mode 100644
index 2635e5f..0000000
--- a/src/main/java/com/zy/core/model/ShuttleSlave.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.zy.core.model;
-
-import com.zy.core.Slave;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@EqualsAndHashCode(callSuper = true)
-@Data
-public class ShuttleSlave extends Slave {
-
- private Integer rack;
-
- private Integer slot;
-
- private Boolean demo;
-
- // 绌挎杞﹀叆搴撶珯鐐�
- private List<Sta> shuttleInStn = new ArrayList<>();
-
- // 绌挎杞﹀嚭搴撶珯鐐�
- private List<Sta> shuttleOutStn = new ArrayList<>();
-
- @Data
- public static class Sta {
-
- // 杈撻�佺嚎plc缂栧彿
- private Integer devpPlcId;
-
- // 绌挎杞︾珯鐐圭紪鍙�
- private Integer staNo;
-
- // 鎺�
- private Integer row;
-
- // 鍒�
- private Integer bay;
-
- // 灞�
- private Integer lev;
-
- }
-
-}
diff --git a/src/main/java/com/zy/core/properties/DeviceConfig.java b/src/main/java/com/zy/core/properties/DeviceConfig.java
new file mode 100644
index 0000000..0b045d8
--- /dev/null
+++ b/src/main/java/com/zy/core/properties/DeviceConfig.java
@@ -0,0 +1,18 @@
+package com.zy.core.properties;
+
+import lombok.Data;
+
+@Data
+public class DeviceConfig {
+
+ private String ip;
+
+ private Integer port;
+
+ private String threadImpl;
+
+ private String deviceType;
+
+ private Integer deviceNo;
+
+}
diff --git a/src/main/java/com/zy/core/properties/SlaveProperties.java b/src/main/java/com/zy/core/properties/SlaveProperties.java
deleted file mode 100644
index 74910e7..0000000
--- a/src/main/java/com/zy/core/properties/SlaveProperties.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.zy.core.properties;
-
-import com.zy.core.Slave;
-import com.zy.core.model.*;
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by vincent on 2020/8/4
- */
-@Data
-@Configuration
-@ConfigurationProperties(prefix = "wcs-slave")
-public class SlaveProperties {
-
- private boolean doubleDeep;
-
- private List<Integer> doubleLocs = new ArrayList<>();
-
- private int groupCount;
-
- private List<ShuttleSlave> shuttle = new ArrayList<>();
-
- private List<ForkLiftSlave> forkLift = new ArrayList<>();
-
- private List<ForkLiftSlave> forkLiftMaster = new ArrayList<>();
-
-}
diff --git a/src/main/java/com/zy/core/thread/impl/LfdZyForkLiftMasterThread.java b/src/main/java/com/zy/core/thread/impl/LfdZyForkLiftMasterThread.java
index 7206144..46353b4 100644
--- a/src/main/java/com/zy/core/thread/impl/LfdZyForkLiftMasterThread.java
+++ b/src/main/java/com/zy/core/thread/impl/LfdZyForkLiftMasterThread.java
@@ -4,12 +4,12 @@
import HslCommunication.Core.Types.OperateResultExOne;
import HslCommunication.Profinet.Siemens.SiemensPLCS;
import HslCommunication.Profinet.Siemens.SiemensS7Net;
-import com.core.common.DateUtils;
+import com.zy.common.utils.DateUtils;
import com.zy.common.utils.RedisUtil;
import com.zy.core.News;
import com.zy.core.ThreadHandler;
import com.zy.core.cache.OutputQueue;
-import com.zy.core.model.ForkLiftSlave;
+import com.zy.core.properties.DeviceConfig;
import lombok.extern.slf4j.Slf4j;
import java.text.MessageFormat;
@@ -22,14 +22,14 @@
@SuppressWarnings("all")
public class LfdZyForkLiftMasterThread implements ThreadHandler {
- private ForkLiftSlave slave;
+ private DeviceConfig deviceConfig;
private RedisUtil redisUtil;
private SiemensS7Net siemensS7Net;
private List<HashMap<String,Object>> slaveAddressList = null;
private boolean connect = false;
- public LfdZyForkLiftMasterThread(ForkLiftSlave slave, RedisUtil redisUtil) {
- this.slave = slave;
+ public LfdZyForkLiftMasterThread(DeviceConfig deviceConfig, RedisUtil redisUtil) {
+ this.deviceConfig = deviceConfig;
this.redisUtil = redisUtil;
ArrayList<HashMap<String, Object>> addressList = new ArrayList<>();
@@ -59,17 +59,17 @@
@Override
public boolean connect() {
boolean result = false;
- siemensS7Net = new SiemensS7Net(SiemensPLCS.S1200, slave.getIp());
- siemensS7Net.setRack(slave.getRack().byteValue());
- siemensS7Net.setSlot(slave.getSlot().byteValue());
+ siemensS7Net = new SiemensS7Net(SiemensPLCS.S1200, deviceConfig.getIp());
+ siemensS7Net.setRack(Integer.valueOf(0).byteValue());
+ siemensS7Net.setSlot(Integer.valueOf(0).byteValue());
OperateResult connect = siemensS7Net.ConnectServer();
if(connect.IsSuccess){
result = true;
- OutputQueue.FORKLIFT.offer(MessageFormat.format( "銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
- News.info("璐у弶鎻愬崌鏈鸿繛鎺ユ垚鍔� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+ OutputQueue.FORKLIFT.offer(MessageFormat.format( "銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort(), 0, 0));
+ News.info("璐у弶鎻愬崌鏈鸿繛鎺ユ垚鍔� ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
} else {
- OutputQueue.FORKLIFT.offer(MessageFormat.format( "銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
- News.error("璐у弶鎻愬崌鏈鸿繛鎺ュけ璐ワ紒锛侊紒 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+ OutputQueue.FORKLIFT.offer(MessageFormat.format( "銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort(), 0, 0));
+ News.error("璐у弶鎻愬崌鏈鸿繛鎺ュけ璐ワ紒锛侊紒 ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
}
// siemensS7Net.ConnectClose();
this.connect = result;
@@ -83,7 +83,7 @@
@Override
public void run() {
- News.info("{}鍙疯揣鍙夋彁鍗囨満Master绾跨▼鍚姩", slave.getId());
+ News.info("{}鍙疯揣鍙夋彁鍗囨満Master绾跨▼鍚姩", deviceConfig.getDeviceNo());
this.connect();
while (true) {
try {
@@ -109,7 +109,7 @@
OperateResultExOne<byte[]> result = siemensS7Net.Read(dbData.dbAddress, dbData.dbAddressLength);
return result;
} catch (Exception e) {
- OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆戣鍙栨彁鍗囨満鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+ OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆戣鍙栨彁鍗囨満鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
}
return null;
}
@@ -121,7 +121,7 @@
OperateResult result = siemensS7Net.Write(dbData.dbAddress, array);
return result;
} catch (Exception e) {
- OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆戝啓鍏ユ彁鍗囨満鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+ OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆戝啓鍏ユ彁鍗囨満鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
}
return null;
}
@@ -133,7 +133,7 @@
OperateResult result = siemensS7Net.Write(dbData.dbAddress, val);
return result;
} catch (Exception e) {
- OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆戝啓鍏ユ彁鍗囨満鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+ OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆戝啓鍏ユ彁鍗囨満鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
}
return null;
}
diff --git a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
index 5014298..3296a6b 100644
--- a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
@@ -2,16 +2,16 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
-import com.core.common.DateUtils;
-import com.core.common.SpringUtils;
+import com.zy.common.SpringUtils;
+import com.zy.common.utils.DateUtils;
import com.zy.common.utils.RedisUtil;
import com.zy.core.News;
import com.zy.core.model.DeviceCommandMsgModel;
import com.zy.core.model.DeviceMsgModel;
+import com.zy.core.properties.DeviceConfig;
import com.zy.core.utils.DeviceMsgUtils;
import com.zy.core.cache.OutputQueue;
import com.zy.core.enums.SlaveType;
-import com.zy.core.model.ShuttleSlave;
import com.zy.core.thread.ShuttleThread;
import lombok.extern.slf4j.Slf4j;
@@ -27,20 +27,20 @@
@SuppressWarnings("all")
public class NyShuttleThread implements ShuttleThread {
- private ShuttleSlave slave;
+ private DeviceConfig deviceConfig;
private RedisUtil redisUtil;
private Socket socket;
private static final boolean DEBUG = false;//璋冭瘯妯″紡
- public NyShuttleThread(ShuttleSlave slave, RedisUtil redisUtil) {
- this.slave = slave;
+ public NyShuttleThread(DeviceConfig deviceConfig, RedisUtil redisUtil) {
+ this.deviceConfig = deviceConfig;
this.redisUtil = redisUtil;
}
@Override
public void run() {
- News.info("{}鍙峰洓鍚戣溅绾跨▼鍚姩", slave.getId());
+ News.info("{}鍙峰洓鍚戣溅绾跨▼鍚姩", deviceConfig.getDeviceNo());
this.connect();
//鐩戝惉娑堟伅
@@ -59,8 +59,14 @@
Thread executeThread = new Thread(() -> {
while (true) {
try {
- DeviceMsgUtils deviceMsgUtils = SpringUtils.getBean(DeviceMsgUtils.class);
- DeviceCommandMsgModel deviceCommandMsg = deviceMsgUtils.getDeviceCommandMsg(SlaveType.Shuttle, slave.getId());
+ DeviceMsgUtils deviceMsgUtils = null;
+ try {
+ deviceMsgUtils = SpringUtils.getBean(DeviceMsgUtils.class);
+ }catch (Exception e){}
+ if (deviceMsgUtils == null) {
+ continue;
+ }
+ DeviceCommandMsgModel deviceCommandMsg = deviceMsgUtils.getDeviceCommandMsg(SlaveType.Shuttle, deviceConfig.getDeviceNo());
if (deviceCommandMsg == null) {
continue;
}
@@ -99,7 +105,11 @@
return;
}
- DeviceMsgUtils deviceMsgUtils = SpringUtils.getBean(DeviceMsgUtils.class);
+ DeviceMsgUtils deviceMsgUtils = null;
+ try {
+ deviceMsgUtils = SpringUtils.getBean(DeviceMsgUtils.class);
+ }catch (Exception e){
+ }
if(deviceMsgUtils == null) {
return;
}
@@ -129,21 +139,21 @@
JSONObject data = parseSocketResult(body);
DeviceMsgModel deviceMsgModel = new DeviceMsgModel();
- deviceMsgModel.setDeviceId(slave.getId());
+ deviceMsgModel.setDeviceId(deviceConfig.getDeviceNo());
deviceMsgModel.setDeviceMsgType("status");
deviceMsgModel.setDeviceMsg(data);
deviceMsgModel.setDeviceOriginMsg(sb.toString());
- deviceMsgUtils.sendDeviceMsg(SlaveType.Shuttle, slave.getId(), deviceMsgModel);
+ deviceMsgUtils.sendDeviceMsg(SlaveType.Shuttle, deviceConfig.getDeviceNo(), deviceMsgModel);
return;
}
}
DeviceMsgModel deviceMsgModel = new DeviceMsgModel();
- deviceMsgModel.setDeviceId(slave.getId());
+ deviceMsgModel.setDeviceId(deviceConfig.getDeviceNo());
deviceMsgModel.setDeviceMsgType("command");
deviceMsgModel.setDeviceMsg(result);
deviceMsgModel.setDeviceOriginMsg(sb.toString());
- deviceMsgUtils.sendDeviceMsg(SlaveType.Shuttle, slave.getId(), deviceMsgModel);
+ deviceMsgUtils.sendDeviceMsg(SlaveType.Shuttle, deviceConfig.getDeviceNo(), deviceMsgModel);
} catch (Exception e) {
e.printStackTrace();
}
@@ -152,16 +162,16 @@
@Override
public boolean connect() {
try {
- InetAddress address = InetAddress.getByName(slave.getIp());
+ InetAddress address = InetAddress.getByName(deviceConfig.getIp());
if (address.isReachable(10000)) {
- Socket socket = new Socket(slave.getIp(), slave.getPort());
+ Socket socket = new Socket(deviceConfig.getIp(), deviceConfig.getPort());
socket.setSoTimeout(10000);
socket.setKeepAlive(true);
this.socket = socket;
- log.info(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅Socket閾炬帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+ log.info(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅Socket閾炬帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
}
} catch (Exception e) {
- OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅Socket閾炬帴澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+ OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅Socket閾炬帴澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
return false;
}
diff --git a/src/main/java/com/zy/core/utils/DeviceMsgUtils.java b/src/main/java/com/zy/core/utils/DeviceMsgUtils.java
index f963dc4..eb9f81f 100644
--- a/src/main/java/com/zy/core/utils/DeviceMsgUtils.java
+++ b/src/main/java/com/zy/core/utils/DeviceMsgUtils.java
@@ -1,6 +1,6 @@
package com.zy.core.utils;
-import com.core.exception.CoolException;
+import com.zy.common.exception.CoolException;
import com.zy.common.utils.RedisUtil;
import com.zy.core.enums.RedisKeyType;
import com.zy.core.enums.SlaveType;
@@ -23,6 +23,14 @@
@Autowired
private RedisUtil redisUtil;
+
+ public String getDeviceConfig() {
+ Object obj = redisUtil.get(RedisKeyType.DEVICE_CONFIG.key);
+ if(null == obj){
+ return null;
+ }
+ return obj.toString();
+ }
public DeviceCommandMsgModel getDeviceCommandMsg(SlaveType deviceType, Integer deviceId) {
TreeSet<String> listKey = getDeviceCommandMsgListKey(deviceType, deviceId);
@@ -81,6 +89,10 @@
return key;
}
+ public void sendDeviceConfig(String allDevices) {
+ redisUtil.set(RedisKeyType.DEVICE_CONFIG.key, allDevices);
+ }
+
public TreeSet<String> getDeviceMsgListKey(SlaveType deviceType, Integer deviceId) {
String listKey = parseDeviceMsgKey(deviceType, deviceId);
Set<String> keys = redisUtil.searchKeys(listKey);
diff --git a/src/main/java/com/zy/system/controller/ApiController.java b/src/main/java/com/zy/system/controller/ApiController.java
deleted file mode 100644
index 126983d..0000000
--- a/src/main/java/com/zy/system/controller/ApiController.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.zy.system.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.plugins.Page;
-import com.core.annotations.ManagerAuth;
-import com.core.common.Cools;
-import com.core.common.DateUtils;
-import com.core.common.R;
-import com.core.controller.AbstractBaseController;
-import com.zy.system.entity.Api;
-import com.zy.system.service.ApiService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-@RestController
-public class ApiController extends AbstractBaseController {
-
- @Autowired
- private ApiService apiService;
-
- @RequestMapping(value = "/api/{id}/auth")
- @ManagerAuth
- public R get(@PathVariable("id") Long id) {
- return R.ok(apiService.selectById(String.valueOf(id)));
- }
-
- @RequestMapping(value = "/api/list/auth")
- @ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam Map<String, Object> param){
- excludeTrash(param);
- EntityWrapper<Api> wrapper = new EntityWrapper<>();
- convert(param, wrapper);
- wrapper.orderBy("id", false);
- return R.ok(apiService.selectPage(new Page<>(curr, limit), wrapper));
- }
-
- private void convert(Map<String, Object> map, EntityWrapper wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
- if (entry.getKey().endsWith(">")) {
- wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else if (entry.getKey().endsWith("<")) {
- wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else {
- wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
- }
- }
- }
-
- @RequestMapping(value = "/api/edit/auth")
- @ManagerAuth
- public R edit(Api api) {
- if (Cools.isEmpty(api)){
- return R.error();
- }
- if (null == api.getId()){
- apiService.insert(api);
- } else {
- apiService.updateById(api);
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/api/add/auth")
- @ManagerAuth
- public R add(Api api) {
- apiService.insert(api);
- return R.ok();
- }
-
- @RequestMapping(value = "/api/update/auth")
- @ManagerAuth
- public R update(Api api){
- if (Cools.isEmpty(api) || null==api.getId()){
- return R.error();
- }
- apiService.updateById(api);
- return R.ok();
- }
-
- @RequestMapping(value = "/api/delete/auth")
- @ManagerAuth
- public R delete(Integer[] ids){
- if (Cools.isEmpty(ids)){
- return R.error();
- }
- apiService.deleteBatchIds(Arrays.asList(ids));
- return R.ok();
- }
-
- @RequestMapping(value = "/api/export/auth")
- @ManagerAuth
- public R export(@RequestBody JSONObject param){
- List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
- EntityWrapper<Api> wrapper = new EntityWrapper<>();
- Map<String, Object> map = excludeTrash(param.getJSONObject("api"));
- convert(map, wrapper);
- List<Api> list = apiService.selectList(wrapper);
- return R.ok(exportSupport(list, fields));
- }
-
- @RequestMapping(value = "/apiQuery/auth")
- @ManagerAuth
- public R query(String condition) {
- EntityWrapper<Api> wrapper = new EntityWrapper<>();
- wrapper.like("id", condition);
- Page<Api> page = apiService.selectPage(new Page<>(0, 10), wrapper);
- List<Map<String, Object>> result = new ArrayList<>();
- for (Api api : page.getRecords()){
- Map<String, Object> map = new HashMap<>();
- map.put("id", api.getId());
- map.put("value", api.getId());
- result.add(map);
- }
- return R.ok(result);
- }
-
-}
diff --git a/src/main/java/com/zy/system/controller/ConfigController.java b/src/main/java/com/zy/system/controller/ConfigController.java
deleted file mode 100644
index a005512..0000000
--- a/src/main/java/com/zy/system/controller/ConfigController.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package com.zy.system.controller;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.plugins.Page;
-import com.core.annotations.ManagerAuth;
-import com.core.common.Cools;
-import com.core.common.DateUtils;
-import com.core.common.R;
-import com.core.controller.AbstractBaseController;
-import com.zy.common.entity.Parameter;
-import com.zy.system.entity.Config;
-import com.zy.system.service.ConfigService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-@RestController
-public class ConfigController extends AbstractBaseController {
-
- @Autowired
- private ConfigService configService;
-
- @RequestMapping(value = "/config/{id}/auth")
- @ManagerAuth
- public R get(@PathVariable("id") Long id) {
- return R.ok(configService.selectById(String.valueOf(id)));
- }
-
- @RequestMapping(value = "/config/list/auth")
- @ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam Map<String, Object> param){
- excludeTrash(param);
- EntityWrapper<Config> wrapper = new EntityWrapper<>();
- convert(param, wrapper);
- wrapper.orderBy("id", false);
- return R.ok(configService.selectPage(new Page<>(curr, limit), wrapper));
- }
-
- private void convert(Map<String, Object> map, EntityWrapper wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
- if (entry.getKey().endsWith(">")) {
- wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else if (entry.getKey().endsWith("<")) {
- wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else {
- wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
- }
- }
- }
-
- @RequestMapping(value = "/config/edit/auth")
- @ManagerAuth
- public R edit(Config config) {
- if (Cools.isEmpty(config)){
- return R.error();
- }
- if (config.getType() == 2){
- if (!checkJson(config.getValue())){
- return R.error("json瑙f瀽澶辫触");
- }
- }
- if (null == config.getId()){
- configService.insert(config);
- } else {
- configService.updateById(config);
- Parameter.reset();
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/config/add/auth")
- @ManagerAuth
- public R add(Config config) {
- if (config.getType() == 2){
- if (!checkJson(config.getValue())){
- return R.error("json瑙f瀽澶辫触");
- }
- }
- configService.insert(config);
- return R.ok();
- }
-
- @RequestMapping(value = "/config/update/auth")
- @ManagerAuth
- public R update(Config config){
- if (Cools.isEmpty(config) || null==config.getId()){
- return R.error();
- }
- if (config.getType() == 2){
- if (!checkJson(config.getValue())){
- return R.error("json瑙f瀽澶辫触");
- }
- }
- configService.updateById(config);
- Parameter.reset();
- return R.ok();
- }
-
- @RequestMapping(value = "/config/delete/auth")
- @ManagerAuth
- public R delete(Integer[] ids){
- if (Cools.isEmpty(ids)){
- return R.error();
- }
- configService.deleteBatchIds(Arrays.asList(ids));
- return R.ok();
- }
-
- @RequestMapping(value = "/config/export/auth")
- @ManagerAuth
- public R export(@RequestBody JSONObject param){
- List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
- EntityWrapper<Config> wrapper = new EntityWrapper<>();
- Map<String, Object> map = excludeTrash(param.getJSONObject("config"));
- convert(map, wrapper);
- List<Config> list = configService.selectList(wrapper);
- return R.ok(exportSupport(list, fields));
- }
-
- @RequestMapping(value = "/configQuery/auth")
- @ManagerAuth
- public R query(String condition) {
- EntityWrapper<Config> wrapper = new EntityWrapper<>();
- wrapper.like("id", condition);
- Page<Config> page = configService.selectPage(new Page<>(0, 10), wrapper);
- List<Map<String, Object>> result = new ArrayList<>();
- for (Config config : page.getRecords()){
- Map<String, Object> map = new HashMap<>();
- map.put("id", config.getId());
- map.put("value", config.getId());
- result.add(map);
- }
- return R.ok(result);
- }
-
- /**
- * 鍒锋柊閰嶇疆
- */
- @RequestMapping(value = "/config/refresh/auth")
- @ManagerAuth
- public R refresh(){
- Parameter parameter;
- try {
- parameter = Parameter.reset();
- } catch (Exception e) {
- e.printStackTrace();
- return R.error();
- }
- if (Cools.isEmpty(parameter)){
- return R.error();
- }
- return R.ok();
- }
-
-
- private static boolean checkJson(String val){
- Object parse = null;
- try {
- parse = JSON.parse(val);
- } catch (Exception ignore){
- }
- return parse != null;
- }
-
-}
diff --git a/src/main/java/com/zy/system/controller/HomeController.java b/src/main/java/com/zy/system/controller/HomeController.java
deleted file mode 100644
index 6568c90..0000000
--- a/src/main/java/com/zy/system/controller/HomeController.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package com.zy.system.controller;
-
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.core.annotations.ManagerAuth;
-import com.core.common.Arith;
-import com.core.common.R;
-import com.zy.system.service.OperateLogService;
-import com.zy.system.service.UserLoginService;
-import com.zy.system.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.*;
-
-/**
- * Created by vincent on 2019-12-06
- */
-@RestController
-@RequestMapping("/home")
-public class HomeController {
-
- @Autowired
- private OperateLogService operateLogService;
- @Autowired
- private UserService userService;
- @Autowired
- private UserLoginService userLoginService;
-
- @RequestMapping("/top")
- @ManagerAuth
- public R top(){
- int logTotal = operateLogService.selectCount(new EntityWrapper<>());
- int logWeek = operateLogService.selectCountByCurrentWeek();
- int userTotal = userService.selectCount(new EntityWrapper<>());
- int loginWeek = userLoginService.selectCountByCurrentWeek();
-
- Map<String, Object> result = new HashMap<>();
- result.put("logTotal", logTotal);
- result.put("logWeek", logWeek);
- result.put("userTotal", userTotal);
- result.put("live", Arith.multiplys(0, Arith.divides(2, loginWeek, userTotal), 100)+"%");
- return R.ok(result);
- }
-
-
- @RequestMapping("/report")
- @ManagerAuth
- public R top(@RequestParam(defaultValue = "1", value = "type", required = false)Integer type){
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(new Date());
-
- List<Map<String, Object>> report;
- StatsType statsType = StatsType.get(type);
- if (type == 1) {
- report = operateLogService.getReport(calendar.get(Calendar.YEAR), null);
- report = fill(report, statsType.start, statsType.end);
- } else {
- report = operateLogService.getReport(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1);
- report = fill(report, statsType.start, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
- }
-
-
- Map<String, Object> result = new HashMap<>();
- result.put("visits", convert(report, statsType, 2));
- return R.ok(result);
- }
-
-
- /**
- * 鑷姩琛ラ浂
- */
- private List<Map<String, Object>> fill(List<Map<String, Object>> list, int start, int end){
- for (int i = start ; i <= end; i++){
- boolean exist = false;
- for (Map seq : list){
- if (Integer.parseInt(String.valueOf(seq.get("node"))) == i){
- exist = true;
- }
- }
- if (!exist){
- HashMap<String, Object> map = new HashMap<>();
- map.put("node", i);
- map.put("val", 0);
- list.add(map);
- }
- }
- list.sort(Comparator.comparingInt(o -> (int) o.get("node")));
- return list;
- }
-
- /**
- * x杞村崟浣嶈浆鎹�
- * @param dot y杞存暟鍊间繚鐣欏皬鏁颁綅
- */
- private List<Map<String, Object>> convert(List<Map<String, Object>> list, StatsType statsType, int dot){
- for (Map<String, Object> map : list){
- Object val = map.get("val");
- map.put("val", Arith.multiplys(dot, 1, (Number) val));
- Object node = map.get("node");
- switch (statsType){
- case MONTH:
- map.put("node", node + "鍙�");
- break;
- case YEAR:
- map.put("node", node + "鏈�");
- break;
- default:
- break;
- }
- }
- return list;
- }
-
- enum StatsType{
-
- YEAR(1,1, 12),
- MONTH(2,1, 30),
- ;
-
- int id;
- int start;
- int end;
- StatsType(int id, int start, int end) {
- this.id = id;
- this.start = start;
- this.end = end;
- }
-
- static StatsType get(int id) {
- StatsType[] values = StatsType.values();
- for (StatsType statsType : values){
- if (statsType.id == id){
- return statsType;
- }
- }
- throw new RuntimeException("鎵句笉鍒癝tatsType绫诲瀷");
- }
-
- }
-
-}
diff --git a/src/main/java/com/zy/system/controller/HostController.java b/src/main/java/com/zy/system/controller/HostController.java
deleted file mode 100644
index bad930a..0000000
--- a/src/main/java/com/zy/system/controller/HostController.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.zy.system.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.plugins.Page;
-import com.core.annotations.ManagerAuth;
-import com.core.common.Cools;
-import com.core.common.DateUtils;
-import com.core.common.R;
-import com.core.controller.AbstractBaseController;
-import com.zy.system.entity.Host;
-import com.zy.system.service.HostService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-@RestController
-public class HostController extends AbstractBaseController {
-
- @Autowired
- private HostService hostService;
-
- @RequestMapping(value = "/host/{id}/auth")
- @ManagerAuth
- public R get(@PathVariable("id") Long id) {
- return R.ok(hostService.selectById(String.valueOf(id)));
- }
-
- @RequestMapping(value = "/host/list/auth")
- @ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam Map<String, Object> param){
- excludeTrash(param);
- EntityWrapper<Host> wrapper = new EntityWrapper<>();
- convert(param, wrapper);
- wrapper.orderBy("id", false);
- return R.ok(hostService.selectPage(new Page<>(curr, limit), wrapper));
- }
-
- private void convert(Map<String, Object> map, EntityWrapper wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
- if (entry.getKey().endsWith(">")) {
- wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else if (entry.getKey().endsWith("<")) {
- wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else {
- wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
- }
- }
- }
-
- @RequestMapping(value = "/host/edit/auth")
- @ManagerAuth
- public R edit(Host host) {
- if (Cools.isEmpty(host)){
- return R.error();
- }
- if (null == host.getId()){
- hostService.insert(host);
- } else {
- hostService.updateById(host);
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/host/add/auth")
- @ManagerAuth
- public R add(Host host) {
- hostService.insert(host);
- return R.ok();
- }
-
- @RequestMapping(value = "/host/update/auth")
- @ManagerAuth
- public R update(Host host){
- if (Cools.isEmpty(host) || null==host.getId()){
- return R.error();
- }
- hostService.updateById(host);
- return R.ok();
- }
-
- @RequestMapping(value = "/host/delete/auth")
- @ManagerAuth
- public R delete(Integer[] ids){
- if (Cools.isEmpty(ids)){
- return R.error();
- }
- hostService.deleteBatchIds(Arrays.asList(ids));
- return R.ok();
- }
-
- @RequestMapping(value = "/host/export/auth")
- @ManagerAuth
- public R export(@RequestBody JSONObject param){
- List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
- EntityWrapper<Host> wrapper = new EntityWrapper<>();
- Map<String, Object> map = excludeTrash(param.getJSONObject("host"));
- convert(map, wrapper);
- List<Host> list = hostService.selectList(wrapper);
- return R.ok(exportSupport(list, fields));
- }
-
- @RequestMapping(value = "/hostQuery/auth")
- @ManagerAuth
- public R query(String condition) {
- EntityWrapper<Host> wrapper = new EntityWrapper<>();
- wrapper.like("name", condition);
- Page<Host> page = hostService.selectPage(new Page<>(0, 10), wrapper);
- List<Map<String, Object>> result = new ArrayList<>();
- for (Host host : page.getRecords()){
- Map<String, Object> map = new HashMap<>();
- map.put("id", host.getId());
- map.put("value", host.getName());
- result.add(map);
- }
- return R.ok(result);
- }
-
-}
diff --git a/src/main/java/com/zy/system/controller/OperateLogController.java b/src/main/java/com/zy/system/controller/OperateLogController.java
deleted file mode 100644
index da7f7b1..0000000
--- a/src/main/java/com/zy/system/controller/OperateLogController.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.zy.system.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.plugins.Page;
-import com.core.annotations.ManagerAuth;
-import com.core.common.Cools;
-import com.core.common.DateUtils;
-import com.core.common.R;
-import com.core.controller.AbstractBaseController;
-import com.zy.system.entity.OperateLog;
-import com.zy.system.service.OperateLogService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-@RestController
-public class OperateLogController extends AbstractBaseController {
-
- @Autowired
- private OperateLogService operateLogService;
-
- @RequestMapping(value = "/operateLog/{id}/auth")
- @ManagerAuth
- public R get(@PathVariable("id") Long id) {
- return R.ok(operateLogService.selectById(String.valueOf(id)));
- }
-
- @RequestMapping(value = "/operateLog/list/auth")
- @ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam Map<String, Object> param){
- excludeTrash(param);
- EntityWrapper<OperateLog> wrapper = new EntityWrapper<>();
- convert(param, wrapper);
- wrapper.orderBy("id", false);
- return R.ok(operateLogService.selectPage(new Page<>(curr, limit), wrapper));
- }
-
- private void convert(Map<String, Object> map, EntityWrapper wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
- if (entry.getKey().endsWith(">")) {
- wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else if (entry.getKey().endsWith("<")) {
- wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else {
- wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
- }
- }
- }
-
- @RequestMapping(value = "/operateLog/edit/auth")
- @ManagerAuth
- public R edit(OperateLog operateLog) {
- if (Cools.isEmpty(operateLog)){
- return R.error();
- }
- if (null == operateLog.getId()){
- operateLogService.insert(operateLog);
- } else {
- operateLogService.updateById(operateLog);
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/operateLog/add/auth")
- @ManagerAuth
- public R add(OperateLog operateLog) {
- operateLogService.insert(operateLog);
- return R.ok();
- }
-
- @RequestMapping(value = "/operateLog/update/auth")
- @ManagerAuth
- public R update(OperateLog operateLog){
- if (Cools.isEmpty(operateLog) || null==operateLog.getId()){
- return R.error();
- }
- operateLogService.updateById(operateLog);
- return R.ok();
- }
-
- @RequestMapping(value = "/operateLog/delete/auth")
- @ManagerAuth
- public R delete(Integer[] ids){
- if (Cools.isEmpty(ids)){
- return R.error();
- }
- operateLogService.deleteBatchIds(Arrays.asList(ids));
- return R.ok();
- }
-
- @RequestMapping(value = "/operateLog/export/auth")
- @ManagerAuth
- public R export(@RequestBody JSONObject param){
- List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
- EntityWrapper<OperateLog> wrapper = new EntityWrapper<>();
- Map<String, Object> map = excludeTrash(param.getJSONObject("operateLog"));
- convert(map, wrapper);
- List<OperateLog> list = operateLogService.selectList(wrapper);
- return R.ok(exportSupport(list, fields));
- }
-
- @RequestMapping(value = "/operateLogQuery/auth")
- @ManagerAuth
- public R query(String condition) {
- EntityWrapper<OperateLog> wrapper = new EntityWrapper<>();
- wrapper.like("id", condition);
- Page<OperateLog> page = operateLogService.selectPage(new Page<>(0, 10), wrapper);
- List<Map<String, Object>> result = new ArrayList<>();
- for (OperateLog operateLog : page.getRecords()){
- Map<String, Object> map = new HashMap<>();
- map.put("id", operateLog.getId());
- map.put("value", operateLog.getId());
- result.add(map);
- }
- return R.ok(result);
- }
-
-}
diff --git a/src/main/java/com/zy/system/controller/PermissionController.java b/src/main/java/com/zy/system/controller/PermissionController.java
deleted file mode 100644
index c943808..0000000
--- a/src/main/java/com/zy/system/controller/PermissionController.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.zy.system.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.plugins.Page;
-import com.core.annotations.ManagerAuth;
-import com.core.common.Cools;
-import com.core.common.DateUtils;
-import com.core.common.R;
-import com.core.controller.AbstractBaseController;
-import com.zy.system.entity.Permission;
-import com.zy.system.service.PermissionService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-@RestController
-public class PermissionController extends AbstractBaseController {
-
- @Autowired
- private PermissionService permissionService;
-
- @RequestMapping(value = "/permission/{id}/auth")
- @ManagerAuth
- public R get(@PathVariable("id") Long id) {
- return R.ok(permissionService.selectById(String.valueOf(id)));
- }
-
- @RequestMapping(value = "/permission/list/auth")
- @ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam Map<String, Object> param){
- excludeTrash(param);
- EntityWrapper<Permission> wrapper = new EntityWrapper<>();
- convert(param, wrapper);
- wrapper.orderBy("id", false);
- return R.ok(permissionService.selectPage(new Page<>(curr, limit), wrapper));
- }
-
- private void convert(Map<String, Object> map, EntityWrapper wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
- if (entry.getKey().endsWith(">")) {
- wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else if (entry.getKey().endsWith("<")) {
- wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else {
- wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
- }
- }
- }
-
- @RequestMapping(value = "/permission/edit/auth")
- @ManagerAuth
- public R edit(Permission permission) {
- if (Cools.isEmpty(permission)){
- return R.error();
- }
- if (null == permission.getId()){
- permissionService.insert(permission);
- } else {
- permissionService.updateById(permission);
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/permission/add/auth")
- @ManagerAuth
- public R add(Permission permission) {
- permissionService.insert(permission);
- return R.ok();
- }
-
- @RequestMapping(value = "/permission/update/auth")
- @ManagerAuth
- public R update(Permission permission){
- if (Cools.isEmpty(permission) || null==permission.getId()){
- return R.error();
- }
- permissionService.updateById(permission);
- return R.ok();
- }
-
- @RequestMapping(value = "/permission/delete/auth")
- @ManagerAuth
- public R delete(Integer[] ids){
- if (Cools.isEmpty(ids)){
- return R.error();
- }
- permissionService.deleteBatchIds(Arrays.asList(ids));
- return R.ok();
- }
-
- @RequestMapping(value = "/permission/export/auth")
- @ManagerAuth
- public R export(@RequestBody JSONObject param){
- List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
- EntityWrapper<Permission> wrapper = new EntityWrapper<>();
- Map<String, Object> map = excludeTrash(param.getJSONObject("permission"));
- convert(map, wrapper);
- List<Permission> list = permissionService.selectList(wrapper);
- return R.ok(exportSupport(list, fields));
- }
-
- @RequestMapping(value = "/permissionQuery/auth")
- @ManagerAuth
- public R query(String condition) {
- EntityWrapper<Permission> wrapper = new EntityWrapper<>();
- wrapper.like("name", condition);
- Page<Permission> page = permissionService.selectPage(new Page<>(0, 10), wrapper);
- List<Map<String, Object>> result = new ArrayList<>();
- for (Permission permission : page.getRecords()){
- Map<String, Object> map = new HashMap<>();
- map.put("id", permission.getId());
- map.put("value", permission.getName());
- result.add(map);
- }
- return R.ok(result);
- }
-
-}
diff --git a/src/main/java/com/zy/system/controller/ResourceController.java b/src/main/java/com/zy/system/controller/ResourceController.java
deleted file mode 100644
index 4cc94dc..0000000
--- a/src/main/java/com/zy/system/controller/ResourceController.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package com.zy.system.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.plugins.Page;
-import com.core.annotations.ManagerAuth;
-import com.core.common.Cools;
-import com.core.common.DateUtils;
-import com.core.common.R;
-import com.core.controller.AbstractBaseController;
-import com.zy.system.entity.Resource;
-import com.zy.system.service.ResourceService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-@RestController
-public class ResourceController extends AbstractBaseController {
-
- @Autowired
- private ResourceService resourceService;
-
- @RequestMapping(value = "/resource/{id}/auth")
- @ManagerAuth
- public R get(@PathVariable("id") Long id) {
- return R.ok(resourceService.selectById(String.valueOf(id)));
- }
-
- @RequestMapping(value = "/resource/list/auth")
- @ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam Map<String, Object> param){
- excludeTrash(param);
- EntityWrapper<Resource> wrapper = new EntityWrapper<>();
- convert(param, wrapper);
- wrapper.orderBy("id", false);
- return R.ok(resourceService.selectPage(new Page<>(curr, limit), wrapper));
- }
-
- private void convert(Map<String, Object> map, EntityWrapper wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
- if (entry.getKey().endsWith(">")) {
- wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else if (entry.getKey().endsWith("<")) {
- wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else {
- wrapper.eq(entry.getKey(), String.valueOf(entry.getValue()));
- }
- }
- }
-
- @RequestMapping(value = "/resource/edit/auth")
- @ManagerAuth(memo = "鑿滃崟缂栬緫")
- public R edit(Resource resource) {
- if (Cools.isEmpty(resource)){
- return R.error();
- }
- if (null == resource.getId()){
- if (resource.getSort() == null){
- resource.setSort(999);
- }
- resourceService.insert(resource);
- } else {
- resourceService.updateById(resource);
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/resource/add/auth")
- @ManagerAuth(memo = "鑿滃崟娣诲姞")
- public R add(Resource resource) {
- resourceService.insert(resource);
- return R.ok();
- }
-
- @RequestMapping(value = "/resource/update/auth")
- @ManagerAuth(memo = "鑿滃崟淇敼")
- public R update(Resource resource){
- if (Cools.isEmpty(resource) || null==resource.getId()){
- return R.error();
- }
- resourceService.updateById(resource);
- return R.ok();
- }
-
- @RequestMapping(value = "/resource/delete/auth")
- @ManagerAuth(memo = "鑿滃崟鍒犻櫎")
- public R delete(@RequestParam(value="ids[]") Long[] ids){
- for (Long id : ids){
- resourceService.deleteById(id);
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/resource/export/auth")
- @ManagerAuth(memo = "鑿滃崟瀵煎嚭")
- public R export(@RequestBody JSONObject param){
- List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
- EntityWrapper<Resource> wrapper = new EntityWrapper<>();
- Map<String, Object> map = excludeTrash(param.getJSONObject("resource"));
- convert(map, wrapper);
- List<Resource> list = resourceService.selectList(wrapper);
- return R.ok(exportSupport(list, fields));
- }
-
- @RequestMapping(value = "/resourceQuery/auth")
- @ManagerAuth
- public R query(String condition) {
- EntityWrapper<Resource> wrapper = new EntityWrapper<>();
- wrapper.like("name", condition);
- Page<Resource> page = resourceService.selectPage(new Page<>(0, 10), wrapper);
- List<Map<String, Object>> result = new ArrayList<>();
- for (Resource resource : page.getRecords()){
- Map<String, Object> map = new HashMap<>();
- map.put("id", resource.getId());
- map.put("value", resource.getName().concat("(").concat(resource.getLevel$().substring(0, 2).concat(")")));
- result.add(map);
- }
- return R.ok(result);
- }
-
- @RequestMapping(value = "/resource/tree/auth")
- @ManagerAuth
- public R tree(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam Map<String, Object> param){
- EntityWrapper<Resource> wrapper = new EntityWrapper<>();
- excludeTrash(param);
- convert(param, wrapper);
- if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
- else {
- wrapper.orderBy("sort");
- }
- return R.parse("0-鎿嶄綔鎴愬姛").add(resourceService.selectList(wrapper));
- }
-
-}
diff --git a/src/main/java/com/zy/system/controller/RoleController.java b/src/main/java/com/zy/system/controller/RoleController.java
deleted file mode 100644
index ef9d380..0000000
--- a/src/main/java/com/zy/system/controller/RoleController.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package com.zy.system.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.plugins.Page;
-import com.core.annotations.ManagerAuth;
-import com.core.common.Cools;
-import com.core.common.DateUtils;
-import com.core.common.R;
-import com.zy.common.web.BaseController;
-import com.zy.system.entity.Role;
-import com.zy.system.service.RoleService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-@RestController
-public class RoleController extends BaseController {
-
- @Autowired
- private RoleService roleService;
-
- @RequestMapping(value = "/role/{id}/auth")
- @ManagerAuth
- public R get(@PathVariable("id") Long id) {
- return R.ok(roleService.selectById(String.valueOf(id)));
- }
-
- @RequestMapping(value = "/role/list/auth")
- @ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam Map<String, Object> param){
- excludeTrash(param);
- EntityWrapper<Role> wrapper = new EntityWrapper<>();
- convert(param, wrapper);
- wrapper.orderBy("id", false);
-
- if (9527 == getUserId()) {
- return R.ok(roleService.selectPage(new Page<>(curr, limit), wrapper));
- }
- Long roleId = getUser().getRoleId();
- Role role = roleService.selectById(roleId);
- Long leaderId = role.getLeader();
- if (null != leaderId) {
- List<Long> leaderIds = new ArrayList<>();
- leaderIds.add(roleId);
- while (leaderId != null) {
- Role leader = roleService.selectById(leaderId);
- leaderIds.add(leader.getId());
- leaderId = leader.getLeader();
- }
- wrapper.notIn("id", leaderIds);
- }
-// if (null != role.getLevel()) {
-// wrapper.gt("level", role.getLevel());
-// }
- return R.ok(roleService.selectPage(new Page<>(curr, limit), wrapper));
- }
-
- private void convert(Map<String, Object> map, EntityWrapper wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
- if (entry.getKey().endsWith(">")) {
- wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else if (entry.getKey().endsWith("<")) {
- wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else {
- wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
- }
- }
- }
-
- @RequestMapping(value = "/role/edit/auth")
- @ManagerAuth(memo = "瑙掕壊缂栬緫")
- public R edit(Role role) {
- if (Cools.isEmpty(role)){
- return R.error();
- }
- if (null == role.getId()){
- roleService.insert(role);
- } else {
- roleService.updateById(role);
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/role/add/auth")
- @ManagerAuth(memo = "瑙掕壊娣诲姞")
- public R add(Role role) {
- roleService.insert(role);
- return R.ok();
- }
-
- @RequestMapping(value = "/role/update/auth")
- @ManagerAuth(memo = "瑙掕壊淇敼")
- public R update(Role role){
- if (Cools.isEmpty(role) || null==role.getId()){
- return R.error();
- }
- roleService.updateById(role);
- return R.ok();
- }
-
- @RequestMapping(value = "/role/delete/auth")
- @ManagerAuth(memo = "瑙掕壊鍒犻櫎")
- public R delete(Integer[] ids){
- if (Cools.isEmpty(ids)){
- return R.error();
- }
- roleService.deleteBatchIds(Arrays.asList(ids));
- return R.ok();
- }
-
- @RequestMapping(value = "/role/export/auth")
- @ManagerAuth(memo = "瑙掕壊瀵煎嚭")
- public R export(@RequestBody JSONObject param){
- List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
- EntityWrapper<Role> wrapper = new EntityWrapper<>();
- Map<String, Object> map = excludeTrash(param.getJSONObject("role"));
- convert(map, wrapper);
- List<Role> list = roleService.selectList(wrapper);
- return R.ok(exportSupport(list, fields));
- }
-
- @RequestMapping(value = "/roleQuery/auth")
- @ManagerAuth
- public R query(String condition) {
- EntityWrapper<Role> wrapper = new EntityWrapper<>();
- wrapper.like("name", condition);
- // 涓婁笅绾х鐞�
- if (9527 != getUserId()) {
- Long roleId = getUser().getRoleId();
- Role role = roleService.selectById(roleId);
- Long leaderId = role.getLeader();
- if (null != leaderId) {
- List<Long> leaderIds = new ArrayList<>();
- while (leaderId != null) {
- Role leader = roleService.selectById(leaderId);
- leaderIds.add(leader.getId());
- leaderId = leader.getLeader();
- }
- wrapper.notIn("id", leaderIds);
- }
-// if (null != role.getLevel()) {
-// wrapper.ge("level", role.getLevel());
-// }
- }
-
- Page<Role> page = roleService.selectPage(new Page<>(0, 10), wrapper);
- List<Map<String, Object>> result = new ArrayList<>();
- for (Role role : page.getRecords()){
- Map<String, Object> map = new HashMap<>();
- map.put("id", role.getId());
- map.put("value", role.getName());
- result.add(map);
- }
- return R.ok(result);
- }
-
-}
diff --git a/src/main/java/com/zy/system/controller/UserController.java b/src/main/java/com/zy/system/controller/UserController.java
deleted file mode 100644
index 9344ff6..0000000
--- a/src/main/java/com/zy/system/controller/UserController.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package com.zy.system.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.plugins.Page;
-import com.core.annotations.ManagerAuth;
-import com.core.common.Cools;
-import com.core.common.DateUtils;
-import com.core.common.R;
-import com.zy.common.web.BaseController;
-import com.zy.system.entity.Role;
-import com.zy.system.entity.User;
-import com.zy.system.service.RoleService;
-import com.zy.system.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-@RestController
-public class UserController extends BaseController {
-
- @Autowired
- private UserService userService;
- @Autowired
- private RoleService roleService;
-
- @RequestMapping(value = "/user/{id}/auth")
- @ManagerAuth
- public R get(@PathVariable("id") Long id) {
- return R.ok(userService.selectById(String.valueOf(id)));
- }
-
- @RequestMapping(value = "/user/list/auth")
- @ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam Map<String, Object> param){
- excludeTrash(param);
- EntityWrapper<User> wrapper = new EntityWrapper<>();
- convert(param, wrapper);
- wrapper.orderBy("id", false);
- if (9527 == getUserId()) {
- return R.ok(userService.selectPage(new Page<>(curr, limit), wrapper));
- }
-
- Long roleId = getUser().getRoleId();
- Role role = roleService.selectById(roleId);
- Long leaderId = role.getLeader();
- if (null != leaderId) {
- List<Long> leaderIds = new ArrayList<>();
- leaderIds.add(role.getId());
- while (leaderId != null) {
- Role leader = roleService.selectById(leaderId);
- leaderIds.add(leader.getId());
- leaderId = leader.getLeader();
- }
- wrapper.notIn("role_id", leaderIds);
- }
-
- return R.ok(userService.selectPage(new Page<>(curr, limit), wrapper));
- }
-
- private void convert(Map<String, Object> map, EntityWrapper wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
- if (entry.getKey().endsWith(">")) {
- wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else if (entry.getKey().endsWith("<")) {
- wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else {
- wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
- }
- }
- }
-
- @RequestMapping(value = "/user/edit/auth")
- @ManagerAuth(memo = "绯荤粺鐢ㄦ埛缂栬緫")
- public R edit(User user) {
- if (Cools.isEmpty(user)){
- return R.error();
- }
- if (null == user.getId()){
- userService.insert(user);
- } else {
- userService.updateById(user);
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/user/add/auth")
- @ManagerAuth(memo = "绯荤粺鐢ㄦ埛娣诲姞")
- public R add(User user) {
- userService.insert(user);
- return R.ok();
- }
-
- @RequestMapping(value = "/user/update/auth")
- @ManagerAuth(memo = "绯荤粺鐢ㄦ埛淇敼")
- public R update(User user){
- if (Cools.isEmpty(user) || null==user.getId()){
- return R.error();
- }
- User entity = userService.selectById(user.getId());
- if (user.getPassword()!=null) {
- entity.setPassword(user.getPassword());
- }
- if (user.getUsername()!=null) {
- entity.setUsername(user.getUsername());
- }
- if (user.getMobile()!=null) {
- entity.setMobile(user.getMobile());
- }
- if (user.getRoleId() !=null) {
- entity.setRoleId(user.getRoleId());
- }
- userService.updateById(entity);
- return R.ok();
- }
-
- @RequestMapping(value = "/user/delete/auth")
- @ManagerAuth(memo = "绯荤粺鐢ㄦ埛鍒犻櫎")
- public R delete(@RequestParam(value="ids[]") Long[] ids){
- for (Long id : ids){
- userService.deleteById(id);
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/user/export/auth")
- @ManagerAuth(memo = "绯荤粺鐢ㄦ埛瀵煎嚭")
- public R export(@RequestBody JSONObject param){
- List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
- EntityWrapper<User> wrapper = new EntityWrapper<>();
- Map<String, Object> map = excludeTrash(param.getJSONObject("user"));
- convert(map, wrapper);
- List<User> list = userService.selectList(wrapper);
- return R.ok(exportSupport(list, fields));
- }
-
- @RequestMapping(value = "/userQuery/auth")
- @ManagerAuth
- public R query(String condition) {
- EntityWrapper<User> wrapper = new EntityWrapper<>();
- wrapper.like("username", condition);
- Page<User> page = userService.selectPage(new Page<>(0, 10), wrapper);
- List<Map<String, Object>> result = new ArrayList<>();
- for (User user : page.getRecords()){
- Map<String, Object> map = new HashMap<>();
- map.put("id", user.getId());
- map.put("value", user.getUsername());
- result.add(map);
- }
- return R.ok(result);
- }
-
-}
diff --git a/src/main/java/com/zy/system/controller/UserLoginController.java b/src/main/java/com/zy/system/controller/UserLoginController.java
deleted file mode 100644
index 69960f1..0000000
--- a/src/main/java/com/zy/system/controller/UserLoginController.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.zy.system.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.plugins.Page;
-import com.core.annotations.ManagerAuth;
-import com.core.common.Cools;
-import com.core.common.DateUtils;
-import com.core.common.R;
-import com.core.controller.AbstractBaseController;
-import com.zy.system.entity.UserLogin;
-import com.zy.system.service.UserLoginService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-@RestController
-public class UserLoginController extends AbstractBaseController {
-
- @Autowired
- private UserLoginService userLoginService;
-
- @RequestMapping(value = "/userLogin/{id}/auth")
- @ManagerAuth
- public R get(@PathVariable("id") Long id) {
- return R.ok(userLoginService.selectById(String.valueOf(id)));
- }
-
- @RequestMapping(value = "/userLogin/list/auth")
- @ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam Map<String, Object> param){
- excludeTrash(param);
- EntityWrapper<UserLogin> wrapper = new EntityWrapper<>();
- convert(param, wrapper);
- wrapper.orderBy("id", false);
- return R.ok(userLoginService.selectPage(new Page<>(curr, limit), wrapper));
- }
-
- private void convert(Map<String, Object> map, EntityWrapper wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
- if (entry.getKey().endsWith(">")) {
- wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else if (entry.getKey().endsWith("<")) {
- wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
- } else {
- wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
- }
- }
- }
-
- @RequestMapping(value = "/userLogin/edit/auth")
- @ManagerAuth
- public R edit(UserLogin userLogin) {
- if (Cools.isEmpty(userLogin)){
- return R.error();
- }
- if (null == userLogin.getId()){
- userLoginService.insert(userLogin);
- } else {
- userLoginService.updateById(userLogin);
- }
- return R.ok();
- }
-
- @RequestMapping(value = "/userLogin/add/auth")
- @ManagerAuth
- public R add(UserLogin userLogin) {
- userLoginService.insert(userLogin);
- return R.ok();
- }
-
- @RequestMapping(value = "/userLogin/update/auth")
- @ManagerAuth
- public R update(UserLogin userLogin){
- if (Cools.isEmpty(userLogin) || null==userLogin.getId()){
- return R.error();
- }
- userLoginService.updateById(userLogin);
- return R.ok();
- }
-
- @RequestMapping(value = "/userLogin/delete/auth")
- @ManagerAuth
- public R delete(Integer[] ids){
- if (Cools.isEmpty(ids)){
- return R.error();
- }
- userLoginService.deleteBatchIds(Arrays.asList(ids));
- return R.ok();
- }
-
- @RequestMapping(value = "/userLogin/export/auth")
- @ManagerAuth
- public R export(@RequestBody JSONObject param){
- List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
- EntityWrapper<UserLogin> wrapper = new EntityWrapper<>();
- Map<String, Object> map = excludeTrash(param.getJSONObject("userLogin"));
- convert(map, wrapper);
- List<UserLogin> list = userLoginService.selectList(wrapper);
- return R.ok(exportSupport(list, fields));
- }
-
- @RequestMapping(value = "/userLoginQuery/auth")
- @ManagerAuth
- public R query(String condition) {
- EntityWrapper<UserLogin> wrapper = new EntityWrapper<>();
- wrapper.like("token", condition);
- Page<UserLogin> page = userLoginService.selectPage(new Page<>(0, 10), wrapper);
- List<Map<String, Object>> result = new ArrayList<>();
- for (UserLogin userLogin : page.getRecords()){
- Map<String, Object> map = new HashMap<>();
- map.put("id", userLogin.getId());
- map.put("value", userLogin.getToken());
- result.add(map);
- }
- return R.ok(result);
- }
-
-}
diff --git a/src/main/java/com/zy/system/entity/Api.java b/src/main/java/com/zy/system/entity/Api.java
deleted file mode 100644
index 9342543..0000000
--- a/src/main/java/com/zy/system/entity/Api.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package com.zy.system.entity;
-
-import com.baomidou.mybatisplus.annotations.TableField;
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.baomidou.mybatisplus.enums.IdType;
-import com.core.common.Cools;
-
-import java.io.Serializable;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-@TableName("sys_api")
-public class Api implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 缂栧彿
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 鍛藉悕绌洪棿
- */
- private String namespace;
-
- /**
- * 鎺堟潈 0: 鏃犻渶鎺堟潈 1: 闇�瑕佹巿鏉�
- */
- private Short oauth;
-
- /**
- * 璇锋眰缁撴瀯
- */
- private String request;
-
- /**
- * 鍝嶅簲缁撴瀯
- */
- private String response;
-
- /**
- * 娣诲姞鏃堕棿
- */
- @TableField("create_time")
- private Date createTime;
-
- /**
- * 淇敼鏃堕棿
- */
- @TableField("update_time")
- private Date updateTime;
-
- /**
- * 鐘舵�� 1: 鏈夋晥 0: 绂佺敤
- */
- private Short status;
-
- public Api() {}
-
- public Api(String namespace,Short oauth,String request,String response,Date createTime,Date updateTime,Short status) {
- this.namespace = namespace; // 鍛藉悕绌洪棿[闈炵┖]
- this.oauth = oauth; // 鎺堟潈[闈炵┖]
- this.request = request; // 璇锋眰缁撴瀯
- this.response = response; // 鍝嶅簲缁撴瀯
- this.createTime = createTime; // 娣诲姞鏃堕棿[闈炵┖]
- this.updateTime = updateTime; // 淇敼鏃堕棿
- this.status = status; // 鐘舵�乕闈炵┖]
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
- public Short getOauth() {
- return oauth;
- }
-
- public String getOauth$(){
- if (null == this.oauth){ return null; }
- switch (this.oauth){
- case 0:
- return "鏃犻渶鎺堟潈";
- case 1:
- return "闇�瑕佹巿鏉�";
- default:
- return String.valueOf(this.oauth);
- }
- }
-
- public void setOauth(Short oauth) {
- this.oauth = oauth;
- }
-
- public String getRequest() {
- return request;
- }
-
- public void setRequest(String request) {
- this.request = request;
- }
-
- public String getResponse() {
- return response;
- }
-
- public void setResponse(String response) {
- this.response = response;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public String getCreateTime$(){
- if (Cools.isEmpty(this.createTime)){
- return "";
- }
- return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
- public Date getUpdateTime() {
- return updateTime;
- }
-
- public String getUpdateTime$(){
- if (Cools.isEmpty(this.updateTime)){
- return "";
- }
- return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
- }
-
- public void setUpdateTime(Date updateTime) {
- this.updateTime = updateTime;
- }
-
- public Short getStatus() {
- return status;
- }
-
- public String getStatus$(){
- if (null == this.status){ return null; }
- switch (this.status){
- case 1:
- return "鏈夋晥";
- case 0:
- return "绂佺敤";
- default:
- return String.valueOf(this.status);
- }
- }
-
- public void setStatus(Short status) {
- this.status = status;
- }
-
-
-}
diff --git a/src/main/java/com/zy/system/entity/Config.java b/src/main/java/com/zy/system/entity/Config.java
deleted file mode 100644
index 9b6a39a..0000000
--- a/src/main/java/com/zy/system/entity/Config.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package com.zy.system.entity;
-
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.baomidou.mybatisplus.enums.IdType;
-
-import java.io.Serializable;
-
-@TableName("sys_config")
-public class Config implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 缂栧彿
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 鍚嶇О
- */
- private String name;
-
- /**
- * 缂栫爜
- */
- private String code;
-
- /**
- * 瀵瑰簲鍊�
- */
- private String value;
-
- /**
- * 绫诲瀷 1: String 2: JSON
- */
- private Short type;
-
- /**
- * 鐘舵�� 1: 姝e父 0: 绂佺敤
- */
- private Short status;
-
- public Config() {}
-
- public Config(String name,String code,String value,Short type,Short status) {
- this.name = name;
- this.code = code;
- this.value = value;
- this.type = type;
- this.status = status;
- }
-
-// Config config = new Config(
-// null, // 鍚嶇О[闈炵┖]
-// null, // 缂栫爜[闈炵┖]
-// null, // 瀵瑰簲鍊糩闈炵┖]
-// null, // 绫诲瀷[闈炵┖]
-// null // 鐘舵�乕闈炵┖]
-// );
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public Short getType() {
- return type;
- }
-
- public String getType$(){
- if (null == this.type){ return null; }
- switch (this.type){
- case 1:
- return "String";
- case 2:
- return "JSON";
- default:
- return String.valueOf(this.type);
- }
- }
-
- public void setType(Short type) {
- this.type = type;
- }
-
- public Short getStatus() {
- return status;
- }
-
- public String getStatus$(){
- if (null == this.status){ return null; }
- switch (this.status){
- case 1:
- return "姝e父";
- case 0:
- return "绂佺敤";
- default:
- return String.valueOf(this.status);
- }
- }
-
- public void setStatus(Short status) {
- this.status = status;
- }
-
-
-}
diff --git a/src/main/java/com/zy/system/entity/Host.java b/src/main/java/com/zy/system/entity/Host.java
deleted file mode 100644
index 28b85ab..0000000
--- a/src/main/java/com/zy/system/entity/Host.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package com.zy.system.entity;
-
-import com.baomidou.mybatisplus.annotations.TableField;
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.baomidou.mybatisplus.enums.IdType;
-import com.core.common.Cools;
-
-import java.io.Serializable;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-@TableName("sys_host")
-public class Host implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 缂栧彿
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 鍟嗘埛鍚嶇О
- */
- private String name;
-
- /**
- * 鏍囪瘑
- */
- private String flag;
-
- /**
- * 娣诲姞鏃堕棿
- */
- @TableField("create_time")
- private Date createTime;
-
- /**
- * 淇敼鏃堕棿
- */
- @TableField("update_time")
- private Date updateTime;
-
- /**
- * 鐘舵�� 1: 姝e父 0: 绂佺敤
- */
- private Integer status;
-
- public Host() {}
-
- public Host(String name,String flag,Date createTime,Date updateTime,Integer status) {
- this.name = name;
- this.flag = flag;
- this.createTime = createTime;
- this.updateTime = updateTime;
- this.status = status;
- }
-
-// Host host = new Host(
-// null, // 鍟嗘埛鍚嶇О[闈炵┖]
-// null, // 鏍囪瘑[闈炵┖]
-// null, // 娣诲姞鏃堕棿[闈炵┖]
-// null, // 淇敼鏃堕棿
-// null // 鐘舵�乕闈炵┖]
-// );
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getFlag() {
- return flag;
- }
-
- public void setFlag(String flag) {
- this.flag = flag;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public String getCreateTime$(){
- if (Cools.isEmpty(this.createTime)){
- return "";
- }
- return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
- public Date getUpdateTime() {
- return updateTime;
- }
-
- public String getUpdateTime$(){
- if (Cools.isEmpty(this.updateTime)){
- return "";
- }
- return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
- }
-
- public void setUpdateTime(Date updateTime) {
- this.updateTime = updateTime;
- }
-
- public Integer getStatus() {
- return status;
- }
-
- public String getStatus$(){
- if (null == this.status){ return null; }
- switch (this.status){
- case 1:
- return "姝e父";
- case 0:
- return "绂佺敤";
- default:
- return String.valueOf(this.status);
- }
- }
-
- public void setStatus(Integer status) {
- this.status = status;
- }
-
-
-}
diff --git a/src/main/java/com/zy/system/entity/OperateLog.java b/src/main/java/com/zy/system/entity/OperateLog.java
deleted file mode 100644
index eb93fad..0000000
--- a/src/main/java/com/zy/system/entity/OperateLog.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package com.zy.system.entity;
-
-import com.baomidou.mybatisplus.annotations.TableField;
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.baomidou.mybatisplus.enums.IdType;
-import com.core.common.Cools;
-import com.core.common.SpringUtils;
-import com.zy.system.service.UserService;
-
-import java.io.Serializable;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-@TableName("sys_operate_log")
-public class OperateLog implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 缂栧彿
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 璁块棶鍦板潃
- */
- private String action;
-
- /**
- * 鐢ㄦ埛
- */
- @TableField("user_id")
- private Long userId;
-
- /**
- * 瀹㈡埛绔疘P
- */
- private String ip;
-
- /**
- * 璇锋眰鏁版嵁
- */
- private String request;
-
- /**
- * 鍝嶅簲鏁版嵁
- */
- private String response;
-
- /**
- * 娣诲姞鏃堕棿
- */
- @TableField("create_time")
- private Date createTime;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getAction() {
- return action;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
-
- public Long getUserId() {
- return userId;
- }
-
- public String getUserId$(){
- UserService service = SpringUtils.getBean(UserService.class);
- User user = service.selectById(this.userId);
- if (!Cools.isEmpty(user)){
- return user.getUsername();
- }
- return null;
- }
- public void setUserId(Long userId) {
- this.userId = userId;
- }
-
- public String getIp() {
- return ip;
- }
-
- public void setIp(String ip) {
- this.ip = ip;
- }
-
- public String getRequest() {
- return request;
- }
-
- public void setRequest(String request) {
- this.request = request;
- }
-
- public String getResponse() {
- return response;
- }
-
- public void setResponse(String response) {
- this.response = response;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public String getCreateTime$(){
- if (Cools.isEmpty(this.createTime)){
- return "";
- }
- return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
-
-}
diff --git a/src/main/java/com/zy/system/entity/Permission.java b/src/main/java/com/zy/system/entity/Permission.java
deleted file mode 100644
index 8373e0f..0000000
--- a/src/main/java/com/zy/system/entity/Permission.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package com.zy.system.entity;
-
-import com.baomidou.mybatisplus.annotations.TableField;
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.baomidou.mybatisplus.enums.IdType;
-import com.core.common.Cools;
-import com.core.common.SpringUtils;
-import com.zy.system.service.ResourceService;
-
-import java.io.Serializable;
-
-@TableName("sys_permission")
-public class Permission implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 缂栧彿
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 鏉冮檺鍚嶇О
- */
- private String name;
-
- /**
- * 鎺ュ彛鍦板潃
- */
- private String action;
-
- /**
- * 鎵�灞炶彍鍗�
- */
- @TableField("resource_id")
- private Long resourceId;
-
- /**
- * 鐘舵�� 1: 姝e父 0: 绂佺敤
- */
- private Short status;
-
- public Permission() {}
-
- public Permission(String name,String action,Long resourceId,Short status) {
- this.name = name;
- this.action = action;
- this.resourceId = resourceId;
- this.status = status;
- }
-
-// Permission permission = new Permission(
-// null, // 鏉冮檺鍚嶇О[闈炵┖]
-// null, // 鎺ュ彛鍦板潃[闈炵┖]
-// null, // 鎵�灞炶彍鍗�
-// null // 鐘舵�乕闈炵┖]
-// );
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getAction() {
- return action;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
-
- public Long getResourceId() {
- return resourceId;
- }
-
- public String getResourceName(){
- ResourceService service = SpringUtils.getBean(ResourceService.class);
- Resource resource = service.selectById(this.resourceId);
- if (!Cools.isEmpty(resource)){
- return resource.getName();
- }
- return null;
- }
-
- public void setResourceId(Long resourceId) {
- this.resourceId = resourceId;
- }
-
- public Short getStatus() {
- return status;
- }
-
- public String getStatus$(){
- if (null == this.status){ return null; }
- switch (this.status){
- case 1:
- return "姝e父";
- case 0:
- return "绂佺敤";
- default:
- return String.valueOf(this.status);
- }
- }
-
- public void setStatus(Short status) {
- this.status = status;
- }
-
-
-}
diff --git a/src/main/java/com/zy/system/entity/Resource.java b/src/main/java/com/zy/system/entity/Resource.java
deleted file mode 100644
index 01b81f9..0000000
--- a/src/main/java/com/zy/system/entity/Resource.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package com.zy.system.entity;
-
-import com.baomidou.mybatisplus.annotations.TableField;
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.baomidou.mybatisplus.enums.IdType;
-import com.core.common.Cools;
-import com.core.common.SpringUtils;
-import com.zy.system.service.ResourceService;
-
-import java.io.Serializable;
-
-@TableName("sys_resource")
-public class Resource implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 缂栧彿
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 鑿滃崟缂栫爜
- */
- private String code;
-
- /**
- * 鑿滃崟鍚嶇О
- */
- private String name;
-
- /**
- * 鐖剁骇鑿滃崟
- */
- @TableField("resource_id")
- private Long resourceId;
-
- /**
- * 鑿滃崟绛夌骇 1: 涓�绾ц彍鍗� 2: 浜岀骇鑿滃崟
- */
- private Short level;
-
- /**
- * 鎺掑簭
- */
- private Integer sort;
-
- /**
- * 鐘舵�� 1: 姝e父 0: 绂佺敤
- */
- private Short status;
-
- public Resource() {}
-
- public Resource(String code,String name,Long resourceId,Short level,Integer sort,Short status) {
- this.code = code;
- this.name = name;
- this.resourceId = resourceId;
- this.level = level;
- this.sort = sort;
- this.status = status;
- }
-
-// Resource resource = new Resource(
-// null, // 鑿滃崟缂栫爜[闈炵┖]
-// null, // 鑿滃崟鍚嶇О[闈炵┖]
-// null, // 鐖剁骇鑿滃崟
-// null, // 鑿滃崟绛夌骇[闈炵┖]
-// null, // 鎺掑簭
-// null // 鐘舵�乕闈炵┖]
-// );
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Long getResourceId() {
- return resourceId;
- }
-
- public String getResourceName(){
- ResourceService service = SpringUtils.getBean(ResourceService.class);
- Resource resource = service.selectById(this.resourceId);
- if (!Cools.isEmpty(resource)){
- return resource.getName();
- }
- return null;
- }
-
- public void setResourceId(Long resourceId) {
- this.resourceId = resourceId;
- }
-
- public Short getLevel() {
- return level;
- }
-
- public String getLevel$(){
- if (null == this.level){ return null; }
- switch (this.level){
- case 1:
- return "涓�绾ц彍鍗�";
- case 2:
- return "浜岀骇鑿滃崟";
- case 3:
- return "涓夌骇鑿滃崟";
- default:
- return String.valueOf(this.level);
- }
- }
-
- public void setLevel(Short level) {
- this.level = level;
- }
-
- public Integer getSort() {
- return sort;
- }
-
- public void setSort(Integer sort) {
- this.sort = sort;
- }
-
- public Short getStatus() {
- return status;
- }
-
- public String getStatus$(){
- if (null == this.status){ return null; }
- switch (this.status){
- case 1:
- return "姝e父";
- case 0:
- return "绂佺敤";
- default:
- return String.valueOf(this.status);
- }
- }
-
- public void setStatus(Short status) {
- this.status = status;
- }
-
-
-}
diff --git a/src/main/java/com/zy/system/entity/Role.java b/src/main/java/com/zy/system/entity/Role.java
deleted file mode 100644
index 9f6a998..0000000
--- a/src/main/java/com/zy/system/entity/Role.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package com.zy.system.entity;
-
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.baomidou.mybatisplus.enums.IdType;
-import com.core.common.Cools;
-import com.core.common.SpringUtils;
-import com.zy.system.service.RoleService;
-import io.swagger.annotations.ApiModelProperty;
-
-import java.io.Serializable;
-
-@TableName("sys_role")
-public class Role implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 缂栧彿
- */
- @ApiModelProperty(value= "缂栧彿")
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 缂栫爜
- */
- @ApiModelProperty(value= "缂栫爜")
- private String code;
-
- /**
- * 鍚嶇О
- */
- @ApiModelProperty(value= "鍚嶇О")
- private String name;
-
- /**
- * 涓婄骇
- */
- @ApiModelProperty(value= "涓婄骇")
- private Long leader;
-
- /**
- * 瑙掕壊绛夌骇 1: 涓�绾� 2: 浜岀骇 3: 涓夌骇 4: 鍥涚骇 5: 浜旂骇
- */
- @ApiModelProperty(value= "瑙掕壊绛夌骇 1: 涓�绾� 2: 浜岀骇 3: 涓夌骇 4: 鍥涚骇 5: 浜旂骇 ")
- private Short level;
-
- public Role() {}
-
- public Role(String code,String name,Long leader,Short level) {
- this.code = code;
- this.name = name;
- this.leader = leader;
- this.level = level;
- }
-
-// Role role = new Role(
-// null, // 缂栫爜[闈炵┖]
-// null, // 鍚嶇О[闈炵┖]
-// null, // 涓婄骇
-// null // 瑙掕壊绛夌骇
-// );
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Long getLeader() {
- return leader;
- }
-
- public String getLeader$(){
- RoleService service = SpringUtils.getBean(RoleService.class);
- Role role = service.selectById(this.leader);
- if (!Cools.isEmpty(role)){
- return String.valueOf(role.getName());
- }
- return null;
- }
-
- public void setLeader(Long leader) {
- this.leader = leader;
- }
-
- public Short getLevel() {
- return level;
- }
-
- public String getLevel$(){
- if (null == this.level){ return null; }
- switch (this.level){
- case 1:
- return "涓�绾�";
- case 2:
- return "浜岀骇";
- case 3:
- return "涓夌骇";
- case 4:
- return "鍥涚骇";
- case 5:
- return "浜旂骇";
- default:
- return String.valueOf(this.level);
- }
- }
-
- public void setLevel(Short level) {
- this.level = level;
- }
-
-
-}
diff --git a/src/main/java/com/zy/system/entity/RolePermission.java b/src/main/java/com/zy/system/entity/RolePermission.java
deleted file mode 100644
index d846f50..0000000
--- a/src/main/java/com/zy/system/entity/RolePermission.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.zy.system.entity;
-
-import com.baomidou.mybatisplus.annotations.TableField;
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.baomidou.mybatisplus.enums.IdType;
-import com.core.common.Cools;
-import com.core.common.SpringUtils;
-import com.zy.system.service.PermissionService;
-import com.zy.system.service.RoleService;
-
-import java.io.Serializable;
-
-//import com.zy.system.service.RoleService;
-
-@TableName("sys_role_permission")
-public class RolePermission implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 缂栧彿
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 瑙掕壊
- */
- @TableField("role_id")
- private Long roleId;
-
- /**
- * 鏉冮檺
- */
- @TableField("permission_id")
- private Long permissionId;
-
- public RolePermission() {}
-
- public RolePermission(Long roleId,Long permissionId) {
- this.roleId = roleId;
- this.permissionId = permissionId;
- }
-
-// RolePermission rolePermission = new RolePermission(
-// null, // 瑙掕壊[闈炵┖]
-// null // 鏉冮檺[闈炵┖]
-// );
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public Long getRoleId() {
- return roleId;
- }
-
- public String getRoleName(){
- RoleService service = SpringUtils.getBean(RoleService.class);
- Role role = service.selectById(this.roleId);
- if (!Cools.isEmpty(role)){
- return role.getName();
- }
- return null;
- }
-
- public void setRoleId(Long roleId) {
- this.roleId = roleId;
- }
-
- public Long getPermissionId() {
- return permissionId;
- }
-
- public String getPermissionName(){
- PermissionService service = SpringUtils.getBean(PermissionService.class);
- Permission permission = service.selectById(this.permissionId);
- if (!Cools.isEmpty(permission)){
- return permission.getName();
- }
- return null;
- }
-
- public void setPermissionId(Long permissionId) {
- this.permissionId = permissionId;
- }
-
-
-}
diff --git a/src/main/java/com/zy/system/entity/RoleResource.java b/src/main/java/com/zy/system/entity/RoleResource.java
deleted file mode 100644
index 48d4091..0000000
--- a/src/main/java/com/zy/system/entity/RoleResource.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.zy.system.entity;
-
-import com.baomidou.mybatisplus.annotations.TableField;
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.baomidou.mybatisplus.enums.IdType;
-
-import java.io.Serializable;
-
-@TableName("sys_role_resource")
-public class RoleResource implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 缂栧彿
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 瑙掕壊
- */
- @TableField("role_id")
- private Long roleId;
-
- /**
- * 璧勬簮
- */
- @TableField("resource_id")
- private Long resourceId;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public Long getRoleId() {
- return roleId;
- }
-
- public void setRoleId(Long roleId) {
- this.roleId = roleId;
- }
-
- public Long getResourceId() {
- return resourceId;
- }
-
- public void setResourceId(Long resourceId) {
- this.resourceId = resourceId;
- }
-
-
-}
diff --git a/src/main/java/com/zy/system/entity/User.java b/src/main/java/com/zy/system/entity/User.java
deleted file mode 100644
index c5086aa..0000000
--- a/src/main/java/com/zy/system/entity/User.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package com.zy.system.entity;
-
-import com.baomidou.mybatisplus.annotations.TableField;
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.baomidou.mybatisplus.enums.IdType;
-import com.core.common.Cools;
-import com.core.common.SpringUtils;
-import com.zy.system.service.HostService;
-import com.zy.system.service.RoleService;
-
-import java.io.Serializable;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-//import com.zy.system.service.RoleService;
-
-@TableName("sys_user")
-public class User implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 缂栧彿
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 鎺堟潈鍟嗘埛
- */
- @TableField("host_id")
- private Long hostId;
-
- /**
- * 璐﹀彿
- */
- private String username;
-
- /**
- * 鎵嬫満鍙�
- */
- private String mobile;
-
- /**
- * 瀵嗙爜
- */
- private String password;
-
- /**
- * 瑙掕壊
- */
- @TableField("role_id")
- private Long roleId;
-
- /**
- * 娉ㄥ唽鏃堕棿
- */
- @TableField("create_time")
- private Date createTime;
-
- /**
- * 鐘舵�� 1: 鍚敤 2: 鍐荤粨 3: 鍒犻櫎
- */
- private Integer status;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getUsername() {
- return username;
- }
-
- public Long getHostId() {
- return hostId;
- }
-
- public String getHostName() {
- HostService service = SpringUtils.getBean(HostService.class);
- Host host = service.selectById(this.hostId);
- if (!Cools.isEmpty(host)){
- return host.getName();
- }
- return null;
- }
-
- public void setHostId(Long hostId) {
- this.hostId = hostId;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getMobile() {
- return mobile;
- }
-
- public void setMobile(String mobile) {
- this.mobile = mobile;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public Long getRoleId() {
- return roleId;
- }
-
- public String getRoleName(){
- RoleService service = SpringUtils.getBean(RoleService.class);
- Role role = service.selectById(this.roleId);
- if (!Cools.isEmpty(role)){
- return role.getName();
- }
- return null;
- }
-
- public void setRoleId(Long roleId) {
- this.roleId = roleId;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public String getCreateTime$(){
- if (Cools.isEmpty(this.createTime)){
- return "";
- }
- return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
- public Integer getStatus() {
- return status;
- }
-
- public String getStatus$(){
- if (null == this.status){ return null; }
- switch (this.status){
- case 1:
- return "鍚敤";
- case 2:
- return "鍐荤粨";
- case 3:
- return "鍒犻櫎";
- default:
- return String.valueOf(this.status);
- }
- }
-
- public void setStatus(Integer status) {
- this.status = status;
- }
-
-
-}
diff --git a/src/main/java/com/zy/system/entity/UserLogin.java b/src/main/java/com/zy/system/entity/UserLogin.java
deleted file mode 100644
index d8fbc00..0000000
--- a/src/main/java/com/zy/system/entity/UserLogin.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.zy.system.entity;
-
-import com.baomidou.mybatisplus.annotations.TableField;
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.baomidou.mybatisplus.enums.IdType;
-import com.core.common.Cools;
-import com.core.common.SpringUtils;
-import com.zy.system.service.UserService;
-
-import java.io.Serializable;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-@TableName("sys_user_login")
-public class UserLogin implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 缂栧彿
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 鍛樺伐
- */
- @TableField("user_id")
- private Long userId;
-
- /**
- * 鍑瘉鍊�
- */
- private String token;
-
- /**
- * 娣诲姞鏃堕棿
- */
- @TableField("create_time")
- private Date createTime;
-
- /**
- * 鐧诲綍绯荤粺
- */
- @TableField("system")
- private String system;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public Long getUserId() {
- return userId;
- }
-
- public String getUserUsername(){
- UserService service = SpringUtils.getBean(UserService.class);
- User user = service.selectById(this.userId);
- if (!Cools.isEmpty(user)){
- return user.getUsername();
- }
- return null;
- }
- public void setUserId(Long userId) {
- this.userId = userId;
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public String getCreateTime$(){
- if (Cools.isEmpty(this.createTime)){
- return "";
- }
- return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
- public String getSystem() {
- return system;
- }
-
- public void setSystem(String system) {
- this.system = system;
- }
-}
diff --git a/src/main/java/com/zy/system/mapper/ApiMapper.java b/src/main/java/com/zy/system/mapper/ApiMapper.java
deleted file mode 100644
index bd3d145..0000000
--- a/src/main/java/com/zy/system/mapper/ApiMapper.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.mapper;
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.zy.system.entity.Api;
-import org.apache.ibatis.annotations.Mapper;
-import org.springframework.stereotype.Repository;
-
-@Mapper
-@Repository
-public interface ApiMapper extends BaseMapper<Api> {
-
-}
diff --git a/src/main/java/com/zy/system/mapper/ConfigMapper.java b/src/main/java/com/zy/system/mapper/ConfigMapper.java
deleted file mode 100644
index 9ec6ab3..0000000
--- a/src/main/java/com/zy/system/mapper/ConfigMapper.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.mapper;
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.zy.system.entity.Config;
-import org.apache.ibatis.annotations.Mapper;
-import org.springframework.stereotype.Repository;
-
-@Mapper
-@Repository
-public interface ConfigMapper extends BaseMapper<Config> {
-
-}
diff --git a/src/main/java/com/zy/system/mapper/HostMapper.java b/src/main/java/com/zy/system/mapper/HostMapper.java
deleted file mode 100644
index ea5b9c1..0000000
--- a/src/main/java/com/zy/system/mapper/HostMapper.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.mapper;
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.zy.system.entity.Host;
-import org.apache.ibatis.annotations.Mapper;
-import org.springframework.stereotype.Repository;
-
-@Mapper
-@Repository
-public interface HostMapper extends BaseMapper<Host> {
-
-}
diff --git a/src/main/java/com/zy/system/mapper/OperateLogMapper.java b/src/main/java/com/zy/system/mapper/OperateLogMapper.java
deleted file mode 100644
index d002d10..0000000
--- a/src/main/java/com/zy/system/mapper/OperateLogMapper.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.zy.system.mapper;
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.zy.system.entity.OperateLog;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-import java.util.Map;
-
-@Mapper
-@Repository
-public interface OperateLogMapper extends BaseMapper<OperateLog> {
-
- @Select("select count(1) from sys_operate_log where yearweek(date_format(create_time,'%Y-%m-%d')) = yearweek(now());")
- int selectCountByCurrentWeek();
-
- @Select("select MONTH(create_time) as node , count(1) as val from sys_operate_log where 1 = 1 and year(create_time) = #{year} group by MONTH(create_time)")
- List<Map<String, Object>> getReportByYear(@Param("year") Integer year);
-
- @Select("select DAYOFMONTH(create_time) as node,count(1) as val from sys_operate_log where 1 = 1 and year(create_time) = #{year} and month(create_time) = #{month} group by DAYOFMONTH(create_time)")
- List<Map<String, Object>> getReportByMonth(@Param("year") Integer year, @Param("month") Integer month);
-
-}
diff --git a/src/main/java/com/zy/system/mapper/PermissionMapper.java b/src/main/java/com/zy/system/mapper/PermissionMapper.java
deleted file mode 100644
index 3b6a70e..0000000
--- a/src/main/java/com/zy/system/mapper/PermissionMapper.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.mapper;
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.zy.system.entity.Permission;
-import org.apache.ibatis.annotations.Mapper;
-import org.springframework.stereotype.Repository;
-
-@Mapper
-@Repository
-public interface PermissionMapper extends BaseMapper<Permission> {
-
-}
diff --git a/src/main/java/com/zy/system/mapper/ResourceMapper.java b/src/main/java/com/zy/system/mapper/ResourceMapper.java
deleted file mode 100644
index 3372755..0000000
--- a/src/main/java/com/zy/system/mapper/ResourceMapper.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.mapper;
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.zy.system.entity.Resource;
-import org.apache.ibatis.annotations.Mapper;
-import org.springframework.stereotype.Repository;
-
-@Mapper
-@Repository
-public interface ResourceMapper extends BaseMapper<Resource> {
-
-}
diff --git a/src/main/java/com/zy/system/mapper/RoleMapper.java b/src/main/java/com/zy/system/mapper/RoleMapper.java
deleted file mode 100644
index 7900402..0000000
--- a/src/main/java/com/zy/system/mapper/RoleMapper.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.mapper;
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.zy.system.entity.Role;
-import org.apache.ibatis.annotations.Mapper;
-import org.springframework.stereotype.Repository;
-
-@Mapper
-@Repository
-public interface RoleMapper extends BaseMapper<Role> {
-
-}
diff --git a/src/main/java/com/zy/system/mapper/RolePermissionMapper.java b/src/main/java/com/zy/system/mapper/RolePermissionMapper.java
deleted file mode 100644
index f7815ca..0000000
--- a/src/main/java/com/zy/system/mapper/RolePermissionMapper.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.mapper;
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.zy.system.entity.RolePermission;
-import org.apache.ibatis.annotations.Mapper;
-import org.springframework.stereotype.Repository;
-
-@Mapper
-@Repository
-public interface RolePermissionMapper extends BaseMapper<RolePermission> {
-
-}
diff --git a/src/main/java/com/zy/system/mapper/RoleResourceMapper.java b/src/main/java/com/zy/system/mapper/RoleResourceMapper.java
deleted file mode 100644
index e77e262..0000000
--- a/src/main/java/com/zy/system/mapper/RoleResourceMapper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.zy.system.mapper;
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.zy.system.entity.Resource;
-import com.zy.system.entity.RoleResource;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Mapper
-@Repository
-public interface RoleResourceMapper extends BaseMapper<RoleResource> {
-
- @Select("select sr.* from sys_resource sr left join sys_role_resource srr on srr.resource_id = sr.id left join sys_user su on su.role_id = srr.role_id where 1 = 1 and su.id = #{userId} and sr. level = 3 and sr.resource_id = #{fatherResourceId} and sr. status = 1 order by sr.sort")
- List<Resource> getMenuButtomResource(@Param("fatherResourceId") Long fatherResourceId, @Param("userId") Long userId);
-
-}
diff --git a/src/main/java/com/zy/system/mapper/UserLoginMapper.java b/src/main/java/com/zy/system/mapper/UserLoginMapper.java
deleted file mode 100644
index b275758..0000000
--- a/src/main/java/com/zy/system/mapper/UserLoginMapper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.zy.system.mapper;
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.zy.system.entity.UserLogin;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Select;
-import org.springframework.stereotype.Repository;
-
-@Mapper
-@Repository
-public interface UserLoginMapper extends BaseMapper<UserLogin> {
-
- @Select("select count(1) from sys_user_login where yearweek(date_format(create_time,'%Y-%m-%d')) = yearweek(now())")
- int selectCountByCurrentWeek();
-
-}
diff --git a/src/main/java/com/zy/system/mapper/UserMapper.java b/src/main/java/com/zy/system/mapper/UserMapper.java
deleted file mode 100644
index 0e40b22..0000000
--- a/src/main/java/com/zy/system/mapper/UserMapper.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.mapper;
-
-import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.zy.system.entity.User;
-import org.apache.ibatis.annotations.Mapper;
-import org.springframework.stereotype.Repository;
-
-@Mapper
-@Repository
-public interface UserMapper extends BaseMapper<User> {
-
-}
diff --git a/src/main/java/com/zy/system/service/ApiService.java b/src/main/java/com/zy/system/service/ApiService.java
deleted file mode 100644
index 4d0dca5..0000000
--- a/src/main/java/com/zy/system/service/ApiService.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.zy.system.service;
-
-import com.baomidou.mybatisplus.service.IService;
-import com.zy.system.entity.Api;
-
-public interface ApiService extends IService<Api> {
-
-}
diff --git a/src/main/java/com/zy/system/service/ConfigService.java b/src/main/java/com/zy/system/service/ConfigService.java
deleted file mode 100644
index 7e31e9a..0000000
--- a/src/main/java/com/zy/system/service/ConfigService.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.zy.system.service;
-
-import com.baomidou.mybatisplus.service.IService;
-import com.zy.system.entity.Config;
-
-public interface ConfigService extends IService<Config> {
-
-}
diff --git a/src/main/java/com/zy/system/service/HostService.java b/src/main/java/com/zy/system/service/HostService.java
deleted file mode 100644
index 0643fe1..0000000
--- a/src/main/java/com/zy/system/service/HostService.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.zy.system.service;
-
-import com.baomidou.mybatisplus.service.IService;
-import com.zy.system.entity.Host;
-
-public interface HostService extends IService<Host> {
-
-}
diff --git a/src/main/java/com/zy/system/service/OperateLogService.java b/src/main/java/com/zy/system/service/OperateLogService.java
deleted file mode 100644
index 4516f15..0000000
--- a/src/main/java/com/zy/system/service/OperateLogService.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.zy.system.service;
-
-import com.baomidou.mybatisplus.service.IService;
-import com.zy.system.entity.OperateLog;
-
-import java.util.List;
-import java.util.Map;
-
-public interface OperateLogService extends IService<OperateLog> {
-
- int selectCountByCurrentWeek();
-
- List<Map<String, Object>> getReport(Integer year, Integer month);
-
-}
diff --git a/src/main/java/com/zy/system/service/PermissionService.java b/src/main/java/com/zy/system/service/PermissionService.java
deleted file mode 100644
index 6e13883..0000000
--- a/src/main/java/com/zy/system/service/PermissionService.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.zy.system.service;
-
-import com.baomidou.mybatisplus.service.IService;
-import com.zy.system.entity.Permission;
-
-public interface PermissionService extends IService<Permission> {
-
-}
diff --git a/src/main/java/com/zy/system/service/ResourceService.java b/src/main/java/com/zy/system/service/ResourceService.java
deleted file mode 100644
index 5f4df69..0000000
--- a/src/main/java/com/zy/system/service/ResourceService.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.zy.system.service;
-
-import com.baomidou.mybatisplus.service.IService;
-import com.zy.system.entity.Resource;
-
-public interface ResourceService extends IService<Resource> {
-
-}
diff --git a/src/main/java/com/zy/system/service/RolePermissionService.java b/src/main/java/com/zy/system/service/RolePermissionService.java
deleted file mode 100644
index a308902..0000000
--- a/src/main/java/com/zy/system/service/RolePermissionService.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.zy.system.service;
-
-import com.baomidou.mybatisplus.service.IService;
-import com.zy.system.entity.RolePermission;
-
-public interface RolePermissionService extends IService<RolePermission> {
-
-}
diff --git a/src/main/java/com/zy/system/service/RoleResourceService.java b/src/main/java/com/zy/system/service/RoleResourceService.java
deleted file mode 100644
index 42ef479..0000000
--- a/src/main/java/com/zy/system/service/RoleResourceService.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.zy.system.service;
-
-import com.baomidou.mybatisplus.service.IService;
-import com.zy.system.entity.Resource;
-import com.zy.system.entity.RoleResource;
-
-import java.util.List;
-
-public interface RoleResourceService extends IService<RoleResource> {
-
- List<Resource> getMenuButtomResource(Long fatherResourceId, Long userId);
-
-}
diff --git a/src/main/java/com/zy/system/service/RoleService.java b/src/main/java/com/zy/system/service/RoleService.java
deleted file mode 100644
index 8a23ead..0000000
--- a/src/main/java/com/zy/system/service/RoleService.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.zy.system.service;
-
-import com.baomidou.mybatisplus.service.IService;
-import com.zy.system.entity.Role;
-
-public interface RoleService extends IService<Role> {
-
-}
diff --git a/src/main/java/com/zy/system/service/UserLoginService.java b/src/main/java/com/zy/system/service/UserLoginService.java
deleted file mode 100644
index 8bfa7b0..0000000
--- a/src/main/java/com/zy/system/service/UserLoginService.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.zy.system.service;
-
-import com.baomidou.mybatisplus.service.IService;
-import com.zy.system.entity.UserLogin;
-
-public interface UserLoginService extends IService<UserLogin> {
-
- int selectCountByCurrentWeek();
-
-}
diff --git a/src/main/java/com/zy/system/service/UserService.java b/src/main/java/com/zy/system/service/UserService.java
deleted file mode 100644
index adf1253..0000000
--- a/src/main/java/com/zy/system/service/UserService.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.zy.system.service;
-
-import com.baomidou.mybatisplus.service.IService;
-import com.zy.system.entity.User;
-
-public interface UserService extends IService<User> {
-
-}
diff --git a/src/main/java/com/zy/system/service/impl/ApiServiceImpl.java b/src/main/java/com/zy/system/service/impl/ApiServiceImpl.java
deleted file mode 100644
index 4f92956..0000000
--- a/src/main/java/com/zy/system/service/impl/ApiServiceImpl.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.service.impl;
-
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.zy.system.entity.Api;
-import com.zy.system.mapper.ApiMapper;
-import com.zy.system.service.ApiService;
-import org.springframework.stereotype.Service;
-
-@Service("apiService")
-public class ApiServiceImpl extends ServiceImpl<ApiMapper, Api> implements ApiService {
-
-}
diff --git a/src/main/java/com/zy/system/service/impl/ConfigServiceImpl.java b/src/main/java/com/zy/system/service/impl/ConfigServiceImpl.java
deleted file mode 100644
index 0a8661c..0000000
--- a/src/main/java/com/zy/system/service/impl/ConfigServiceImpl.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.service.impl;
-
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.zy.system.entity.Config;
-import com.zy.system.mapper.ConfigMapper;
-import com.zy.system.service.ConfigService;
-import org.springframework.stereotype.Service;
-
-@Service("configService")
-public class ConfigServiceImpl extends ServiceImpl<ConfigMapper, Config> implements ConfigService {
-
-}
diff --git a/src/main/java/com/zy/system/service/impl/HostServiceImpl.java b/src/main/java/com/zy/system/service/impl/HostServiceImpl.java
deleted file mode 100644
index 8565c35..0000000
--- a/src/main/java/com/zy/system/service/impl/HostServiceImpl.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.service.impl;
-
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.zy.system.entity.Host;
-import com.zy.system.mapper.HostMapper;
-import com.zy.system.service.HostService;
-import org.springframework.stereotype.Service;
-
-@Service("hostService")
-public class HostServiceImpl extends ServiceImpl<HostMapper, Host> implements HostService {
-
-}
diff --git a/src/main/java/com/zy/system/service/impl/OperateLogServiceImpl.java b/src/main/java/com/zy/system/service/impl/OperateLogServiceImpl.java
deleted file mode 100644
index 960a05f..0000000
--- a/src/main/java/com/zy/system/service/impl/OperateLogServiceImpl.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.zy.system.service.impl;
-
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.core.common.Cools;
-import com.zy.system.entity.OperateLog;
-import com.zy.system.mapper.OperateLogMapper;
-import com.zy.system.service.OperateLogService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.Map;
-
-@Service("operateLogService")
-public class OperateLogServiceImpl extends ServiceImpl<OperateLogMapper, OperateLog> implements OperateLogService {
-
- @Autowired
- private OperateLogMapper operateLogMapper;
-
-
- @Override
- public int selectCountByCurrentWeek() {
- return operateLogMapper.selectCountByCurrentWeek();
- }
-
- @Override
- public List<Map<String, Object>> getReport(Integer year, Integer month) {
- if (Cools.isEmpty(month)) {
- return operateLogMapper.getReportByYear(year);
- }
- return operateLogMapper.getReportByMonth(year, month);
- }
-
-}
diff --git a/src/main/java/com/zy/system/service/impl/PermissionServiceImpl.java b/src/main/java/com/zy/system/service/impl/PermissionServiceImpl.java
deleted file mode 100644
index d6d3eeb..0000000
--- a/src/main/java/com/zy/system/service/impl/PermissionServiceImpl.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.service.impl;
-
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.zy.system.entity.Permission;
-import com.zy.system.mapper.PermissionMapper;
-import com.zy.system.service.PermissionService;
-import org.springframework.stereotype.Service;
-
-@Service("permissionService")
-public class PermissionServiceImpl extends ServiceImpl<PermissionMapper, Permission> implements PermissionService {
-
-}
diff --git a/src/main/java/com/zy/system/service/impl/ResourceServiceImpl.java b/src/main/java/com/zy/system/service/impl/ResourceServiceImpl.java
deleted file mode 100644
index 353b867..0000000
--- a/src/main/java/com/zy/system/service/impl/ResourceServiceImpl.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.service.impl;
-
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.zy.system.entity.Resource;
-import com.zy.system.mapper.ResourceMapper;
-import com.zy.system.service.ResourceService;
-import org.springframework.stereotype.Service;
-
-@Service("resourceService")
-public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> implements ResourceService {
-
-}
diff --git a/src/main/java/com/zy/system/service/impl/RolePermissionServiceImpl.java b/src/main/java/com/zy/system/service/impl/RolePermissionServiceImpl.java
deleted file mode 100644
index 8311fb1..0000000
--- a/src/main/java/com/zy/system/service/impl/RolePermissionServiceImpl.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.service.impl;
-
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.zy.system.entity.RolePermission;
-import com.zy.system.mapper.RolePermissionMapper;
-import com.zy.system.service.RolePermissionService;
-import org.springframework.stereotype.Service;
-
-@Service("rolePermissionService")
-public class RolePermissionServiceImpl extends ServiceImpl<RolePermissionMapper, RolePermission> implements RolePermissionService {
-
-}
diff --git a/src/main/java/com/zy/system/service/impl/RoleResourceServiceImpl.java b/src/main/java/com/zy/system/service/impl/RoleResourceServiceImpl.java
deleted file mode 100644
index 35aa081..0000000
--- a/src/main/java/com/zy/system/service/impl/RoleResourceServiceImpl.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.zy.system.service.impl;
-
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.zy.system.entity.Resource;
-import com.zy.system.entity.RoleResource;
-import com.zy.system.mapper.RoleResourceMapper;
-import com.zy.system.service.RoleResourceService;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service("roleResourceService")
-public class RoleResourceServiceImpl extends ServiceImpl<RoleResourceMapper, RoleResource> implements RoleResourceService {
-
- @Override
- public List<Resource> getMenuButtomResource(Long fatherResourceId, Long userId) {
- return this.baseMapper.getMenuButtomResource(fatherResourceId, userId);
- }
-}
diff --git a/src/main/java/com/zy/system/service/impl/RoleServiceImpl.java b/src/main/java/com/zy/system/service/impl/RoleServiceImpl.java
deleted file mode 100644
index f86c513..0000000
--- a/src/main/java/com/zy/system/service/impl/RoleServiceImpl.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.service.impl;
-
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.zy.system.entity.Role;
-import com.zy.system.mapper.RoleMapper;
-import com.zy.system.service.RoleService;
-import org.springframework.stereotype.Service;
-
-@Service("roleService")
-public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
-
-}
diff --git a/src/main/java/com/zy/system/service/impl/UserLoginServiceImpl.java b/src/main/java/com/zy/system/service/impl/UserLoginServiceImpl.java
deleted file mode 100644
index ebe5908..0000000
--- a/src/main/java/com/zy/system/service/impl/UserLoginServiceImpl.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.zy.system.service.impl;
-
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.zy.system.entity.UserLogin;
-import com.zy.system.mapper.UserLoginMapper;
-import com.zy.system.service.UserLoginService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service("userLoginService")
-public class UserLoginServiceImpl extends ServiceImpl<UserLoginMapper, UserLogin> implements UserLoginService {
-
- @Autowired
- private UserLoginMapper userLoginMapper;
-
- @Override
- public int selectCountByCurrentWeek() {
- return userLoginMapper.selectCountByCurrentWeek();
- }
-}
diff --git a/src/main/java/com/zy/system/service/impl/UserServiceImpl.java b/src/main/java/com/zy/system/service/impl/UserServiceImpl.java
deleted file mode 100644
index 67c0ce4..0000000
--- a/src/main/java/com/zy/system/service/impl/UserServiceImpl.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.zy.system.service.impl;
-
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.zy.system.entity.User;
-import com.zy.system.mapper.UserMapper;
-import com.zy.system.service.UserService;
-import org.springframework.stereotype.Service;
-
-@Service("userService")
-public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
-
-}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index a6f6e03..d877347 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -6,14 +6,8 @@
spring:
application:
name: @pom.build.finalName@
- datasource:
- hikari:
- validation-timeout: 3000
- connection-test-query: select 1
- driver-class-name: com.mysql.jdbc.Driver
- url: jdbc:mysql://127.0.0.1:3306/shuttle_rcs?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
- username: root
- password: root
+ jmx:
+ enabled: false
mvc:
static-path-pattern: /**
redis:
@@ -22,80 +16,12 @@
database: 0
# password: 123456
-mybatis-plus:
- mapper-locations: classpath:mapper/*.xml
-# global-config:
-# field-strategy: 0
-# configuration:
-# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
-
-
logging:
path: ./stock/out/@pom.build.finalName@/logs
super:
pwd: xltys1995
-swagger:
- enable: false
-
-pythonCalcPath: D:\\path\\cpu.py
-pythonCalcSimilarity: D:\\path\\similarity.py
-
deviceMsgConfig:
# 璇诲彇鏁版嵁鍚庤嚜鍔ㄥ垹闄�
- destroyAfterReading: true
-
-# 涓嬩綅鏈洪厤缃�
-wcs-slave:
- # 鍥涘悜绌挎杞�1
- shuttle[0]:
- id: 1
- ip: 192.168.4.77
- port: 8888
- rack: 0
- slot: 0
- threadImpl: NyShuttleThread
-# # 鍥涘悜绌挎杞�2
-# shuttle[1]:
-# id: 2
-# ip: 10.10.20.12
-# port: 8888
-# rack: 0
-# slot: 0
-# threadImpl: NyShuttleThread
-# # 璐у弶鎻愬崌鏈轰富绾跨▼
-# forkLiftMaster[0]:
-# id: 99
-# ip: 10.10.20.20
-# port: 102
-# rack: 0
-# slot: 0
-# threadImpl: LfdZyForkLiftMasterThread
-# # 璐у弶鎻愬崌鏈�1
-# forkLift[0]:
-# id: 1
-# ip: 10.10.20.20
-# port: 102
-# rack: 0
-# slot: 0
-# threadImpl: LfdZyForkLiftSlaveThread
-# masterId: 99
-# staRow: 9
-# staBay: 6
-# sta[0]:
-# staNo: 1001
-# lev: 1
-# liftNo: ${wcs-slave.forkLift[0].id}
-# sta[1]:
-# staNo: 1002
-# lev: 2
-# liftNo: ${wcs-slave.forkLift[0].id}
-# sta[2]:
-# staNo: 1003
-# lev: 3
-# liftNo: ${wcs-slave.forkLift[0].id}
-# sta[3]:
-# staNo: 1004
-# lev: 4
-# liftNo: ${wcs-slave.forkLift[0].id}
\ No newline at end of file
+ destroyAfterReading: true
\ No newline at end of file
--
Gitblit v1.9.1