#update
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -36,4 +36,7 @@ build/
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
|
||||
/logs
|
||||
.idea/*
|
||||
61
.idea/workspace.xml
generated
61
.idea/workspace.xml
generated
@@ -5,18 +5,44 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="84ac1b15-3cfa-4375-9957-45b7b581d04e" name="Changes" comment="#update">
|
||||
<change afterPath="$PROJECT_DIR$/maibu-admin/src/main/java/com/maibu/web/controller/system/SysOrgController.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/maibu-admin/src/main/java/com/maibu/web/controller/system/SysSiteController.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller/DeviceController.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysOrgMapper.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysSiteMapper.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/maibu-service/maibu-system-service/src/main/java/com/maibu/service/SysOrgService.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/maibu-service/maibu-system-service/src/main/java/com/maibu/service/SysSiteService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-admin/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-admin/pom.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-admin/src/main/java/com/maibu/MiddlePlatformApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-admin/src/main/java/com/maibu/MiddlePlatformApplication.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-admin/src/main/java/com/maibu/web/controller/system/SysLoginController.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-admin/src/main/java/com/maibu/web/controller/system/SysLoginController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-admin/src/main/resources/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-admin/src/main/resources/application-dev.yml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-admin/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-admin/src/main/resources/application.yml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-admin/src/main/resources/logback.xml" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-admin/src/main/resources/logback.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-admin/src/main/resources/sharding-sphere-config.yaml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/config/RuoYiConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/config/RuoYiConfig.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/core/device/DeviceAndProtocol.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/core/domain/entity/SysMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/core/domain/entity/SysMenu.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/core/domain/entity/SysRole.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/core/domain/entity/SysRole.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/core/domain/entity/SysUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/core/domain/entity/SysUser.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-framework/src/main/java/com/maibu/config/SecurityConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-framework/src/main/java/com/maibu/config/SecurityConfig.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/dto/DeviceBindDTO.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/dto/DeviceBindDTO.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/service/TransferDeviceService.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/service/TransferDeviceService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/domain/Bridge.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/domain/Device.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/domain/Device.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/mapper/DeviceMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/mapper/DeviceMapper.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/maibu-service/maibu-system-service/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-service/maibu-system-service/pom.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
@@ -51,7 +77,7 @@
|
||||
"Spring Boot.MiddlePlatformApplication.executor": "Debug",
|
||||
"git-widget-placeholder": "main",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "/home/maibu/Test/MiddlePlatform/maibu-service/maibu-iot-service/src/main/java/com/maibu/service/impl",
|
||||
"last_opened_file_path": "/home/maibu/Test/MiddlePlatform/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
@@ -70,8 +96,8 @@
|
||||
<window_info id="Commit_Guest" show_stripe_button="false" />
|
||||
<window_info id="Pull Requests" />
|
||||
<window_info id="Learn" show_stripe_button="false" />
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24985355" />
|
||||
<window_info id="Commit" order="1" weight="0.24985355" />
|
||||
<window_info content_ui="combo" id="Project" order="0" weight="0.28090215" />
|
||||
<window_info active="true" id="Commit" order="1" visible="true" weight="0.28090215" />
|
||||
<window_info id="Structure" order="2" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Database Changes" />
|
||||
<window_info anchor="bottom" id="TypeScript" />
|
||||
@@ -80,13 +106,13 @@
|
||||
<window_info anchor="bottom" id="File Transfer" />
|
||||
<window_info anchor="bottom" id="Version Control" order="0" weight="0.48920512" />
|
||||
<window_info anchor="bottom" id="Problems" order="1" />
|
||||
<window_info anchor="bottom" id="Problems View" order="2" />
|
||||
<window_info anchor="bottom" id="Problems View" order="2" weight="0.5019627" />
|
||||
<window_info anchor="bottom" id="Terminal" order="3" />
|
||||
<window_info anchor="bottom" id="Services" order="4" />
|
||||
<window_info anchor="bottom" id="Build" order="5" weight="0.3302257" />
|
||||
<window_info active="true" anchor="bottom" id="Run" order="6" visible="true" weight="0.4421001" />
|
||||
<window_info anchor="bottom" id="Run" order="6" weight="0.30961728" />
|
||||
<window_info anchor="bottom" id="Find" order="7" weight="0.3302257" />
|
||||
<window_info anchor="bottom" id="Debug" order="8" weight="0.48920512" />
|
||||
<window_info anchor="bottom" id="Debug" order="8" weight="0.5019627" />
|
||||
<window_info anchor="right" id="Endpoints" />
|
||||
<window_info anchor="right" id="documentation.v2" show_stripe_button="false" side_tool="true" />
|
||||
<window_info anchor="right" id="Coverage" side_tool="true" />
|
||||
@@ -95,21 +121,23 @@
|
||||
<window_info anchor="right" id="AIAssistant" order="1" weight="0.25" />
|
||||
<window_info anchor="right" id="Database" order="2" weight="0.25" />
|
||||
<window_info anchor="right" id="Gradle" order="3" weight="0.25" />
|
||||
<window_info active="true" anchor="right" id="Maven" order="4" visible="true" weight="0.17545402" />
|
||||
<window_info active="true" anchor="right" id="Maven" order="4" visible="true" weight="0.12214411" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller" />
|
||||
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service/impl" />
|
||||
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service" />
|
||||
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/mapper" />
|
||||
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/model" />
|
||||
<recent name="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/utils/poi" />
|
||||
</key>
|
||||
<key name="CopyClassDialog.RECENTS_KEY">
|
||||
<recent name="com.maibu.service.impl" />
|
||||
<recent name="com.maibu.service" />
|
||||
<recent name="com.maibu.web.controller.system" />
|
||||
<recent name="com.maibu.mapper" />
|
||||
<recent name="com.maibu" />
|
||||
<recent name="com.maibu.core.domain.entity" />
|
||||
<recent name="com.maibu.service.impl" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
@@ -173,6 +201,11 @@
|
||||
<workItem from="1776409083429" duration="4878000" />
|
||||
<workItem from="1776415338017" duration="2452000" />
|
||||
<workItem from="1776645540256" duration="2126000" />
|
||||
<workItem from="1776760450293" duration="3126000" />
|
||||
<workItem from="1776818751852" duration="9107000" />
|
||||
<workItem from="1776832672297" duration="8049000" />
|
||||
<workItem from="1776904775197" duration="11165000" />
|
||||
<workItem from="1776991172322" duration="5635000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="#update">
|
||||
<option name="closed" value="true" />
|
||||
@@ -232,7 +265,7 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/maibu-admin/src/main/java/com/maibu/web/controller/system/SysLoginController.java</url>
|
||||
<line>141</line>
|
||||
<line>76</line>
|
||||
<option name="timeStamp" value="12" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<version>4.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maibu-admin</artifactId>
|
||||
<artifactId>maibu-MiddlePlatform</artifactId>
|
||||
<dependencies>
|
||||
|
||||
<!-- spring-boot-devtools -->
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication()
|
||||
@SpringBootApplication
|
||||
@ForestScan(basePackages = "com.maibu")
|
||||
public class MiddlePlatformApplication
|
||||
{
|
||||
|
||||
@@ -12,10 +12,8 @@ import com.maibu.enums.BusinessType;
|
||||
import com.maibu.enums.ConnectorStatus;
|
||||
import com.maibu.enums.SourceType;
|
||||
import com.maibu.manager.DeviceSessionManager;
|
||||
import com.maibu.mapper.SysLoginConfigMapper;
|
||||
import com.maibu.service.IAppPreferencesService;
|
||||
import com.maibu.service.ISysMenuService;
|
||||
import com.maibu.service.ISysUserClientService;
|
||||
import com.maibu.service.ISysUserService;
|
||||
import com.maibu.utils.SecurityUtils;
|
||||
import com.maibu.web.domain.dto.LoginResultDto;
|
||||
@@ -60,75 +58,12 @@ public class SysLoginController {
|
||||
@Resource
|
||||
private IAppPreferencesService appPreferencesService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserClientService sysUserClientService;
|
||||
|
||||
@Autowired
|
||||
private SysLoginConfigMapper sysLoginConfigMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private DeviceSessionManager sessionManager;
|
||||
|
||||
|
||||
// /**
|
||||
// * 登录方法
|
||||
// *
|
||||
// * @param loginBody 登录信息
|
||||
// * @return 结果
|
||||
// */
|
||||
// @ApiOperation("用户登录")
|
||||
// @PostMapping("login")
|
||||
// @Log(title = "用户登录", businessType = BusinessType.OTHER)
|
||||
// public AjaxResult login(HttpServletRequest request, @RequestBody LoginBody loginBody) {
|
||||
// System.out.println("用户登录");
|
||||
// Integer sourceType = loginBody.getSourceType();
|
||||
// if (sourceType == null) {
|
||||
// return AjaxResult.error("登录来源为空!");
|
||||
// }
|
||||
//
|
||||
// String username;
|
||||
// String password;
|
||||
// if (sourceType == 5) {
|
||||
// LoginResultDto dto = loginService.threePlatformOpenIdVerify(loginBody);
|
||||
// if (!dto.isSuccess() || dto.isSkipLogin()) {
|
||||
// return new AjaxResult(dto.getResultCode(), dto.getMsg());
|
||||
// }
|
||||
// username = dto.getUserName();
|
||||
// password = dto.getPassword();
|
||||
// } else {
|
||||
// if (StringUtils.isEmpty(loginBody.getUsername()) || StringUtils.isEmpty(loginBody.getPassword())) {
|
||||
// return AjaxResult.error("参数错误!");
|
||||
// }
|
||||
// // 使用Redis保存当前登录用户信息
|
||||
// String code = SourceType.switchCode(sourceType);
|
||||
// username = loginBody.getUsername();
|
||||
// password = loginBody.getPassword();
|
||||
// String loginUserKey = username + ":" + code; // 使用用户ID作为缓存键的一部分
|
||||
// NettyDevice nettyDevice = sessionManager.getDevice(loginUserKey);
|
||||
// if (nettyDevice != null && ConnectorStatus.ACTIVE.equals(nettyDevice.getConnectorStatus())) {
|
||||
// return AjaxResult.error("已达登录上限!");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// AjaxResult ajax = AjaxResult.success();
|
||||
// // 生成令牌
|
||||
// String token = loginService.login(username, password, loginBody.getCode(),
|
||||
// loginBody.getUuid(), loginBody.getSourceType(), request.getHeader(LANGUAGE));
|
||||
// String[] split = token.split("====");
|
||||
// ajax.put(Constants.TOKEN, split[1]);
|
||||
// ajax.put("userId", split[0]);
|
||||
// ajax.put("username", username);
|
||||
//
|
||||
// SysUser sysUser = userService.selectUserByUserName(username);
|
||||
// sysUser.setSessionId(split[1]);
|
||||
// userService.updateUserProfile(sysUser);
|
||||
// return ajax;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
@@ -230,6 +165,7 @@ public class SysLoginController {
|
||||
ajax.put("aiChatNum", aiChatNum);
|
||||
ajax.put("nickName", nickName);
|
||||
if (sysUser != null) {
|
||||
ajax.put("roleId",sysUser.getRoleId());
|
||||
aiChatNum = sysUser.getAiChatNum();
|
||||
sysUser.setSessionId(split[1]);
|
||||
sysUser.setDisplayPassword(password);
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.maibu.web.controller.system;
|
||||
|
||||
import com.maibu.core.controller.BaseController;
|
||||
import com.maibu.core.domain.AjaxResult;
|
||||
import com.maibu.core.domain.entity.SysOrg;
|
||||
import com.maibu.core.page.TableDataInfo;
|
||||
import com.maibu.domain.Device;
|
||||
import com.maibu.service.SysOrgService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 组织管理
|
||||
*/
|
||||
@RequestMapping("/system/org")
|
||||
@RestController
|
||||
@Slf4j
|
||||
public class SysOrgController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SysOrgService sysOrgService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询组织列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysOrg org) {
|
||||
try {
|
||||
startPage();
|
||||
return getDataTable(sysOrgService.list(org));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或者修改组织
|
||||
*/
|
||||
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@RequestBody SysOrg org) {
|
||||
try {
|
||||
return AjaxResult.success(sysOrgService.save(org));
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("保存组织出错", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组织
|
||||
*/
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(@RequestParam Long id) {
|
||||
try {
|
||||
return AjaxResult.success(sysOrgService.delete(id));
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("保存组织出错", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组织详情
|
||||
*/
|
||||
|
||||
@GetMapping("/selectById")
|
||||
public AjaxResult selectById(@RequestParam Long id) {
|
||||
try {
|
||||
return AjaxResult.success(sysOrgService.selectById(id));
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("保存组织出错", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.maibu.web.controller.system;
|
||||
|
||||
import com.maibu.annotation.Log;
|
||||
import com.maibu.constant.Constants;
|
||||
import com.maibu.core.controller.BaseController;
|
||||
import com.maibu.core.domain.AjaxResult;
|
||||
import com.maibu.core.domain.entity.SysMenu;
|
||||
import com.maibu.core.domain.entity.SysOrg;
|
||||
import com.maibu.core.domain.entity.SysSite;
|
||||
import com.maibu.core.domain.entity.SysUser;
|
||||
import com.maibu.core.domain.model.LoginBody;
|
||||
import com.maibu.core.page.TableDataInfo;
|
||||
import com.maibu.domain.AppPreferences;
|
||||
import com.maibu.dto.NettyDevice;
|
||||
import com.maibu.enums.BusinessType;
|
||||
import com.maibu.enums.ConnectorStatus;
|
||||
import com.maibu.enums.SourceType;
|
||||
import com.maibu.manager.DeviceSessionManager;
|
||||
import com.maibu.service.*;
|
||||
import com.maibu.utils.SecurityUtils;
|
||||
import com.maibu.web.domain.dto.LoginResultDto;
|
||||
import com.maibu.web.service.SysLoginService;
|
||||
import com.maibu.web.service.SysPermissionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.maibu.constant.Constants.LANGUAGE;
|
||||
|
||||
|
||||
/**
|
||||
* 区域/场站
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysSiteController extends BaseController {
|
||||
@Autowired
|
||||
private SysSiteService sysSiteService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询组织列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysSite org) {
|
||||
try {
|
||||
startPage();
|
||||
return getDataTable(sysSiteService.list(org));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或者修改组织
|
||||
*/
|
||||
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@RequestBody SysSite org) {
|
||||
try {
|
||||
return AjaxResult.success(sysSiteService.save(org));
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("保存组织出错", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组织
|
||||
*/
|
||||
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(@RequestParam Long id) {
|
||||
try {
|
||||
return AjaxResult.success(sysSiteService.delete(id));
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("保存组织出错", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组织详情
|
||||
*/
|
||||
|
||||
@GetMapping("/selectById")
|
||||
public AjaxResult selectById(@RequestParam Long id) {
|
||||
try {
|
||||
return AjaxResult.success(sysSiteService.selectById(id));
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("保存组织出错", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://1.95.137.212:3306/fastbee?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://localhost:3306/maibu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: fastbee
|
||||
password: maibu520
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ maibu:
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
port: 8081 # 服务器的HTTP端口,默认为8080
|
||||
port: 8082 # 服务器的HTTP端口,默认为8080
|
||||
servlet:
|
||||
context-path: / # 应用的访问路径
|
||||
tomcat:
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.maibu.core.device;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author gsb
|
||||
* @date 2024/6/14 9:25
|
||||
*/
|
||||
@Data
|
||||
public class DeviceAndProtocol {
|
||||
|
||||
/**
|
||||
* 子设备编号
|
||||
*/
|
||||
private Long deviceId;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String serialNumber;
|
||||
/**
|
||||
* 协议编号
|
||||
*/
|
||||
private String protocolCode;
|
||||
/**
|
||||
* 产品id
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
private String transport;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private Integer deviceType;
|
||||
/**
|
||||
* 子设备地址
|
||||
*/
|
||||
private Integer slaveId;
|
||||
/**
|
||||
* 网关绑定的子设备地址
|
||||
*/
|
||||
private Integer proSlaveId;
|
||||
/**
|
||||
* 网关设备id
|
||||
*/
|
||||
private Long gwDeviceId;
|
||||
/**
|
||||
* 网关设备产品id
|
||||
*/
|
||||
private Long gwProductId;
|
||||
/**
|
||||
* 网关设备编号
|
||||
*/
|
||||
private String gwSerialNumber;
|
||||
/**
|
||||
* 网关设备名
|
||||
*/
|
||||
private String gwDeviceName;
|
||||
/**
|
||||
* 网关产品名
|
||||
*/
|
||||
private String gwProductName;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
}
|
||||
@@ -1,8 +1,14 @@
|
||||
package com.maibu.core.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.maibu.core.domain.BaseDO;
|
||||
import com.maibu.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
@@ -14,16 +20,19 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单权限表 sys_menu
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "SysMenu", description = "菜单权限表 sys_menu")
|
||||
public class SysMenu extends BaseEntity
|
||||
{
|
||||
@TableName(value = "sys_site")
|
||||
@Data
|
||||
public class SysMenu extends BaseDO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 菜单ID */
|
||||
@ApiModelProperty("菜单ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long menuId;
|
||||
|
||||
/** 菜单名称 */
|
||||
@@ -69,7 +78,7 @@ public class SysMenu extends BaseEntity
|
||||
/** 显示状态(0显示 1隐藏) */
|
||||
@ApiModelProperty("显示状态(0显示 1隐藏)")
|
||||
private String visible;
|
||||
|
||||
|
||||
/** 菜单状态(0正常 1停用) */
|
||||
@ApiModelProperty("菜单状态(0正常 1停用)")
|
||||
private String status;
|
||||
@@ -95,211 +104,4 @@ public class SysMenu extends BaseEntity
|
||||
@Deprecated
|
||||
private String language;
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getMenuId()
|
||||
{
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(Long menuId)
|
||||
{
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
|
||||
public String getMenuName()
|
||||
{
|
||||
return menuName;
|
||||
}
|
||||
|
||||
public void setMenuName(String menuName)
|
||||
{
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
public String getParentName()
|
||||
{
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName)
|
||||
{
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public Long getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
public Integer getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
|
||||
public String getPath()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
|
||||
public String getComponent()
|
||||
{
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent(String component)
|
||||
{
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
public String getQuery()
|
||||
{
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query)
|
||||
{
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public String getIsFrame()
|
||||
{
|
||||
return isFrame;
|
||||
}
|
||||
|
||||
public void setIsFrame(String isFrame)
|
||||
{
|
||||
this.isFrame = isFrame;
|
||||
}
|
||||
|
||||
public String getIsCache()
|
||||
{
|
||||
return isCache;
|
||||
}
|
||||
|
||||
public void setIsCache(String isCache)
|
||||
{
|
||||
this.isCache = isCache;
|
||||
}
|
||||
|
||||
@NotBlank(message = "菜单类型不能为空")
|
||||
public String getMenuType()
|
||||
{
|
||||
return menuType;
|
||||
}
|
||||
|
||||
public void setMenuType(String menuType)
|
||||
{
|
||||
this.menuType = menuType;
|
||||
}
|
||||
|
||||
public String getVisible()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(String visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
|
||||
public String getPerms()
|
||||
{
|
||||
return perms;
|
||||
}
|
||||
|
||||
public void setPerms(String perms)
|
||||
{
|
||||
this.perms = perms;
|
||||
}
|
||||
|
||||
public String getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon)
|
||||
{
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public List<SysMenu> getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<SysMenu> children)
|
||||
{
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("menuId", getMenuId())
|
||||
.append("menuName", getMenuName())
|
||||
.append("parentId", getParentId())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("path", getPath())
|
||||
.append("component", getComponent())
|
||||
.append("isFrame", getIsFrame())
|
||||
.append("IsCache", getIsCache())
|
||||
.append("menuType", getMenuType())
|
||||
.append("visible", getVisible())
|
||||
.append("status ", getStatus())
|
||||
.append("perms", getPerms())
|
||||
.append("icon", getIcon())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.maibu.core.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.maibu.core.domain.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName(value = "sys_org")
|
||||
public class SysOrg extends BaseDO {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 组织名称
|
||||
*/
|
||||
private String orgName;
|
||||
/**
|
||||
* 组织code
|
||||
*/
|
||||
private String orgCode;
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String manager;
|
||||
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.maibu.core.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.maibu.annotation.Excel;
|
||||
import com.maibu.core.domain.BaseEntity;
|
||||
import com.maibu.core.domain.BaseDO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -17,14 +17,17 @@ import java.util.Set;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "SysRole", description = "角色表 sys_role")
|
||||
public class SysRole extends BaseEntity
|
||||
{
|
||||
@TableName(value = "sys_role")
|
||||
@Data
|
||||
public class SysRole extends BaseDO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 角色ID */
|
||||
@ApiModelProperty("角色ID")
|
||||
@Excel(name = "角色序号", cellType = Excel.ColumnType.NUMERIC)
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long roleId;
|
||||
|
||||
/** 角色名称 */
|
||||
@@ -104,218 +107,23 @@ public class SysRole extends BaseEntity
|
||||
*/
|
||||
private Boolean manager;
|
||||
|
||||
public Boolean getManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void setManager(Boolean manager) {
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
public Boolean getCanEditRole() {
|
||||
return canEditRole;
|
||||
}
|
||||
|
||||
public void setCanEditRole(Boolean canEditRole) {
|
||||
this.canEditRole = canEditRole;
|
||||
}
|
||||
|
||||
public Boolean getShowChild() {
|
||||
return showChild;
|
||||
}
|
||||
|
||||
public void setShowChild(Boolean showChild) {
|
||||
this.showChild = showChild;
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public SysRole()
|
||||
{
|
||||
public SysRole() {
|
||||
|
||||
}
|
||||
|
||||
public SysRole(Long roleId)
|
||||
{
|
||||
public SysRole(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public Long getRoleId()
|
||||
{
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId)
|
||||
{
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public boolean isAdmin()
|
||||
{
|
||||
public boolean isAdmin() {
|
||||
return isAdmin(this.roleId);
|
||||
}
|
||||
|
||||
public static boolean isAdmin(Long roleId)
|
||||
{
|
||||
public static boolean isAdmin(Long roleId) {
|
||||
return roleId != null && 1L == roleId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
|
||||
public String getRoleName()
|
||||
{
|
||||
return roleName;
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName)
|
||||
{
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
@NotBlank(message = "权限字符不能为空")
|
||||
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
|
||||
public String getRoleKey()
|
||||
{
|
||||
return roleKey;
|
||||
}
|
||||
|
||||
public void setRoleKey(String roleKey)
|
||||
{
|
||||
this.roleKey = roleKey;
|
||||
}
|
||||
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
public Integer getRoleSort()
|
||||
{
|
||||
return roleSort;
|
||||
}
|
||||
|
||||
public void setRoleSort(Integer roleSort)
|
||||
{
|
||||
this.roleSort = roleSort;
|
||||
}
|
||||
|
||||
public String getDataScope()
|
||||
{
|
||||
return dataScope;
|
||||
}
|
||||
|
||||
public void setDataScope(String dataScope)
|
||||
{
|
||||
this.dataScope = dataScope;
|
||||
}
|
||||
|
||||
public boolean isMenuCheckStrictly()
|
||||
{
|
||||
return menuCheckStrictly;
|
||||
}
|
||||
|
||||
public void setMenuCheckStrictly(boolean menuCheckStrictly)
|
||||
{
|
||||
this.menuCheckStrictly = menuCheckStrictly;
|
||||
}
|
||||
|
||||
public boolean isDeptCheckStrictly()
|
||||
{
|
||||
return deptCheckStrictly;
|
||||
}
|
||||
|
||||
public void setDeptCheckStrictly(boolean deptCheckStrictly)
|
||||
{
|
||||
this.deptCheckStrictly = deptCheckStrictly;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public boolean isFlag()
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(boolean flag)
|
||||
{
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public Long[] getMenuIds()
|
||||
{
|
||||
return menuIds;
|
||||
}
|
||||
|
||||
public void setMenuIds(Long[] menuIds)
|
||||
{
|
||||
this.menuIds = menuIds;
|
||||
}
|
||||
|
||||
public Long[] getDeptIds()
|
||||
{
|
||||
return deptIds;
|
||||
}
|
||||
|
||||
public void setDeptIds(Long[] deptIds)
|
||||
{
|
||||
this.deptIds = deptIds;
|
||||
}
|
||||
|
||||
public Set<String> getPermissions()
|
||||
{
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(Set<String> permissions)
|
||||
{
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("roleId", getRoleId())
|
||||
.append("roleName", getRoleName())
|
||||
.append("roleKey", getRoleKey())
|
||||
.append("roleSort", getRoleSort())
|
||||
.append("dataScope", getDataScope())
|
||||
.append("menuCheckStrictly", isMenuCheckStrictly())
|
||||
.append("deptCheckStrictly", isDeptCheckStrictly())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.maibu.core.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.maibu.core.domain.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName(value = "sys_site")
|
||||
public class SysSite extends BaseDO {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String siteName;
|
||||
|
||||
private String siteCode;
|
||||
|
||||
private String orgId;
|
||||
|
||||
private BigDecimal longitude;
|
||||
|
||||
private BigDecimal latitude;
|
||||
|
||||
private String address;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.maibu.core.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.maibu.annotation.Excel;
|
||||
import com.maibu.annotation.Excels;
|
||||
import com.maibu.core.domain.BaseEntity;
|
||||
import com.maibu.xss.Xss;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,14 +22,15 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "SysUser", description = "用户对象 sys_user")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class SysUser extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@ApiModelProperty("用户ID")
|
||||
@Excel(name = "用户序号", cellType = Excel.ColumnType.NUMERIC, prompt = "用户编号")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
@@ -191,54 +191,10 @@ public class SysUser extends BaseEntity {
|
||||
*/
|
||||
private Integer aiChatNum;
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public String getTimeZone() {
|
||||
return timeZone;
|
||||
}
|
||||
|
||||
public void setTimeZone(String timeZone) {
|
||||
this.timeZone = timeZone;
|
||||
}
|
||||
|
||||
public Boolean getManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void setManager(Boolean manager) {
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
public Boolean getShowChild() {
|
||||
return showChild;
|
||||
}
|
||||
|
||||
public void setShowChild(Boolean showChild) {
|
||||
this.showChild = showChild;
|
||||
}
|
||||
|
||||
public SysUser() {
|
||||
|
||||
}
|
||||
|
||||
public SysUser(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public boolean isAdmin() {
|
||||
return isAdmin(this.userId);
|
||||
}
|
||||
@@ -247,180 +203,4 @@ public class SysUser extends BaseEntity {
|
||||
return userId != null && 1L == userId;
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
@Xss(message = "用户昵称不能包含脚本字符")
|
||||
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
@Xss(message = "用户账号不能包含脚本字符")
|
||||
@NotBlank(message = "用户账号不能为空")
|
||||
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
@Email(message = "邮箱格式不正确")
|
||||
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
|
||||
public String getPhonenumber() {
|
||||
return phonenumber;
|
||||
}
|
||||
|
||||
public void setPhonenumber(String phonenumber) {
|
||||
this.phonenumber = phonenumber;
|
||||
}
|
||||
|
||||
public String getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(String sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getLoginIp() {
|
||||
return loginIp;
|
||||
}
|
||||
|
||||
public void setLoginIp(String loginIp) {
|
||||
this.loginIp = loginIp;
|
||||
}
|
||||
|
||||
public Date getLoginDate() {
|
||||
return loginDate;
|
||||
}
|
||||
|
||||
public void setLoginDate(Date loginDate) {
|
||||
this.loginDate = loginDate;
|
||||
}
|
||||
|
||||
public SysDept getDept() {
|
||||
return dept;
|
||||
}
|
||||
|
||||
public void setDept(SysDept dept) {
|
||||
this.dept = dept;
|
||||
}
|
||||
|
||||
public List<SysRole> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(List<SysRole> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public Long[] getRoleIds() {
|
||||
return roleIds;
|
||||
}
|
||||
|
||||
public void setRoleIds(Long[] roleIds) {
|
||||
this.roleIds = roleIds;
|
||||
}
|
||||
|
||||
public Long[] getPostIds() {
|
||||
return postIds;
|
||||
}
|
||||
|
||||
public void setPostIds(Long[] postIds) {
|
||||
this.postIds = postIds;
|
||||
}
|
||||
|
||||
public Long getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("userId", getUserId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("userName", getUserName())
|
||||
.append("nickName", getNickName())
|
||||
.append("email", getEmail())
|
||||
.append("phonenumber", getPhonenumber())
|
||||
.append("sex", getSex())
|
||||
.append("avatar", getAvatar())
|
||||
.append("password", getPassword())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("loginIp", getLoginIp())
|
||||
.append("loginDate", getLoginDate())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("dept", getDept())
|
||||
.toString();
|
||||
}
|
||||
|
||||
public String getRoleNames() {
|
||||
return roleNames;
|
||||
}
|
||||
|
||||
public void setRoleNames(String roleNames) {
|
||||
this.roleNames = roleNames;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,11 +198,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
// 关键:设置允许的前端源(替换为你的实际前端域名,如https://ri.satabot.com)
|
||||
// 填* 会有问题
|
||||
config.setAllowedOrigins(Arrays.asList("https://ri.satabot.com", "https://ai.satabot.com",
|
||||
"https://serviceai.satabot.com", "https://serviceri.satabot.com", "https://pvs.satabot.com",
|
||||
"https://servicepvs.satabot.com", "https://servicepathplan.satabot.com", "https://solar.satabot.com",
|
||||
"https://servicestream.satabot.com", "http://192.168.2.58", "http://192.168.2.58"));
|
||||
// config.addAllowedOriginPattern("*");
|
||||
// config.setAllowedOrigins(Arrays.asList("https://ri.satabot.com", "https://ai.satabot.com",
|
||||
// "https://serviceai.satabot.com", "https://serviceri.satabot.com", "https://pvs.satabot.com",
|
||||
// "https://servicepvs.satabot.com", "https://servicepathplan.satabot.com", "https://solar.satabot.com",
|
||||
// "https://servicestream.satabot.com", "http://192.168.2.58", "http://192.168.2.58"));
|
||||
config.addAllowedOriginPattern("*");
|
||||
// 允许的请求方法(必须包含OPTIONS,支持业务请求的GET/POST等)
|
||||
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS"));
|
||||
// 允许的请求头(*表示所有,若有自定义头可单独指定,如Token)
|
||||
|
||||
@@ -22,4 +22,6 @@ public class DeviceBindDTO {
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
private Integer type; // releaseControl 1 完全释放 2 释放控制权 可监听数据
|
||||
|
||||
}
|
||||
|
||||
@@ -368,11 +368,17 @@ public class TransferDeviceService {
|
||||
String platform = bindDTO.getPlatform();
|
||||
String userName = user.getUsername();
|
||||
String masterId = userName + ":" + platform;
|
||||
Integer type = bindDTO.getType();
|
||||
NettyDevice deviceMaster = sessionManager.getDevice(masterId);
|
||||
if (deviceMaster != null) {
|
||||
sysUserClientService.updateAliveStatus(masterId, "", 0);
|
||||
deviceMaster.setCurrentSlaveId(null);
|
||||
deviceMaster.getConnectedConnectors().clear();
|
||||
if (deviceMaster != null && type!=null) {
|
||||
if(type == 1){
|
||||
sysUserClientService.updateAliveStatus(masterId, "", 0);
|
||||
deviceMaster.setCurrentSlaveId(null);
|
||||
deviceMaster.getConnectedConnectors().clear();
|
||||
} else if (type == 2) {
|
||||
deviceMaster.setConnectorStatus(ConnectorStatus.RECEIVER);
|
||||
sysUserClientService.updateAliveStatus(masterId, deviceMaster.getCurrentSlaveId(), 2);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
package com.maibu.controller;
|
||||
|
||||
import com.maibu.annotation.Log;
|
||||
import com.maibu.core.controller.BaseController;
|
||||
import com.maibu.core.domain.AjaxResult;
|
||||
import com.maibu.core.page.TableDataInfo;
|
||||
import com.maibu.domain.Device;
|
||||
import com.maibu.domain.DeviceRunStatistics;
|
||||
import com.maibu.enums.BusinessType;
|
||||
import com.maibu.mapper.DeviceRunStatisticsMapper;
|
||||
import com.maibu.mybatis.LambdaQueryWrapperX;
|
||||
import com.maibu.service.IDeviceService;
|
||||
import com.maibu.utils.StringUtils;
|
||||
import com.maibu.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 设备Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Api(tags = "设备管理")
|
||||
@RestController
|
||||
@RequestMapping("/iot/device")
|
||||
public class DeviceController extends BaseController {
|
||||
@Autowired
|
||||
private IDeviceService deviceService;
|
||||
|
||||
@Autowired
|
||||
private DeviceRunStatisticsMapper deviceRunStatisticsMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("设备分页列表")
|
||||
public TableDataInfo list(Device device) {
|
||||
startPage();
|
||||
// 限制当前用户机构
|
||||
if (null == device.getDeptId()) {
|
||||
device.setDeptId(getLoginUser().getDeptId());
|
||||
}
|
||||
return getDataTable(deviceService.selectDeviceList(device));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/userDevice")
|
||||
public AjaxResult userDevice(Device device) {
|
||||
if (null == device.getDeptId()) {
|
||||
device.setDeptId(100L);
|
||||
}
|
||||
return AjaxResult.success(deviceService.selectDeviceList(device));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出设备列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:export')")
|
||||
@Log(title = "设备", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出设备")
|
||||
public void export(HttpServletResponse response, Device device) {
|
||||
List<Device> list = deviceService.selectDeviceList(device);
|
||||
ExcelUtil<Device> util = new ExcelUtil<Device>(Device.class);
|
||||
util.exportExcel(response, list, "设备数据");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据设备编号详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||
@GetMapping(value = "/getDeviceBySerialNumber/{serialNumber}")
|
||||
@ApiOperation("根据设备编号获取设备详情")
|
||||
public AjaxResult getInfoBySerialNumber(@PathVariable("serialNumber") String serialNumber) {
|
||||
return AjaxResult.success(deviceService.selectDeviceBySerialNumber(serialNumber));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重置设备状态
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||
@Log(title = "重置设备状态", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/reset/{serialNumber}")
|
||||
@ApiOperation("重置设备状态")
|
||||
public AjaxResult resetDeviceStatus(@PathVariable String serialNumber) {
|
||||
Device device = new Device();
|
||||
device.setSerialNumber(serialNumber);
|
||||
return toAjax(deviceService.resetDeviceStatus(device.getSerialNumber()));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getDeviceRunStatistics")
|
||||
public AjaxResult getDeviceRunStatistics(@RequestParam("deviceId") String deviceId) {
|
||||
if (StringUtils.isEmpty(deviceId)) {
|
||||
return error("请选择设备");
|
||||
}
|
||||
LambdaQueryWrapperX<DeviceRunStatistics> queryWrapperX = new LambdaQueryWrapperX<>();
|
||||
queryWrapperX.eq(DeviceRunStatistics::getDeviceId, deviceId);
|
||||
queryWrapperX.orderByDesc(DeviceRunStatistics::getEndTime);
|
||||
queryWrapperX.last("LIMIT 10");
|
||||
return AjaxResult.success(deviceRunStatisticsMapper.selectList(queryWrapperX));
|
||||
}
|
||||
|
||||
@GetMapping("/getDeviceIntradayData")
|
||||
public AjaxResult getDeviceIntradayData(@RequestParam("deviceId") String deviceId) {
|
||||
List<DeviceRunStatistics> resultList = getIntradayData();
|
||||
DeviceRunStatistics statistics = null;
|
||||
if (!CollectionUtils.isEmpty(resultList)) {
|
||||
statistics = resultList.stream().filter(x -> deviceId.equals(x.getDeviceId())).findFirst().orElse(null);
|
||||
}
|
||||
return AjaxResult.success(statistics);
|
||||
}
|
||||
|
||||
public List<DeviceRunStatistics> getIntradayData() {
|
||||
LambdaQueryWrapperX<DeviceRunStatistics> wrapper = new LambdaQueryWrapperX<>();
|
||||
LocalDateTime start = LocalDate.now().atStartOfDay(); // 今天 00:00:00
|
||||
LocalDateTime end = LocalDate.now().plusDays(1).atStartOfDay(); // 明天 00:00:00
|
||||
|
||||
wrapper.ge(DeviceRunStatistics::getStartTime, start)
|
||||
.lt(DeviceRunStatistics::getStartTime, end);
|
||||
|
||||
List<DeviceRunStatistics> list = deviceRunStatisticsMapper.selectList(wrapper);
|
||||
List<DeviceRunStatistics> resultList = new ArrayList<>();
|
||||
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
resultList = list.stream()
|
||||
.collect(Collectors.groupingBy(DeviceRunStatistics::getDeviceId))
|
||||
.values()
|
||||
.stream()
|
||||
.map(group -> {
|
||||
DeviceRunStatistics sum = new DeviceRunStatistics();
|
||||
sum.setDeviceId(group.get(0).getDeviceId());
|
||||
|
||||
sum.setWorkArea(
|
||||
group.stream().mapToDouble(DeviceRunStatistics::getWorkArea).sum()
|
||||
);
|
||||
|
||||
sum.setTime(
|
||||
group.stream().mapToLong(DeviceRunStatistics::getTime).sum()
|
||||
);
|
||||
|
||||
return sum;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
List<String> l = resultList.stream().map(DeviceRunStatistics::getDeviceId).collect(Collectors.toList());
|
||||
Device d = new Device();
|
||||
d.setParams(new HashMap<>());
|
||||
List<Device> query = deviceService.selectDeviceList(d);
|
||||
if (!CollectionUtils.isEmpty(query) && !CollectionUtils.isEmpty(l)) {
|
||||
for (Device device : query) {
|
||||
if (!l.contains(device.getDeviceName())) {
|
||||
DeviceRunStatistics statistics = new DeviceRunStatistics();
|
||||
statistics.setDeviceId(device.getDeviceName());
|
||||
statistics.setTime(0L);
|
||||
statistics.setWorkArea(0.0);
|
||||
resultList.add(statistics);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@GetMapping("/generateOperationReport")
|
||||
public void generateOperationReport(HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
List<DeviceRunStatistics> resultList = getIntradayData();
|
||||
// ✅ 4. 响应头(下载)
|
||||
response.setContentType(
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
|
||||
String fileName = URLEncoder.encode("设备统计.xlsx", "UTF-8");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;filename=" + fileName);
|
||||
try (Workbook workbook = new XSSFWorkbook();
|
||||
OutputStream os = response.getOutputStream()) {
|
||||
|
||||
Sheet sheet = workbook.createSheet("当日工作量统计");
|
||||
|
||||
// ✅ 1. 表头
|
||||
Row header = sheet.createRow(0);
|
||||
header.createCell(0).setCellValue("设备号");
|
||||
header.createCell(1).setCellValue("工作面积(m2)");
|
||||
header.createCell(2).setCellValue("工作时长(分钟)");
|
||||
|
||||
// ✅ 2. 数据
|
||||
for (int i = 0; i < resultList.size(); i++) {
|
||||
DeviceRunStatistics d = resultList.get(i);
|
||||
Row row = sheet.createRow(i + 1);
|
||||
|
||||
row.createCell(0).setCellValue(d.getDeviceId());
|
||||
row.createCell(1).setCellValue(d.getWorkArea());
|
||||
row.createCell(2).setCellValue(d.getTime());
|
||||
}
|
||||
|
||||
// ✅ 3. 自动列宽(可选)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
sheet.autoSizeColumn(i);
|
||||
}
|
||||
|
||||
|
||||
// ✅ 5. 写出
|
||||
workbook.write(os);
|
||||
os.flush();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
package com.maibu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 数据桥接对象 bridge
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-08-20
|
||||
*/
|
||||
|
||||
@ApiModel(value = "Bridge", description = "数据桥接 bridge")
|
||||
@Data
|
||||
@TableName("bridge" )
|
||||
public class Bridge implements Serializable{
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/** id唯一标识 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty("id唯一标识")
|
||||
private Long id;
|
||||
|
||||
/** 桥接配置信息 */
|
||||
@ApiModelProperty("桥接配置信息")
|
||||
private String configJson;
|
||||
|
||||
/** 连接器名称 */
|
||||
@ApiModelProperty("连接器名称")
|
||||
private String name;
|
||||
|
||||
/** 是否生效(0-不生效,1-生效) */
|
||||
@ApiModelProperty("是否生效")
|
||||
private String enable;
|
||||
|
||||
/** 状态(0-未连接,1-连接中) */
|
||||
@ApiModelProperty("状态")
|
||||
private String status;
|
||||
|
||||
/** 桥接类型(3=Http推送,4=Mqtt桥接,5=数据库存储) */
|
||||
@ApiModelProperty("桥接类型(3=Http推送,4=Mqtt桥接,5=数据库存储 2=Mqtt外部服务器连接)")
|
||||
private Integer type;
|
||||
|
||||
/** 桥接方向(1=输入,2=输出) */
|
||||
@ApiModelProperty("桥接方向(1=输入,2=输出)")
|
||||
private Integer direction;
|
||||
|
||||
/** 转发路由(mqtt topic,http url) */
|
||||
@ApiModelProperty("转发路由")
|
||||
private String route;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
@ApiModelProperty("删除标志")
|
||||
private String delFlag;
|
||||
|
||||
/** 创建者 */
|
||||
@ApiModelProperty("创建者")
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
@ApiModelProperty("更新者")
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/** 备注 */
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Setter
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("请求参数")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Map<String, Object> params;
|
||||
|
||||
public Map<String, Object> getParams(){
|
||||
if (params == null){
|
||||
params = new HashMap<>();
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.maibu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.maibu.annotation.Excel;
|
||||
import com.maibu.core.domain.BaseDO;
|
||||
import com.maibu.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -27,14 +30,18 @@ import java.util.List;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Data
|
||||
@TableName("iot_device")
|
||||
public class Device extends BaseEntity {
|
||||
public class Device extends BaseDO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
* 设备编号
|
||||
*/
|
||||
@ApiModelProperty("设备ID")
|
||||
private Long deviceId;
|
||||
@ApiModelProperty("设备编号")
|
||||
@Excel(name = "设备编号")
|
||||
private String serialNumber;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
@@ -79,13 +86,6 @@ public class Device extends BaseEntity {
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@ApiModelProperty("设备编号")
|
||||
@Excel(name = "设备编号")
|
||||
private String serialNumber;
|
||||
|
||||
/**
|
||||
* 固件版本
|
||||
*/
|
||||
@@ -246,7 +246,6 @@ public class Device extends BaseEntity {
|
||||
private Boolean showChild;
|
||||
|
||||
private List<Device> subDeviceList;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
@@ -262,23 +261,6 @@ public class Device extends BaseEntity {
|
||||
*/
|
||||
private String protocolCode;
|
||||
|
||||
/**
|
||||
* 关联组态,来源产品
|
||||
*/
|
||||
private String guid;
|
||||
|
||||
// private List<SipRelation> sipRelationList;
|
||||
|
||||
/**
|
||||
* 是否可以配置轮询
|
||||
*/
|
||||
private Boolean canConfigPoll = false;
|
||||
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
@TableField(exist = false)
|
||||
private DeviceRunningStatusHistory lastRunningStatus;
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.maibu.mapper;
|
||||
|
||||
import com.maibu.core.device.DeviceAndProtocol;
|
||||
import com.maibu.domain.Device;
|
||||
import com.maibu.model.*;
|
||||
import com.maibu.mybatis.mapper.BaseMapperX;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -15,7 +14,7 @@ import java.util.List;
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Repository
|
||||
public interface DeviceMapper {
|
||||
public interface DeviceMapper extends BaseMapperX<Device> {
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
<artifactId>maibu-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.maibu</groupId>
|
||||
<artifactId>maibu-framework</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.maibu.mapper;
|
||||
|
||||
import com.maibu.core.domain.entity.SysOrg;
|
||||
import com.maibu.mybatis.mapper.BaseMapperX;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 设备历史状态
|
||||
*/
|
||||
@Repository
|
||||
public interface SysOrgMapper extends BaseMapperX<SysOrg> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.maibu.mapper;
|
||||
|
||||
import com.maibu.core.domain.entity.SysSite;
|
||||
import com.maibu.mybatis.mapper.BaseMapperX;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 设备历史状态
|
||||
*/
|
||||
@Repository
|
||||
public interface SysSiteMapper extends BaseMapperX<SysSite> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.maibu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.maibu.core.domain.entity.SysOrg;
|
||||
import com.maibu.mapper.SysOrgMapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 登录校验方法
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class SysOrgService {
|
||||
|
||||
@Autowired
|
||||
private SysOrgMapper sysOrgMapper;
|
||||
|
||||
|
||||
public List<SysOrg> list(SysOrg org) {
|
||||
LambdaQueryWrapper<SysOrg> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (org != null && !StringUtils.isEmpty(org.getOrgCode())) {
|
||||
queryWrapper.eq(SysOrg::getOrgCode, org.getOrgCode());
|
||||
}
|
||||
if (org != null && !StringUtils.isEmpty(org.getOrgName())) {
|
||||
queryWrapper.like(SysOrg::getOrgName, org.getOrgName());
|
||||
}
|
||||
return sysOrgMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
public boolean save(SysOrg org) {
|
||||
return sysOrgMapper.saveOrUpdate(org);
|
||||
}
|
||||
|
||||
public int delete(Long id) {
|
||||
return sysOrgMapper.updateById(id);
|
||||
}
|
||||
|
||||
public SysOrg selectById(Long id) {
|
||||
return sysOrgMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.maibu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.maibu.core.domain.entity.SysOrg;
|
||||
import com.maibu.core.domain.entity.SysSite;
|
||||
import com.maibu.core.redis.RedisCache;
|
||||
import com.maibu.mapper.SysOrgMapper;
|
||||
import com.maibu.mapper.SysSiteMapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class SysSiteService {
|
||||
|
||||
@Autowired
|
||||
private SysSiteMapper sysSiteMapper;
|
||||
|
||||
|
||||
public List<SysSite> list(SysSite site) {
|
||||
LambdaQueryWrapper<SysSite> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (site != null && !StringUtils.isEmpty(site.getSiteName())) {
|
||||
queryWrapper.like(SysSite::getSiteName, site.getSiteName());
|
||||
}
|
||||
return sysSiteMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
public boolean save(SysSite org) {
|
||||
return sysSiteMapper.saveOrUpdate(org);
|
||||
}
|
||||
|
||||
public int delete(Long id) {
|
||||
return sysSiteMapper.deleteById(id);
|
||||
}
|
||||
|
||||
public SysSite selectById(Long id) {
|
||||
return sysSiteMapper.selectById(id);
|
||||
}
|
||||
|
||||
public List<SysSite> selectByOrgId(Long id) {
|
||||
LambdaQueryWrapper<SysSite> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysSite::getOrgId, id);
|
||||
return sysSiteMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user