初始代码

This commit is contained in:
wangmingwei
2026-04-21 16:49:46 +08:00
parent aae9dc4036
commit f0453ff3a3
2396 changed files with 256575 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>yunzhupaas-app</artifactId>
<groupId>com.yunzhupaas</groupId>
<version>5.2.0-RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yunzhupaas-app-controller</artifactId>
<dependencies>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-app-biz</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,76 @@
package com.yunzhupaas.controller;
import com.yunzhupaas.base.controller.SuperController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.AppDataEntity;
import com.yunzhupaas.model.AppDataCrForm;
import com.yunzhupaas.service.AppDataService;
import com.yunzhupaas.util.JsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
/**
* app常用数据
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-07-08
*/
@Tag(name = "app常用数据", description = "data")
@RestController
@RequestMapping("/api/app/Data")
public class AppDataController extends SuperController<AppDataService, AppDataEntity> {
@Autowired
private AppDataService appDataService;
/**
* 新建
*
* @param appDataCrForm 新建模型
* @return
*/
@PostMapping
@Operation(summary = "新建")
@Parameters({
@Parameter(name = "appDataCrForm", description = "常用模型",required = true),
})
public ActionResult create(@RequestBody @Valid AppDataCrForm appDataCrForm) {
AppDataEntity entity = JsonUtil.getJsonToBean(appDataCrForm, AppDataEntity.class);
if (appDataService.isExistByObjectId(entity.getObjectId(),appDataCrForm.getSystemId())) {
return ActionResult.fail(MsgCode.FA036.get());
}
appDataService.create(entity);
return ActionResult.success(MsgCode.SU001.get());
}
/**
* 删除
*
* @param objectId 主键
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{objectId}")
@Parameters({
@Parameter(name = "objectId", description = "主键", required = true),
})
public ActionResult create(@PathVariable("objectId") String objectId) {
AppDataEntity entity = appDataService.getInfo(objectId);
if (entity != null) {
appDataService.delete(entity);
return ActionResult.success(MsgCode.SU003.get());
}
return ActionResult.fail(MsgCode.FA003.get());
}
}

View File

@@ -0,0 +1,96 @@
package com.yunzhupaas.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.Page;
import com.yunzhupaas.base.model.module.ModuleModel;
import com.yunzhupaas.base.vo.ListVO;
import com.yunzhupaas.model.AppMenuListVO;
import com.yunzhupaas.model.UserMenuModel;
import com.yunzhupaas.permission.model.authorize.AuthorizeVO;
import com.yunzhupaas.permission.service.AuthorizeService;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.StringUtil;
import com.yunzhupaas.util.UserProvider;
import com.yunzhupaas.util.treeutil.ListToTreeUtil;
import com.yunzhupaas.util.treeutil.SumTree;
import com.yunzhupaas.util.treeutil.newtreeutil.TreeDotUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.stream.Collectors;
/**
* app应用
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-07-08
*/
@Tag(name = "app应用", description = "Menu")
@RestController
@RequestMapping("/api/app/Menu")
public class AppMenuController {
@Autowired
private AuthorizeService authorizeService;
/**
* 获取菜单列表
*
* @param page 分页模型
* @return
*/
@Operation(summary = "获取菜单列表")
@GetMapping
public ActionResult<ListVO<AppMenuListVO>> list(Page page) {
AuthorizeVO authorizeModel = authorizeService.getAuthorize(false, false);
List<ModuleModel> buttonListAll = authorizeModel.getModuleList().stream().filter(t -> "App".equals(t.getCategory())).collect(Collectors.toList());
// 通过系统id捞取相应的菜单
buttonListAll = buttonListAll.stream().filter(t -> UserProvider.getUser().getAppSystemId() != null && UserProvider.getUser().getAppSystemId().equals(t.getSystemId())).collect(Collectors.toList());
List<ModuleModel> buttonList = buttonListAll;
if (StringUtil.isNotEmpty(page.getKeyword())) {
buttonList = buttonListAll.stream().filter(t -> t.getFullName().contains(page.getKeyword())).collect(Collectors.toList());
}
List<UserMenuModel> list = JsonUtil.getJsonToList(ListToTreeUtil.treeWhere(buttonList, buttonListAll), UserMenuModel.class);
List<SumTree<UserMenuModel>> menuAll = TreeDotUtils.convertListToTreeDot(list, "-1");
List<AppMenuListVO> data = JsonUtil.getJsonToList(menuAll, AppMenuListVO.class);
ListVO listVO = new ListVO();
listVO.setList(data);
return ActionResult.success(listVO);
}
/**
* 获取子集菜单
*
* @return
*/
@Operation(summary = "获取子集菜单")
@GetMapping("/getChildList/{id}")
public ActionResult<List<AppMenuListVO>> getChildList(@PathVariable("id") String id) {
AuthorizeVO authorizeModel = authorizeService.getAuthorize(false, false);
List<ModuleModel> buttonListAll = authorizeModel.getModuleList().stream().filter(t -> "App".equals(t.getCategory())).collect(Collectors.toList());
// 通过系统id捞取相应的菜单
buttonListAll = buttonListAll.stream().filter(t -> UserProvider.getUser().getAppSystemId() != null && UserProvider.getUser().getAppSystemId().equals(t.getSystemId())).collect(Collectors.toList());
Set<ModuleModel> models = new HashSet<>();
next(buttonListAll,id,models);
List<UserMenuModel> list = JsonUtil.getJsonToList(models, UserMenuModel.class);
List<SumTree<UserMenuModel>> menuAll = TreeDotUtils.convertListToTreeDot(list);
List<AppMenuListVO> data = JsonUtil.getJsonToList(menuAll, AppMenuListVO.class);
return ActionResult.success(data);
}
private void next(List<ModuleModel> buttonListAll,String parentId,Set<ModuleModel> list){
List<ModuleModel> menuList = buttonListAll.stream().filter(t -> t.getId().equals(parentId) || t.getParentId().equals(parentId)).collect(Collectors.toList());
for (ModuleModel model : menuList) {
if(!list.contains(model)){
list.add(model);
next(buttonListAll,model.getId(),list);
}
}
}
}

View File

@@ -0,0 +1,62 @@
package com.yunzhupaas.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.model.AppUserInfoVO;
import com.yunzhupaas.model.AppUsersVO;
import com.yunzhupaas.service.AppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 用户信息
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-07-08
*/
@Tag(name = "app用户信息", description = "User")
@RestController
@RequestMapping("/api/app/User")
public class AppUserController {
@Autowired
private AppService appService;
/**
* 用户信息
*
* @return
*/
@Operation(summary = "用户信息")
@GetMapping
public ActionResult<AppUsersVO> getInfo() {
AppUsersVO userAllVO = appService.userInfo();
return ActionResult.success(userAllVO);
}
/**
* 通讯录详情
*
* @param id 主键
* @return
*/
@Operation(summary = "通讯录详情")
@GetMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult<AppUserInfoVO> userInfo(@PathVariable("id") String id) {
AppUserInfoVO userInfoVO = appService.getInfo(id);
return ActionResult.success(userInfoVO);
}
}

View File

@@ -0,0 +1,45 @@
package com.yunzhupaas.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.config.ConfigValueUtil;
import com.yunzhupaas.util.NoDataSourceBind;
import org.apache.commons.collections4.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* 获取AppVersion
*
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2022/3/31 11:26
*/
@Tag(name = "获取APP版本号", description = "AppVersion")
@RestController
@RequestMapping("/api/app")
public class AppVersionController {
@Autowired
private ConfigValueUtil configValueUtil;
/**
* 判断是否需要验证码
*
* @return
*/
@NoDataSourceBind()
@Operation(summary = "判断是否需要验证码")
@GetMapping("/Version")
public ActionResult getAppVersion() {
Map<String, String> map = new HashedMap<>();
map.put("sysVersion", configValueUtil.getAppVersion());
return ActionResult.success(map);
}
}