Bladeren bron

接口测试+定时任务查询

丁治程 2 maanden geleden
bovenliggende
commit
01bc1b662d

+ 178 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/controller/IoredgeInterfaceTestController.java

@@ -0,0 +1,178 @@
+package org.jeecg.modules.iotedgeCollectData.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.modules.iotedgeCollectData.entity.IotedgeCollectData;
+import org.jeecg.modules.iotedgeCollectData.service.IIotedgeCollectDataService;
+import org.jeecg.modules.iotedgeCollectData.service.RestClientService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author dzc
+ * @date 2024/9/2 8:54
+ * @package org.jeecg.modules.iotedgeCollectData.controller
+ * @project interlock_server
+ * @des IoTEdge/SSO接口测试类
+ */
+@Api(tags="IoTEdge、SSO接口测试")
+@RestController
+@RequestMapping("/iotedgeInterfaceTest/iotedgeInterfaceTest")
+@Slf4j
+public class IoredgeInterfaceTestController extends JeecgController<IotedgeCollectData, IIotedgeCollectDataService> {
+
+    @Autowired
+    private RestClientService restClientService;
+
+    @AutoLog(value = "IoTEdge-标准登录(admin)获取Token")
+    @ApiOperation(value="IoTEdge-标准登录(admin)获取Token", notes="IoTEdge-标准登录(admin)获取Token")
+    @PostMapping(value = "/testGetAccessToken")
+    public String testGetAccessToken(){
+        return restClientService.getAccessToken();
+    }
+
+
+    @AutoLog(value = "IoTEdge-根据组织ID获取设备信息")
+    @ApiOperation(value="IoTEdge-根据组织ID获取设备信息", notes="IoTEdge-根据组织ID获取设备信息")
+    @PostMapping(value = "/testGetGroupDevicesInfo")
+    public JSONObject testGetGroupDevicesInfo(@RequestParam(name = "groupId") String groupId, @RequestParam(name = "elToken",required = false) String elToken){
+        return restClientService.getGroupDevicesInfo(groupId,elToken);
+    }
+
+    @AutoLog(value = "IoTEdge-获取所有设备信息")
+    @ApiOperation(value="IoTEdge-获取所有设备信息", notes="IoTEdge-获取所有设备信息")
+    @PostMapping(value = "/testGetAllDevicesInfo")
+    public JSONObject testGetAllDevicesInfo(@RequestParam(name = "elToken",required = false) String elToken){
+        return restClientService.getAllDevicesInfo(elToken);
+    }
+
+
+    @AutoLog(value = "IoTEdge-根据设备ID获取点位信息")
+    @ApiOperation(value="IoTEdge-根据设备ID获取点位信息", notes="IoTEdge-根据设备ID获取点位信息")
+    @PostMapping(value = "/testGetAllDevicesInfoById")
+    public JSONObject testGetAllDevicesInfoById(@RequestParam(name = "deviceId") String deviceId, @RequestParam(name = "elToken",required = false) String elToken){
+        return restClientService.getAllDevicesInfoById(deviceId,elToken);
+    }
+
+    @AutoLog(value = "Notification-获取所有群组信息")
+    @ApiOperation(value="Notification-获取所有群组信息", notes="Notification-获取所有群组信息")
+    @PostMapping(value = "/testGetAllEmailGroupInfo")
+    public JSONObject testGetAllEmailGroupInfo(@RequestParam(name = "elToken",required = false) String elToken){
+        return restClientService.getAllEmailGroupInfo();
+    }
+
+    @AutoLog(value = "Notification-发送邮件")
+    @ApiOperation(value="Notification-发送邮件", notes="Notification-发送邮件")
+    @PostMapping(value = "/testSendEmali")
+    public ResponseEntity<String> testSendEmali(@RequestParam(name = "fileName",required = false) String fileName, @RequestParam(name = "filePath",required = false) String filePath) throws Exception {
+        return restClientService.sendEmali(fileName,filePath);
+    }
+
+    @AutoLog(value = "IoTEdge-新增组织")
+    @ApiOperation(value="IoTEdge-新增组织", notes="IoTEdge-新增组织")
+    @PostMapping(value = "/testAddGroup")
+    public JSONObject testAddGroup(@RequestParam(name = "groupName") String groupName, @RequestParam(name = "elToken",required = false) String elToken){
+        return restClientService.addGroup(groupName,elToken);
+    }
+
+    @AutoLog(value = "IoTEdge-删除组织")
+    @ApiOperation(value="IoTEdge-删除组织", notes="IoTEdge-删除组织")
+    @PostMapping(value = "/testDeleteGroup")
+    public JSONObject testDeleteGroup(@RequestParam(name = "groupId") String groupId, @RequestParam(name = "elToken",required = false) String elToken){
+        return restClientService.deleteGroup(groupId,elToken);
+    }
+
+    @AutoLog(value = "SSO-登录")
+    @ApiOperation(value="SSO-登录", notes="SSO-登录")
+    @PostMapping(value = "/testGetSSOToken")
+    public String testGetSSOToken(){
+        return restClientService.getSSOToken();
+    }
+
+
+    @AutoLog(value = "SSO-修改组织名称时获取clientId/clientSecret")
+    @ApiOperation(value="SSO-修改组织名称时获取clientId/clientSecret", notes="SSO-修改组织名称时获取clientId/clientSecret")
+    @PostMapping(value = "/testGetClientInfo")
+    public JSONObject testGetClientInfo(){
+        return restClientService.getClientInfo();
+    }
+
+    @AutoLog(value = "SSO-修改组织名称时获取accessToken")
+    @ApiOperation(value="SSO-修改组织名称时获取accessToken", notes="SSO-修改组织名称时获取accessToken")
+    @PostMapping(value = "/testGetClientToken")
+    public String testGetClientToken(){
+        return restClientService.getClientToken();
+    }
+
+    @AutoLog(value = "IoTEdge-修改组织")
+    @ApiOperation(value="IoTEdge-修改组织", notes="IoTEdge-修改组织")
+    @PostMapping(value = "/testUpdateGroup")
+    public JSONObject testUpdateGroup(@RequestParam(name = "groupName") String groupName, @RequestParam(name = "groupId",required = false) String groupId){
+        return restClientService.updateGroup(groupName,groupId);
+    }
+
+    @AutoLog(value = "IoTEdge-获取所有的组织")
+    @ApiOperation(value="IoTEdge-获取所有的组织", notes="IoTEdge-获取所有的组织")
+    @PostMapping(value = "/testGetAllGroup")
+    public JSONObject testGetAllGroup(){
+        return restClientService.getAllGroup();
+    }
+
+    @AutoLog(value = "SSO-新增SSO用户时获取clientId/clientSecret")
+    @ApiOperation(value="SSO-新增SSO用户时获取clientId/clientSecret", notes="SSO-新增SSO用户时获取clientId/clientSecret")
+    @PostMapping(value = "/testPostClinetInfo")
+    public JSONObject testPostClinetInfo(){
+        return restClientService.postClinetInfo();
+    }
+
+    @AutoLog(value = "SSO-新增SSO用户时获取clientToken")
+    @ApiOperation(value="SSO-新增SSO用户时获取clientToken", notes="SSO-新增SSO用户时获取clientToken")
+    @PostMapping(value = "/testGetClientToken2")
+    public String testGetClientToken2(){
+        return restClientService.getClientToken2();
+    }
+
+    @AutoLog(value = "SSO-新增SSO用户")
+    @ApiOperation(value="SSO-新增SSO用户", notes="SSO-新增SSO用户")
+    @PostMapping(value = "/testAddSSOUser")
+    public JSONObject testAddSSOUser(@RequestParam(name = "userName",required = false) String userName, @RequestParam(name = "password",required = false) String password){
+        return restClientService.addSSOUser(userName,password);
+    }
+
+    @AutoLog(value = "IoTEdge-邀请SSO用户")
+    @ApiOperation(value="IoTEdge-邀请SSO用户", notes="IoTEdge-邀请SSO用户")
+    @PostMapping(value = "/testInvitationSSOUserInIoTEdge")
+    public JSONObject testInvitationSSOUserInIoTEdge(@RequestParam(name = "userName",required = false) String userName, @RequestParam(name = "elToken",required = false) String elToken){
+        return restClientService.invitationSSOUserInIoTEdge(userName,elToken);
+    }
+
+    @AutoLog(value = "IoTEdge-给用户分配角色")
+    @ApiOperation(value="IoTEdge-给用户分配角色", notes="IoTEdge-给用户分配角色")
+    @PostMapping(value = "/testSetUserRole")
+    public JSONObject testSetUserRole(@RequestParam(name = "userId",required = false) String userId,@RequestParam(name = "groupId",required = false) String groupId,@RequestParam(name = "rloe",required = false) String rloe, @RequestParam(name = "elToken",required = false) String elToken){
+        return restClientService.setUserRole(userId,groupId,rloe,elToken);
+    }
+
+    @AutoLog(value = "IoTEdge-删除用户权限")
+    @ApiOperation(value="IoTEdge-删除用户权限", notes="IoTEdge-删除用户权限")
+    @PostMapping(value = "/testDeleteUserRole")
+    public JSONObject testDeleteUserRole(@RequestParam(name = "userId",required = false) String userId,@RequestParam(name = "groupId",required = false) String groupId,@RequestParam(name = "rloe",required = false) String rloe, @RequestParam(name = "elToken",required = false) String elToken){
+        return restClientService.deleteUserRole(userId,groupId,rloe,elToken);
+    }
+
+    @AutoLog(value = "SSO-判断用户是否已经存在")
+    @ApiOperation(value="SSO-判断用户是否已经存在", notes="SSO-判断用户是否已经存在")
+    @PostMapping(value = "/testIfUserInSSO")
+    public JSONObject testIfUserInSSO(@RequestParam(name = "userName",required = false) String userName){
+        return restClientService.ifUserInSSO(userName);
+    }
+
+}

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/iotedgeCollectData/service/RestClientService.java

@@ -248,7 +248,7 @@ public class RestClientService {
     *   des: sso登录
     *   date: 2024/8/1
     */
-    private String getSSOToken(){
+    public String getSSOToken(){
         //String url = "http://127.0.0.1:8188/v4.0/auth/native";
         String url = configService.getConfigValue(ConfigInfo.SSO_LOGIN_URL);
         String username = configService.getConfigValue(ConfigInfo.SSO_SYS_USERNAME);

+ 17 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/quartz/controller/QuartzJobController.java

@@ -74,6 +74,23 @@ public class QuartzJobController {
 	}
 
 	/**
+	*   author: dzc
+	*   version: 1.0
+	*   des: 用于定时任务菜单的查询
+	*   date: 2024/9/2
+	*/
+	@RequestMapping(value = "/list1", method = RequestMethod.GET)
+	public Result<?> queryPageList1(QuartzJob quartzJob, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+								   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
+		QueryWrapper<QuartzJob> queryWrapper = QueryGenerator.initQueryWrapper(quartzJob, req.getParameterMap());
+		//queryWrapper.eq("parameter","day").or().eq("parameter","month").or().eq("parameter","year");
+		Page<QuartzJob> page = new Page<QuartzJob>(pageNo, pageSize);
+		IPage<QuartzJob> pageList = quartzJobService.page(page, queryWrapper);
+		return Result.ok(pageList);
+
+	}
+
+	/**
 	 * 添加定时任务
 	 *
 	 * @param quartzJob