初始代码
This commit is contained in:
20
yunzhupaas-app/pom.xml
Normal file
20
yunzhupaas-app/pom.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?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-java-boot</artifactId>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<version>5.2.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>yunzhupaas-app</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>yunzhupaas-app-entity</module>
|
||||
<module>yunzhupaas-app-biz</module>
|
||||
<module>yunzhupaas-app-controller</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
35
yunzhupaas-app/yunzhupaas-app-biz/pom.xml
Normal file
35
yunzhupaas-app/yunzhupaas-app-biz/pom.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-app-entity</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-permission-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-system-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.entity.AppDataEntity;
|
||||
|
||||
/**
|
||||
* app常用数据
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-07-08
|
||||
*/
|
||||
public interface AppDataMapper extends SuperMapper<AppDataEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.yunzhupaas.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.entity.AppDataEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app常用数据
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
public interface AppDataService extends SuperService<AppDataEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<AppDataEntity> getList();
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*
|
||||
* @param objectId 对象主键
|
||||
* @return
|
||||
*/
|
||||
AppDataEntity getInfo(String objectId);
|
||||
|
||||
/**
|
||||
* 验证名称
|
||||
*
|
||||
* @param objectId 对象主键
|
||||
* @return
|
||||
*/
|
||||
boolean isExistByObjectId(String objectId, String systemId);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void create(AppDataEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param entity 实体对象
|
||||
*/
|
||||
void delete(AppDataEntity entity);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yunzhupaas.service;
|
||||
|
||||
import com.yunzhupaas.model.AppUserInfoVO;
|
||||
import com.yunzhupaas.model.AppUsersVO;
|
||||
|
||||
/**
|
||||
* app用户信息
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
public interface AppService {
|
||||
|
||||
/**
|
||||
* app用户信息
|
||||
* @return
|
||||
*/
|
||||
AppUsersVO userInfo();
|
||||
|
||||
/**
|
||||
* 通讯录
|
||||
* @return
|
||||
*/
|
||||
AppUserInfoVO getInfo(String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.yunzhupaas.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.entity.AppDataEntity;
|
||||
import com.yunzhupaas.mapper.AppDataMapper;
|
||||
import com.yunzhupaas.service.AppDataService;
|
||||
import com.yunzhupaas.util.RandomUtil;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* app常用数据
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
@Service
|
||||
public class AppDataServiceImpl extends SuperServiceImpl<AppDataMapper, AppDataEntity> implements AppDataService {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<AppDataEntity> getList() {
|
||||
QueryWrapper<AppDataEntity> queryWrapper = new QueryWrapper<>();
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppDataEntity getInfo(String objectId) {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
QueryWrapper<AppDataEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(AppDataEntity::getObjectId, objectId).eq(AppDataEntity::getCreatorUserId, userInfo.getUserId());
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExistByObjectId(String objectId, String systemId) {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
QueryWrapper<AppDataEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(AppDataEntity::getObjectId, objectId)
|
||||
.eq(AppDataEntity::getCreatorUserId, userInfo.getUserId())
|
||||
.eq(AppDataEntity::getSystemId, systemId);
|
||||
return this.count(queryWrapper) > 0 ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(AppDataEntity entity) {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
entity.setId(RandomUtil.uuId());
|
||||
entity.setCreatorUserId(userInfo.getUserId());
|
||||
entity.setCreatorTime(new Date());
|
||||
entity.setEnabledMark(1);
|
||||
entity.setSystemId(userInfo.getAppSystemId());
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(AppDataEntity entity) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.yunzhupaas.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.entity.DictionaryDataEntity;
|
||||
import com.yunzhupaas.base.service.DictionaryDataService;
|
||||
import com.yunzhupaas.model.AppPositionVO;
|
||||
import com.yunzhupaas.model.AppUserInfoVO;
|
||||
import com.yunzhupaas.model.AppUsersVO;
|
||||
import com.yunzhupaas.permission.entity.*;
|
||||
import com.yunzhupaas.permission.service.*;
|
||||
import com.yunzhupaas.service.AppService;
|
||||
import com.yunzhupaas.util.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* app用户信息
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
@Service
|
||||
public class AppServiceImpl implements AppService {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private PositionService positionService;
|
||||
@Autowired
|
||||
private OrganizeService organizeService;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private UserRelationService userRelationService;
|
||||
@Autowired
|
||||
private DictionaryDataService dictionaryDataService;
|
||||
|
||||
@Override
|
||||
public AppUsersVO userInfo() {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
UserEntity userEntity = userService.getInfo(userInfo.getUserId());
|
||||
AppUsersVO usersVO = new AppUsersVO();
|
||||
usersVO.setBirthday(userEntity.getBirthday() != null ? userEntity.getBirthday().getTime() : null);
|
||||
usersVO.setEmail(userEntity.getEmail());
|
||||
List<DictionaryDataEntity> dataServiceList4 = dictionaryDataService.getListByTypeDataCode("sex");
|
||||
Map<String, String> dataServiceMap4 = dataServiceList4.stream().filter(t -> ObjectUtil.equal(t.getEnabledMark(), 1)).collect(Collectors.toMap(DictionaryDataEntity::getEnCode, DictionaryDataEntity::getFullName));
|
||||
usersVO.setGender(dataServiceMap4.get(userEntity.getGender()));
|
||||
usersVO.setMobilePhone(userEntity.getMobilePhone());
|
||||
this.data(usersVO, userEntity, userInfo);
|
||||
this.userInfo(usersVO, userInfo);
|
||||
//岗位
|
||||
PositionEntity position = positionService.getInfo(userEntity.getPositionId());
|
||||
AppPositionVO positionVO = new AppPositionVO();
|
||||
if(position != null){
|
||||
positionVO.setId(position.getId());
|
||||
positionVO.setName(position.getFullName());
|
||||
usersVO.setPositionIds(ListUtil.toList(positionVO));
|
||||
}
|
||||
//直属主管
|
||||
if(StringUtil.isNotEmpty(userEntity.getManagerId())){
|
||||
UserEntity menager = userService.getInfo(userEntity.getManagerId());
|
||||
usersVO.setManager(menager != null ? menager.getRealName() + "/" + menager.getAccount() : "");
|
||||
}
|
||||
//角色
|
||||
List<String> roles = roleService.getAllRoleIdsByUserIdAndOrgId(userInfo.getUserId(), usersVO.getOrganizeId());
|
||||
List<RoleEntity> roleList = roleService.getListByIds(roles, null, false);
|
||||
usersVO.setRoleName(String.join(",", roleList.stream().map(RoleEntity::getFullName).collect(Collectors.toList())));
|
||||
usersVO.setRoleId(String.join(".", roleList.stream().map(RoleEntity::getId).collect(Collectors.toList())));
|
||||
return usersVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUserInfoVO getInfo(String id) {
|
||||
AppUserInfoVO userInfoVO = new AppUserInfoVO();
|
||||
UserEntity entity = userService.getInfo(id);
|
||||
if (entity != null) {
|
||||
userInfoVO = JsonUtil.getJsonToBean(entity, AppUserInfoVO.class);
|
||||
List<String> positionIds = StringUtil.isNotEmpty(entity.getPositionId()) ? Arrays.asList(entity.getPositionId().split(",")) : new ArrayList<>();
|
||||
List<String> positionName = positionService.getPositionName(positionIds, false).stream().map(t -> t.getFullName()).collect(Collectors.toList());
|
||||
userInfoVO.setPositionName(String.join(",", positionName));
|
||||
OrganizeEntity info = organizeService.getInfo(entity.getOrganizeId());
|
||||
userInfoVO.setOrganizeName(info != null ? info.getFullName() : "");
|
||||
userInfoVO.setHeadIcon(UploaderUtil.uploaderImg(userInfoVO.getHeadIcon()));
|
||||
}
|
||||
return userInfoVO;
|
||||
}
|
||||
/**
|
||||
* 赋值
|
||||
*
|
||||
* @param userInfo
|
||||
* @param userId
|
||||
* @param isAdmin
|
||||
*/
|
||||
private void userInfo(UserInfo userInfo, String userId, boolean isAdmin, UserEntity userEntity) {
|
||||
List<String> userIdList = new ArrayList(){{add(userId);}};
|
||||
List<UserRelationEntity> data = userRelationService.getListByUserIdAll(userIdList);
|
||||
//获取一个字段的值
|
||||
List<String> positionList = data.stream().filter(m -> "Position".equals(m.getObjectType())).map(t -> t.getObjectId()).collect(Collectors.toList());
|
||||
Set<String> id = new LinkedHashSet<>();
|
||||
String[] position = StringUtil.isNotEmpty(userEntity.getPositionId()) ? userEntity.getPositionId().split(",") : new String[]{};
|
||||
List<String> positions = positionList.stream().filter(t->Arrays.asList(position).contains(t)).collect(Collectors.toList());
|
||||
id.addAll(positions);
|
||||
id.addAll(positionList);
|
||||
userInfo.setPositionIds(id.toArray(new String[id.size()]));
|
||||
if (!isAdmin) {
|
||||
data = data.stream().filter(m -> "Role".equals(m.getObjectType())).collect(Collectors.toList());
|
||||
}
|
||||
List<String> roleList = data.stream().map(t -> t.getObjectId()).collect(Collectors.toList());
|
||||
userInfo.setRoleIds(roleList);
|
||||
}
|
||||
|
||||
private void data(AppUsersVO usersVO, UserEntity userEntity, UserInfo userInfo) {
|
||||
//组织
|
||||
usersVO.setOrganizeId(userEntity.getOrganizeId());
|
||||
List<OrganizeEntity> organizeIdList = new ArrayList<>();
|
||||
organizeService.getOrganizeId(userEntity.getOrganizeId(),organizeIdList);
|
||||
Collections.reverse(organizeIdList);
|
||||
usersVO.setOrganizeName(organizeIdList.stream().map(OrganizeEntity::getFullName).collect(Collectors.joining("/")));
|
||||
OrganizeEntity organizeEntity = organizeIdList.stream().filter(t->t.getId().equals(userEntity.getOrganizeId())).findFirst().orElse(null);
|
||||
if (organizeEntity != null) {
|
||||
String[] organizeId = StringUtil.isNotEmpty(organizeEntity.getOrganizeIdTree()) ? organizeEntity.getOrganizeIdTree().split(",") : new String[]{};
|
||||
if (organizeId.length > 0) {
|
||||
userInfo.setOrganizeId(organizeId[0]);
|
||||
userInfo.setDepartmentId(organizeId[organizeId.length - 1]);
|
||||
}
|
||||
}
|
||||
userInfo.setManagerId(userInfo.getManagerId());
|
||||
boolean b = userInfo.getIsAdministrator();
|
||||
List<String> subordinateIdsList = userService.getListByManagerId(userInfo.getUserId(),null).stream().map(UserEntity::getId).collect(Collectors.toList());
|
||||
userInfo.setSubordinateIds(subordinateIdsList);
|
||||
this.userInfo(userInfo, userInfo.getUserId(), b,userEntity);
|
||||
// userInfo.setSubOrganizeIds(new String[]{});
|
||||
//redisUtil.insert(userInfo.getId(), userInfo, DateUtil.getTime(userInfo.getOverdueTime()) - DateUtil.getTime(new Date()));
|
||||
UserProvider.setLoginUser(userInfo);
|
||||
UserProvider.setLocalLoginUser(userInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录信息
|
||||
*
|
||||
* @param appUsersVO 返回对象
|
||||
* @param userInfo 回话信息
|
||||
* @return
|
||||
*/
|
||||
private void userInfo(AppUsersVO appUsersVO, UserInfo userInfo) {
|
||||
appUsersVO.setUserId(userInfo.getUserId());
|
||||
appUsersVO.setHeadIcon(UploaderUtil.uploaderImg(userInfo.getUserIcon()));
|
||||
appUsersVO.setUserName(userInfo.getUserName());
|
||||
appUsersVO.setUserAccount(userInfo.getUserAccount());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
23
yunzhupaas-app/yunzhupaas-app-controller/pom.xml
Normal file
23
yunzhupaas-app/yunzhupaas-app-controller/pom.xml
Normal 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>
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
22
yunzhupaas-app/yunzhupaas-app-entity/pom.xml
Normal file
22
yunzhupaas-app/yunzhupaas-app-entity/pom.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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-entity</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-common-all</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.yunzhupaas.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* app常用数据
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_app_data")
|
||||
public class AppDataEntity extends SuperExtendEntity.SuperExtendDEEntity<String> {
|
||||
|
||||
/**
|
||||
* 对象类型
|
||||
*/
|
||||
@TableField("f_object_type")
|
||||
private String objectType;
|
||||
|
||||
/**
|
||||
* 对象主键
|
||||
*/
|
||||
@TableField("f_object_id")
|
||||
private String objectId;
|
||||
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
@TableField("f_object_data")
|
||||
private String objectData;
|
||||
|
||||
/**
|
||||
* 关联系统id
|
||||
*/
|
||||
@TableField("f_system_id")
|
||||
private String systemId;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* app常用数据
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-07-08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "常用模型")
|
||||
public class AppDataCrForm {
|
||||
@NotBlank(message = "必填")
|
||||
@Schema(description = "应用类型")
|
||||
private String objectType;
|
||||
@NotBlank(message = "必填")
|
||||
@Schema(description = "应用主键")
|
||||
private String objectId;
|
||||
@Schema(description = "数据")
|
||||
private String objectData;
|
||||
@Schema(description = "系统主键")
|
||||
private String systemId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app常用数据
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-07-08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "常用模型")
|
||||
public class AppDataListAllVO {
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "是否有下级菜单")
|
||||
private Boolean hasChildren;
|
||||
@Schema(description = "菜单名称")
|
||||
private String fullName;
|
||||
@Schema(description = " 图标")
|
||||
private String icon;
|
||||
@Schema(description = "链接地址")
|
||||
private String urlAddress;
|
||||
@Schema(description = "父级id")
|
||||
private String parentId;
|
||||
@Schema(description = "菜单类型",example = "1")
|
||||
private Integer type;
|
||||
@Schema(description = "扩展字段")
|
||||
private String propertyJson;
|
||||
@Schema(description = "图标背景色")
|
||||
private String iconBackground;
|
||||
@Schema(description = "是否常用")
|
||||
private Boolean isData;
|
||||
@Schema(description = "排序")
|
||||
private Long sortCode;
|
||||
@Schema(description = "分类")
|
||||
private String category;
|
||||
@Schema(description = "下级菜单列表")
|
||||
private List<AppDataListAllVO> children;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* app常用数据
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-07-08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "常用模型")
|
||||
public class AppDataListVO {
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "应用主键")
|
||||
private String objectId;
|
||||
@Schema(description = "数据")
|
||||
private String objectData;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* app常用数据
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-07-08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "常用模型")
|
||||
public class AppFlowListAllVO {
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "名称")
|
||||
private String fullName;
|
||||
@Schema(description = "图标")
|
||||
private String icon;
|
||||
@Schema(description = "图标背景色")
|
||||
private String iconBackground;
|
||||
@Schema(description = "编码")
|
||||
private String enCode;
|
||||
@Schema(description = "是否常用")
|
||||
private Boolean isData;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app应用
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-07-08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "常用模型")
|
||||
public class AppMenuListVO {
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "是否有下级菜单")
|
||||
private Boolean hasChildren;
|
||||
@Schema(description = "父级id")
|
||||
private String parentId;
|
||||
@Schema(description = "菜单编码")
|
||||
private String enCode;
|
||||
@Schema(description = "菜单名称")
|
||||
private String fullName;
|
||||
@Schema(description = " 图标")
|
||||
private String icon;
|
||||
@Schema(description = "是否常用")
|
||||
private Boolean isData;
|
||||
@Schema(description = "链接地址")
|
||||
private String urlAddress;
|
||||
@Schema(description = "菜单类型",example = "1")
|
||||
private Integer type;
|
||||
@Schema(description = "扩展字段")
|
||||
private String propertyJson;
|
||||
@Schema(description = "下级菜单列表")
|
||||
private List<AppMenuListVO> children;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* app应用
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "常用模型")
|
||||
public class AppPositionVO {
|
||||
@Schema(description = "岗位id")
|
||||
private String id;
|
||||
@Schema(description = "岗位名称")
|
||||
private String name;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/3/12 15:31
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "常用模型")
|
||||
public class AppUserInfoVO {
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@Schema(description = "户名")
|
||||
private String realName;
|
||||
@Schema(description = "部门名称")
|
||||
private String organizeName;
|
||||
@Schema(description = "账号")
|
||||
private String account;
|
||||
@Schema(description = "岗位名称")
|
||||
private String positionName;
|
||||
@Schema(description = "办公电话")
|
||||
private String telePhone;
|
||||
@Schema(description = "办公座机")
|
||||
private String landline;
|
||||
@Schema(description = "手机号码")
|
||||
private String mobilePhone;
|
||||
@Schema(description = "用户头像")
|
||||
private String headIcon;
|
||||
@Schema(description = "邮箱")
|
||||
private String email;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.yunzhupaas.model;
|
||||
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024-07-08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "常用模型")
|
||||
public class AppUsersVO {
|
||||
@Schema(description = "用户id")
|
||||
private String userId;
|
||||
@Schema(description = "用户账号")
|
||||
private String userAccount;
|
||||
@Schema(description = "用户姓名")
|
||||
private String userName;
|
||||
@Schema(description = "用户头像")
|
||||
private String headIcon;
|
||||
@Schema(description = "组织主键")
|
||||
private String organizeId;
|
||||
@Schema(description = "组织名称")
|
||||
private String organizeName;
|
||||
@Schema(description = "角色主键")
|
||||
private String roleId;
|
||||
@Schema(description = "角色名称")
|
||||
private String roleName;
|
||||
@Schema(description = "性别")
|
||||
private String gender;
|
||||
@Schema(description = "岗位")
|
||||
private List<AppPositionVO> positionIds;
|
||||
@Schema(description = "生日")
|
||||
private Long birthday;
|
||||
@Schema(description = "手机")
|
||||
private String mobilePhone;
|
||||
@Schema(description = "邮箱")
|
||||
private String email;
|
||||
@Schema(description = "直属主管")
|
||||
private String manager;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user