初始代码

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

20
yunzhupaas-extend/pom.xml Normal file
View 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-extend</artifactId>
<packaging>pom</packaging>
<modules>
<module>yunzhupaas-extend-entity</module>
<module>yunzhupaas-extend-biz</module>
<module>yunzhupaas-extend-controller</module>
</modules>
</project>

View File

@@ -0,0 +1,45 @@
<?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-extend</artifactId>
<groupId>com.yunzhupaas</groupId>
<version>5.2.0-RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yunzhupaas-extend-biz</artifactId>
<dependencies>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-extend-entity</artifactId>
<version>${project.version}</version>
</dependency>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>-->
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-system-biz</artifactId>
<version>${project.version}</version>
</dependency>
<!-- PDF -->
<dependency>
<groupId>com.github.librepdf</groupId>
<artifactId>openpdf</artifactId>
</dependency>
<dependency>
<groupId>com.github.librepdf</groupId>
<artifactId>openpdf-fonts-extra</artifactId>
</dependency>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-generater-base</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,20 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.BigDataEntity;
/**
* 大数据测试
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface BigDataMapper extends SuperMapper<BigDataEntity> {
Integer maxCode();
}

View File

@@ -0,0 +1,18 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.CustomerEntity;
/**
*
* 客户信息
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 14:09:05
*/
public interface CustomerMapper extends SuperMapper<CustomerEntity> {
}

View File

@@ -0,0 +1,8 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.yunzhupaas.entity.DocumentLogEntity;
public interface DocumentLogMapper extends SuperMapper<DocumentLogEntity> {
}

View File

@@ -0,0 +1,22 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.DocumentEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 知识文档
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface DocumentMapper extends SuperMapper<DocumentEntity> {
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.DocumentShareEntity;
/**
* 知识文档
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface DocumentShareMapper extends SuperMapper<DocumentShareEntity> {
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.base.entity.EmailConfigEntity;
/**
* 邮件配置
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface EmailConfigMapper extends SuperMapper<EmailConfigEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.yunzhupaas.base.entity.EmailReceiveEntity;
/**
* 邮件接收
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface EmailReceiveMapper extends SuperMapper<EmailReceiveEntity> {
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.EmailSendEntity;
/**
* 邮件发送
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface EmailSendMapper extends SuperMapper<EmailSendEntity> {
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.EmployeeEntity;
/**
* 职员信息
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface EmployeeMapper extends SuperMapper<EmployeeEntity> {
}

View File

@@ -0,0 +1,17 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.yunzhupaas.entity.LeaveApplyEntity;
/**
* 流程表单【请假申请】
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-29 上午9:18
*/
public interface LeaveApplyMapper extends SuperMapper<LeaveApplyEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.OrderEntryEntity;
/**
* 订单明细
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface OrderEntryMapper extends SuperMapper<OrderEntryEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.OrderEntity;
/**
* 订单信息
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface OrderMapper extends SuperMapper<OrderEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.OrderReceivableEntity;
/**
* 订单收款
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface OrderReceivableMapper extends SuperMapper<OrderReceivableEntity> {
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.ProductEntryEntity;
/**
*
* base_productentry
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 10:40:59
*/
public interface ProductEntryMapper extends SuperMapper<ProductEntryEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.yunzhupaas.entity.ProductGoodsEntity;
/**
*
* 产品商品
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 15:57:50
*/
public interface ProductGoodsMapper extends SuperMapper<ProductGoodsEntity> {
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.ProductEntity;
/**
*
* 销售订单
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 10:40:59
*/
public interface ProductMapper extends SuperMapper<ProductEntity> {
}

View File

@@ -0,0 +1,18 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.ProductclassifyEntity;
/**
*
* 产品分类
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 14:34:04
*/
public interface ProductclassifyMapper extends SuperMapper<ProductclassifyEntity> {
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.ProjectGanttEntity;
/**
* 订单收款
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface ProjectGanttMapper extends SuperMapper<ProjectGanttEntity> {
}

View File

@@ -0,0 +1,17 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.yunzhupaas.entity.SalesOrderEntryEntity;
/**
* 销售订单明细
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-29 上午9:18
*/
public interface SalesOrderEntryMapper extends SuperMapper<SalesOrderEntryEntity> {
}

View File

@@ -0,0 +1,17 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.yunzhupaas.entity.SalesOrderEntity;
/**
* 销售订单
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-29 上午9:18
*/
public interface SalesOrderMapper extends SuperMapper<SalesOrderEntity> {
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.TableExampleEntity;
/**
* 表格示例数据
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface TableExampleMapper extends SuperMapper<TableExampleEntity> {
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.WorkLogEntity;
/**
* 工作日志
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface WorkLogMapper extends SuperMapper<WorkLogEntity> {
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhupaas.entity.WorkLogShareEntity;
/**
* 工作日志分享
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface WorkLogShareMapper extends SuperMapper<WorkLogShareEntity> {
}

View File

@@ -0,0 +1,35 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.Pagination;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.BigDataEntity;
import com.yunzhupaas.exception.WorkFlowException;
import java.util.List;
/**
* 大数据测试
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface BigDataService extends SuperService<BigDataEntity> {
/**
* 列表
*
* @param pagination 分页参数
* @return
*/
List<BigDataEntity> getList(Pagination pagination);
/**
* 创建
* @param insertCount 添加数量
* @throws WorkFlowException
*/
void create(int insertCount) throws WorkFlowException;
}

View File

@@ -0,0 +1,30 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.Pagination;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.CustomerEntity;
import java.util.List;
/**
*
* 客户信息
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 14:09:05
*/
public interface CustomerService extends SuperService<CustomerEntity> {
List<CustomerEntity> getList(Pagination pagination);
CustomerEntity getInfo(String id);
void delete(CustomerEntity entity);
void create(CustomerEntity entity);
boolean update( String id, CustomerEntity entity);
}

View File

@@ -0,0 +1,8 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.DocumentLogEntity;
public interface DocumentLogService extends SuperService<DocumentLogEntity> {
}

View File

@@ -0,0 +1,201 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.DocumentEntity;
import com.yunzhupaas.entity.DocumentShareEntity;
import com.yunzhupaas.model.document.DocumentShareForm;
import com.yunzhupaas.model.document.DocumentTrashListVO;
import com.yunzhupaas.model.document.FlowFileModel;
import java.util.List;
import java.util.Map;
/**
* 知识文档
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface DocumentService extends SuperService<DocumentEntity> {
/**
* 列表(全部文档)
*
* @return
*/
List<DocumentEntity> getFolderList();
/**
* 列表(全部文档)
*
* @param parentId 文档父级
* @return
*/
List<DocumentEntity> getAllList(String parentId);
/**
* 列表(全部文档)
*
* @param parentId 文档父级
* @return
*/
List<DocumentEntity> getChildList(String parentId,boolean isShare);
/**
* 列表(全部文档)
*
* @param parentId 文档父级
* @param userId 用户主键
*/
List<DocumentEntity> getAllList(String parentId, String userId);
/**
* 列表查询(全部文档)
*
* @param keyword 文档父级
* @return
*/
List<DocumentEntity> getSearchAllList(String keyword);
/**
* 列表(回收站)
*
* @return
*/
List<DocumentTrashListVO> getTrashList(String keyword);
/**
* 列表(我的共享)
*
* @return
*/
List<DocumentEntity> getShareOutList();
/**
* 列表(共享给我)
*
* @return
*/
List<DocumentShareEntity> getShareTomeList();
/**
* 获取文件信息
*
*/
List<DocumentEntity> getInfoByIds(List<String> ids);
/**
* 列表(共享人员)
*
* @param documentId 文档主键
* @return
*/
List<DocumentShareEntity> getShareUserList(String documentId);
/**
* 信息
*
* @param id 主键值
* @return
*/
DocumentEntity getInfo(String id);
/**
* 删除
*
* @param entity 实体对象
*/
void delete(DocumentEntity entity);
/**
* 创建
*
* @param entity 实体对象
*/
void create(DocumentEntity entity);
/**
* 更新
*
* @param id 主键值
* @param entity 实体对象
* @return
*/
boolean update(String id, DocumentEntity entity);
/**
* 共享文件(创建)
*
* @return
*/
void sharecreate(DocumentShareForm documentShareForm);
/**
* 共享文件(取消)
*
* @return
*/
void shareCancel(List<String> documentIds);
/**
* 共享用户调整
*/
void shareAdjustment(String id, List<String> userIds);
/**
* 回收站(删除)
*
* @param folderId 文件夹主键值
* @return
*/
void trashdelete(List<String> folderId);
/**
* 回收站(还原,包含文件夹及内部数据还原)
*
* @param ids 主键值数组
* @return
*/
void trashRecoveryConstainSrc(List<String> ids);
/**
* 回收站(还原)
*
* @param id 主键值
* @return
*/
boolean trashRecovery(String id, boolean initParent);
/**
* 文件/夹移动到
*
* @param id 主键值
* @param toId 将要移动到Id
* @return
*/
boolean moveTo(String id, String toId);
/**
* 验证文件名是否重复
*
* @param id 主键值
* @param fullName 文件夹名称
* @return
*/
boolean isExistByFullName(String fullName, String id, String parentId);
/**
* 递归获取下级所有文件及文件夹
*
* @return
*/
void getChildSrcList(String pId, List<DocumentEntity> list, Integer enabledMark);
DocumentShareEntity getShareByParentId(String parentId);
List<Map<String, Object>> getFlowFile(FlowFileModel model);
}

View File

@@ -0,0 +1,26 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.DocumentShareEntity;
/**
* 大数据测试
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface DocumentShareService extends SuperService<DocumentShareEntity> {
/**
* 查询共享给我的文件
*
* @param docId
* @param shareUserId
* @return
*/
DocumentShareEntity getByDocIdAndShareUserId(String docId, String shareUserId);
}

View File

@@ -0,0 +1,18 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.entity.EmailConfigEntity;
import com.yunzhupaas.base.service.SuperService;
/**
* 邮件配置
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface EmailConfigService extends SuperService<EmailConfigEntity> {
}

View File

@@ -0,0 +1,150 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.PaginationTime;
import com.yunzhupaas.base.entity.EmailConfigEntity;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.base.entity.EmailReceiveEntity;
import com.yunzhupaas.entity.EmailSendEntity;
import com.yunzhupaas.exception.DataException;
import java.util.List;
/**
* 邮件接收
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface EmailReceiveService extends SuperService<EmailReceiveEntity> {
/**
* 列表(收件箱)
*
* @param paginationTime 分页条件
* @return
*/
List<EmailReceiveEntity> getReceiveList(PaginationTime paginationTime);
/**
* 列表(收件箱)
*
* @return
*/
List<EmailReceiveEntity> getReceiveList();
/**
* 列表(收件箱)
* 门户专用
*
* @return
*/
List<EmailReceiveEntity> getDashboardReceiveList();
/**
* 列表(星标件)
*
* @param paginationTime 分页条件
* @return
*/
List<EmailReceiveEntity> getStarredList(PaginationTime paginationTime);
/**
* 列表(草稿箱)
*
* @param paginationTime 分页条件
* @return
*/
List<EmailSendEntity> getDraftList(PaginationTime paginationTime);
/**
* 列表(已发送)
*
* @param paginationTime 分页条件
* @return
*/
List<EmailSendEntity> getSentList(PaginationTime paginationTime);
/**
* 信息(配置)
*
* @return
*/
EmailConfigEntity getConfigInfo();
/**
* 信息(配置)
* @param userId
* @return
*/
EmailConfigEntity getConfigInfo(String userId);
/**
* 信息(收件/发件)
*
* @param id 主键值
* @return
*/
Object getInfo(String id);
/**
* 删除邮件(发、收)
*
* @param id 主键值
* @return
*/
boolean delete(String id);
/**
* 存草稿
*
* @param entity 实体对象
*/
void saveDraft(EmailSendEntity entity);
/**
* 收邮件设置 已读/未读
*
* @param id
* @param isRead
* @return
*/
boolean receiveRead(String id, int isRead);
/**
* 收邮件 星标邮件/取消星标
*
* @param id
* @param isStarred
* @return
*/
boolean receiveStarred(String id, int isStarred);
/**
* 保存邮箱配置
*
* @param configEntity
* @throws DataException
* @return
*/
void saveConfig(EmailConfigEntity configEntity) throws DataException;
/**
* 发邮件
*
* @param entity 实体对象
* @param mailConfig 邮件配置
* @return
*/
int saveSent(EmailSendEntity entity, EmailConfigEntity mailConfig) ;
/**
* 收邮件
*
* @param mailConfig 邮件配置
* @return
*/
int receive(EmailConfigEntity mailConfig);
}

View File

@@ -0,0 +1,18 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.EmailSendEntity;
/**
* 邮件发送
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface EmailSendService extends SuperService<EmailSendEntity> {
}

View File

@@ -0,0 +1,91 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.EmployeeEntity;
import com.yunzhupaas.model.EmployeeModel;
import com.yunzhupaas.model.employee.EmployeeImportVO;
import com.yunzhupaas.model.employee.PaginationEmployee;
import java.util.List;
import java.util.Map;
/**
* 职员信息
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
*/
public interface EmployeeService extends SuperService<EmployeeEntity> {
/**
* 列表
*
* @return
*/
List<EmployeeEntity> getList();
/**
* 列表
*
* @param paginationEmployee
* @return
*/
List<EmployeeEntity> getList(PaginationEmployee paginationEmployee);
/**
* 信息
*
* @param id 主键值
* @return
*/
EmployeeEntity getInfo(String id);
/**
* 删除
*
* @param entity 实体对象
*/
void delete(EmployeeEntity entity);
/**
* 创建
*
* @param entity 实体对象
*/
void create(EmployeeEntity entity);
/**
* 更新
*
* @param id 主键值
* @param entity 实体对象
*/
void update(String id, EmployeeEntity entity);
/**
* 导入预览
*
* @param personList 实体对象
* @return
*/
Map<String, Object> importPreview(List<EmployeeModel> personList);
/**
* 导入数据
*
* @param dt 数据源
* @return
*/
EmployeeImportVO importData(List<EmployeeModel> dt);
/**
* 导出pdf
*
* @param list 集合数据
* @param outputUrl 保存路径
* @return
*/
void exportPdf(List<EmployeeEntity> list, String outputUrl);
}

View File

@@ -0,0 +1,59 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.LeaveApplyEntity;
import com.yunzhupaas.exception.WorkFlowException;
import com.yunzhupaas.model.leaveapply.LeaveApplyForm;
/**
* 流程表单【请假申请】
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-29 上午9:18
*/
public interface LeaveApplyService extends SuperService<LeaveApplyEntity> {
/**
* 信息
*
* @param id 主键值
* @return
*/
LeaveApplyEntity getInfo(String id);
/**
* 保存
*
* @param id 主键值
* @param entity 实体对象
* @throws WorkFlowException 异常
*/
void save(String id, LeaveApplyEntity entity, LeaveApplyForm form);
/**
* 提交
*
* @param id 主键值
* @param entity 实体对象
* @throws WorkFlowException 异常
*/
void submit(String id, LeaveApplyEntity entity, LeaveApplyForm form);
/**
* 更改数据
*
* @param id 主键值
* @param data 实体对象
*/
void data(String id, String data);
/**
* 删除
*
* @param entity 实体
*/
void delete(LeaveApplyEntity entity);
}

View File

@@ -0,0 +1,17 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.OrderEntryEntity;
/**
* 订单明细
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface OrderEntryService extends SuperService<OrderEntryEntity> {
}

View File

@@ -0,0 +1,17 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.OrderReceivableEntity;
/**
* 订单收款
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface OrderReceivableService extends SuperService<OrderReceivableEntity> {
}

View File

@@ -0,0 +1,113 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.OrderEntity;
import com.yunzhupaas.entity.OrderEntryEntity;
import com.yunzhupaas.entity.OrderReceivableEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.exception.WorkFlowException;
import com.yunzhupaas.model.order.OrderInfoVO;
import com.yunzhupaas.model.order.PaginationOrder;
import java.util.List;
/**
* 订单信息
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
public interface OrderService extends SuperService<OrderEntity> {
/**
* 列表
*
* @param paginationOrder 分页
* @return
*/
List<OrderEntity> getList(PaginationOrder paginationOrder);
/**
* 子列表(订单明细)
*
* @param id 主表Id
* @return
*/
List<OrderEntryEntity> getOrderEntryList(String id);
/**
* 子列表(订单收款)
*
* @param id 主表Id
* @return
*/
List<OrderReceivableEntity> getOrderReceivableList(String id);
/**
* 信息(前单、后单)
*
* @param id 主键值
* @param method 方法:prev、next
* @return
*/
OrderEntity getPrevOrNextInfo(String id, String method);
/**
* 信息(前单、后单)
*
* @param id 主键值
* @param method 方法:prev、next
* @return
* @throws DataException 异常
*/
OrderInfoVO getInfoVo(String id, String method) throws DataException;
/**
* 信息
*
* @param id 主键值
* @return
*/
OrderEntity getInfo(String id);
/**
* 删除
*
* @param entity 订单信息
*/
void delete(OrderEntity entity);
/**
* 新增
*
* @param entity 订单信息
* @param orderEntryList 订单明细
* @param orderReceivableList 订单收款
* @throws WorkFlowException 异常
*/
void create(OrderEntity entity, List<OrderEntryEntity> orderEntryList, List<OrderReceivableEntity> orderReceivableList);
/**
* 更新
*
* @param id 主键值
* @param entity 订单信息
* @param orderEntryList 订单明细
* @param orderReceivableList 订单收款
* @return
* @throws WorkFlowException 异常
*/
boolean update(String id, OrderEntity entity, List<OrderEntryEntity> orderEntryList, List<OrderReceivableEntity> orderReceivableList);
/**
* 更改数据
*
* @param id 主键值
* @param data 实体对象
*/
void data(String id, String data);
}

View File

@@ -0,0 +1,23 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.Pagination;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.ProductEntryEntity;
import java.util.List;
/**
*
* 销售订单明细
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 10:40:59
*/
public interface ProductEntryService extends SuperService<ProductEntryEntity> {
List<ProductEntryEntity> getProductentryEntityList(String id);
List<ProductEntryEntity> getProductentryEntityList(Pagination pagination);
}

View File

@@ -0,0 +1,32 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.ProductGoodsEntity;
import com.yunzhupaas.model.productgoods.ProductGoodsPagination;
import java.util.List;
/**
*
* 产品商品
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 15:57:50
*/
public interface ProductGoodsService extends SuperService<ProductGoodsEntity> {
List<ProductGoodsEntity> getGoodList(String type);
List<ProductGoodsEntity> getList(ProductGoodsPagination productgoodsPagination);
ProductGoodsEntity getInfo(String id);
void delete(ProductGoodsEntity entity);
void create(ProductGoodsEntity entity);
boolean update( String id, ProductGoodsEntity entity);
}

View File

@@ -0,0 +1,31 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.ProductEntity;
import com.yunzhupaas.entity.ProductEntryEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.model.product.ProductPagination;
import java.util.List;
/**
* 销售订单
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 10:40:59
*/
public interface ProductService extends SuperService<ProductEntity> {
List<ProductEntity> getList(ProductPagination productPagination);
ProductEntity getInfo(String id);
void delete(ProductEntity entity);
void create(ProductEntity entity, List<ProductEntryEntity> productEntryList ) throws DataException;
boolean update(String id, ProductEntity entity, List<ProductEntryEntity> productEntryList );
}

View File

@@ -0,0 +1,29 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.ProductclassifyEntity;
import java.util.List;
/**
*
* 产品分类
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 14:34:04
*/
public interface ProductclassifyService extends SuperService<ProductclassifyEntity> {
List<ProductclassifyEntity> getList();
ProductclassifyEntity getInfo(String id);
void delete(ProductclassifyEntity entity);
void create(ProductclassifyEntity entity);
boolean update( String id, ProductclassifyEntity entity);
}

View File

@@ -0,0 +1,110 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.Page;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.ProjectGanttEntity;
import java.util.List;
/**
* 项目计划
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface ProjectGanttService extends SuperService<ProjectGanttEntity> {
/**
* 项目列表
* @param page
* @return
*/
List<ProjectGanttEntity> getList(Page page);
/**
* 任务列表
*
* @param projectId 项目Id
* @return
*/
List<ProjectGanttEntity> getTaskList(String projectId);
/**
* 信息
*
* @param id 主键值
* @return
*/
ProjectGanttEntity getInfo(String id);
/**
* 判断是否允许删除
*
* @param id 主键值
* @return
*/
boolean allowDelete(String id);
/**
* 删除
*
* @param entity 实体对象
* @return
*/
void delete(ProjectGanttEntity entity);
/**
* 创建
*
* @param entity 实体对象
* @return
*/
void create(ProjectGanttEntity entity);
/**
* 更新
*
* @param id 主键值
* @param entity 实体对象
* @return
*/
boolean update(String id, ProjectGanttEntity entity);
/**
* 验证名称
*
* @param fullName 名称
* @param id 主键值
* @return
*/
boolean isExistByFullName(String fullName, String id);
/**
* 验证编码
*
* @param enCode 编码
* @param id 主键值
* @return
*/
boolean isExistByEnCode(String enCode, String id);
/**
* 上移
*
* @param id 主键值
* @return
*/
boolean first(String id);
/**
* 下移
*
* @param id 主键值
* @return
*/
boolean next(String id);
}

View File

@@ -0,0 +1,17 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.SalesOrderEntryEntity;
/**
* 销售订单明细
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-29 上午9:18
*/
public interface SalesOrderEntryService extends SuperService<SalesOrderEntryEntity> {
}

View File

@@ -0,0 +1,72 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.SalesOrderEntity;
import com.yunzhupaas.entity.SalesOrderEntryEntity;
import com.yunzhupaas.exception.WorkFlowException;
import com.yunzhupaas.model.salesorder.SalesOrderForm;
import java.util.List;
/**
* 销售订单
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-29 上午9:18
*/
public interface SalesOrderService extends SuperService<SalesOrderEntity> {
/**
* 列表
*
* @param id 主键值
* @return
*/
List<SalesOrderEntryEntity> getSalesEntryList(String id);
/**
* 信息
*
* @param id 主键值
* @return
*/
SalesOrderEntity getInfo(String id);
/**
* 保存
*
* @param id 主键值
* @param entity 实体对象
* @param salesOrderEntryEntityList 子表
* @throws WorkFlowException 异常
*/
void save(String id, SalesOrderEntity entity, List<SalesOrderEntryEntity> salesOrderEntryEntityList, SalesOrderForm form);
/**
* 提交
*
* @param id 主键值
* @param entity 实体对象
* @param salesOrderEntryEntityList 子表
* @throws WorkFlowException 异常
*/
void submit(String id, SalesOrderEntity entity, List<SalesOrderEntryEntity> salesOrderEntryEntityList, SalesOrderForm form);
/**
* 更改数据
*
* @param id 主键值
* @param data 实体对象
*/
void data(String id, String data);
/**
* 删除
*
* @param entity 实体
*/
void delete(SalesOrderEntity entity);
}

View File

@@ -0,0 +1,91 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.TableExampleEntity;
import com.yunzhupaas.model.tableexample.PaginationTableExample;
import java.util.List;
/**
* 表格示例数据
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface TableExampleService extends SuperService<TableExampleEntity> {
/**
* 列表
*
* @return
*/
List<TableExampleEntity> getList();
/**
* 列表(带关键字)
*
* @param keyword 关键字
* @return
*/
List<TableExampleEntity> getList(String keyword);
/**
* 列表
*
* @param typeId 类别主键
* @param paginationTableExample
* @return
*/
List<TableExampleEntity> getList(String typeId, PaginationTableExample paginationTableExample);
/**
* 列表
*
* @param paginationTableExample
* @return
*/
List<TableExampleEntity> getList(PaginationTableExample paginationTableExample);
/**
* 信息
*
* @param id 主键值
* @return
*/
TableExampleEntity getInfo(String id);
/**
* 删除
*
* @param entity 实体对象
*/
void delete(TableExampleEntity entity);
/**
* 创建
*
* @param entity 实体对象
* @return
*/
void create(TableExampleEntity entity);
/**
* 更新
*
* @param id 主键值
* @param entity 实体对象
* @return
*/
boolean update(String id, TableExampleEntity entity);
/**
* 行编辑
*
* @param entity 实体对象
* @return
*/
boolean rowEditing(TableExampleEntity entity);
}

View File

@@ -0,0 +1,65 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.Pagination;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.WorkLogEntity;
import java.util.List;
/**
* 工作日志
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface WorkLogService extends SuperService<WorkLogEntity> {
/**
* 列表(我发出的)
* @param pageModel 请求参数
* @return
*/
List<WorkLogEntity> getSendList(Pagination pageModel);
/**
* 列表(我收出的)
* @param pageModel 请求参数
* @return
*/
List<WorkLogEntity> getReceiveList(Pagination pageModel);
/**
* 信息
*
* @param id 主键值
* @return
*/
WorkLogEntity getInfo(String id);
/**
* 创建
*
* @param entity 实体对象
* @return
*/
void create(WorkLogEntity entity);
/**
* 更新
*
* @param id 主键值
* @param entity 实体对象
* @return
*/
boolean update(String id, WorkLogEntity entity);
/**
* 删除
*
* @param entity 实体对象
*/
void delete(WorkLogEntity entity);
}

View File

@@ -0,0 +1,18 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.WorkLogShareEntity;
/**
* 工作日志分享
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
public interface WorkLogShareService extends SuperService<WorkLogShareEntity> {
}

View File

@@ -0,0 +1,135 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunzhupaas.base.Pagination;
import com.yunzhupaas.base.entity.SuperBaseEntity;
import com.yunzhupaas.base.service.DbLinkService;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.config.ConfigValueUtil;
import com.yunzhupaas.constant.GlobalConst;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.database.model.entity.DbLinkEntity;
import com.yunzhupaas.database.util.ConnUtil;
import com.yunzhupaas.database.util.DataSourceUtil;
import com.yunzhupaas.database.util.DbTypeUtil;
import com.yunzhupaas.database.util.TenantDataSourceUtil;
import com.yunzhupaas.entity.BigDataEntity;
import com.yunzhupaas.exception.WorkFlowException;
import com.yunzhupaas.mapper.BigDataMapper;
import com.yunzhupaas.service.BigDataService;
import com.yunzhupaas.util.DateUtil;
import com.yunzhupaas.util.RandomUtil;
import com.yunzhupaas.util.StringUtil;
import com.yunzhupaas.util.UserProvider;
import lombok.Cleanup;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 大数据测试
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
@Slf4j
@Service
public class BigDataServiceImpl extends SuperServiceImpl<BigDataMapper, BigDataEntity> implements BigDataService {
@Autowired
private DataSourceUtil dataSourceUtils;
@Autowired
private ConfigValueUtil configValueUtil;
@Autowired
private DbLinkService dbLinkService;
@Override
public List<BigDataEntity> getList(Pagination pagination) {
QueryWrapper<BigDataEntity> queryWrapper = new QueryWrapper<>();
if (StringUtil.isNotEmpty(pagination.getKeyword())) {
queryWrapper.lambda().and(
t -> t.like(BigDataEntity::getFullName, pagination.getKeyword())
.or().like(BigDataEntity::getEnCode, pagination.getKeyword())
);
}
//排序
queryWrapper.lambda().orderByDesc(SuperBaseEntity.SuperCBaseEntity::getCreatorTime, SuperBaseEntity.SuperIBaseEntity::getId);
Page<BigDataEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
IPage<BigDataEntity> iPage = this.page(page, queryWrapper);
return pagination.setData(iPage.getRecords(), page.getTotal());
}
@Override
public void create(int insertCount) throws WorkFlowException {
Integer code = this.baseMapper.maxCode();
if (code == null) {
code = 0;
}
int index = code == 0 ? 10000001 : code;
if (index > 11500001) {
throw new WorkFlowException(MsgCode.ETD113.get());
}
try {
@Cleanup Connection conn = ConnUtil.getConnOrDefault(dataSourceUtils);
@Cleanup PreparedStatement pstm = null;
String sql = "";
String tenantColumn = TenantDataSourceUtil.getTenantColumn();
DbLinkEntity dbLinkEntity = dbLinkService.getResource("0");
if (DbTypeUtil.checkOracle(dbLinkEntity)||DbTypeUtil.checkDM(dbLinkEntity)) {
sql = "INSERT INTO ext_big_data(F_ID,F_EN_CODE,F_FULL_NAME,F_CREATOR_TIME{column}) VALUES (?,?,?,to_date(?,'yyyy-mm-dd hh24:mi:ss'){value})";
} else {
sql = "INSERT INTO ext_big_data(F_ID,F_EN_CODE,F_FULL_NAME,F_CREATOR_TIME{column}) VALUES (?,?,?,?{value})";
}
sql = sql.replaceAll("\\{column}", "," + configValueUtil.getMultiTenantColumn());
sql = sql.replaceAll("\\{value}", ",?");
pstm = conn.prepareStatement(sql);
conn.setAutoCommit(false);
if (DbTypeUtil.checkPostgre(dbLinkEntity)) {
for (int i = 0; i < insertCount; i++) {
pstm.setString(1, RandomUtil.uuId());
pstm.setInt(2, index);
pstm.setString(3, "测试大数据" + index);
pstm.setTimestamp(4, new Timestamp(System.currentTimeMillis()));
if (StringUtil.isNotEmpty(tenantColumn)) {
pstm.setString(5, tenantColumn);
}
pstm.addBatch();
index++;
}
} else {
for (int i = 0; i < insertCount; i++) {
pstm.setString(1, RandomUtil.uuId());
pstm.setInt(2, index);
pstm.setString(3, "测试大数据" + index);
pstm.setString(4, DateUtil.getNow());
// pstm.setString(4, DateUtil.daFormatHHMMSSAddEight(System.currentTimeMillis()));
if (StringUtil.isNotEmpty(tenantColumn)) {
pstm.setString(5, tenantColumn);
}
pstm.addBatch();
index++;
}
}
pstm.executeBatch();
conn.commit();
pstm.close();
conn.close();
} catch (Exception e) {
log.error(e.getMessage());
}
}
}

View File

@@ -0,0 +1,79 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunzhupaas.base.Pagination;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.CustomerEntity;
import com.yunzhupaas.mapper.CustomerMapper;
import com.yunzhupaas.service.CustomerService;
import com.yunzhupaas.util.RandomUtil;
import com.yunzhupaas.util.StringUtil;
import com.yunzhupaas.util.UserProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 客户信息
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 14:09:05
*/
@Service
public class CustomerServiceImpl extends SuperServiceImpl<CustomerMapper, CustomerEntity> implements CustomerService {
@Override
public List<CustomerEntity> getList(Pagination pagination) {
QueryWrapper<CustomerEntity> queryWrapper = new QueryWrapper<>();
if (StringUtil.isNotEmpty(pagination.getKeyword())) {
queryWrapper.lambda().and(
t->t.like(CustomerEntity::getAddress, pagination.getKeyword())
.or().like(CustomerEntity::getName, pagination.getKeyword())
.or().like(CustomerEntity::getCode, pagination.getKeyword())
);
}
Page<CustomerEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
IPage<CustomerEntity> userIPage = this.page(page, queryWrapper);
return pagination.setData(userIPage.getRecords(), userIPage.getTotal());
}
@Override
public CustomerEntity getInfo(String id) {
QueryWrapper<CustomerEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CustomerEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(CustomerEntity entity) {
entity.setId(RandomUtil.uuId());
entity.setCreatorUserId(UserProvider.getUser().getUserId());
entity.setCreatorTime(new Date());
this.save(entity);
}
@Override
public boolean update(String id, CustomerEntity entity) {
entity.setId(id);
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
entity.setLastModifyTime(new Date());
return this.updateById(entity);
}
@Override
public void delete(CustomerEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
}

View File

@@ -0,0 +1,12 @@
package com.yunzhupaas.service.impl;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.DocumentLogEntity;
import com.yunzhupaas.mapper.DocumentLogMapper;
import com.yunzhupaas.service.DocumentLogService;
import org.springframework.stereotype.Service;
@Service
public class DocumentLogServiceImpl extends SuperServiceImpl<DocumentLogMapper, DocumentLogEntity> implements DocumentLogService {
}

View File

@@ -0,0 +1,443 @@
package com.yunzhupaas.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.config.ConfigValueUtil;
import com.yunzhupaas.entity.DocumentEntity;
import com.yunzhupaas.entity.DocumentLogEntity;
import com.yunzhupaas.entity.DocumentShareEntity;
import com.yunzhupaas.mapper.DocumentMapper;
import com.yunzhupaas.model.document.DocumentShareForm;
import com.yunzhupaas.model.document.DocumentTrashListVO;
import com.yunzhupaas.model.document.FlowFileModel;
import com.yunzhupaas.service.DocumentLogService;
import com.yunzhupaas.service.DocumentService;
import com.yunzhupaas.service.DocumentShareService;
import com.yunzhupaas.util.FileUtil;
import com.yunzhupaas.util.RandomUtil;
import com.yunzhupaas.util.StringUtil;
import com.yunzhupaas.util.UserProvider;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* 知识文档
*
* @author 云筑产品开发平台组
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
@Service
public class DocumentServiceImpl extends SuperServiceImpl<DocumentMapper, DocumentEntity> implements DocumentService {
@Autowired
private DocumentShareService documentShareService;
@Autowired
private ConfigValueUtil configValueUtil;
@Autowired
private DocumentLogService documentLogService;
@Override
public List<DocumentEntity> getFolderList() {
QueryWrapper<DocumentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda()
.eq(DocumentEntity::getCreatorUserId, UserProvider.getUser().getUserId())
.eq(DocumentEntity::getType, 0)
.eq(DocumentEntity::getEnabledMark, 1)
.orderByDesc(DocumentEntity::getCreatorTime);
return this.list(queryWrapper);
}
@Override
public List<DocumentEntity> getAllList(String parentId) {
return this.getChildList(parentId, false);
}
@Override
public List<DocumentEntity> getChildList(String parentId, boolean isShare) {
QueryWrapper<DocumentEntity> queryWrapper = new QueryWrapper<>();
if (!isShare) {
queryWrapper.lambda().eq(DocumentEntity::getCreatorUserId, UserProvider.getUser().getUserId());
}
queryWrapper.lambda()
.eq(DocumentEntity::getEnabledMark, 1)
.eq(DocumentEntity::getParentId, parentId)
.orderByAsc(DocumentEntity::getType)
.orderByDesc(DocumentEntity::getCreatorTime);
return this.list(queryWrapper);
}
@Override
public List<DocumentEntity> getAllList(String parentId, String userId) {
QueryWrapper<DocumentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda()
.eq(DocumentEntity::getEnabledMark, 1)
.eq(DocumentEntity::getParentId, parentId)
.eq(DocumentEntity::getCreatorUserId, userId)
.orderByAsc(DocumentEntity::getType)
.orderByDesc(DocumentEntity::getCreatorTime);
return this.list(queryWrapper);
}
@Override
public List<DocumentEntity> getSearchAllList(String keyword) {
QueryWrapper<DocumentEntity> queryWrapper = new QueryWrapper<>();
if (StringUtil.isNotEmpty(keyword)) {
queryWrapper.lambda().like(DocumentEntity::getFullName, keyword);
queryWrapper.lambda().eq(DocumentEntity::getType, 1);
}
queryWrapper.lambda()
.eq(DocumentEntity::getCreatorUserId, UserProvider.getUser().getUserId())
.eq(DocumentEntity::getEnabledMark, 1)
.orderByAsc(DocumentEntity::getType)
.orderByDesc(DocumentEntity::getCreatorTime);
return this.list(queryWrapper);
}
@Override
public List<DocumentTrashListVO> getTrashList(String keyword) {
MPJLambdaWrapper<DocumentLogEntity> wrapper = new MPJLambdaWrapper<>(DocumentLogEntity.class)
.leftJoin(DocumentEntity.class, DocumentEntity::getId, DocumentLogEntity::getDocumentId)
.select(DocumentLogEntity::getId, DocumentLogEntity::getDocumentId)
.select(DocumentEntity::getFullName, DocumentEntity::getDeleteTime, DocumentEntity::getFileSize,
DocumentEntity::getType, DocumentEntity::getFileExtension);
if (StringUtil.isNotEmpty(keyword)) {
wrapper.like(DocumentEntity::getFullName, keyword);
// wrapper.eq(DocumentEntity::getType, 1);
}
wrapper.eq(DocumentLogEntity::getCreatorUserId, UserProvider.getUser().getUserId());
wrapper.orderByAsc(DocumentEntity::getType).orderByDesc(DocumentLogEntity::getCreatorTime);
List<DocumentTrashListVO> list = documentLogService.selectJoinList(DocumentTrashListVO.class, wrapper);
return list;
}
@Override
public List<DocumentEntity> getShareOutList() {
QueryWrapper<DocumentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda()
.eq(DocumentEntity::getCreatorUserId, UserProvider.getUser().getUserId())
.eq(DocumentEntity::getEnabledMark, 1)
.gt(DocumentEntity::getIsShare, 0)
.orderByAsc(DocumentEntity::getType)
.orderByDesc(DocumentEntity::getShareTime);
return this.list(queryWrapper);
}
@Override
public List<DocumentShareEntity> getShareTomeList() {
String userId = UserProvider.getUser().getUserId();
QueryWrapper<DocumentShareEntity> shareWrapper = new QueryWrapper<>();
shareWrapper.lambda().eq(DocumentShareEntity::getShareUserId, userId);
return documentShareService.list(shareWrapper);
}
@Override
public List<DocumentEntity> getInfoByIds(List<String> ids) {
if (CollectionUtils.isNotEmpty(ids)) {
QueryWrapper<DocumentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(DocumentEntity::getId, ids);
queryWrapper.lambda().eq(DocumentEntity::getEnabledMark, 1);
queryWrapper.lambda().orderByAsc(DocumentEntity::getType)
.orderByDesc(DocumentEntity::getCreatorTime);
return this.list(queryWrapper);
}
return new ArrayList<>();
}
@Override
public List<DocumentShareEntity> getShareUserList(String documentId) {
QueryWrapper<DocumentShareEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DocumentShareEntity::getDocumentId, documentId);
return documentShareService.list(queryWrapper);
}
@Override
public DocumentEntity getInfo(String id) {
QueryWrapper<DocumentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DocumentEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void delete(DocumentEntity entity) {
entity.setDeleteTime(new Date());
entity.setDeleteUserId(UserProvider.getUser().getUserId());
entity.setEnabledMark(0);
this.updateById(entity);
}
@Override
public void create(DocumentEntity entity) {
entity.setId(RandomUtil.uuId());
if (StringUtil.isBlank(entity.getCreatorUserId())) {
entity.setCreatorUserId(UserProvider.getUser().getUserId());
}
entity.setEnabledMark(1);
this.save(entity);
}
@Override
public boolean update(String id, DocumentEntity entity) {
entity.setId(id);
entity.setLastModifyTime(new Date());
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
return this.updateById(entity);
}
@Override
@Transactional
public void sharecreate(DocumentShareForm documentShareForm) {
List<String> ids = documentShareForm.getIds();
List<String> userIds = documentShareForm.getUserIds();
String creatorUserId = documentShareForm.getCreatorUserId();
if (CollectionUtils.isEmpty(ids) || CollectionUtils.isEmpty(userIds)) {
return;
}
for (String docId : ids) {
DocumentEntity entity = this.getInfo(docId);
if (entity != null) {
//共享当前文件或者文件夹(文件夹内部文件可以直接查询)
int n = (entity.getIsShare() == null ? 0 : entity.getIsShare()) + userIds.size();
entity.setIsShare(n);
entity.setShareTime(new Date());
this.updateById(entity);
for (String userId : userIds) {
DocumentShareEntity one = documentShareService.getByDocIdAndShareUserId(docId, userId);
if (one != null) {
one.setShareTime(new Date());
documentShareService.updateById(one);
continue;
}
DocumentShareEntity documentShare = new DocumentShareEntity();
documentShare.setId(RandomUtil.uuId());
documentShare.setDocumentId(docId);
documentShare.setShareUserId(userId);
documentShare.setShareTime(new Date());
documentShare.setCreatorUserId(creatorUserId);
documentShareService.save(documentShare);
}
}
}
}
@Override
@Transactional
public void shareCancel(List<String> documentIds) {
for (String documentId : documentIds) {
QueryWrapper<DocumentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DocumentEntity::getId, documentId);
DocumentEntity entity = this.getOne(queryWrapper);
if (entity != null) {
entity.setIsShare(0);
entity.setShareTime(new Date());
this.updateById(entity);
QueryWrapper<DocumentShareEntity> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(DocumentShareEntity::getDocumentId, documentId);
documentShareService.remove(wrapper);
}
}
}
@Override
@Transactional
public void shareAdjustment(String id, List<String> userIds) {
DocumentEntity entity = this.getInfo(id);
if (entity != null) {
entity.setIsShare(userIds.size());
entity.setShareTime(new Date());
this.updateById(entity);
QueryWrapper<DocumentShareEntity> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(DocumentShareEntity::getDocumentId, entity.getId());
documentShareService.remove(wrapper);
for (String userId : userIds) {
DocumentShareEntity documentShare = new DocumentShareEntity();
documentShare.setId(RandomUtil.uuId());
documentShare.setDocumentId(id);
documentShare.setShareUserId(userId);
documentShare.setShareTime(new Date());
documentShareService.save(documentShare);
}
}
}
@Override
@Transactional
public void trashdelete(List<String> folderIds) {
List<String> pathList = new ArrayList<>();
for (String logId : folderIds) {
DocumentLogEntity logEntity = documentLogService.getById(logId);
DocumentEntity entity = this.getInfo(logEntity.getDocumentId());
if (entity != null) {
if (Objects.equals(entity.getType(), 0)) {
String childDocument = logEntity.getChildDocument();
String[] allFile = childDocument.split(",");
for (String item : allFile) {
this.removeById(item);
}
} else {
this.removeById(logEntity.getDocumentId());
}
pathList.add(configValueUtil.getDocumentFilePath() + entity.getFilePath());
}
documentLogService.removeById(logEntity);
}
//先移除数据再移除文件,以便回滚(移除文件夹里面的文件也会删除所以不用递归)
for (String path : pathList) {
FileUtil.deleteFile(path);
}
}
@Override
@Transactional
public void trashRecoveryConstainSrc(List<String> ids) {
for (String logId : ids) {
DocumentLogEntity logEntity = documentLogService.getById(logId);
if (logEntity == null) {
continue;
}
DocumentEntity entity = this.getInfo(logEntity.getDocumentId());
if (entity != null) {
if (!"0".equals(entity.getParentId())) {
//查询父级菜单是否存在,如果存在还原到原菜单里,如果不存在则放在最外层
DocumentEntity parentInfo = this.getInfo(entity.getParentId());
if (parentInfo == null || Objects.equals(parentInfo.getEnabledMark(), 0)) {
this.trashRecovery(entity.getId(), true);
} else {
this.trashRecovery(entity.getId(), false);
}
} else {
this.trashRecovery(entity.getId(), false);
}
String childDocument = logEntity.getChildDocument();
List<String> childList = Arrays.asList(childDocument.split(",")).stream().filter(t -> !t.equals(entity.getId())).collect(Collectors.toList());
//还原文件夹内的所有文件。
for (String item : childList) {
this.trashRecovery(item, false);
}
}
documentLogService.removeById(logEntity);
}
}
@Override
public boolean trashRecovery(String id, boolean initParent) {
UpdateWrapper<DocumentEntity> updateWrapper = new UpdateWrapper<>();
if (initParent) {
updateWrapper.lambda().set(DocumentEntity::getParentId, "0");
}
updateWrapper.lambda().set(DocumentEntity::getEnabledMark, 1);
updateWrapper.lambda().set(DocumentEntity::getDeleteTime, null);
updateWrapper.lambda().set(DocumentEntity::getDeleteUserId, null);
updateWrapper.lambda().eq(DocumentEntity::getId, id);
return this.update(updateWrapper);
}
@Override
public boolean moveTo(String id, String toId) {
DocumentEntity entity = this.getInfo(id);
if (entity != null) {
entity.setParentId(toId);
this.updateById(entity);
return true;
}
return false;
}
@Override
public boolean isExistByFullName(String fullName, String id, String parentId) {
String userId = UserProvider.getUser().getUserId();
QueryWrapper<DocumentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DocumentEntity::getFullName, fullName).eq(DocumentEntity::getEnabledMark, 1).eq(DocumentEntity::getCreatorUserId, userId);
queryWrapper.lambda().eq(DocumentEntity::getParentId, parentId);
if (!StringUtil.isEmpty(id)) {
queryWrapper.lambda().ne(DocumentEntity::getId, id);
}
return this.count(queryWrapper) > 0 ? true : false;
}
@Override
public void getChildSrcList(String pId, List<DocumentEntity> list, Integer enabledMark) {
QueryWrapper<DocumentEntity> queryWrapper = new QueryWrapper<>();
if (enabledMark != null) {
queryWrapper.lambda().eq(DocumentEntity::getEnabledMark, enabledMark);
}
queryWrapper.lambda()
.eq(DocumentEntity::getParentId, pId)
.orderByAsc(DocumentEntity::getType)
.orderByDesc(DocumentEntity::getCreatorTime);
List<DocumentEntity> allList = this.list(queryWrapper);
if (CollectionUtils.isNotEmpty(allList)) {
list.addAll(allList);
for (DocumentEntity doc : allList) {
this.getChildSrcList(doc.getId(), list, enabledMark);
}
}
}
@Override
public DocumentShareEntity getShareByParentId(String parentId) {
DocumentShareEntity one = documentShareService.getByDocIdAndShareUserId(parentId, UserProvider.getUser().getUserId());
if (one != null) {
return one;
} else {
DocumentEntity entity = this.getById(parentId);
if (entity != null && StringUtil.isNotEmpty(entity.getParentId())) {
return this.getShareByParentId(entity.getParentId());
}
}
return null;
}
@Override
public List<Map<String, Object>> getFlowFile(FlowFileModel model) {
String userId = model.getUserId();
String templateId = model.getTemplateId();
QueryWrapper<DocumentShareEntity> shareWrapper = new QueryWrapper<>();
shareWrapper.lambda().eq(DocumentShareEntity::getShareUserId, userId);
List<DocumentShareEntity> shareList = documentShareService.list(shareWrapper);
List<String> docIds = new ArrayList<>();
if (CollectionUtil.isNotEmpty(shareList)) {
docIds = shareList.stream().map(DocumentShareEntity::getDocumentId).collect(Collectors.toList());
}
QueryWrapper<DocumentEntity> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(DocumentEntity::getEnabledMark, 1).like(DocumentEntity::getDescription, templateId);
List<String> finalDocIds = docIds;
wrapper.lambda().and(t -> {
t.eq(DocumentEntity::getCreatorUserId, userId);
if (!finalDocIds.isEmpty()) {
t.or(e -> e.in(DocumentEntity::getId, finalDocIds));
}
});
wrapper.lambda().orderByDesc(DocumentEntity::getCreatorTime);
Page<DocumentEntity> page = this.page(new Page<>(1,5), wrapper);
List<DocumentEntity> documentList = page.getRecords();
List<Map<String, Object>> list = new ArrayList<>();
if (!documentList.isEmpty()) {
for (DocumentEntity document : documentList) {
Map<String, Object> map = new HashMap<>();
map.put("id", document.getId());
map.put("fileName", document.getFullName());
map.put("fileDate", document.getCreatorTime());
map.put("uploaderUrl", document.getUploaderUrl());
list.add(map);
}
}
return list;
}
}

View File

@@ -0,0 +1,34 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.DocumentShareEntity;
import com.yunzhupaas.mapper.DocumentShareMapper;
import com.yunzhupaas.service.DocumentShareService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 邮件配置
*
* @author 云筑产品开发平台组
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
@Service
public class DocumentShareServiceImpl extends SuperServiceImpl<DocumentShareMapper, DocumentShareEntity> implements DocumentShareService {
@Override
public DocumentShareEntity getByDocIdAndShareUserId(String docId, String shareUserId) {
QueryWrapper<DocumentShareEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DocumentShareEntity::getDocumentId, docId);
queryWrapper.lambda().eq(DocumentShareEntity::getShareUserId, shareUserId);
List<DocumentShareEntity> list = list(queryWrapper);
if (list != null && list.size() > 0) {
return list.get(0);
}
return null;
}
}

View File

@@ -0,0 +1,21 @@
package com.yunzhupaas.service.impl;
import com.yunzhupaas.base.entity.EmailConfigEntity;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.mapper.EmailConfigMapper;
import com.yunzhupaas.service.EmailConfigService;
import org.springframework.stereotype.Service;
/**
* 邮件配置
*
* @copyright 深圳市乐程软件有限公司
* @author 云筑产品开发平台组
* @date 2024-09-26 上午9:18
*/
@Service
public class EmailConfigServiceImpl extends SuperServiceImpl<EmailConfigMapper, EmailConfigEntity> implements EmailConfigService {
}

View File

@@ -0,0 +1,413 @@
package com.yunzhupaas.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunzhupaas.base.PaginationTime;
import com.yunzhupaas.base.entity.EmailConfigEntity;
import com.yunzhupaas.base.model.MailAccount;
import com.yunzhupaas.base.model.MailFile;
import com.yunzhupaas.base.model.MailModel;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.base.util.Pop3Util;
import com.yunzhupaas.base.util.SmtpUtil;
import com.yunzhupaas.config.ConfigValueUtil;
import com.yunzhupaas.constant.FileTypeConstant;
import com.yunzhupaas.base.entity.EmailReceiveEntity;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.EmailSendEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.mapper.EmailReceiveMapper;
import com.yunzhupaas.service.EmailConfigService;
import com.yunzhupaas.service.EmailReceiveService;
import com.yunzhupaas.service.EmailSendService;
import com.yunzhupaas.util.*;
import com.yunzhupaas.util.type.StringNumber;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 邮件接收
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Slf4j
@Service
public class EmailReceiveServiceImpl extends SuperServiceImpl<EmailReceiveMapper, EmailReceiveEntity> implements EmailReceiveService {
@Autowired
private EmailSendService emailSendService;
@Autowired
private EmailConfigService emailConfigService;
@Autowired
private Pop3Util pop3Util;
@Autowired
private ConfigValueUtil configValueUtil;
@Override
public List<EmailReceiveEntity> getReceiveList(PaginationTime paginationTime) {
String userId = UserProvider.getUser().getUserId();
QueryWrapper<EmailReceiveEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EmailReceiveEntity::getCreatorUserId, userId);
//日期范围近7天、近1月、近3月、自定义
if (ObjectUtil.isNotEmpty(paginationTime.getStartTime()) && ObjectUtil.isNotEmpty(paginationTime.getEndTime())) {
queryWrapper.lambda().between(EmailReceiveEntity::getFdate, new Date(paginationTime.getStartTime()), new Date(paginationTime.getEndTime()));
}
//关键字用户、IP地址、功能名称
String keyWord = paginationTime.getKeyword() != null ? paginationTime.getKeyword() : null;
//关键字(发件人、主题)
if (!StringUtils.isEmpty(keyWord)) {
String word = keyWord;
queryWrapper.lambda().and(
t -> t.like(EmailReceiveEntity::getSender, word)
.or().like(EmailReceiveEntity::getSubject, word)
);
}
//排序
if (StringUtils.isEmpty(paginationTime.getSidx())) {
queryWrapper.lambda().orderByDesc(EmailReceiveEntity::getFdate);
} else {
queryWrapper = "asc".equals(paginationTime.getSort().toLowerCase()) ? queryWrapper.orderByAsc(paginationTime.getSidx()) : queryWrapper.orderByDesc(paginationTime.getSidx());
}
Page<EmailReceiveEntity> page = new Page<>(paginationTime.getCurrentPage(), paginationTime.getPageSize());
IPage<EmailReceiveEntity> userIPage = this.page(page, queryWrapper);
return paginationTime.setData(userIPage.getRecords(), page.getTotal());
}
@Override
public List<EmailReceiveEntity> getReceiveList() {
String userId = UserProvider.getUser().getUserId();
QueryWrapper<EmailReceiveEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EmailReceiveEntity::getCreatorUserId, userId).eq(EmailReceiveEntity::getIsRead,0).orderByDesc(EmailReceiveEntity::getCreatorTime);
return this.baseMapper.selectList(queryWrapper);
}
@Override
public List<EmailReceiveEntity> getDashboardReceiveList() {
String userId = UserProvider.getUser().getUserId();
QueryWrapper<EmailReceiveEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EmailReceiveEntity::getCreatorUserId, userId).eq(EmailReceiveEntity::getIsRead,0).orderByDesc(EmailReceiveEntity::getCreatorTime);
Page<EmailReceiveEntity> page = new Page<>(1, 20);
IPage<EmailReceiveEntity> iPage = this.page(page, queryWrapper);
return iPage.getRecords();
}
@Override
public List<EmailReceiveEntity> getStarredList(PaginationTime paginationTime) {
String userId = UserProvider.getUser().getUserId();
QueryWrapper<EmailReceiveEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EmailReceiveEntity::getCreatorUserId, userId).eq(EmailReceiveEntity::getStarred, 1);
//日期范围近7天、近1月、近3月、自定义
if (ObjectUtil.isNotEmpty(paginationTime.getStartTime()) && ObjectUtil.isNotEmpty(paginationTime.getEndTime())) {
queryWrapper.lambda().between(EmailReceiveEntity::getCreatorTime, new Date(paginationTime.getStartTime()), new Date(paginationTime.getEndTime()));
}
//关键字用户、IP地址、功能名称
String keyWord = paginationTime.getKeyword() != null ? paginationTime.getKeyword() : null;
//关键字(发件人、主题)
if (!StringUtils.isEmpty(keyWord)) {
String word = keyWord;
queryWrapper.lambda().and(
t -> t.like(EmailReceiveEntity::getSender, word)
.or().like(EmailReceiveEntity::getSubject, word)
);
}
//排序
if (StringUtils.isEmpty(paginationTime.getSidx())) {
queryWrapper.lambda().orderByDesc(EmailReceiveEntity::getCreatorTime);
} else {
queryWrapper = "asc".equals(paginationTime.getSort().toLowerCase()) ? queryWrapper.orderByAsc(paginationTime.getSidx()) : queryWrapper.orderByDesc(paginationTime.getSidx());
}
Page<EmailReceiveEntity> page = new Page<>(paginationTime.getCurrentPage(), paginationTime.getPageSize());
IPage<EmailReceiveEntity> userIPage = this.page(page, queryWrapper);
return paginationTime.setData(userIPage.getRecords(), page.getTotal());
}
@Override
public List<EmailSendEntity> getDraftList(PaginationTime paginationTime) {
String userId = UserProvider.getUser().getUserId();
QueryWrapper<EmailSendEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EmailSendEntity::getCreatorUserId, userId).eq(EmailSendEntity::getState, -1);
//日期范围近7天、近1月、近3月、自定义
if (!ObjectUtil.isEmpty(paginationTime.getStartTime()) && !ObjectUtil.isEmpty(paginationTime.getEndTime())) {
queryWrapper.lambda().between(EmailSendEntity::getCreatorTime, new Date(paginationTime.getStartTime()), new Date(paginationTime.getEndTime()));
}
//关键字用户、IP地址、功能名称
String keyWord = paginationTime.getKeyword() != null ? paginationTime.getKeyword() : null;
//关键字(发件人、主题)
if (!StringUtils.isEmpty(keyWord)) {
String word = keyWord;
queryWrapper.lambda().and(
t -> t.like(EmailSendEntity::getSender, word)
.or().like(EmailSendEntity::getSubject, word)
);
}
//排序
if (StringUtils.isEmpty(paginationTime.getSidx())) {
queryWrapper.lambda().orderByDesc(EmailSendEntity::getCreatorTime);
} else {
queryWrapper = "asc".equals(paginationTime.getSort().toLowerCase()) ? queryWrapper.orderByAsc(paginationTime.getSidx()) : queryWrapper.orderByDesc(paginationTime.getSidx());
}
Page<EmailSendEntity> page = new Page<>(paginationTime.getCurrentPage(), paginationTime.getPageSize());
IPage<EmailSendEntity> userIPage = emailSendService.page(page, queryWrapper);
return paginationTime.setData(userIPage.getRecords(), page.getTotal());
}
@Override
public List<EmailSendEntity> getSentList(PaginationTime paginationTime) {
String userId = UserProvider.getUser().getUserId();
QueryWrapper<EmailSendEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EmailSendEntity::getCreatorUserId, userId).ne(EmailSendEntity::getState, -1);
//日期范围近7天、近1月、近3月、自定义
if (ObjectUtil.isNotEmpty(paginationTime.getStartTime()) && ObjectUtil.isNotEmpty(paginationTime.getEndTime())) {
queryWrapper.lambda().between(EmailSendEntity::getCreatorTime, new Date(paginationTime.getStartTime()), new Date(paginationTime.getEndTime()));
}
//关键字用户、IP地址、功能名称
String keyWord = paginationTime.getKeyword() != null ? String.valueOf(paginationTime.getKeyword()) : null;
//关键字(发件人、主题)
if (!StringUtils.isEmpty(keyWord)) {
String word = keyWord;
queryWrapper.lambda().and(
t -> t.like(EmailSendEntity::getSender, word)
.or().like(EmailSendEntity::getSubject, word)
);
}
//排序
String sort = paginationTime.getSort() != null ? paginationTime.getSort() : null;
if (!StringUtils.isEmpty(sort)) {
queryWrapper.lambda().orderByDesc(EmailSendEntity::getCreatorTime);
}
Page<EmailSendEntity> page = new Page<>(paginationTime.getCurrentPage(), paginationTime.getPageSize());
IPage<EmailSendEntity> userIPage = emailSendService.page(page, queryWrapper);
return paginationTime.setData(userIPage.getRecords(), page.getTotal());
}
@Override
public EmailConfigEntity getConfigInfo() {
String userId = UserProvider.getUser().getUserId();
QueryWrapper<EmailConfigEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EmailConfigEntity::getCreatorUserId, userId);
return emailConfigService.getOne(queryWrapper);
}
@Override
public EmailConfigEntity getConfigInfo(String userId) {
QueryWrapper<EmailConfigEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EmailConfigEntity::getCreatorUserId, userId);
return emailConfigService.getOne(queryWrapper);
}
@Override
public Object getInfo(String id) {
EmailReceiveEntity receiveInfo = this.getById(id);
Object object;
if (receiveInfo != null) {
//解析内容
receiveInfo.setBodyText(receiveInfo.getBodyText());
//更新已读
receiveInfo.setIsRead(1);
receiveInfo.setLastModifyTime(new Date());
receiveInfo.setLastModifyUserId(UserProvider.getUser().getUserId());
this.updateById(receiveInfo);
object = receiveInfo;
} else {
EmailSendEntity sendInfo = emailSendService.getById(id);
object = sendInfo;
}
return object;
}
@Override
public boolean delete(String id) {
Object object = getInfo(id);
if (object != null && object instanceof EmailReceiveEntity) {
//删除邮件
EmailConfigEntity mailConfig = getConfigInfo();
EmailReceiveEntity mailReceiveEntity = (EmailReceiveEntity) object;
MailAccount mailAccount = new MailAccount();
mailAccount.setAccount(mailConfig.getAccount());
mailAccount.setPassword(mailConfig.getPassword());
mailAccount.setPop3Port(mailConfig.getPop3Port());
mailAccount.setPop3Host(mailConfig.getPop3Host());
pop3Util.deleteMessage(mailAccount, mailReceiveEntity.getMID());
this.removeById(mailReceiveEntity.getId());
return true;
} else if (object != null) {
//删除数据
EmailSendEntity entity = (EmailSendEntity) object;
emailSendService.removeById(entity.getId());
return true;
}
return false;
}
@Override
@Transactional
public void saveDraft(EmailSendEntity entity) {
entity.setState(-1);
if (StringUtil.isNotEmpty(entity.getId())) {
entity.setLastModifyTime(new Date());
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
emailSendService.updateById(entity);
} else {
entity.setId(RandomUtil.uuId());
entity.setCreatorUserId(UserProvider.getUser().getUserId());
emailSendService.save(entity);
}
}
@Override
public boolean receiveRead(String id, int isRead) {
EmailReceiveEntity entity = (EmailReceiveEntity) getInfo(id);
if (entity != null) {
entity.setIsRead(isRead);
return this.updateById(entity);
}
return false;
}
@Override
public boolean receiveStarred(String id, int isStarred) {
EmailReceiveEntity entity = (EmailReceiveEntity) getInfo(id);
if (entity != null) {
entity.setStarred(isStarred);
return this.updateById(entity);
}
return false;
}
@Override
public void saveConfig(EmailConfigEntity configEntity) throws DataException {
EmailConfigEntity emailConfigEntity=getConfigInfo(UserProvider.getUser().getUserId());
if (emailConfigEntity == null && UserProvider.getUser().getUserId() != null) {
configEntity.setId(RandomUtil.uuId());
configEntity.setCreatorTime(new Date());
configEntity.setCreatorUserId(UserProvider.getUser().getUserId());
emailConfigService.save(configEntity);
} else if (UserProvider.getUser().getUserId() != null) {
configEntity.setId(emailConfigEntity.getId());
emailConfigService.updateById(configEntity);
} else {
throw new DataException(MsgCode.ETD114.get());
}
}
@Override
@Transactional
public int saveSent(EmailSendEntity entity, EmailConfigEntity mailConfig) {
int flag = 1;
//拷贝文件,注意:从临时文件夹拷贝到邮件文件夹
List<MailFile> attachmentList = JsonUtil.getJsonToList(entity.getAttachment(), MailFile.class);
//邮件路径
String mailFilePath = configValueUtil.getEmailFilePath();
try {
//写入数据
//发送邮件
//邮件发送信息
MailModel mailModel = new MailModel();
mailModel.setFrom(entity.getSender());
mailModel.setRecipient(entity.getRecipient());
mailModel.setCc(entity.getCc());
mailModel.setBcc(entity.getBcc());
mailModel.setSubject(entity.getSubject());
mailModel.setBodyText(entity.getBodyText());
mailModel.setAttachment(attachmentList);
mailModel.setFromName(mailConfig.getSenderName());
//账号验证信息
MailAccount mailAccount = new MailAccount();
mailAccount.setAccount(mailConfig.getAccount());
mailAccount.setPassword(mailConfig.getPassword());
mailAccount.setPop3Host(mailConfig.getPop3Host());
mailAccount.setPop3Port(mailConfig.getPop3Port());
mailAccount.setSmtpHost(mailConfig.getSmtpHost());
mailAccount.setSmtpPort(mailConfig.getSmtpPort());
mailAccount.setSsl(mailConfig.getEmailSsl() == 1 ? true : false);
mailAccount.setAccountName(mailConfig.getSenderName());
SmtpUtil smtpUtil = new SmtpUtil(mailAccount);
smtpUtil.sendMail(null, mailFilePath, mailModel);
flag = 0;
//插入数据库
if (entity.getId() != null) {
entity.setState(1);
emailSendService.updateById(entity);
} else {
entity.setId(RandomUtil.uuId());
entity.setCreatorUserId(UserProvider.getUser().getUserId());
if (mailConfig.getAccount() != null) {
entity.setSender(mailConfig.getAccount());
}
entity.setState(1);
emailSendService.save(entity);
}
} catch (Exception e) {
for (MailFile mailFile : attachmentList) {
FileUtil.deleteFile(mailFilePath + mailFile.getFileId());
}
log.error(e.getMessage());
}
return flag;
}
@Override
@Transactional
public int receive(EmailConfigEntity mailConfig) {
//账号验证信息
MailAccount mailAccount = new MailAccount();
mailAccount.setAccount(mailConfig.getAccount());
mailAccount.setPassword(mailConfig.getPassword());
mailAccount.setPop3Host(mailConfig.getPop3Host());
mailAccount.setPop3Port(mailConfig.getPop3Port());
mailAccount.setSmtpHost(mailConfig.getSmtpHost());
mailAccount.setSmtpPort(mailConfig.getSmtpPort());
if (StringNumber.ONE.equals(mailConfig.getEmailSsl().toString())) {
mailAccount.setSsl(true);
} else {
mailAccount.setSsl(false);
}
Map<String, Object> map = pop3Util.popMail(mailAccount);
int receiveCount = 0;
if (map.get("receiveCount") != null) {
receiveCount = (int) map.get("receiveCount");
}
List<EmailReceiveEntity> mailList = new ArrayList<>();
if (map.get("mailList") != null) {
mailList = (List<EmailReceiveEntity>) map.get("mailList");
}
if (mailList.size() > 0) {
List<String> mids = mailList.stream().map(u -> u.getMID()).collect(Collectors.toList());
//查询数据库状态
QueryWrapper<EmailReceiveEntity> wrapper = new QueryWrapper<>();
wrapper.lambda().in(EmailReceiveEntity::getMID, mids);
List<EmailReceiveEntity> emails = this.list(wrapper);
this.remove(wrapper);
//邮件赋值状态
for (int i = 0; i < mailList.size(); i++) {
EmailReceiveEntity entity = mailList.get(i);
entity.setCreatorUserId(UserProvider.getUser().getUserId());
//通过数据库进行赋值没有就默认0
int stat = emails.stream().filter(m -> m.getMID().equals(entity.getMID())).findFirst().isPresent() ? emails.stream().filter(m -> m.getMID().equals(entity.getMID())).findFirst().get().getIsRead() : 0;
long count = emails.stream().filter(m -> m.getMID().equals(entity.getMID())).count();
entity.setIsRead(stat);
if (count != 0) {
receiveCount--;
}
this.save(entity);
}
}
return receiveCount;
}
}

View File

@@ -0,0 +1,21 @@
package com.yunzhupaas.service.impl;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.EmailSendEntity;
import com.yunzhupaas.mapper.EmailSendMapper;
import com.yunzhupaas.service.EmailSendService;
import org.springframework.stereotype.Service;
/**
* 邮件发送
*
* @copyright 深圳市乐程软件有限公司
* @author 云筑产品开发平台组
* @date 2024-09-26 上午9:18
*/
@Service
public class EmailSendServiceImpl extends SuperServiceImpl<EmailSendMapper, EmailSendEntity> implements EmailSendService {
}

View File

@@ -0,0 +1,305 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.EmployeeEntity;
import com.yunzhupaas.mapper.EmployeeMapper;
import com.yunzhupaas.model.EmployeeModel;
import com.yunzhupaas.model.employee.EmployeeImportVO;
import com.yunzhupaas.model.employee.PaginationEmployee;
import com.yunzhupaas.service.EmployeeService;
import com.yunzhupaas.util.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.io.FileOutputStream;
import java.util.*;
/**
* 职员信息
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
*/
@Slf4j
@Service
public class EmployeeServiceImpl extends SuperServiceImpl<EmployeeMapper, EmployeeEntity> implements EmployeeService {
@Override
public List<EmployeeEntity> getList() {
QueryWrapper<EmployeeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().orderByDesc(EmployeeEntity::getCreatorTime);
return this.list(queryWrapper);
}
@Override
public List<EmployeeEntity> getList(PaginationEmployee paginationEmployee) {
// Map<String, Object> queryParam = OptimizeUtil.queryParam(pagination);
QueryWrapper<EmployeeEntity> queryWrapper = new QueryWrapper<>();
//查询条件
String propertyName = paginationEmployee.getCondition() != null ? paginationEmployee.getCondition() : null;
String propertyValue = paginationEmployee.getKeyword() != null ? paginationEmployee.getKeyword() : null;
if (!StringUtils.isEmpty(propertyName) && !StringUtils.isEmpty(propertyValue)) {
switch (propertyName) {
//工号
case "EnCode":
queryWrapper.lambda().like(EmployeeEntity::getEnCode, propertyValue);
break;
//姓名
case "FullName":
queryWrapper.lambda().like(EmployeeEntity::getFullName, propertyValue);
break;
//电话
case "Telephone":
queryWrapper.lambda().like(EmployeeEntity::getTelephone, propertyValue);
break;
//部门
case "DepartmentName":
queryWrapper.lambda().like(EmployeeEntity::getDepartmentName, propertyValue);
break;
//岗位
case "PositionName":
queryWrapper.lambda().like(EmployeeEntity::getPositionName, propertyValue);
break;
default:
break;
}
}
//排序
if (StringUtils.isEmpty(paginationEmployee.getSidx())) {
queryWrapper.lambda().orderByDesc(EmployeeEntity::getCreatorTime);
} else {
queryWrapper = "asc".equals(paginationEmployee.getSort().toLowerCase()) ? queryWrapper.orderByAsc(paginationEmployee.getSidx()) : queryWrapper.orderByDesc(paginationEmployee.getSidx());
}
Page page = new Page(paginationEmployee.getCurrentPage(), paginationEmployee.getPageSize());
IPage<EmployeeEntity> userIPage = this.page(page, queryWrapper);
return paginationEmployee.setData(userIPage.getRecords(), page.getTotal());
}
@Override
public EmployeeEntity getInfo(String id) {
QueryWrapper<EmployeeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(EmployeeEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void delete(EmployeeEntity entity) {
this.removeById(entity.getId());
}
@Override
public void create(EmployeeEntity entity) {
entity.setId(RandomUtil.uuId());
entity.setSortCode(RandomUtil.parses());
entity.setCreatorUserId(UserProvider.getLoginUserId());
this.save(entity);
}
@Override
public void update(String id, EmployeeEntity entity) {
entity.setId(id);
entity.setLastModifyTime(new Date());
entity.setLastModifyUserId(UserProvider.getLoginUserId());
this.updateById(entity);
}
@Override
public Map<String, Object> importPreview(List<EmployeeModel> personList) {
List<Map<String, Object>> dataRow = new ArrayList<>();
List<Map<String, Object>> columns = new ArrayList<>();
for (int i = 0; i < personList.size(); i++) {
Map<String, Object> dataRowMap = new HashMap<>();
EmployeeModel model = personList.get(i);
dataRowMap.put("enCode", model.getEnCode());
dataRowMap.put("fullName", model.getFullName());
dataRowMap.put("gender", model.getGender());
dataRowMap.put("departmentName", model.getDepartmentName());
dataRowMap.put("positionName", model.getPositionName());
dataRowMap.put("workingNature", model.getWorkingNature());
dataRowMap.put("idNumber", model.getIdNumber());
dataRowMap.put("telephone", model.getTelephone());
dataRowMap.put("attendWorkTime", model.getAttendWorkTime());
dataRowMap.put("birthday", model.getBirthday());
dataRowMap.put("education", model.getEducation());
dataRowMap.put("major", model.getMajor());
dataRowMap.put("graduationAcademy", model.getGraduationAcademy());
dataRowMap.put("graduationTime", model.getGraduationTime());
dataRow.add(dataRowMap);
}
for (int i = 1; i < 15; i++) {
Map<String, Object> columnsMap = new HashMap<>();
columnsMap.put("AllowDBNull", true);
columnsMap.put("AutoIncrement", false);
columnsMap.put("AutoIncrementSeed", 0);
columnsMap.put("AutoIncrementStep", 1);
columnsMap.put("Caption", this.getColumns(i));
columnsMap.put("ColumnMapping", 1);
columnsMap.put("ColumnName", this.getColumns(i));
columnsMap.put("Container", null);
columnsMap.put("DataType", "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
columnsMap.put("DateTimeMode", 3);
columnsMap.put("DefaultValue", null);
columnsMap.put("DesignMode", false);
columnsMap.put("Expression", "");
columnsMap.put("ExtendedProperties", "");
columnsMap.put("MaxLength", -1);
columnsMap.put("Namespace", "");
columnsMap.put("Ordinal", 0);
columnsMap.put("Prefix", "");
columnsMap.put("ReadOnly", false);
columnsMap.put("Site", null);
columnsMap.put("Table", personList);
columnsMap.put("Unique", false);
columns.add(columnsMap);
}
Map<String, Object> map = new HashMap<>();
map.put("dataRow", dataRow);
map.put("columns", columns);
return map;
}
@Override
public EmployeeImportVO importData(List<EmployeeModel> dt) {
for(EmployeeModel model :dt){
model.setAttendWorkTime(DateUtil.cstFormat(model.getAttendWorkTime()));
model.setBirthday(DateUtil.cstFormat(model.getBirthday()));
model.setGraduationTime(DateUtil.cstFormat(model.getGraduationTime()));
}
List<EmployeeEntity> entitys = JsonUtil.getJsonToList(dt, EmployeeEntity.class);
//记录成功了几条
int sum=0;
//记录第几条失败
int num=0;
List<EmployeeEntity> errList = new ArrayList<>();
for (EmployeeEntity entity : entitys) {
entity.setId(RandomUtil.uuId());
entity.setCreatorUserId(UserProvider.getLoginUserId());
entity.setCreatorTime(new Date());
try {
this.baseMapper.insert(entity);
sum++;
}catch (Exception e){
errList.add(entity);
num++;
log.error("导入第"+(num+1)+"条数据失败");
}
}
EmployeeImportVO vo=new EmployeeImportVO();
vo.setSnum(sum);
vo.setFnum(num);
if(vo.getFnum()>0){
vo.setResultType(1);
vo.setFailResult(JsonUtil.getJsonToList(errList, EmployeeModel.class));
return vo;
}else{
vo.setResultType(0);
return vo;
}
}
@Override
public void exportPdf(List<EmployeeEntity> list, String outputUrl) {
try {
Document document = new Document();
BaseFont bfChinese = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H", false);
Font font = new Font(bfChinese, 11, Font.NORMAL);
PdfWriter.getInstance(document, new FileOutputStream(outputUrl));
document.open();
PdfPTable row;
row = new PdfPTable(13);
//表占页面100%宽度
row.setWidthPercentage(100f);
//标题
String[] titles = {"姓名", "性别", "部门", "职位", "用工性质", "身份证号", "联系电话", "出生年月", "参加工作", "最高学历", "所学专业", "毕业院校", "毕业时间"};
for (String title : titles) {
row.addCell(createCell(title, font));
}
document.add(row);
//内容
for (EmployeeEntity entity : list) {
row = new PdfPTable(13);
//表占页面100%宽度
row.setWidthPercentage(100f);
row.addCell(createCell(entity.getFullName(), font));
row.addCell(createCell(entity.getGender(), font));
row.addCell(createCell(entity.getDepartmentName(), font));
row.addCell(createCell(entity.getPositionName(), font));
row.addCell(createCell(entity.getWorkingNature(), font));
row.addCell(createCell(entity.getIdNumber(), font));
row.addCell(createCell(entity.getTelephone(), font));
row.addCell(createCell(entity.getAttendWorkTime() != null ? DateUtil.daFormat(entity.getAttendWorkTime()) : "", font));
row.addCell(createCell(entity.getBirthday() != null ? DateUtil.daFormat(entity.getBirthday()) : "", font));
row.addCell(createCell(entity.getEducation(), font));
row.addCell(createCell(entity.getMajor(), font));
row.addCell(createCell(entity.getGraduationAcademy(), font));
row.addCell(createCell(entity.getGraduationTime() != null ? DateUtil.daFormat(entity.getGraduationTime()) : "", font));
document.add(row);
}
document.close();
} catch (Exception e) {
log.error(e.getMessage());
}
}
private PdfPCell createCell(String value, Font font) {
PdfPCell cell = new PdfPCell();
cell.setVerticalAlignment(Element.ALIGN_CENTER);
cell.setPhrase(new Phrase(value, font));
return cell;
}
private String getKey(String key) {
Map<String, String> map = new HashMap<>();
map.put("工号", "F_EnCode");
map.put("姓名", "F_FullName");
map.put("性别", "F_Gender");
map.put("部门", "F_DepartmentName");
map.put("职务", "F_PositionName");
map.put("用工性质", "F_WorkingNature");
map.put("身份证号", "F_IDNumber");
map.put("联系电话", "F_Telephone");
map.put("出生年月", "F_Birthday");
map.put("参加工作", "F_AttendWorkTime");
map.put("最高学历", "F_Education");
map.put("所学专业", "F_Major");
map.put("毕业院校", "F_GraduationAcademy");
map.put("毕业时间", "F_GraduationTime");
return map.get(key);
}
private String getColumns(Integer key) {
Map<Integer, String> map = new HashMap<>();
map.put(1, "工号");
map.put(2, "姓名");
map.put(3, "性别");
map.put(4, "部门");
map.put(5, "职务");
map.put(6, "用工性质");
map.put(7, "身份证号");
map.put(8, "联系电话");
map.put(9, "出生年月");
map.put(10, "参加工作");
map.put(11, "最高学历");
map.put(12, "所学专业");
map.put(13, "毕业院校");
map.put(14, "毕业时间");
return map.get(key);
}
}

View File

@@ -0,0 +1,79 @@
package com.yunzhupaas.service.impl;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.service.BillRuleService;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.LeaveApplyEntity;
import com.yunzhupaas.mapper.LeaveApplyMapper;
import com.yunzhupaas.model.leaveapply.LeaveApplyForm;
import com.yunzhupaas.service.LeaveApplyService;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 流程表单【请假申请】
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-29 上午9:18
*/
@Service
public class LeaveApplyServiceImpl extends SuperServiceImpl<LeaveApplyMapper, LeaveApplyEntity> implements LeaveApplyService {
@Autowired
private BillRuleService billRuleService;
@Override
public LeaveApplyEntity getInfo(String id) {
QueryWrapper<LeaveApplyEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(LeaveApplyEntity::getId, id);
return getOne(queryWrapper);
}
@Override
@DSTransactional
public void save(String id, LeaveApplyEntity entity, LeaveApplyForm form) {
//表单信息
if (StringUtil.isEmpty(entity.getId())) {
entity.setId(id);
save(entity);
billRuleService.useBillNumber("WF_LeaveApplyNo");
} else {
entity.setId(id);
updateById(entity);
}
}
@Override
@DSTransactional
public void submit(String id, LeaveApplyEntity entity, LeaveApplyForm form) {
//表单信息
if (StringUtil.isEmpty(entity.getId())) {
entity.setId(id);
save(entity);
billRuleService.useBillNumber("WF_LeaveApplyNo");
} else {
entity.setId(id);
updateById(entity);
}
}
@Override
public void data(String id, String data) {
LeaveApplyForm leaveApplyForm = JsonUtil.getJsonToBean(data, LeaveApplyForm.class);
LeaveApplyEntity entity = JsonUtil.getJsonToBean(leaveApplyForm, LeaveApplyEntity.class);
entity.setId(id);
saveOrUpdate(entity);
}
@Override
public void delete(LeaveApplyEntity entity) {
this.removeById(entity);
}
}

View File

@@ -0,0 +1,21 @@
package com.yunzhupaas.service.impl;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.OrderEntryEntity;
import com.yunzhupaas.mapper.OrderEntryMapper;
import com.yunzhupaas.service.OrderEntryService;
import org.springframework.stereotype.Service;
/**
* 订单明细
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Service
public class OrderEntryServiceImpl extends SuperServiceImpl<OrderEntryMapper, OrderEntryEntity> implements OrderEntryService {
}

View File

@@ -0,0 +1,20 @@
package com.yunzhupaas.service.impl;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.OrderReceivableEntity;
import com.yunzhupaas.mapper.OrderReceivableMapper;
import com.yunzhupaas.service.OrderReceivableService;
import org.springframework.stereotype.Service;
/**
* 订单收款
*
* @copyright 深圳市乐程软件有限公司
* @author 云筑产品开发平台组
* @date 2024-09-26 上午9:18
*/
@Service
public class OrderReceivableServiceImpl extends SuperServiceImpl<OrderReceivableMapper, OrderReceivableEntity> implements OrderReceivableService {
}

View File

@@ -0,0 +1,271 @@
package com.yunzhupaas.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunzhupaas.base.UserInfo;
import com.yunzhupaas.base.service.BillRuleService;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.OrderEntity;
import com.yunzhupaas.entity.OrderEntryEntity;
import com.yunzhupaas.entity.OrderReceivableEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.mapper.OrderMapper;
import com.yunzhupaas.model.order.*;
import com.yunzhupaas.permission.entity.UserEntity;
import com.yunzhupaas.permission.service.UserService;
import com.yunzhupaas.service.OrderEntryService;
import com.yunzhupaas.service.OrderReceivableService;
import com.yunzhupaas.service.OrderService;
import com.yunzhupaas.util.*;
import com.yunzhupaas.workflow.service.TaskApi;
import com.yunzhupaas.workflow.service.TemplateApi;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 订单信息
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/3/15 9:19
*/
@Service
public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, OrderEntity> implements OrderService {
@Autowired
private OrderReceivableService orderReceivableService;
@Autowired
private OrderEntryService orderEntryService;
@Autowired
private BillRuleService billRuleService;
@Autowired
private UserService userService;
@Autowired
private TemplateApi templateApi;
/**
* 前单
**/
private static String PREV = "prev";
/**
* 后单
**/
private static String NEXT = "next";
@Override
public List<OrderEntity> getList(PaginationOrder paginationOrder) {
UserInfo userInfo = UserProvider.getUser();
QueryWrapper<OrderEntity> queryWrapper = new QueryWrapper<>();
//关键字(订单编码、客户名称、业务人员)
String keyWord = paginationOrder.getKeyword() != null ? paginationOrder.getKeyword() : null;
if (!StringUtils.isEmpty(keyWord)) {
String word = keyWord;
queryWrapper.lambda().and(
t -> t.like(OrderEntity::getOrderCode, word)
.or().like(OrderEntity::getCustomerName, word)
.or().like(OrderEntity::getSalesmanName, word)
);
}
//起始日期-结束日期
if (ObjectUtil.isNotEmpty(paginationOrder.getStartTime()) && ObjectUtil.isNotEmpty(paginationOrder.getEndTime())) {
queryWrapper.lambda().between(OrderEntity::getOrderDate, new Date(paginationOrder.getStartTime()), new Date(paginationOrder.getEndTime()));
}
//订单状态
String mark = paginationOrder.getEnabledMark();
if (ObjectUtil.isNotEmpty(mark)) {
queryWrapper.lambda().eq(OrderEntity::getEnabledMark, mark);
}
//流程数据查询
if (ObjectUtil.isNotEmpty(paginationOrder.getTemplateId())) {
List<String> flowIdsByTemplateId = templateApi.getFlowIdsByTemplateId(paginationOrder.getTemplateId());
queryWrapper.lambda().in(OrderEntity::getFlowId, flowIdsByTemplateId);
}
//排序
if (StringUtils.isEmpty(paginationOrder.getSidx())) {
queryWrapper.lambda().orderByDesc(OrderEntity::getCreatorTime);
} else {
queryWrapper = "asc".equals(paginationOrder.getSort().toLowerCase()) ? queryWrapper.orderByAsc(paginationOrder.getSidx()) : queryWrapper.orderByDesc(paginationOrder.getSidx());
}
Page<OrderEntity> page = new Page<>(paginationOrder.getCurrentPage(), paginationOrder.getPageSize());
IPage<OrderEntity> orderEntityPage = this.page(page, queryWrapper);
List<OrderEntity> data = orderEntityPage.getRecords();
return paginationOrder.setData(data, page.getTotal());
}
@Override
public List<OrderEntryEntity> getOrderEntryList(String id) {
QueryWrapper<OrderEntryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(OrderEntryEntity::getOrderId, id).orderByDesc(OrderEntryEntity::getSortCode);
return orderEntryService.list(queryWrapper);
}
@Override
public List<OrderReceivableEntity> getOrderReceivableList(String id) {
QueryWrapper<OrderReceivableEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(OrderReceivableEntity::getOrderId, id).orderByDesc(OrderReceivableEntity::getSortCode);
return orderReceivableService.list(queryWrapper);
}
@Override
public OrderEntity getPrevOrNextInfo(String id, String method) {
QueryWrapper<OrderEntity> result = new QueryWrapper<>();
OrderEntity orderEntity = getInfo(id);
String orderBy = "desc";
if (PREV.equals(method)) {
result.lambda().gt(OrderEntity::getCreatorTime, orderEntity.getCreatorTime());
orderBy = "";
} else if (NEXT.equals(method)) {
result.lambda().lt(OrderEntity::getCreatorTime, orderEntity.getCreatorTime());
}
result.lambda().notIn(OrderEntity::getId, orderEntity.getId());
if (StringUtil.isNotEmpty(orderBy)) {
result.lambda().orderByDesc(OrderEntity::getCreatorTime);
}
List<OrderEntity> data = this.list(result);
if (data.size() > 0) {
return data.get(0);
}
return null;
}
@Override
public OrderInfoVO getInfoVo(String id, String method) throws DataException {
OrderInfoVO infoModel = null;
OrderEntity orderEntity = this.getPrevOrNextInfo(id, method);
if (orderEntity != null) {
List<OrderEntryEntity> orderEntryList = this.getOrderEntryList(orderEntity.getId());
List<OrderReceivableEntity> orderReceivableList = this.getOrderReceivableList(orderEntity.getId());
infoModel = JsonUtilEx.getJsonToBeanEx(orderEntity, OrderInfoVO.class);
UserEntity createUser = null;
if (StringUtil.isNotEmpty(infoModel.getCreatorUserId())) {
createUser = userService.getInfo(infoModel.getCreatorUserId());
}
infoModel.setCreatorUserId(createUser != null ? createUser.getRealName() + "/" + createUser.getAccount() : "");
UserEntity lastUser = null;
if (StringUtil.isNotEmpty(infoModel.getLastModifyUserId())) {
lastUser = userService.getInfo(infoModel.getLastModifyUserId());
}
infoModel.setLastModifyUserId(lastUser != null ? lastUser.getRealName() + "/" + lastUser.getAccount() : "");
List<OrderInfoOrderEntryModel> orderEntryModels = JsonUtil.getJsonToList(orderEntryList, OrderInfoOrderEntryModel.class);
infoModel.setGoodsList(orderEntryModels);
List<OrderInfoOrderReceivableModel> orderReceivableModels = JsonUtil.getJsonToList(orderReceivableList, OrderInfoOrderReceivableModel.class);
infoModel.setCollectionPlanList(orderReceivableModels);
}
return infoModel;
}
@Override
public OrderEntity getInfo(String id) {
QueryWrapper<OrderEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(OrderEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void delete(OrderEntity entity) {
QueryWrapper<OrderEntity> orderWrapper = new QueryWrapper<>();
orderWrapper.lambda().eq(OrderEntity::getId, entity.getId());
this.remove(orderWrapper);
QueryWrapper<OrderEntryEntity> entryWrapper = new QueryWrapper<>();
entryWrapper.lambda().eq(OrderEntryEntity::getOrderId, entity.getId());
orderEntryService.remove(entryWrapper);
QueryWrapper<OrderReceivableEntity> receivableWrapper = new QueryWrapper<>();
receivableWrapper.lambda().eq(OrderReceivableEntity::getOrderId, entity.getId());
orderReceivableService.remove(receivableWrapper);
}
@Override
@DSTransactional
public void create(OrderEntity entity, List<OrderEntryEntity> orderEntryList, List<OrderReceivableEntity> orderReceivableList) {
entity.setCreatorUserId(UserProvider.getUser().getUserId());
entity.setEnabledMark(1);
for (int i = 0; i < orderEntryList.size(); i++) {
orderEntryList.get(i).setId(RandomUtil.uuId());
orderEntryList.get(i).setOrderId(entity.getId());
orderEntryList.get(i).setSortCode(Long.parseLong(i + ""));
orderEntryService.save(orderEntryList.get(i));
}
for (int i = 0; i < orderReceivableList.size(); i++) {
orderReceivableList.get(i).setId(RandomUtil.uuId());
orderReceivableList.get(i).setOrderId(entity.getId());
orderReceivableList.get(i).setSortCode(Long.parseLong(i + ""));
orderReceivableService.save(orderReceivableList.get(i));
}
billRuleService.useBillNumber("OrderNumber");
this.save(entity);
}
@Override
@DSTransactional
public boolean update(String id, OrderEntity entity, List<OrderEntryEntity> orderEntryList, List<OrderReceivableEntity> orderReceivableList) {
entity.setId(id);
entity.setLastModifyTime(new Date());
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
QueryWrapper<OrderEntryEntity> entryWrapper = new QueryWrapper<>();
entryWrapper.lambda().eq(OrderEntryEntity::getOrderId, entity.getId());
orderEntryService.remove(entryWrapper);
QueryWrapper<OrderReceivableEntity> receivableWrapper = new QueryWrapper<>();
receivableWrapper.lambda().eq(OrderReceivableEntity::getOrderId, entity.getId());
orderReceivableService.remove(receivableWrapper);
for (int i = 0; i < orderEntryList.size(); i++) {
orderEntryList.get(i).setId(RandomUtil.uuId());
orderEntryList.get(i).setOrderId(entity.getId());
orderEntryList.get(i).setSortCode(Long.parseLong(i + ""));
orderEntryService.save(orderEntryList.get(i));
}
for (int i = 0; i < orderReceivableList.size(); i++) {
orderReceivableList.get(i).setId(RandomUtil.uuId());
orderReceivableList.get(i).setOrderId(entity.getId());
orderReceivableList.get(i).setSortCode(Long.parseLong(i + ""));
orderReceivableService.save(orderReceivableList.get(i));
}
boolean flag = this.updateById(entity);
return flag;
}
@Override
public void data(String id, String data) {
OrderForm orderForm = JsonUtil.getJsonToBean(data, OrderForm.class);
OrderEntity entity = JsonUtil.getJsonToBean(orderForm, OrderEntity.class);
List<OrderEntryModel> goodsList = orderForm.getGoodsList() != null ? orderForm.getGoodsList() : new ArrayList<>();
List<OrderEntryEntity> orderEntryList = JsonUtil.getJsonToList(goodsList, OrderEntryEntity.class);
List<OrderReceivableModel> collectionPlanList = orderForm.getCollectionPlanList() != null ? orderForm.getCollectionPlanList() : new ArrayList<>();
List<OrderReceivableEntity> orderReceivableList = JsonUtil.getJsonToList(collectionPlanList, OrderReceivableEntity.class);
entity.setId(id);
entity.setLastModifyTime(new Date());
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
QueryWrapper<OrderEntryEntity> entryWrapper = new QueryWrapper<>();
entryWrapper.lambda().eq(OrderEntryEntity::getOrderId, entity.getId());
orderEntryService.remove(entryWrapper);
QueryWrapper<OrderReceivableEntity> receivableWrapper = new QueryWrapper<>();
receivableWrapper.lambda().eq(OrderReceivableEntity::getOrderId, entity.getId());
orderReceivableService.remove(receivableWrapper);
for (int i = 0; i < orderEntryList.size(); i++) {
orderEntryList.get(i).setId(RandomUtil.uuId());
orderEntryList.get(i).setOrderId(entity.getId());
orderEntryList.get(i).setSortCode(Long.parseLong(i + ""));
orderEntryService.save(orderEntryList.get(i));
}
for (int i = 0; i < orderReceivableList.size(); i++) {
orderReceivableList.get(i).setId(RandomUtil.uuId());
orderReceivableList.get(i).setOrderId(entity.getId());
orderReceivableList.get(i).setSortCode(Long.parseLong(i + ""));
orderReceivableService.save(orderReceivableList.get(i));
}
this.saveOrUpdate(entity);
}
}

View File

@@ -0,0 +1,49 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunzhupaas.base.Pagination;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.ProductEntryEntity;
import com.yunzhupaas.mapper.ProductEntryMapper;
import com.yunzhupaas.service.ProductEntryService;
import com.yunzhupaas.util.StringUtil;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 销售订单明细
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 10:40:59
*/
@Service
public class ProductEntryServiceImpl extends SuperServiceImpl<ProductEntryMapper, ProductEntryEntity> implements ProductEntryService {
@Override
public List<ProductEntryEntity> getProductentryEntityList(String id) {
QueryWrapper<ProductEntryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProductEntryEntity::getProductId, id);
return this.list(queryWrapper);
}
@Override
public List<ProductEntryEntity> getProductentryEntityList(Pagination pagination) {
QueryWrapper<ProductEntryEntity> queryWrapper = new QueryWrapper<>();
if(StringUtil.isNotEmpty(pagination.getKeyword())){
queryWrapper.lambda().and(
t->t.like(ProductEntryEntity::getProductName, pagination.getKeyword())
.or().like(ProductEntryEntity::getProductCode, pagination.getKeyword())
.or().like(ProductEntryEntity::getProductSpecification, pagination.getKeyword())
);
}
Page<ProductEntryEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
IPage<ProductEntryEntity> userIPage = this.page(page, queryWrapper);
return pagination.setData(userIPage.getRecords(), userIPage.getTotal());
}
}

View File

@@ -0,0 +1,102 @@
package com.yunzhupaas.service.impl;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunzhupaas.entity.ProductGoodsEntity;
import com.yunzhupaas.mapper.ProductGoodsMapper;
import com.yunzhupaas.model.productgoods.ProductGoodsPagination;
import com.yunzhupaas.service.ProductGoodsService;
import com.yunzhupaas.util.RandomUtil;
import com.yunzhupaas.util.StringUtil;
import com.yunzhupaas.util.UserProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 产品商品
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 15:57:50
*/
@Service
public class ProductGoodsServiceImpl extends SuperServiceImpl<ProductGoodsMapper, ProductGoodsEntity> implements ProductGoodsService {
@Override
public List<ProductGoodsEntity> getGoodList(String type) {
QueryWrapper<ProductGoodsEntity> queryWrapper = new QueryWrapper<>();
if (StringUtil.isNotEmpty(type)) {
queryWrapper.lambda().eq(ProductGoodsEntity::getType, type);
}
return this.list(queryWrapper);
}
@Override
public List<ProductGoodsEntity> getList(ProductGoodsPagination goodsPagination) {
QueryWrapper<ProductGoodsEntity> queryWrapper = new QueryWrapper<>();
if (StringUtil.isNotEmpty(goodsPagination.getCode())) {
queryWrapper.lambda().like(ProductGoodsEntity::getEnCode, goodsPagination.getCode());
}
if (StringUtil.isNotEmpty(goodsPagination.getFullName())) {
queryWrapper.lambda().like(ProductGoodsEntity::getFullName, goodsPagination.getFullName());
}
if (StringUtil.isNotEmpty(goodsPagination.getClassifyId())) {
queryWrapper.lambda().like(ProductGoodsEntity::getClassifyId, goodsPagination.getClassifyId());
}
if (StringUtil.isNotEmpty(goodsPagination.getKeyword())) {
queryWrapper.lambda().and(
t -> t.like(ProductGoodsEntity::getFullName, goodsPagination.getKeyword())
.or().like(ProductGoodsEntity::getEnCode, goodsPagination.getKeyword())
.or().like(ProductGoodsEntity::getProductSpecification, goodsPagination.getKeyword())
);
}
//排序
if (StringUtil.isEmpty(goodsPagination.getSidx())) {
queryWrapper.lambda().orderByDesc(ProductGoodsEntity::getId);
} else {
queryWrapper = "asc".equals(goodsPagination.getSort().toLowerCase()) ? queryWrapper.orderByAsc(goodsPagination.getSidx()) : queryWrapper.orderByDesc(goodsPagination.getSidx());
}
Page<ProductGoodsEntity> page = new Page<>(goodsPagination.getCurrentPage(), goodsPagination.getPageSize());
IPage<ProductGoodsEntity> userIPage = this.page(page, queryWrapper);
return goodsPagination.setData(userIPage.getRecords(), userIPage.getTotal());
}
@Override
public ProductGoodsEntity getInfo(String id) {
QueryWrapper<ProductGoodsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProductGoodsEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(ProductGoodsEntity entity) {
entity.setId(RandomUtil.uuId());
entity.setCreatorUserId(UserProvider.getUser().getUserId());
entity.setCreatorTime(new Date());
this.save(entity);
}
@Override
public boolean update(String id, ProductGoodsEntity entity) {
entity.setId(id);
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
entity.setLastModifyTime(new Date());
return this.updateById(entity);
}
@Override
public void delete(ProductGoodsEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
}

View File

@@ -0,0 +1,130 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunzhupaas.base.UserInfo;
import com.yunzhupaas.base.service.BillRuleService;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.ProductEntity;
import com.yunzhupaas.entity.ProductEntryEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.mapper.ProductMapper;
import com.yunzhupaas.model.product.ProductPagination;
import com.yunzhupaas.service.ProductEntryService;
import com.yunzhupaas.service.ProductService;
import com.yunzhupaas.util.RandomUtil;
import com.yunzhupaas.util.StringUtil;
import com.yunzhupaas.util.UserProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* 销售订单
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 10:40:59
*/
@Service
public class ProductServiceImpl extends SuperServiceImpl<ProductMapper, ProductEntity> implements ProductService {
@Autowired
private BillRuleService billRuleService;
@Autowired
private ProductEntryService productEntryService;
@Override
public List<ProductEntity> getList(ProductPagination productPagination) {
QueryWrapper<ProductEntity> queryWrapper = new QueryWrapper<>();
if (StringUtil.isNotEmpty(productPagination.getCode())) {
queryWrapper.lambda().and(t -> t.like(ProductEntity::getEnCode, productPagination.getCode()));
}
if (StringUtil.isNotEmpty(productPagination.getCustomerName())) {
queryWrapper.lambda().and(t -> t.like(ProductEntity::getCustomerName, productPagination.getCustomerName()));
}
if (StringUtil.isNotEmpty(productPagination.getContactTel())) {
queryWrapper.lambda().and(t -> t.like(ProductEntity::getContactTel, productPagination.getContactTel()));
}
//排序
queryWrapper.lambda().orderByDesc(ProductEntity::getCreatorTime);
Page<ProductEntity> page = new Page<>(productPagination.getCurrentPage(), productPagination.getPageSize());
IPage<ProductEntity> userIPage = this.page(page, queryWrapper);
return productPagination.setData(userIPage.getRecords(), userIPage.getTotal());
}
@Override
public ProductEntity getInfo(String id) {
QueryWrapper<ProductEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProductEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(ProductEntity entity, List<ProductEntryEntity> productEntryList) throws DataException {
UserInfo userInfo = UserProvider.getUser();
String code = billRuleService.getBillNumber("OrderNumber",false);
entity.setEnCode(code);
//类型
entity.setType("市场活动");
//制单
entity.setSalesmanId(userInfo.getUserId());
entity.setSalesmanName(userInfo.getUserName());
entity.setSalesmanDate(new Date());
//状态
entity.setAuditState(1);
entity.setGoodsState(1);
entity.setCloseState(1);
entity.setCreatorUserId(userInfo.getUserId());
entity.setCreatorTime(new Date());
entity.setId(RandomUtil.uuId());
this.save(entity);
for (ProductEntryEntity product : productEntryList) {
product.setId(RandomUtil.uuId());
product.setActivity("市场部全国香风健康奢护");
product.setType("市场活动");
product.setUtil("");
product.setCommandType("唯一码");
product.setProductId(entity.getId());
productEntryService.save(product);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean update(String id, ProductEntity entity, List<ProductEntryEntity> productEntryList) {
entity.setId(id);
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
entity.setLastModifyTime(new Date());
QueryWrapper<ProductEntryEntity> entryWrapper = new QueryWrapper<>();
entryWrapper.lambda().eq(ProductEntryEntity::getProductId, entity.getId());
productEntryService.remove(entryWrapper);
for (ProductEntryEntity product : productEntryList) {
product.setId(RandomUtil.uuId());
product.setProductId(entity.getId());
productEntryService.save(product);
}
return this.updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(ProductEntity entity) {
if (entity != null) {
QueryWrapper<ProductEntryEntity> entryWrapper = new QueryWrapper<>();
entryWrapper.lambda().eq(ProductEntryEntity::getProductId, entity.getId());
productEntryService.remove(entryWrapper);
this.removeById(entity.getId());
}
}
}

View File

@@ -0,0 +1,65 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.ProductclassifyEntity;
import com.yunzhupaas.mapper.ProductclassifyMapper;
import com.yunzhupaas.service.ProductclassifyService;
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.Date;
import java.util.List;
/**
*
* 产品分类
* 版本: V3.1.0
* 版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* 作者: 云筑产品开发平台组
* 日期: 2021-07-10 14:34:04
*/
@Service
public class ProductclassifyServiceImpl extends SuperServiceImpl<ProductclassifyMapper, ProductclassifyEntity> implements ProductclassifyService {
@Override
public List<ProductclassifyEntity> getList(){
QueryWrapper<ProductclassifyEntity> queryWrapper=new QueryWrapper<>();
return list(queryWrapper);
}
@Override
public ProductclassifyEntity getInfo(String id){
QueryWrapper<ProductclassifyEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(ProductclassifyEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(ProductclassifyEntity entity){
entity.setId(RandomUtil.uuId());
entity.setCreatorUserId(UserProvider.getUser().getUserId());
entity.setCreatorTime(new Date());
this.save(entity);
}
@Override
public boolean update(String id, ProductclassifyEntity entity){
entity.setId(id);
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
entity.setLastModifyTime(new Date());
return this.updateById(entity);
}
@Override
public void delete(ProductclassifyEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
}

View File

@@ -0,0 +1,167 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.Page;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.ProjectGanttEntity;
import com.yunzhupaas.mapper.ProjectGanttMapper;
import com.yunzhupaas.service.ProjectGanttService;
import com.yunzhupaas.util.RandomUtil;
import com.yunzhupaas.util.UserProvider;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* 订单明细
*
* @author 云筑产品开发平台组
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
@Service
public class ProjectGanttServiceImpl extends SuperServiceImpl<ProjectGanttMapper, ProjectGanttEntity> implements ProjectGanttService {
@Override
public List<ProjectGanttEntity> getList(Page page) {
QueryWrapper<ProjectGanttEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProjectGanttEntity::getType, 1).orderByAsc(ProjectGanttEntity::getSortCode)
.orderByDesc(ProjectGanttEntity::getCreatorTime);
if (!StringUtils.isEmpty(page.getKeyword())) {
queryWrapper.lambda().and(
t -> t.like(ProjectGanttEntity::getEnCode, page.getKeyword())
.or().like(ProjectGanttEntity::getFullName, page.getKeyword())
);
}
return this.list(queryWrapper);
}
@Override
public List<ProjectGanttEntity> getTaskList(String projectId) {
ProjectGanttEntity entity = this.getInfo(projectId);
QueryWrapper<ProjectGanttEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProjectGanttEntity::getType, 2).eq(ProjectGanttEntity::getProjectId, projectId).orderByAsc(ProjectGanttEntity::getSortCode);
List<ProjectGanttEntity> list = this.list(queryWrapper);
list.add(entity);
return list;
}
@Override
public ProjectGanttEntity getInfo(String id) {
QueryWrapper<ProjectGanttEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProjectGanttEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public boolean allowDelete(String id) {
QueryWrapper<ProjectGanttEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().and(t ->
t.eq(ProjectGanttEntity::getParentId, id).or().eq(ProjectGanttEntity::getProjectId, id)
);
return this.list(queryWrapper).size() < 1;
}
@Override
public void delete(ProjectGanttEntity entity) {
this.removeById(entity.getId());
}
@Override
public void create(ProjectGanttEntity entity) {
entity.setId(RandomUtil.uuId());
if (entity.getEnabledMark() == null) {
entity.setEnabledMark(1);
}
entity.setSortCode(RandomUtil.parses());
entity.setCreatorUserId(UserProvider.getUser().getUserId());
this.save(entity);
}
@Override
public boolean update(String id, ProjectGanttEntity entity) {
entity.setId(id);
entity.setLastModifyTime(new Date());
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
return this.updateById(entity);
}
@Override
public boolean isExistByFullName(String fullName, String id) {
QueryWrapper<ProjectGanttEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProjectGanttEntity::getFullName, fullName);
if (!StringUtils.isEmpty(id)) {
queryWrapper.lambda().ne(ProjectGanttEntity::getId, id);
}
return this.count(queryWrapper) > 0 ? true : false;
}
@Override
public boolean isExistByEnCode(String enCode, String id) {
QueryWrapper<ProjectGanttEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProjectGanttEntity::getEnCode, enCode);
if (!StringUtils.isEmpty(id)) {
queryWrapper.lambda().ne(ProjectGanttEntity::getId, id);
}
return this.count(queryWrapper) > 0 ? true : false;
}
@Override
@Transactional
public boolean first(String id) {
boolean isOk = false;
//获取要上移的那条数据的信息
ProjectGanttEntity upEntity = this.getById(id);
Long upSortCode = upEntity.getSortCode() == null ? 0 : upEntity.getSortCode();
//查询上几条记录
QueryWrapper<ProjectGanttEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda()
.lt(ProjectGanttEntity::getSortCode, upSortCode)
.eq(ProjectGanttEntity::getParentId, upEntity.getParentId())
.orderByDesc(ProjectGanttEntity::getSortCode);
List<ProjectGanttEntity> downEntity = this.list(queryWrapper);
if (downEntity.size() > 0) {
//交换两条记录的sort值
Long temp = upEntity.getSortCode();
upEntity.setSortCode(downEntity.get(0).getSortCode());
downEntity.get(0).setSortCode(temp);
this.updateById(downEntity.get(0));
this.updateById(upEntity);
isOk = true;
}
return isOk;
}
@Override
@Transactional
public boolean next(String id) {
boolean isOk = false;
//获取要下移的那条数据的信息
ProjectGanttEntity downEntity = this.getById(id);
Long upSortCode = downEntity.getSortCode() == null ? 0 : downEntity.getSortCode();
//查询下几条记录
QueryWrapper<ProjectGanttEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda()
.gt(ProjectGanttEntity::getSortCode, upSortCode)
.eq(ProjectGanttEntity::getParentId,downEntity.getParentId())
.orderByAsc(ProjectGanttEntity::getSortCode);
List<ProjectGanttEntity> upEntity = this.list(queryWrapper);
if (upEntity.size() > 0) {
//交换两条记录的sort值
Long temp = downEntity.getSortCode();
downEntity.setSortCode(upEntity.get(0).getSortCode());
upEntity.get(0).setSortCode(temp);
this.updateById(upEntity.get(0));
this.updateById(downEntity);
isOk = true;
}
return isOk;
}
}

View File

@@ -0,0 +1,21 @@
package com.yunzhupaas.service.impl;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.SalesOrderEntryEntity;
import com.yunzhupaas.mapper.SalesOrderEntryMapper;
import com.yunzhupaas.service.SalesOrderEntryService;
import org.springframework.stereotype.Service;
/**
* 销售订单明细
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-29 上午9:18
*/
@Service
public class SalesOrderEntryServiceImpl extends SuperServiceImpl<SalesOrderEntryMapper, SalesOrderEntryEntity> implements SalesOrderEntryService {
}

View File

@@ -0,0 +1,141 @@
package com.yunzhupaas.service.impl;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.service.BillRuleService;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.SalesOrderEntity;
import com.yunzhupaas.entity.SalesOrderEntryEntity;
import com.yunzhupaas.mapper.SalesOrderMapper;
import com.yunzhupaas.model.salesorder.SalesOrderEntryEntityInfoModel;
import com.yunzhupaas.model.salesorder.SalesOrderForm;
import com.yunzhupaas.service.SalesOrderEntryService;
import com.yunzhupaas.service.SalesOrderService;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.RandomUtil;
import com.yunzhupaas.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 销售订单
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-29 上午9:18
*/
@Service
public class SalesOrderServiceImpl extends SuperServiceImpl<SalesOrderMapper, SalesOrderEntity> implements SalesOrderService {
@Autowired
private BillRuleService billRuleService;
@Autowired
private SalesOrderEntryService salesOrderEntryService;
@Override
public List<SalesOrderEntryEntity> getSalesEntryList(String id) {
QueryWrapper<SalesOrderEntryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SalesOrderEntryEntity::getSalesOrderId, id).orderByDesc(SalesOrderEntryEntity::getSortCode);
return salesOrderEntryService.list(queryWrapper);
}
@Override
public SalesOrderEntity getInfo(String id) {
QueryWrapper<SalesOrderEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SalesOrderEntity::getId, id);
return getOne(queryWrapper);
}
@Override
@DSTransactional
public void save(String id, SalesOrderEntity entity, List<SalesOrderEntryEntity> salesOrderEntryEntityList, SalesOrderForm form) {
//表单信息
if (StringUtil.isEmpty(entity.getId())) {
entity.setId(id);
for (int i = 0; i < salesOrderEntryEntityList.size(); i++) {
salesOrderEntryEntityList.get(i).setId(RandomUtil.uuId());
salesOrderEntryEntityList.get(i).setSalesOrderId(entity.getId());
salesOrderEntryEntityList.get(i).setSortCode(Long.parseLong(i + ""));
salesOrderEntryService.save(salesOrderEntryEntityList.get(i));
}
//创建
save(entity);
billRuleService.useBillNumber("WF_SalesOrderNo");
} else {
entity.setId(id);
QueryWrapper<SalesOrderEntryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SalesOrderEntryEntity::getSalesOrderId, entity.getId());
salesOrderEntryService.remove(queryWrapper);
for (int i = 0; i < salesOrderEntryEntityList.size(); i++) {
salesOrderEntryEntityList.get(i).setId(RandomUtil.uuId());
salesOrderEntryEntityList.get(i).setSalesOrderId(entity.getId());
salesOrderEntryEntityList.get(i).setSortCode(Long.parseLong(i + ""));
salesOrderEntryService.save(salesOrderEntryEntityList.get(i));
}
//编辑
updateById(entity);
}
}
@Override
@DSTransactional
public void submit(String id, SalesOrderEntity entity, List<SalesOrderEntryEntity> salesOrderEntryEntityList, SalesOrderForm form) {
//表单信息
if (StringUtil.isEmpty(entity.getId())) {
entity.setId(id);
for (int i = 0; i < salesOrderEntryEntityList.size(); i++) {
salesOrderEntryEntityList.get(i).setId(RandomUtil.uuId());
salesOrderEntryEntityList.get(i).setSalesOrderId(entity.getId());
salesOrderEntryEntityList.get(i).setSortCode(Long.parseLong(i + ""));
salesOrderEntryService.save(salesOrderEntryEntityList.get(i));
}
//创建
save(entity);
billRuleService.useBillNumber("WF_SalesOrderNo");
} else {
entity.setId(id);
QueryWrapper<SalesOrderEntryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SalesOrderEntryEntity::getSalesOrderId, entity.getId());
salesOrderEntryService.remove(queryWrapper);
for (int i = 0; i < salesOrderEntryEntityList.size(); i++) {
salesOrderEntryEntityList.get(i).setId(RandomUtil.uuId());
salesOrderEntryEntityList.get(i).setSalesOrderId(entity.getId());
salesOrderEntryEntityList.get(i).setSortCode(Long.parseLong(i + ""));
salesOrderEntryService.save(salesOrderEntryEntityList.get(i));
}
//编辑
updateById(entity);
}
}
@Override
public void data(String id, String data) {
SalesOrderForm salesOrderForm = JsonUtil.getJsonToBean(data, SalesOrderForm.class);
SalesOrderEntity entity = JsonUtil.getJsonToBean(salesOrderForm, SalesOrderEntity.class);
List<SalesOrderEntryEntityInfoModel> entryList = salesOrderForm.getEntryList() != null ? salesOrderForm.getEntryList() : new ArrayList<>();
List<SalesOrderEntryEntity> salesOrderEntryEntityList = JsonUtil.getJsonToList(entryList, SalesOrderEntryEntity.class);
entity.setId(id);
QueryWrapper<SalesOrderEntryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SalesOrderEntryEntity::getSalesOrderId, entity.getId());
salesOrderEntryService.remove(queryWrapper);
for (int i = 0; i < salesOrderEntryEntityList.size(); i++) {
salesOrderEntryEntityList.get(i).setId(RandomUtil.uuId());
salesOrderEntryEntityList.get(i).setSalesOrderId(entity.getId());
salesOrderEntryEntityList.get(i).setSortCode(Long.parseLong(i + ""));
salesOrderEntryService.save(salesOrderEntryEntityList.get(i));
}
//编辑
saveOrUpdate(entity);
}
@Override
public void delete(SalesOrderEntity entity) {
this.removeById(entity);
}
}

View File

@@ -0,0 +1,161 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.TableExampleEntity;
import com.yunzhupaas.mapper.TableExampleMapper;
import com.yunzhupaas.model.tableexample.PaginationTableExample;
import com.yunzhupaas.service.TableExampleService;
import com.yunzhupaas.util.RandomUtil;
import com.yunzhupaas.util.UserProvider;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 表格示例数据
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Service
public class TableExampleServiceImpl extends SuperServiceImpl<TableExampleMapper, TableExampleEntity> implements TableExampleService {
@Override
public List<TableExampleEntity> getList() {
QueryWrapper<TableExampleEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().orderByAsc(TableExampleEntity::getProjectType).orderByAsc(TableExampleEntity::getSortCode);
return this.list(queryWrapper);
}
@Override
public List<TableExampleEntity> getList(String keyword) {
QueryWrapper<TableExampleEntity> queryWrapper = new QueryWrapper<>();
//关键字查询
if (!StringUtils.isEmpty(keyword)){
queryWrapper.lambda().and(t->t.like(TableExampleEntity::getCustomerName,keyword)
.or().like(TableExampleEntity::getProjectName,keyword));
}
queryWrapper.lambda().orderByAsc(TableExampleEntity::getProjectType).orderByAsc(TableExampleEntity::getSortCode);
return this.list(queryWrapper);
}
@Override
public List<TableExampleEntity> getList(String typeId, PaginationTableExample paginationTableExample) {
QueryWrapper<TableExampleEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TableExampleEntity::getProjectType, typeId);
//关键字(项目编码、项目名称、客户名称)
String keyWord = paginationTableExample.getKeyword() != null ? paginationTableExample.getKeyword() : null;
if (!StringUtils.isEmpty(keyWord)) {
queryWrapper.lambda().and(
t -> t.like(TableExampleEntity::getProjectCode, keyWord)
.or().like(TableExampleEntity::getProjectName, keyWord)
.or().like(TableExampleEntity::getCustomerName, keyWord)
);
}
//标签查询
String sign = paginationTableExample.getF_Sign() != null ? paginationTableExample.getF_Sign() : null;
if (!StringUtils.isEmpty(sign)) {
String[] arraySign = sign.split(",");
for (int i = 0; i < arraySign.length; i++) {
String item = arraySign[i];
if (i == 0) {
queryWrapper.lambda().like(TableExampleEntity::getProjectCode, item);
} else {
queryWrapper.lambda().or(t -> t.like(TableExampleEntity::getProjectCode, item));
}
}
}
//排序
if (StringUtils.isEmpty(paginationTableExample.getSidx())) {
queryWrapper.lambda().orderByDesc(TableExampleEntity::getRegisterDate);
} else {
queryWrapper = "asc".equals(paginationTableExample.getSort().toLowerCase()) ? queryWrapper.orderByAsc(paginationTableExample.getSidx()) : queryWrapper.orderByDesc(paginationTableExample.getSidx());
}
return this.list(queryWrapper);
}
@Override
public List<TableExampleEntity> getList(PaginationTableExample paginationTableExample) {
QueryWrapper<TableExampleEntity> queryWrapper = new QueryWrapper<>();
// Map<String, Object> queryParam = OptimizeUtil.queryParam(pagination);
//关键字(项目编码、项目名称、客户名称)
String keyWord = paginationTableExample.getKeyword() != null ? paginationTableExample.getKeyword() : null;
if (!StringUtils.isEmpty(keyWord)) {
queryWrapper.lambda().and(
t -> t.like(TableExampleEntity::getProjectCode, keyWord)
.or().like(TableExampleEntity::getProjectName, keyWord)
.or().like(TableExampleEntity::getCustomerName, keyWord)
);
}
//标签查询
String sign = paginationTableExample.getF_Sign() != null ? paginationTableExample.getF_Sign() : null;
if (!StringUtils.isEmpty(sign)) {
String[] arraySign = sign.split(",");
for (int i = 0; i < arraySign.length; i++) {
String item = arraySign[i];
if (i == 0) {
queryWrapper.lambda().like(TableExampleEntity::getProjectCode, item);
} else {
queryWrapper.lambda().or(t -> t.like(TableExampleEntity::getProjectCode, item));
}
}
}
//排序
if (StringUtils.isEmpty(paginationTableExample.getSidx())) {
queryWrapper.lambda().orderByDesc(TableExampleEntity::getRegisterDate);
} else {
queryWrapper = "asc".equalsIgnoreCase(paginationTableExample.getSort()) ? queryWrapper.orderByAsc(paginationTableExample.getSidx()) : queryWrapper.orderByDesc(paginationTableExample.getSidx());
}
Page page=new Page(paginationTableExample.getCurrentPage(),paginationTableExample.getPageSize());
IPage<TableExampleEntity> exampleEntityIPage=this.page(page,queryWrapper);
return paginationTableExample.setData(exampleEntityIPage.getRecords(),page.getTotal());
}
@Override
public TableExampleEntity getInfo(String id) {
QueryWrapper<TableExampleEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TableExampleEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void delete(TableExampleEntity entity) {
this.removeById(entity.getId());
}
@Override
public void create(TableExampleEntity entity) {
entity.setId(RandomUtil.uuId());
entity.setSortCode(RandomUtil.parses());
entity.setRegisterDate(new Date());
entity.setRegistrant(UserProvider.getUser().getUserId());
this.save(entity);
}
@Override
public boolean update(String id, TableExampleEntity entity) {
entity.setId(id);
entity.setLastModifyTime(new Date());
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
return this.updateById(entity);
}
@Override
public boolean rowEditing(TableExampleEntity entity) {
entity.setLastModifyTime(new Date());
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
return this.updateById(entity);
}
}

View File

@@ -0,0 +1,138 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunzhupaas.base.Pagination;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.WorkLogEntity;
import com.yunzhupaas.entity.WorkLogShareEntity;
import com.yunzhupaas.mapper.WorkLogMapper;
import com.yunzhupaas.service.WorkLogService;
import com.yunzhupaas.service.WorkLogShareService;
import com.yunzhupaas.util.RandomUtil;
import com.yunzhupaas.util.StringUtil;
import com.yunzhupaas.util.UserProvider;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* 工作日志
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Service
public class WorkLogServiceImpl extends SuperServiceImpl<WorkLogMapper, WorkLogEntity> implements WorkLogService {
@Autowired
private WorkLogShareService workLogShareService;
@Override
public List<WorkLogEntity> getSendList(Pagination pageModel) {
QueryWrapper<WorkLogEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(WorkLogEntity::getCreatorUserId, UserProvider.getUser().getUserId());
//app搜索
if(StringUtil.isNotEmpty(pageModel.getKeyword())){
queryWrapper.lambda().like(WorkLogEntity::getTitle,pageModel.getKeyword());
}
//排序
if (StringUtils.isEmpty(pageModel.getSidx())) {
queryWrapper.lambda().orderByDesc(WorkLogEntity::getCreatorTime);
} else {
queryWrapper = "asc".equals(pageModel.getSort().toLowerCase()) ? queryWrapper.orderByAsc(pageModel.getSidx()) : queryWrapper.orderByDesc(pageModel.getSidx());
}
Page page = new Page(pageModel.getCurrentPage(), pageModel.getPageSize());
IPage<WorkLogEntity> IPages = this.page(page, queryWrapper);
return pageModel.setData(IPages.getRecords(), page.getTotal());
}
@Override
public List<WorkLogEntity> getReceiveList(Pagination pageModel) {
QueryWrapper<WorkLogEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().like(WorkLogEntity::getToUserId, UserProvider.getUser().getUserId());
//app搜索
if(StringUtil.isNotEmpty(pageModel.getKeyword())){
queryWrapper.lambda().like(WorkLogEntity::getTitle,pageModel.getKeyword());
}
//排序
if (StringUtils.isEmpty(pageModel.getSidx())) {
queryWrapper.lambda().orderByDesc(WorkLogEntity::getCreatorTime);
} else {
queryWrapper = "asc".equals(pageModel.getSort().toLowerCase()) ? queryWrapper.orderByAsc(pageModel.getSidx()) : queryWrapper.orderByDesc(pageModel.getSidx());
}
Page page = new Page(pageModel.getCurrentPage(), pageModel.getPageSize());
IPage<WorkLogEntity> IPages = this.page(page, queryWrapper);
return pageModel.setData(IPages.getRecords(), page.getTotal());
}
@Override
public WorkLogEntity getInfo(String id) {
QueryWrapper<WorkLogEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(WorkLogEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
@Transactional
public void create(WorkLogEntity entity) {
entity.setId(RandomUtil.uuId());
entity.setSortCode(RandomUtil.parses());
entity.setCreatorTime(new Date());
entity.setCreatorUserId(UserProvider.getUser().getUserId());
this.save(entity);
String[] toUserIds = entity.getToUserId().split(",");
for (String userIds : toUserIds) {
WorkLogShareEntity workLogShare = new WorkLogShareEntity();
workLogShare.setId(RandomUtil.uuId());
workLogShare.setShareTime(new Date());
workLogShare.setWorkLogId(entity.getId());
workLogShare.setShareUserId(userIds);
workLogShareService.save(workLogShare);
}
}
@Override
@Transactional
public boolean update(String id, WorkLogEntity entity) {
boolean flag = false;
entity.setId(id);
entity.setLastModifyTime(new Date());
entity.setLastModifyUserId(UserProvider.getUser().getUserId());
flag = this.updateById(entity);
QueryWrapper<WorkLogShareEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(WorkLogShareEntity::getWorkLogId,entity.getId());
workLogShareService.remove(queryWrapper);
String[] toUserIds = entity.getToUserId().split(",");
for (String userIds : toUserIds) {
WorkLogShareEntity workLogShare = new WorkLogShareEntity();
workLogShare.setId(RandomUtil.uuId());
workLogShare.setShareTime(new Date());
workLogShare.setWorkLogId(entity.getId());
workLogShare.setShareUserId(userIds);
workLogShareService.save(workLogShare);
}
return flag;
}
@Override
@Transactional
public void delete(WorkLogEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
QueryWrapper<WorkLogShareEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(WorkLogShareEntity::getWorkLogId,entity.getId());
workLogShareService.remove(queryWrapper);
}
}

View File

@@ -0,0 +1,22 @@
package com.yunzhupaas.service.impl;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.WorkLogShareEntity;
import com.yunzhupaas.mapper.WorkLogShareMapper;
import com.yunzhupaas.service.WorkLogShareService;
import org.springframework.stereotype.Service;
/**
* 工作日志分享
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Service
public class WorkLogShareServiceImpl extends SuperServiceImpl<WorkLogShareMapper, WorkLogShareEntity> implements WorkLogShareService {
}

View File

@@ -0,0 +1,32 @@
<?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-extend</artifactId>
<groupId>com.yunzhupaas</groupId>
<version>5.2.0-RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yunzhupaas-extend-controller</artifactId>
<dependencies>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-extend-biz</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-file-entity</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-provider</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,51 @@
package com.yunzhupaas.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.util.DownUtil;
import com.yunzhupaas.util.ServletUtil;
import com.yunzhupaas.util.ZxingCodeUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.awt.image.BufferedImage;
/**
* 生成条码
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@RestController
@Tag(name = "(待定)生成条码", description = "BarCode")
@RequestMapping("/api/extend/BarCode")
public class BarCodeController {
/**
* 生成二维码
*
* @return
*/
@Operation(summary = "生成二维码")
@GetMapping("/BuildQRCode")
public void buildQrCode() {
BufferedImage image = ZxingCodeUtil.createCode(ServletUtil.getHeader("F_QRCodeContent"), 400, 400);
DownUtil.write(image);
}
/**
* 生成条形码
*
* @return
*/
@Operation(summary = "生成条形码")
@GetMapping("/BuildBarCode")
public void buildBarCode() {
BufferedImage image = ZxingCodeUtil.getBarcode(ServletUtil.getHeader("F_BarCodeContent"), 265, 50);
DownUtil.write(image);
}
}

View File

@@ -0,0 +1,70 @@
package com.yunzhupaas.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.Pagination;
import com.yunzhupaas.base.controller.SuperController;
import com.yunzhupaas.base.vo.PageListVO;
import com.yunzhupaas.base.vo.PaginationVO;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.BigDataEntity;
import com.yunzhupaas.exception.WorkFlowException;
import com.yunzhupaas.model.bidata.BigBigDataListVO;
import com.yunzhupaas.service.BigDataService;
import com.yunzhupaas.util.JsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 大数据测试
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Tag(name = "大数据测试", description = "BigData")
@RestController
@RequestMapping("/api/extend/BigData")
public class BigDataController extends SuperController<BigDataService, BigDataEntity> {
@Autowired
private BigDataService bigDataService;
/**
* 列表
*
* @param pagination 分页模型
* @return
*/
@Operation(summary = "列表")
@GetMapping
@SaCheckPermission("extend.bigData")
public ActionResult<PageListVO<BigBigDataListVO>> list(Pagination pagination) {
List<BigDataEntity> data = bigDataService.getList(pagination);
List<BigBigDataListVO> list= JsonUtil.getJsonToList(data, BigBigDataListVO.class);
PaginationVO paginationVO = JsonUtil.getJsonToBean(pagination,PaginationVO.class);
return ActionResult.page(list,paginationVO);
}
/**
* 新建
*
* @return
*/
@Operation(summary = "添加大数据测试")
@PostMapping
@SaCheckPermission("extend.bigData")
public ActionResult create() throws WorkFlowException {
bigDataService.create(10000);
return ActionResult.success(MsgCode.ETD105.get());
}
}

View File

@@ -0,0 +1,137 @@
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.base.Pagination;
import com.yunzhupaas.base.vo.PageListVO;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.CustomerEntity;
import com.yunzhupaas.model.customer.CustomerCrForm;
import com.yunzhupaas.model.customer.CustomerInfoVO;
import com.yunzhupaas.model.customer.CustomerListVO;
import com.yunzhupaas.model.customer.CustomerUpForm;
import com.yunzhupaas.service.CustomerService;
import com.yunzhupaas.util.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
import java.util.List;
/**
* 客户信息
*
* @版本: V3.1.0
* @版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* @作者: 云筑产品开发平台组
* @日期: 2021-07-10 14:09:05
*/
@Slf4j
@RestController
@Tag(name = "客户信息", description = "Customer")
@RequestMapping("/api/extend/saleOrder/Customer")
public class CustomerController extends SuperController<CustomerService, CustomerEntity> {
@Autowired
private CustomerService customerService;
/**
* 列表
*
* @param pagination 分页模型
* @return
*/
@GetMapping
@Operation(summary = "列表")
public ActionResult<PageListVO<CustomerListVO>> list(Pagination pagination) {
pagination.setPageSize(50);
pagination.setCurrentPage(1);
List<CustomerEntity> list = customerService.getList(pagination);
List<CustomerListVO> listVO = JsonUtil.getJsonToList(list, CustomerListVO.class);
PageListVO<CustomerListVO> vo = new PageListVO<>();
vo.setList(listVO);
return ActionResult.success(vo);
}
/**
* 创建
*
* @param customerCrForm 新建模型
* @return
*/
@PostMapping
@Operation(summary = "创建")
@Parameters({
@Parameter(name = "customerCrForm", description = "客户模型", required = true),
})
public ActionResult<String> create(@RequestBody @Valid CustomerCrForm customerCrForm) {
CustomerEntity entity = JsonUtil.getJsonToBean(customerCrForm, CustomerEntity.class);
customerService.create(entity);
return ActionResult.success(MsgCode.SU001.get());
}
/**
* 信息
*
* @param id 主键
* @return
*/
@GetMapping("/{id}")
@Operation(summary = "信息")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult<CustomerInfoVO> info(@PathVariable("id") String id) {
CustomerEntity entity = customerService.getInfo(id);
CustomerInfoVO vo = JsonUtil.getJsonToBean(entity, CustomerInfoVO.class);
return ActionResult.success(vo);
}
/**
* 更新
*
* @param id 主键
* @param customerUpForm 修改模型
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
@Parameter(name = "customerUpForm", description = "客户模型", required = true),
})
public ActionResult<String> update(@PathVariable("id") String id,
@RequestBody @Valid CustomerUpForm customerUpForm) {
CustomerEntity entity = JsonUtil.getJsonToBean(customerUpForm, CustomerEntity.class);
boolean ok = customerService.update(id, entity);
if (ok) {
return ActionResult.success(MsgCode.SU004.get());
}
return ActionResult.fail(MsgCode.FA002.get());
}
/**
* 删除
*
* @param id 主键
* @return
*/
@DeleteMapping("/{id}")
@Operation(summary = "删除")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult<String> delete(@PathVariable("id") String id) {
CustomerEntity entity = customerService.getInfo(id);
if (entity != null) {
customerService.delete(entity);
}
return ActionResult.success(MsgCode.SU003.get());
}
}

View File

@@ -0,0 +1,788 @@
package com.yunzhupaas.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.xuyanwu.spring.file.storage.FileInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.Page;
import com.yunzhupaas.base.UserInfo;
import com.yunzhupaas.base.controller.SuperController;
import com.yunzhupaas.base.util.OptimizeUtil;
import com.yunzhupaas.base.vo.DownloadVO;
import com.yunzhupaas.base.vo.ListVO;
import com.yunzhupaas.config.ConfigValueUtil;
import com.yunzhupaas.constant.FileTypeConstant;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.DocumentEntity;
import com.yunzhupaas.entity.DocumentLogEntity;
import com.yunzhupaas.entity.DocumentShareEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.extend.service.DocumentApi;
import com.yunzhupaas.flowable.entity.TaskEntity;
import com.yunzhupaas.flowable.model.task.FileModel;
import com.yunzhupaas.model.MergeChunkDto;
import com.yunzhupaas.model.document.*;
import com.yunzhupaas.permission.entity.UserEntity;
import com.yunzhupaas.permission.service.UserService;
import com.yunzhupaas.service.DocumentLogService;
import com.yunzhupaas.service.DocumentService;
import com.yunzhupaas.util.*;
import com.yunzhupaas.util.treeutil.SumTree;
import com.yunzhupaas.util.treeutil.newtreeutil.TreeDotUtils;
import com.yunzhupaas.workflow.service.TaskApi;
import lombok.Cleanup;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* 文档管理
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Slf4j
@Tag(name = "知识管理", description = "Document")
@RestController
@RequestMapping("/api/extend/Document")
public class DocumentController extends SuperController<DocumentService, DocumentEntity> implements DocumentApi {
@Autowired
private DocumentService documentService;
@Autowired
private ConfigValueUtil configValueUtil;
@Autowired
private UserService userService;
@Autowired
private DocumentLogService documentLogService;
@Autowired
private TaskApi taskApi;
/**
* 列表
*
* @param id 主键
* @return
*/
@Operation(summary = "列表")
@GetMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult<DocumentInfoVO> info(@PathVariable("id") String id) throws DataException {
DocumentEntity entity = documentService.getInfo(id);
DocumentInfoVO vo = JsonUtil.getJsonToBean(entity, DocumentInfoVO.class);
//截取后缀
String[] fullName = vo.getFullName().split("\\.");
if (fullName.length > 1) {
String fullNames = "";
for (int i = 0; i < fullName.length - 1; i++) {
if (i > 0) {
fullNames += "." + fullName[i];
} else {
fullNames += fullName[i];
}
}
vo.setFullName(fullNames);
}
return ActionResult.success(vo);
}
/**
* 新建
*
* @param documentCrForm 新建模型
* @return
*/
@Operation(summary = "新建")
@PostMapping
@Parameters({
@Parameter(name = "documentCrForm", description = "知识模型", required = true),
})
public ActionResult create(@RequestBody @Valid DocumentCrForm documentCrForm) {
DocumentEntity entity = JsonUtil.getJsonToBean(documentCrForm, DocumentEntity.class);
if (documentService.isExistByFullName(documentCrForm.getFullName(), entity.getId(), documentCrForm.getParentId())) {
return ActionResult.fail(MsgCode.EXIST004.get());
}
entity.setEnabledMark(1);
documentService.create(entity);
return ActionResult.success(MsgCode.SU001.get());
}
/**
* 修改
*
* @param id 主键
* @param documentUpForm 修改模型
* @return
*/
@Operation(summary = "修改")
@PutMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
@Parameter(name = "documentUpForm", description = "知识模型", required = true),
})
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid DocumentUpForm documentUpForm) {
DocumentEntity entity = JsonUtil.getJsonToBean(documentUpForm, DocumentEntity.class);
if (documentService.isExistByFullName(documentUpForm.getFullName(), id, documentUpForm.getParentId())) {
return ActionResult.fail(MsgCode.EXIST004.get());
}
DocumentEntity info = documentService.getInfo(id);
//获取后缀名
String[] fullName = info.getFullName().split("\\.");
if (fullName.length > 1) {
entity.setFullName(entity.getFullName() + "." + fullName[fullName.length - 1]);
}
boolean flag = documentService.update(id, entity);
if (flag == false) {
return ActionResult.fail(MsgCode.FA002.get());
}
return ActionResult.success(MsgCode.SU004.get());
}
/**
* 删除
*
* @param id 主键
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult delete(@PathVariable("id") String id) {
DocumentEntity entity = documentService.getInfo(id);
if (entity != null) {
List<DocumentEntity> allList = documentService.getAllList(entity.getId());
if (allList.size() > 0) {
return ActionResult.fail(MsgCode.FA016.get());
}
documentService.delete(entity);
return ActionResult.success(MsgCode.SU003.get());
}
return ActionResult.fail(MsgCode.FA003.get());
}
/**
* 列表
*
* @return
*/
@Operation(summary = "获取知识管理列表(文件夹树)")
@PostMapping("/FolderTree")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult<ListVO<DocumentFolderTreeVO>> folderTree(@RequestBody DocumentShareForm form) {
List<DocumentEntity> data = documentService.getFolderList();
if (StringUtil.isNotEmpty(form.getIds())) {
form.getIds().forEach(t -> data.remove(documentService.getInfo(t)));
}
List<DocumentFolderTreeModel> treeList = new ArrayList<>();
DocumentFolderTreeModel model = new DocumentFolderTreeModel();
model.setId("-1");
model.setFullName("全部文档");
model.setParentId("0");
model.setIcon("0");
treeList.add(model);
for (DocumentEntity entity : data) {
DocumentFolderTreeModel treeModel = new DocumentFolderTreeModel();
treeModel.setId(entity.getId());
treeModel.setFullName(entity.getFullName());
treeModel.setParentId(entity.getParentId());
treeModel.setIcon("fa fa-folder");
treeList.add(treeModel);
}
List<SumTree<DocumentFolderTreeModel>> trees = TreeDotUtils.convertListToTreeDotFilter(treeList);
List<DocumentFolderTreeVO> listVO = JsonUtil.getJsonToList(trees, DocumentFolderTreeVO.class);
ListVO vo = new ListVO();
vo.setList(listVO);
return ActionResult.success(vo);
}
/**
* 列表(全部文档)
*
* @param page 分页模型
* @return
*/
@Operation(summary = "获取知识管理列表(全部文档)")
@GetMapping
public ActionResult<ListVO<DocumentListVO>> allList(PageDocument page) {
List<DocumentEntity> data = documentService.getAllList(page.getParentId());
if (StringUtil.isNotEmpty(page.getKeyword())) {
data = documentService.getSearchAllList(page.getKeyword());
}
List<DocumentListVO> list = JsonUtil.getJsonToList(data, DocumentListVO.class);
//读取允许文件预览类型
String allowPreviewType = configValueUtil.getAllowPreviewFileType();
String[] fileType = allowPreviewType.split(",");
for (DocumentListVO documentListVO : list) {
//文件预览类型检验
String s = Arrays.asList(fileType).stream().filter(type -> type.equals(documentListVO.getFileExtension())).findFirst().orElse(null);
documentListVO.setIsPreview(s);
}
ListVO vo = new ListVO();
vo.setList(list);
return ActionResult.success(vo);
}
/**
* 列表(我的分享)
*
* @param page 分页模型
* @return
*/
@Operation(summary = "知识管理(我的共享列表)")
@GetMapping("/Share")
public ActionResult<ListVO<DocumentListVO>> shareOutList(PageDocument page) {
List<DocumentEntity> data = documentService.getShareOutList();
if (StringUtil.isNotEmpty(page.getKeyword())) {
List<DocumentEntity> dataSearch = new ArrayList<>();
for (DocumentEntity datum : data) {
if (Objects.equals(datum.getType(), 0)) {
List<DocumentEntity> childList = new ArrayList<>();
documentService.getChildSrcList(datum.getId(), childList, 1);
List<DocumentEntity> collect = childList.stream().filter(t -> !Objects.equals(t.getType(), 0)).collect(Collectors.toList());
dataSearch.addAll(collect);
} else {
dataSearch.add(datum);
}
}
data = dataSearch.stream().distinct().filter(t -> t.getFullName().contains(page.getKeyword())).collect(Collectors.toList());
} else if (StringUtil.isNotEmpty(page.getParentId()) && !"0".equals(page.getParentId())) {
data = documentService.getAllList(page.getParentId());
}
List<DocumentListVO> list = JsonUtil.getJsonToList(data, DocumentListVO.class);
ListVO vo = new ListVO();
vo.setList(list);
return ActionResult.success(vo);
}
/**
* 列表(共享给我)
*
* @param page 分页模型
* @return
*/
@Operation(summary = "获取知识管理列表(共享给我)")
@GetMapping("/ShareTome")
public ActionResult<ListVO<DocumentListVO>> shareTomeList(PageDocument page) {
List<DocumentShareEntity> shareTomeList = documentService.getShareTomeList();
List<String> ids = shareTomeList.stream().map(DocumentShareEntity::getDocumentId).collect(Collectors.toList());
List<DocumentEntity> list = documentService.getInfoByIds(ids);
List<String> userIds = list.stream().map(t -> t.getCreatorUserId()).collect(Collectors.toList());
List<UserEntity> userNames = userService.getUserName(userIds);
List<DocumentListVO> dataRes = new ArrayList<>();
if (StringUtil.isNotEmpty(page.getParentId()) && !"0".equals(page.getParentId())) {
list = documentService.getChildList(page.getParentId(), true);
DocumentShareEntity documentShareEntity = documentService.getShareByParentId(page.getParentId());
for (DocumentEntity item : list) {
DocumentListVO documentListVO = BeanUtil.copyProperties(item, DocumentListVO.class);
if (documentShareEntity != null) {
documentListVO.setShareTime(documentShareEntity.getShareTime());
UserEntity userEntity = userNames.stream().filter(t -> t.getId().equals(documentShareEntity.getCreatorUserId())).findFirst().orElse(null);
documentListVO.setCreatorUserId(userEntity != null ? userEntity.getRealName() + "/" + userEntity.getAccount() : "");
}
dataRes.add(documentListVO);
}
} else {
for (DocumentEntity datum : list) {
if (StringUtil.isNotEmpty(page.getKeyword())) {
DocumentShareEntity documentShareEntity = shareTomeList.stream().filter(t -> t.getDocumentId().equals(datum.getId())).findFirst().orElse(null);
if (documentShareEntity != null) {
if (Objects.equals(datum.getType(), 0)) {
List<DocumentEntity> childList = new ArrayList<>();
documentService.getChildSrcList(datum.getId(), childList, 1);
for (DocumentEntity item : childList) {
DocumentListVO documentListVO = BeanUtil.copyProperties(item, DocumentListVO.class);
if (item.getFullName().contains(page.getKeyword()) && Objects.equals(item.getEnabledMark(), 1) && !Objects.equals(item.getType(), 0)) {
documentListVO.setShareTime(documentShareEntity.getShareTime());
UserEntity userEntity = userNames.stream().filter(t -> t.getId().equals(documentShareEntity.getCreatorUserId())).findFirst().orElse(null);
documentListVO.setCreatorUserId(userEntity != null ? userEntity.getRealName() + "/" + userEntity.getAccount() : "");
dataRes.add(documentListVO);
}
}
}
}
} else {
DocumentShareEntity documentShareEntity = shareTomeList.stream().filter(t -> t.getDocumentId().equals(datum.getId())).findFirst().orElse(null);
if (documentShareEntity != null) {
DocumentListVO documentListVO = BeanUtil.copyProperties(datum, DocumentListVO.class);
documentListVO.setShareTime(documentShareEntity.getShareTime());
UserEntity userEntity = userNames.stream().filter(t -> t.getId().equals(documentShareEntity.getCreatorUserId())).findFirst().orElse(null);
documentListVO.setCreatorUserId(userEntity != null ? userEntity.getRealName() + "/" + userEntity.getAccount() : "");
dataRes.add(documentListVO);
}
}
}
}
ListVO vo = new ListVO();
vo.setList(dataRes);
return ActionResult.success(vo);
}
/**
* 列表(回收站)
*
* @param page 分页模型
* @return
*/
@Operation(summary = "获取知识管理列表(回收站)")
@GetMapping("/Trash")
public ActionResult<ListVO<DocumentTrashListVO>> trashList(Page page) {
List<DocumentTrashListVO> data = documentService.getTrashList(page.getKeyword());
ListVO vo = new ListVO();
vo.setList(data);
return ActionResult.success(vo);
}
/**
* 列表(共享人员)
*
* @param documentId 文档主键
* @return
*/
@Operation(summary = "获取知识管理列表(共享人员)")
@GetMapping("/ShareUser/{documentId}")
@Parameters({
@Parameter(name = "documentId", description = "文档主键", required = true),
})
public ActionResult<ListVO<DocumentSuserListVO>> shareUserList(@PathVariable("documentId") String documentId) {
List<DocumentShareEntity> data = documentService.getShareUserList(documentId);
List<DocumentSuserListVO> list = JsonUtil.getJsonToList(data, DocumentSuserListVO.class);
ListVO vo = new ListVO();
vo.setList(list);
return ActionResult.success(vo);
}
/**
* app上传文件
*
* @param documentUploader 上传模型
* @return
*/
@Operation(summary = "知识管理上传文件")
@PostMapping("/Uploader")
public ActionResult uploader(DocumentUploader documentUploader) throws DataException {
String fileType = UpUtil.getFileType(documentUploader.getFile());
//验证类型
if (!OptimizeUtil.fileType(configValueUtil.getAllowUploadFileType(), fileType)) {
return ActionResult.fail(MsgCode.FA017.get());
}
//上传
uploaderVO(documentUploader);
return ActionResult.success(MsgCode.SU015.get());
}
/**
* 分片组装
*
* @param mergeChunkDto 合并模型
* @return
*/
@Operation(summary = "分片组装")
@PostMapping("/merge")
public ActionResult merge(MergeChunkDto mergeChunkDto) {
String identifier = XSSEscape.escapePath(mergeChunkDto.getIdentifier());
String path = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
String filePath = XSSEscape.escapePath(path + identifier);
String partFile = XSSEscape.escapePath(path + mergeChunkDto.getFileName());
try {
List<File> mergeFileList = FileUtil.getFile(new File(filePath));
@Cleanup FileOutputStream destTempfos = new FileOutputStream(partFile, true);
for (int i = 0; i < mergeFileList.size(); i++) {
String chunkName = identifier.concat("-") + (i + 1);
File files = new File(filePath, chunkName);
if (files.exists()) {
FileUtils.copyFile(files, destTempfos);
}
}
File partFiles = new File(partFile);
if (partFiles.exists()) {
MultipartFile multipartFile = FileUtil.createFileItem(partFiles);
uploaderVO(new DocumentUploader(multipartFile, mergeChunkDto.getParentId()));
FileUtil.deleteTmp(multipartFile);
}
} catch (Exception e) {
log.error("合并分片失败: {}", e.getMessage());
throw new DataException(MsgCode.FA033.get());
} finally {
FileUtils.deleteQuietly(new File(filePath));
FileUtils.deleteQuietly(new File(partFile));
}
return ActionResult.success(MsgCode.SU015.get());
}
@Operation(summary = "流程归档文件上传接口")
@PostMapping("/UploadBlob")
public ActionResult UploadBlob(DocumentUploader dub) throws DataException {
uploaderVO(dub);
taskApi.updateIsFile(dub.getTaskId());
return ActionResult.success(MsgCode.SU015.get());
}
/**
* 获取下载文件链接
*
* @param id 主键
* @return
*/
@Operation(summary = "获取下载文件链接")
@PostMapping("/Download/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult download(@PathVariable("id") String id) {
UserInfo userInfo = UserProvider.getUser();
DocumentEntity entity = documentService.getInfo(id);
if (entity != null) {
String name = entity.getFilePath();
String fileName = name + "#" + "document#" + entity.getFullName() + "." + entity.getFileExtension();
DownloadVO vo = DownloadVO.builder().name(entity.getFullName()).url(UploaderUtil.uploaderFile(fileName)).build();
return ActionResult.success(vo);
}
return ActionResult.fail(MsgCode.FA018.get());
}
/**
* 获取全部下载文件链接(打包下载)
*
* @return
*/
@Operation(summary = "打包下载")
@PostMapping("/PackDownload")
public ActionResult packDownloadUrl(@RequestBody DocumentShareForm obj) {
//单个文件直接下载
if (obj.getIds().size() == 1) {
DocumentEntity entity = documentService.getInfo(obj.getIds().get(0));
if (entity != null && !Objects.equals(entity.getType(), 0)) {
String name = entity.getFilePath();
String fileName = name + "#" + "document#" + entity.getFullName() + "." + entity.getFileExtension();
DownloadVO vo = DownloadVO.builder().name(entity.getFullName()).url(UploaderUtil.uploaderFile(fileName)).build();
return ActionResult.success(vo);
}
}
String tempFilePath = FileUploadUtils.getLocalBasePath() + FilePathUtil.getFilePath(FileTypeConstant.FILEZIPDOWNTEMPPATH);
String zipFileSrc = "我的文档" + RandomUtil.uuId();
String zipFileName = zipFileSrc + ".zip";
String mainPath = tempFilePath + zipFileSrc;
new File(mainPath).mkdirs();
//递归生成文件夹下的文件
createdFiles(obj.getIds(), mainPath);
String filePath = tempFilePath + zipFileName;
//打包
FileUtil.toZip(filePath, true, tempFilePath + zipFileSrc);
//删除源文件
FileUtil.deleteFileAll(new File(tempFilePath + zipFileSrc));
//上传压缩包到服务器
MultipartFile multipartFile = FileUtil.createFileItem(new File(XSSEscape.escapePath(filePath)));
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, FilePathUtil.getFilePath(FileTypeConstant.FILEZIPDOWNTEMPPATH), zipFileName);
// 删除压缩包
FileUtil.deleteFileAll(new File(tempFilePath + zipFileName));
//获取服务器下载路径
DownloadVO vo = DownloadVO.builder()
.name(zipFileName)
.url(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + FileTypeConstant.FILEZIPDOWNTEMPPATH))
.build();
return ActionResult.success(vo);
}
/**
* 递归获取文件夹下的文件
*
* @param fileIdList
* @param mainPath
*/
private void createdFiles(List<String> fileIdList, String mainPath) {
for (String id : fileIdList) {
DocumentEntity info = documentService.getInfo(id);
if (info != null) {
String fileId = StringUtil.isNotEmpty(info.getFilePath()) ? XSSEscape.escape(info.getFilePath()).trim() : "";
String fileName = XSSEscape.escapePath(info.getFullName()).trim();
if (Objects.equals(info.getType(), 0)) {
//文件夹
File file = new File(mainPath + "/" + fileName);
if (!file.exists()) {
file.mkdir();
}
List<DocumentEntity> allList = documentService.getChildList(id, true);
List<String> collect = allList.stream().map(DocumentEntity::getId).collect(Collectors.toList());
createdFiles(collect, mainPath + "/" + fileName);
} else {
try {
//文件
byte[] bytes = FileUploadUtils.downloadFileByte(FilePathUtil.getFilePath(FileTypeConstant.DOCUMENT), fileId, false);
FileUtils.writeByteArrayToFile(new File(mainPath + "/" + fileName), bytes);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
/**
* 批量删除
*/
@Operation(summary = "批量删除")
@PostMapping("/BatchDelete")
@Parameters({
@Parameter(name = "ids", description = "主键", required = true),
})
public ActionResult BatchDelete(@RequestBody DocumentShareForm obj) {
for (String id : obj.getIds()) {
DocumentEntity entity = documentService.getInfo(id);
if (entity != null) {
List<DocumentEntity> allList = new ArrayList<>();
documentService.getChildSrcList(entity.getId(), allList, 1);
allList.add(entity);
//添加删除记录
DocumentLogEntity logent = new DocumentLogEntity();
logent.setDocumentId(id);
List<String> collect = allList.stream().map(DocumentEntity::getId).collect(Collectors.toList());
logent.setChildDocument(collect.stream().collect(Collectors.joining(",")));
documentLogService.save(logent);
for (DocumentEntity item : allList) {
documentService.delete(item);
}
}
}
return ActionResult.success(MsgCode.SU003.get());
}
/**
* 回收站(彻底删除)
*
* @return
*/
@Operation(summary = "回收站(彻底删除)")
@PostMapping("/Trash")
@Parameters({
@Parameter(name = "ids", description = "主键数组", required = true),
})
public ActionResult trashdelete(@RequestBody DocumentShareForm obj) {
documentService.trashdelete(obj.getIds());
return ActionResult.success(MsgCode.SU003.get());
}
/**
* 回收站(还原文件)
*
* @return
*/
@Operation(summary = "回收站(还原文件)")
@PostMapping("/Trash/Actions/Recovery")
@Parameters({
@Parameter(name = "ids", description = "主键数组", required = true),
})
@Transactional
public ActionResult trashRecovery(@RequestBody DocumentShareForm obj) {
documentService.trashRecoveryConstainSrc(obj.getIds());
return ActionResult.success(MsgCode.SU010.get());
}
/**
* 共享文件(创建)
*
* @param documentShareForm 分享模型
* @return
*/
@Operation(summary = "分享文件/文件夹")
@PostMapping("/Actions/Share")
@Parameters({
@Parameter(name = "documentShareForm", description = "分享模型", required = true),
})
public ActionResult shareCreate(@RequestBody DocumentShareForm documentShareForm) {
documentService.sharecreate(documentShareForm);
return ActionResult.success(MsgCode.SU005.get());
}
/**
* 取消共享
*
* @param obj 主键值
* @return
*/
@Operation(summary = "取消分享文件/文件夹")
@PostMapping("/Actions/CancelShare")
@Parameters({
@Parameter(name = "ids", description = "主键", required = true),
})
public ActionResult shareCancel(@RequestBody DocumentShareForm obj) {
documentService.shareCancel(obj.getIds());
return ActionResult.success(MsgCode.SU005.get());
}
@Operation(summary = "共享用户调整")
@PostMapping("/Actions/ShareAdjustment/{id}")
@Parameters({
@Parameter(name = "id", description = "文档主键", required = true),
@Parameter(name = "userIds", description = "共享用户组", required = true),
})
public ActionResult shareAdjustment(@PathVariable("id") String id, @RequestBody DocumentShareForm obj) {
if (obj.getUserIds().size() > 0) {
documentService.shareAdjustment(id, obj.getUserIds());
}
return ActionResult.success(MsgCode.SU005.get());
}
@Operation(summary = "移动文件/文件夹")
@PutMapping("/Actions/MoveTo/{toId}")
@Parameters({
@Parameter(name = "ids", description = "主键", required = true),
@Parameter(name = "toId", description = "将要移动到Id", required = true),
})
@Transactional
public ActionResult moveTo(@RequestBody DocumentShareForm obj, @PathVariable("toId") String toId) {
List<String> allIds = new ArrayList<>();
allIds.addAll(obj.getIds());
List<DocumentEntity> childList = new ArrayList<>();
for (String oneId : obj.getIds()) {
documentService.getChildSrcList(oneId, childList, 1);
}
allIds.addAll(childList.stream().map(DocumentEntity::getId).collect(Collectors.toList()));
if (allIds.contains(toId)) {
return ActionResult.fail(MsgCode.ETD103.get());
}
for (String id : obj.getIds()) {
boolean flag = documentService.moveTo(id, toId);
if (flag == false) {
return ActionResult.fail(MsgCode.FA002.get());
}
}
return ActionResult.success(MsgCode.SU004.get());
}
/**
* 封装上传附件
* 流程归档-文件上传
*
* @return
*/
private void uploaderVO(DocumentUploader documentUploader) {
MultipartFile file = documentUploader.getFile();
String parentId = documentUploader.getParentId();
String taskId = documentUploader.getTaskId();
String fileName = StringUtil.isNotEmpty(documentUploader.getTaskId()) ? documentUploader.getTaskId() :
StringUtil.isNotEmpty(documentUploader.getFileName()) ? documentUploader.getFileName() : file.getOriginalFilename();
String fileType = UpUtil.getFileType(file);
String creatorUserId = "";
List<String> userList = new ArrayList<>();
if (StringUtil.isNotEmpty(taskId)) {
try { //获取流程信息
FileModel fileModel = taskApi.getFileModel(taskId);
fileName = fileModel.getFilename();
creatorUserId = fileModel.getUserId();
userList.addAll(fileModel.getUserList());
fileType = "pdf";
List<DocumentEntity> allList = documentService.getAllList("0", creatorUserId);
DocumentEntity documentEntity = allList.stream().filter(t -> Objects.equals(t.getType(), 0) && FileModel.FOLDER_NAME.equals(t.getFullName())).findFirst().orElse(null);
if (Objects.isNull(documentEntity)) {
documentEntity = new DocumentEntity();
documentEntity.setFullName(FileModel.FOLDER_NAME);
documentEntity.setType(0);
documentEntity.setParentId("0");
documentEntity.setCreatorUserId(creatorUserId);
documentService.create(documentEntity);
}
parentId = documentEntity.getId();
} catch (Exception e) {
throw new DataException(MsgCode.FA001.get());
}
}
String filePath = configValueUtil.getDocumentFilePath();
List<DocumentEntity> data = documentService.getAllList(parentId);
String finalFileName = fileName;
data = data.stream().filter(t -> finalFileName.equals(t.getFullName())).collect(Collectors.toList());
if (data.size() > 0) {
fileName = fileName.substring(0, fileName.lastIndexOf(".")) + "副本" + UUID.randomUUID().toString().substring(0, 5) + fileName.substring(fileName.lastIndexOf("."));
}
//上传
FileInfo fileInfo = null;
try {
fileInfo = FileUploadUtils.uploadFile(file.getBytes(), filePath, fileName);
} catch (IOException e) {
throw new DataException(MsgCode.FA033.get());
}
DocumentEntity entity = new DocumentEntity();
entity.setType(1);
entity.setFullName(fileName);
entity.setParentId(parentId);
entity.setFileExtension(fileType);
entity.setFilePath(fileInfo.getFilename());
entity.setFileSize(String.valueOf(file.getSize()));
entity.setCreatorUserId(creatorUserId);
entity.setEnabledMark(1);
String desc = null;
TaskEntity taskEntity = taskApi.getInfoSubmit(taskId, TaskEntity::getId, TaskEntity::getTemplateId);
if (null != taskEntity) {
desc = taskId + "-" + taskEntity.getTemplateId();
}
entity.setDescription(desc);
entity.setUploaderUrl(UploaderUtil.uploaderImg("/api/file/Image/document/", fileInfo.getFilename()));
documentService.create(entity);
if (StringUtil.isNotEmpty(taskId)) {
DocumentShareForm documentShareForm = new DocumentShareForm();
documentShareForm.setUserIds(userList);
documentShareForm.setIds(new ArrayList() {{
add(entity.getId());
}});
documentShareForm.setCreatorUserId(creatorUserId);
documentService.sharecreate(documentShareForm);
}
}
/**
* 判断是否存在归档文件
*
* @param taskId 流程任务主键
*/
public Boolean checkFlowFile(String taskId) {
QueryWrapper<DocumentEntity> wrapper = new QueryWrapper<>();
wrapper.lambda().like(DocumentEntity::getDescription, taskId);
return documentService.count(wrapper) < 1;
}
/**
* 获取归档文件
*
* @param model 参数
*/
public List<Map<String, Object>> getFlowFile(FlowFileModel model) {
return documentService.getFlowFile(model);
}
}

View File

@@ -0,0 +1,128 @@
package com.yunzhupaas.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
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.util.NoDataSourceBind;
import com.yunzhupaas.base.Page;
import com.yunzhupaas.config.ConfigValueUtil;
import com.yunzhupaas.enums.FilePreviewTypeEnum;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.model.YozoFileParams;
import com.yunzhupaas.model.YozoParams;
import com.yunzhupaas.model.FileListVO;
import com.yunzhupaas.util.*;
import com.yunzhupaas.utils.SplicingUrlUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* 文档在线预览
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-26 上午9:18
*/
@NoDataSourceBind()
@Tag(name = "文档在线预览", description = "DocumentPreview")
@RestController
@RequestMapping("/api/extend/DocumentPreview")
public class DocumentPreviewController {
@Autowired
private ConfigValueUtil configValueUtil;
/**
* 永中文件预览
*
* @param fileId 文件主键
* @param params 永中模型
* @param previewType 类型
* @return
*/
@Operation(summary = "文件预览")
@GetMapping("/{fileId}/Preview")
@Parameters({
@Parameter(name = "fileId", description = "文件主键", required = true),
@Parameter(name = "previewType", description = "类型"),
})
@SaCheckPermission("extend.documentPreview")
public ActionResult filePreview(@PathVariable("fileId") String fileId, YozoFileParams params,
@RequestParam("previewType") String previewType) {
FileListVO fileListVO = FileUploadUtils.getFileDetail(configValueUtil.getDocumentPreviewPath(), fileId);
if (fileListVO == null) {
return ActionResult.fail(MsgCode.ETD111.get());
}
if (fileListVO.getFileName() != null) {
String[] split = fileListVO.getFileName().split("/");
if (split.length > 0) {
fileListVO.setFileName(split[split.length - 1]);
}
}
String url = YozoParams.YUNZHUPAAS_DOMAINS + "/api/extend/DocumentPreview/down/" + fileListVO.getFileName();
String urlPath;
if (previewType.equals(FilePreviewTypeEnum.YOZO_ONLINE_PREVIEW.getType())) {
params.setUrl(url);
urlPath = SplicingUrlUtil.getPreviewUrl(params);
return ActionResult.success("success", XSSEscape.escape(urlPath));
}
return ActionResult.success("success", url);
}
/**
* 列表
*
* @param page 分页模型
* @return
*/
@Operation(summary = "获取文档列表")
@GetMapping
@SaCheckPermission("extend.documentPreview")
public ActionResult<List<FileListVO>> list(Page page) {
List<FileListVO> fileList = FileUploadUtils.getFileList(configValueUtil.getDocumentPreviewPath());
fileList.stream().forEach(t -> {
if (t.getFileName() != null) {
String[] split = t.getFileName().split("/");
if (split.length > 0) {
t.setFileName(split[split.length - 1]);
}
}
});
if (StringUtil.isNotEmpty(page.getKeyword())) {
fileList = fileList.stream().filter(t -> t.getFileName().contains(page.getKeyword()))
.collect(Collectors.toList());
}
return ActionResult.success(fileList);
}
/**
* 文件下载url
*
* @param fileName 名称
*/
@NoDataSourceBind()
@GetMapping("/down/{fileName}")
@Parameters({
@Parameter(name = "fileName", description = "名称", required = true),
})
public void pointDown(@PathVariable("fileName") String fileName) throws DataException {
boolean exists = FileUploadUtils.exists(configValueUtil.getDocumentPreviewPath(), fileName);
if (!exists) {
throw new DataException(MsgCode.FA006.get());
}
byte[] bytes = FileUploadUtils.downloadFileByte(configValueUtil.getDocumentPreviewPath(), fileName, false);
FileDownloadUtil.downloadFile(bytes, fileName, null);
}
}

View File

@@ -0,0 +1,353 @@
package com.yunzhupaas.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
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.base.model.MailAccount;
import com.yunzhupaas.base.util.Pop3Util;
import com.yunzhupaas.base.vo.PaginationVO;
import com.yunzhupaas.base.service.SysconfigService;
import com.yunzhupaas.base.entity.EmailConfigEntity;
import com.yunzhupaas.base.entity.EmailReceiveEntity;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.EmailSendEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.model.email.*;
import com.yunzhupaas.service.EmailReceiveService;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.JsonUtilEx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
import java.util.List;
/**
* 邮件配置
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Tag(name = "邮件收发", description = "Email")
@RestController
@RequestMapping("/api/extend/Email")
public class EmailController {
@Autowired
private EmailReceiveService emailReceiveService;
@Autowired
private Pop3Util pop3Util;
@Autowired
private SysconfigService sysconfigService;
/**
* 获取邮件列表(收件箱、标星件、草稿箱、已发送)
*
* @param paginationEmail 分页模型
* @return
*/
@Operation(summary = "获取邮件列表(收件箱、标星件、草稿箱、已发送)")
@GetMapping
@SaCheckPermission("extend.email")
public ActionResult receiveList(PaginationEmail paginationEmail) {
String type = paginationEmail.getType() != null ? paginationEmail.getType() : "inBox";
switch (type) {
case "inBox":
List<EmailReceiveEntity> entity = emailReceiveService.getReceiveList(paginationEmail);
PaginationVO paginationVO = JsonUtil.getJsonToBean(paginationEmail, PaginationVO.class);
List<EmailReceiveListVO> listVO = JsonUtil.getJsonToList(entity, EmailReceiveListVO.class);
return ActionResult.page(listVO,paginationVO);
case "star":
List<EmailReceiveEntity> entity1 = emailReceiveService.getStarredList(paginationEmail);
PaginationVO paginationVo1 = JsonUtil.getJsonToBean(paginationEmail, PaginationVO.class);
List<EmailStarredListVO> listVo1 = JsonUtil.getJsonToList(entity1, EmailStarredListVO.class);
return ActionResult.page(listVo1,paginationVo1);
case "draft":
List<EmailSendEntity> entity2 = emailReceiveService.getDraftList(paginationEmail);
PaginationVO paginationVo2 = JsonUtil.getJsonToBean(paginationEmail, PaginationVO.class);
List<EmailDraftListVO> listVo2 = JsonUtil.getJsonToList(entity2, EmailDraftListVO.class);
return ActionResult.page(listVo2,paginationVo2);
case "sent":
List<EmailSendEntity> entity3 = emailReceiveService.getSentList(paginationEmail);
PaginationVO paginationVo3 = JsonUtil.getJsonToBean(paginationEmail, PaginationVO.class);
List<EmailSentListVO> listVo3 = JsonUtil.getJsonToList(entity3, EmailSentListVO.class);
return ActionResult.page(listVo3,paginationVo3);
default:
return ActionResult.fail(MsgCode.ETD106.get());
}
}
/**
* 获取邮箱配置
*
* @return
*/
@Operation(summary = "获取邮箱配置")
@GetMapping("/Config")
@SaCheckPermission("extend.email")
public ActionResult<EmailCofigInfoVO> configInfo() {
EmailConfigEntity entity = emailReceiveService.getConfigInfo();
EmailCofigInfoVO vo = JsonUtil.getJsonToBean(entity, EmailCofigInfoVO.class);
if(vo==null){
vo=new EmailCofigInfoVO();
}
return ActionResult.success(vo);
}
/**
* 获取邮件信息
*
* @param id 主键
* @return
*/
@Operation(summary = "获取邮件信息")
@GetMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("extend.email")
public ActionResult<EmailInfoVO> info(@PathVariable("id") String id) throws DataException {
Object entity = emailReceiveService.getInfo(id);
EmailInfoVO vo = JsonUtil.getJsonToBeanEx(entity, EmailInfoVO.class);
return ActionResult.success(vo);
}
/**
* 删除
*
* @param id 主键
* @return
*/
@Operation(summary = "删除邮件")
@DeleteMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("extend.email")
public ActionResult delete(@PathVariable("id") String id) {
boolean flag= emailReceiveService.delete(id);
if(flag==false){
return ActionResult.fail(MsgCode.FA003.get());
}
return ActionResult.success(MsgCode.SU003.get());
}
/**
* 设置已读邮件
*
* @param id 主键
* @return
*/
@Operation(summary = "设置已读邮件")
@PutMapping("/{id}/Actions/Read")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("extend.email")
public ActionResult receiveRead(@PathVariable("id") String id) {
boolean flag= emailReceiveService.receiveRead(id, 1);
if(flag==false){
return ActionResult.fail(MsgCode.FA007.get());
}
return ActionResult.success(MsgCode.SU005.get());
}
/**
* 设置未读邮件
*
* @param id 主键
* @return
*/
@Operation(summary = "设置未读邮件")
@PutMapping("/{id}/Actions/Unread")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("extend.email")
public ActionResult receiveUnread(@PathVariable("id") String id) {
boolean flag= emailReceiveService.receiveRead(id, 0);
if(flag==false){
return ActionResult.fail(MsgCode.FA007.get());
}
return ActionResult.success(MsgCode.SU005.get());
}
/**
* 设置星标邮件
*
* @param id 主键
* @return
*/
@Operation(summary = "设置星标邮件")
@PutMapping("/{id}/Actions/Star")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("extend.email")
public ActionResult receiveYesStarred(@PathVariable("id") String id) {
boolean flag= emailReceiveService.receiveStarred(id, 1);
if(flag==false){
return ActionResult.fail(MsgCode.FA007.get());
}
return ActionResult.success(MsgCode.SU005.get());
}
/**
* 设置取消星标
*
* @param id 主键
* @return
*/
@Operation(summary = "设置取消星标")
@PutMapping("/{id}/Actions/Unstar")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("extend.email")
public ActionResult receiveNoStarred(@PathVariable("id") String id) {
boolean flag= emailReceiveService.receiveStarred(id, 0);
if(flag==false){
return ActionResult.fail(MsgCode.FA007.get());
}
return ActionResult.success(MsgCode.SU005.get());
}
/**
* 收邮件
*
* @return
*/
@Operation(summary = "收邮件")
@PostMapping("/Receive")
@SaCheckPermission("extend.email")
public ActionResult receive() {
EmailConfigEntity configEntity = emailReceiveService.getConfigInfo();
if (configEntity != null) {
MailAccount mailAccount = new MailAccount();
mailAccount.setAccount(configEntity.getAccount());
mailAccount.setPassword(configEntity.getPassword());
mailAccount.setPop3Host(configEntity.getPop3Host());
mailAccount.setPop3Port(configEntity.getPop3Port());
mailAccount.setSmtpHost(configEntity.getSmtpHost());
mailAccount.setSmtpPort(configEntity.getSmtpPort());
if ("1".equals(String.valueOf(configEntity.getEmailSsl()))) {
mailAccount.setSsl(true);
} else {
mailAccount.setSsl(false);
}
String checkResult=pop3Util.checkConnected(mailAccount);
if ("true".equals(checkResult)) {
int mailCount = emailReceiveService.receive(configEntity);
return ActionResult.success(MsgCode.SU005.get(), mailCount);
} else {
return ActionResult.fail(MsgCode.ETD107.get());
}
} else {
return ActionResult.fail(MsgCode.ETD108.get());
}
}
/**
* 存草稿
*
* @param emailSendCrForm 邮件模型
* @return
*/
@Operation(summary = "存草稿")
@PostMapping("/Actions/SaveDraft")
@Parameters({
@Parameter(name = "emailSendCrForm", description = "邮件模型",required = true),
})
@SaCheckPermission("extend.email")
public ActionResult saveDraft(@RequestBody @Valid EmailSendCrForm emailSendCrForm) {
EmailSendEntity entity = JsonUtil.getJsonToBean(emailSendCrForm, EmailSendEntity.class);
emailReceiveService.saveDraft(entity);
return ActionResult.success(MsgCode.SU002.get());
}
/**
* 发邮件
*
* @param emailCrForm 发送邮件模型
* @return
*/
@Operation(summary = "发邮件")
@PostMapping
@Parameters({
@Parameter(name = "emailCrForm", description = "发送邮件模型",required = true),
})
@SaCheckPermission("extend.email")
public ActionResult saveSent(@RequestBody @Valid EmailCrForm emailCrForm) {
EmailSendEntity entity = JsonUtil.getJsonToBean(emailCrForm, EmailSendEntity.class);
EmailConfigEntity configEntity = emailReceiveService.getConfigInfo();
if (configEntity != null) {
MailAccount mailAccount = new MailAccount();
mailAccount.setAccount(configEntity.getAccount());
mailAccount.setPassword(configEntity.getPassword());
mailAccount.setPop3Host(configEntity.getPop3Host());
mailAccount.setPop3Port(configEntity.getPop3Port());
mailAccount.setSmtpHost(configEntity.getSmtpHost());
mailAccount.setSmtpPort(configEntity.getSmtpPort());
if ("1".equals(String.valueOf(configEntity.getEmailSsl()))) {
mailAccount.setSsl(true);
} else {
mailAccount.setSsl(false);
}
int flag = emailReceiveService.saveSent(entity, configEntity);
if (flag == 0) {
return ActionResult.success(MsgCode.SU012.get());
} else {
return ActionResult.fail(MsgCode.ETD107.get());
}
} else {
return ActionResult.fail(MsgCode.ETD108.get());
}
}
/**
* 更新邮件配置
*
* @param emailCheckForm 邮件配置模型
* @return
*/
@Operation(summary = "更新邮件配置")
@PutMapping("/Config")
@Parameters({
@Parameter(name = "emailCheckForm", description = "邮件配置模型",required = true),
})
@SaCheckPermission("extend.email")
public ActionResult saveConfig(@RequestBody @Valid EmailCheckForm emailCheckForm) throws DataException {
EmailConfigEntity entity = JsonUtil.getJsonToBean(emailCheckForm, EmailConfigEntity.class);
emailReceiveService.saveConfig(entity);
return ActionResult.success(MsgCode.SU002.get());
}
/**
* 邮箱配置-测试连接
*
* @param emailCheckForm 邮件配置模型
* @return
*/
@Operation(summary = "邮箱配置-测试连接")
@PostMapping("/Config/Actions/CheckMail")
@Parameters({
@Parameter(name = "emailCheckForm", description = "邮件配置模型",required = true),
})
@SaCheckPermission("extend.email")
public ActionResult checkLogin(@RequestBody @Valid EmailCheckForm emailCheckForm) {
EmailConfigEntity entity = JsonUtil.getJsonToBean(emailCheckForm, EmailConfigEntity.class);
String result = sysconfigService.checkLogin(entity);
if ("true".equals(result)) {
return ActionResult.success(MsgCode.SU017.get());
} else {
return ActionResult.fail(MsgCode.ETD107.get());
}
}
}

View File

@@ -0,0 +1,519 @@
package com.yunzhupaas.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.xuyanwu.spring.file.storage.FileInfo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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.base.controller.SuperController;
import com.yunzhupaas.base.vo.DownloadVO;
import com.yunzhupaas.base.vo.PageListVO;
import com.yunzhupaas.base.vo.PaginationVO;
import com.yunzhupaas.config.ConfigValueUtil;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.EmployeeEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.exception.ImportException;
import com.yunzhupaas.model.EmployeeModel;
import com.yunzhupaas.model.employee.*;
import com.yunzhupaas.service.EmployeeService;
import com.yunzhupaas.util.*;
import lombok.Cleanup;
import lombok.extern.slf4j.Slf4j;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.JsonUtilEx;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import jakarta.validation.Valid;
import java.io.ByteArrayInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 职员信息
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
*/
@Slf4j
@Tag(name = "职员信息", description = "Employee")
@RestController
@RequestMapping("/api/extend/Employee")
public class EmployeeController extends SuperController<EmployeeService, EmployeeEntity> {
@Autowired
private EmployeeService employeeService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
* 列表(忽略验证Token)
*
* @param paginationEmployee 分页模型
* @return
*/
@Operation(summary = "获取职员列表")
@GetMapping
public ActionResult<PageListVO<EmployeeListVO>> getList(PaginationEmployee paginationEmployee) {
List<EmployeeEntity> data = employeeService.getList(paginationEmployee);
List<EmployeeListVO> list = JsonUtil.getJsonToList(data, EmployeeListVO.class);
PaginationVO paginationVO = JsonUtil.getJsonToBean(paginationEmployee, PaginationVO.class);
return ActionResult.page(list, paginationVO);
}
/**
* 信息
*
* @param id 主键
* @return
*/
@Operation(summary = "获取职员信息")
@GetMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult<EmployeeInfoVO> info(@PathVariable("id") String id) throws DataException {
EmployeeEntity entity = employeeService.getInfo(id);
EmployeeInfoVO vo = JsonUtilEx.getJsonToBeanEx(entity, EmployeeInfoVO.class);
return ActionResult.success(vo);
}
/**
* 新建
*
* @param employeeCrForm 职工模型
* @return
*/
@Operation(summary = "app添加职员信息")
@PostMapping
@Parameters({
@Parameter(name = "employeeCrForm", description = "职工模型", required = true),
})
public ActionResult create(@RequestBody @Valid EmployeeCrForm employeeCrForm) {
EmployeeEntity entity = JsonUtil.getJsonToBean(employeeCrForm, EmployeeEntity.class);
employeeService.create(entity);
return ActionResult.success(MsgCode.SU001.get());
}
/**
* 更新
*
* @param id 主键
* @param employeeUpForm 职工模型
* @return
*/
@Operation(summary = "app修改职员信息")
@PutMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
@Parameter(name = "employeeUpForm", description = "职工模型", required = true),
})
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid EmployeeUpForm employeeUpForm) {
EmployeeEntity entity = JsonUtil.getJsonToBean(employeeUpForm, EmployeeEntity.class);
employeeService.update(id, entity);
return ActionResult.success(MsgCode.SU004.get());
}
/**
* 删除
*
* @param id 主键
* @return
*/
@Operation(summary = "删除职员信息")
@DeleteMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult delete(@PathVariable("id") String id) {
EmployeeEntity entity = employeeService.getInfo(id);
if (entity != null) {
employeeService.delete(entity);
return ActionResult.success(MsgCode.SU003.get());
}
return ActionResult.fail(MsgCode.FA003.get());
}
/**
* 模板下载
*
* @return
*/
@Operation(summary = "模板下载")
@GetMapping("/TemplateDownload")
public ActionResult<DownloadVO> templateDownload() {
DownloadVO vo = DownloadVO.builder().build();
try {
vo.setName("职员信息.xlsx");
vo.setUrl(UploaderUtil.uploaderFile("/api/file/DownloadModel?encryption=", "职员信息" +
".xlsx" + "#" + "Temporary"));
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
}
return ActionResult.success(vo);
}
/**
* 导出Excel
*
* @return
*/
@Operation(summary = "导出 Excel")
@GetMapping("/ExportExcel")
@SuppressWarnings("unchecked")
public ActionResult<DownloadVO> exportExcel() {
List<EmployeeEntity> entityList = employeeService.getList();
String jsonString = JsonUtilEx.getObjectToStringDateFormat(entityList, "yyyy-MM-dd");
List<EmployeeExportVO> list = (List<EmployeeExportVO>) (List<?>) JsonUtil
.listToJsonField(JsonUtil.getJsonToList(jsonString, EmployeeExportVO.class));
List<ExcelExportEntity> entitys = new ArrayList<>();
entitys.add(new ExcelExportEntity("工号", "enCode"));
entitys.add(new ExcelExportEntity("姓名", "fullName"));
entitys.add(new ExcelExportEntity("性别", "gender"));
entitys.add(new ExcelExportEntity("部门", "departmentName"));
entitys.add(new ExcelExportEntity("职务", "positionName", 25));
entitys.add(new ExcelExportEntity("用工性质", "workingNature"));
entitys.add(new ExcelExportEntity("身份证号", "idNumber", 25));
entitys.add(new ExcelExportEntity("联系电话", "telephone", 20));
entitys.add(new ExcelExportEntity("出生年月", "birthday", 20));
entitys.add(new ExcelExportEntity("参加工作", "attendWorkTime", 20));
entitys.add(new ExcelExportEntity("最高学历", "education"));
entitys.add(new ExcelExportEntity("所学专业", "major"));
entitys.add(new ExcelExportEntity("毕业院校", "graduationAcademy"));
entitys.add(new ExcelExportEntity("毕业时间", "graduationTime", 20));
ExportParams exportParams = new ExportParams(null, "职员信息");
exportParams.setType(ExcelType.XSSF);
DownloadVO vo = DownloadVO.builder().build();
try {
@Cleanup
Workbook workbook = new HSSFWorkbook();
if (entitys.size() > 0) {
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
}
String name = "职员信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
String fileName = configValueUtil.getTemporaryFilePath() + name;
@Cleanup
FileOutputStream output = new FileOutputStream(XSSEscape.escapePath(fileName));
workbook.write(output);
vo.setName(name);
vo.setUrl(UploaderUtil.uploaderFile(name + "#" + "Temporary"));
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
}
return ActionResult.success(vo);
}
/**
* 导出Word
*
* @return
*/
@Operation(summary = "导出Word")
@GetMapping("/ExportWord")
public ActionResult<DownloadVO> exportWord() {
List<EmployeeEntity> list = employeeService.getList();
// 模板文件地址
String inputUrl = configValueUtil.getTemplateFilePath() + "employee_export_template.docx";
// 新生产的模板文件
String name = "职员信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".docx";
String outputUrl = configValueUtil.getTemporaryFilePath() + name;
List<String[]> testList = new ArrayList<>();
Map<String, String> testMap = new HashMap<>();
for (int i = 0; i < list.size(); i++) {
String[] employee = new String[13];
EmployeeEntity entity = list.get(i);
employee[0] = entity.getFullName();
employee[1] = entity.getGender();
employee[2] = entity.getDepartmentName();
employee[3] = entity.getPositionName();
employee[4] = entity.getWorkingNature();
employee[5] = entity.getIdNumber();
employee[6] = entity.getTelephone();
employee[7] = entity.getBirthday() != null ? DateUtil.daFormat(entity.getBirthday()) : "";
employee[8] = entity.getAttendWorkTime() != null ? DateUtil.daFormat(entity.getAttendWorkTime()) : "";
employee[9] = entity.getEducation();
employee[10] = entity.getMajor();
employee[11] = entity.getGraduationAcademy();
employee[12] = entity.getGraduationTime() != null ? DateUtil.daFormat(entity.getGraduationTime()) : "";
testList.add(employee);
}
WordUtil.changWord(inputUrl, outputUrl, testMap, testList);
if (FileUtil.fileIsFile(outputUrl)) {
DownloadVO vo = DownloadVO.builder().name(name).url(UploaderUtil.uploaderFile(name + "#" + "Temporary"))
.build();
return ActionResult.success(vo);
}
return ActionResult.success(MsgCode.ETD109.get());
}
/**
* 导出pdf
*
* @return
*/
@Operation(summary = "导出pdf")
@GetMapping("/ExportPdf")
public ActionResult<DownloadVO> exportPdf() {
String name = "职员信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".pdf";
String outputUrl = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath() + name;
employeeService.exportPdf(employeeService.getList(), outputUrl);
if (FileUtil.fileIsFile(outputUrl)) {
DownloadVO vo = DownloadVO.builder().name(name).url(UploaderUtil.uploaderFile(name + "#" + "Temporary"))
.build();
return ActionResult.success(vo);
}
return ActionResult.success(MsgCode.ETD109.get());
}
/**
* 导出Excel
*
* @return
*/
@Operation(summary = "导出Excel(备用)")
@GetMapping("/Excel")
public void excel() {
Map<String, Object> map = new HashMap<>();
List<EmployeeEntity> list = employeeService.getList();
TemplateExportParams param = new TemplateExportParams(
configValueUtil.getTemplateFilePath() + "employee_import_template.xlsx", true);
map.put("Employee", JSON.parse(JSONObject.toJSONStringWithDateFormat(list, "yyyy-MM-dd")));
Workbook workbook = ExcelExportUtil.exportExcel(param, map);
ExcelUtil.dowloadExcel(workbook, "职员信息.xlsx");
}
/**
* 上传文件(excel)
*
* @return
*/
@Operation(summary = "上传文件")
@PostMapping("/Uploader")
public ActionResult<DownloadVO> uploader() {
List<MultipartFile> list = UpUtil.getFileAll();
MultipartFile file = list.get(0);
if (file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls")) {
String filePath = configValueUtil.getTemporaryFilePath();
String fileName = RandomUtil.uuId() + "." + UpUtil.getFileType(file);
fileName = XSSEscape.escape(fileName);
// 上传文件
FileInfo fileInfo = FileUploadUtils.uploadFile(file, filePath, fileName);
// FileUtil.upFile(file, filePath, fileName);
DownloadVO vo = DownloadVO.builder().build();
vo.setName(fileInfo.getFilename());
return ActionResult.success(vo);
} else {
return ActionResult.fail(MsgCode.ETD110.get());
}
}
/**
* 导入预览
*
* @param fileName 文件名称
* @return
*/
@Operation(summary = "导入预览")
@GetMapping("/ImportPreview")
@Parameters({
@Parameter(name = "fileName", description = "文件名称"),
})
public ActionResult importPreview(@RequestParam("fileName") String fileName) throws ImportException {
Map<String, Object> map = new HashMap<>();
try {
String filePath = configValueUtil.getTemporaryFilePath();
@Cleanup
InputStream inputStream = new ByteArrayInputStream(
FileUploadUtils.downloadFileByte(filePath, fileName, false));
// 得到数据
List<EmployeeModel> personList = ExcelUtil.importExcelByInputStream(inputStream, 0, 1, EmployeeModel.class);
// 预览数据
map = employeeService.importPreview(personList);
} catch (Exception e) {
log.error(e.getMessage());
throw new ImportException(e.getMessage());
}
return ActionResult.success(map);
}
/**
* 导入数据
*
* @param data 职工模型
* @return
*/
@Operation(summary = "导入数据")
@PostMapping("/ImportData")
@Parameters({
@Parameter(name = "data", description = "职工模型"),
})
public ActionResult<EmployeeImportVO> importData(@RequestBody EmployeeModel data) throws Exception {
List<EmployeeModel> dataList = new ArrayList<>();
if (data.isType()) {
ActionResult result = importPreview(data.getFileName());
if (result == null) {
throw new Exception(MsgCode.FA018.get());
}
if (result.getCode() != 200) {
throw new Exception(result.getMsg());
}
if (result.getData() instanceof Map) {
Map<String, Object> dataMap = (Map<String, Object>) result.getData();
dataList = JsonUtil.getJsonToList(dataMap.get("dataRow"), EmployeeModel.class);
}
} else {
dataList = data.getList();
}
// 导入数据
EmployeeImportVO result = employeeService.importData(dataList);
return ActionResult.success(result);
}
/**
* 导出 Excel(可选字段)
*
* @param paginationEmployee 分页模型
* @return
*/
@Operation(summary = "导出 Excel可选字段")
@GetMapping("/ExportData")
@SuppressWarnings("unchecked")
public ActionResult<DownloadVO> exportExcelData(PaginationEmployee paginationEmployee) {
String dataType = paginationEmployee.getDataType();
String selectKey = paginationEmployee.getSelectKey();
List<EmployeeEntity> entityList = new ArrayList<>();
if ("0".equals(dataType)) {
entityList = employeeService.getList(paginationEmployee);
} else if ("1".equals(dataType)) {
entityList = employeeService.getList();
}
List<EmployeeModel> modeList = new ArrayList<>();
for (EmployeeEntity employeeEntity : entityList) {
EmployeeModel mode = new EmployeeModel();
mode.setEnCode(employeeEntity.getEnCode());
mode.setFullName(employeeEntity.getFullName());
mode.setGender(employeeEntity.getGender());
mode.setDepartmentName(employeeEntity.getDepartmentName());
mode.setPositionName(employeeEntity.getPositionName());
mode.setWorkingNature(employeeEntity.getWorkingNature());
mode.setIdNumber(employeeEntity.getIdNumber());
mode.setTelephone(employeeEntity.getTelephone());
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
if (employeeEntity.getBirthday() != null) {
String birthday = sf.format(employeeEntity.getBirthday());
mode.setBirthday(birthday);
}
if (employeeEntity.getAttendWorkTime() != null) {
String attendWorkTime = sf.format(employeeEntity.getAttendWorkTime());
mode.setAttendWorkTime(attendWorkTime);
}
mode.setEducation(employeeEntity.getEducation());
mode.setMajor(employeeEntity.getMajor());
mode.setGraduationAcademy(employeeEntity.getGraduationAcademy());
if (employeeEntity.getGraduationTime() != null) {
String graduationTime = sf.format(employeeEntity.getGraduationTime());
mode.setGraduationTime(graduationTime);
}
SimpleDateFormat sf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
if (employeeEntity.getCreatorTime() != null) {
String creatorTime = sf1.format(employeeEntity.getCreatorTime());
mode.setCreatorTime(creatorTime);
}
modeList.add(mode);
}
String jsonString = JsonUtilEx.getObjectToStringDateFormat(modeList, "yyyy-MM-dd");
List<EmployeeExportVO> list = (List<EmployeeExportVO>) (List<?>) JsonUtil
.listToJsonField(JsonUtil.getJsonToList(jsonString, EmployeeExportVO.class));
List<ExcelExportEntity> entitys = new ArrayList<>();
String[] splitData = selectKey.split(",");
if (splitData != null && splitData.length > 0) {
for (int i = 0; i < splitData.length; i++) {
if ("enCode".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("工号", "enCode"));
}
if ("fullName".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("姓名", "fullName"));
}
if ("gender".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("性别", "gender"));
}
if ("departmentName".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("部门", "departmentName"));
}
if ("positionName".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("职务", "positionName", 25));
}
if ("workingNature".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("用工性质", "workingNature"));
}
if ("idNumber".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("身份证号", "idNumber", 25));
}
if ("telephone".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("联系电话", "telephone", 20));
}
if ("birthday".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("出生年月", "birthday", 20));
}
if ("attendWorkTime".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("参加工作", "attendWorkTime", 20));
}
if ("education".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("最高学历", "education"));
}
if ("major".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("所学专业", "major"));
}
if ("graduationAcademy".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("毕业院校", "graduationAcademy"));
}
if ("graduationTime".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("毕业时间", "graduationTime", 20));
}
if ("creatorTime".equals(splitData[i])) {
entitys.add(new ExcelExportEntity("创建时间", "creatorTime"));
}
}
}
ExportParams exportParams = new ExportParams(null, "职员信息");
exportParams.setType(ExcelType.XSSF);
DownloadVO vo = DownloadVO.builder().build();
try {
@Cleanup
Workbook workbook = new HSSFWorkbook();
if (entitys.size() > 0) {
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
}
String name = "职员信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
// 上传文件
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, name);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, name);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + name);
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
}
return ActionResult.success(vo);
}
}

View File

@@ -0,0 +1,118 @@
package com.yunzhupaas.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.controller.SuperController;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.LeaveApplyEntity;
import com.yunzhupaas.model.leaveapply.LeaveApplyForm;
import com.yunzhupaas.model.leaveapply.LeaveApplyInfoVO;
import com.yunzhupaas.service.LeaveApplyService;
import com.yunzhupaas.util.GeneraterSwapUtil;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 请假申请
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2023/09/27
*/
@Tag(name = "请假申请", description = "LeaveApply")
@RestController
@RequestMapping("/api/extend/Form/LeaveApply")
public class LeaveApplyController extends SuperController<LeaveApplyService, LeaveApplyEntity> {
@Autowired
private LeaveApplyService leaveApplyService;
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
/**
* 获取请假申请信息
*
* @param id 主键值
* @return
*/
@Operation(summary = "获取请假申请信息")
@GetMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult<LeaveApplyInfoVO> info(@PathVariable("id") String id) {
LeaveApplyEntity entity = leaveApplyService.getInfo(id);
LeaveApplyInfoVO vo = JsonUtil.getJsonToBean(entity, LeaveApplyInfoVO.class);
return ActionResult.success(vo);
}
/**
* 新建请假申请
*
* @param leaveApplyForm 表单对象
* @return
*/
@Operation(summary = "新建请假申请")
@PostMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
@Parameter(name = "leaveApplyForm", description = "请假模型", required = true),
})
public ActionResult create(@RequestBody LeaveApplyForm leaveApplyForm, @PathVariable("id") String id) {
LeaveApplyEntity entity = JsonUtil.getJsonToBean(leaveApplyForm, LeaveApplyEntity.class);
leaveApplyService.submit(id, entity, leaveApplyForm);
return ActionResult.success(MsgCode.SU006.get());
}
/**
* 修改请假申请
*
* @param leaveApplyForm 表单对象
* @param id 主键
* @return
*/
@Operation(summary = "修改请假申请")
@PutMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
@Parameter(name = "leaveApplyForm", description = "请假模型", required = true),
})
public ActionResult update(@RequestBody LeaveApplyForm leaveApplyForm, @PathVariable("id") String id) {
LeaveApplyEntity entity = JsonUtil.getJsonToBean(leaveApplyForm, LeaveApplyEntity.class);
entity.setId(id);
leaveApplyService.submit(id, entity, leaveApplyForm);
return ActionResult.success(MsgCode.SU006.get());
}
/**
* 删除请假申请信息
*
* @param id 主键
*/
@Operation(summary = "删除请假申请信息")
@DeleteMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult delete(@PathVariable("id") String id, @RequestParam(name = "forceDel", defaultValue = "false") Boolean forceDel) {
LeaveApplyEntity entity = leaveApplyService.getInfo(id);
if (null != entity) {
if (!forceDel) {
String errMsg = generaterSwapUtil.deleteFlowTask(entity.getId());
if (StringUtil.isNotBlank(errMsg)) {
throw new RuntimeException(errMsg);
}
}
leaveApplyService.delete(entity);
return ActionResult.success(MsgCode.SU003.get());
}
return ActionResult.fail(MsgCode.FA003.get());
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,188 @@
package com.yunzhupaas.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.controller.SuperController;
import com.yunzhupaas.base.vo.ListVO;
import com.yunzhupaas.base.vo.PageListVO;
import com.yunzhupaas.base.vo.PaginationVO;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.ProductEntity;
import com.yunzhupaas.entity.ProductEntryEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.model.product.*;
import com.yunzhupaas.model.productEntry.ProductEntryInfoVO;
import com.yunzhupaas.model.productEntry.ProductEntryListVO;
import com.yunzhupaas.model.productEntry.ProductEntryMdoel;
import com.yunzhupaas.service.ProductEntryService;
import com.yunzhupaas.service.ProductService;
import com.yunzhupaas.util.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* 销售订单
*
* @版本: V3.1.0
* @版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* @作者: 云筑产品开发平台组
* @日期: 2021-07-10 10:40:59
*/
@Slf4j
@RestController
@Tag(name = "销售订单", description = "Product")
@RequestMapping("/api/extend/saleOrder/Product")
public class ProductController extends SuperController<ProductService, ProductEntity> {
@Autowired
private ProductService productService;
@Autowired
private ProductEntryService productEntryService;
/**
* 列表
*
* @param productPagination 分页模型
* @return
*/
@Operation(summary = "列表")
@GetMapping
@SaCheckPermission("saleOrder")
public ActionResult<PageListVO<ProductListVO>> list(ProductPagination productPagination) {
List<ProductEntity> list = productService.getList(productPagination);
List<ProductListVO> listVO = JsonUtil.getJsonToList(list, ProductListVO.class);
PageListVO vo = new PageListVO();
vo.setList(listVO);
PaginationVO page = JsonUtil.getJsonToBean(productPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
* 创建
*
* @param productCrForm 销售模型
* @return
*/
@Operation(summary = "创建")
@PostMapping
@Parameters({
@Parameter(name = "productCrForm", description = "销售模型",required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult create(@RequestBody @Valid ProductCrForm productCrForm) throws DataException {
ProductEntity entity = JsonUtil.getJsonToBean(productCrForm, ProductEntity.class);
List<ProductEntryEntity> productEntryList = JsonUtil.getJsonToList(productCrForm.getProductEntryList(), ProductEntryEntity.class);
productService.create(entity, productEntryList);
return ActionResult.success(MsgCode.SU001.get());
}
/**
* 信息
*
* @param id 主键
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult<ProductInfoVO> info(@PathVariable("id") String id) {
ProductEntity entity = productService.getInfo(id);
ProductInfoVO vo = JsonUtil.getJsonToBean(entity, ProductInfoVO.class);
List<ProductEntryEntity> productEntryList = productEntryService.getProductentryEntityList(id);
List<ProductEntryInfoVO> productList = JsonUtil.getJsonToList(productEntryList, ProductEntryInfoVO.class);
vo.setProductEntryList(productList);
return ActionResult.success(vo);
}
/**
* 更新
*
* @param productUpForm 销售模型
* @param id 主键
* @return
*/
@Operation(summary = "更新")
@PutMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
@Parameter(name = "productUpForm", description = "销售模型",required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid ProductUpForm productUpForm) {
ProductEntity entity = productService.getInfo(id);
if (entity != null) {
List<ProductEntryEntity> productEntryList = JsonUtil.getJsonToList(productUpForm.getProductEntryList(), ProductEntryEntity.class);
productService.update(id, entity, productEntryList);
return ActionResult.success(MsgCode.SU004.get());
} else {
return ActionResult.fail(MsgCode.FA002.get());
}
}
/**
* 删除
*
* @param id 主键
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult delete(@PathVariable("id") String id) {
ProductEntity entity = productService.getInfo(id);
if (entity != null) {
productService.delete(entity);
}
return ActionResult.success(MsgCode.SU003.get());
}
/**
* 获取销售产品明细
*
* @param id 主键
* @return
*/
@Operation(summary = "获取销售明细")
@GetMapping("/ProductEntry/{id}")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult<ListVO<ProductEntryInfoVO>> ProductEntryList(@PathVariable("id") String id) {
String data = "[{\"id\":\"37c995b4044541009fb7e285bcf9845d\",\"productSpecification\":\"120ml\",\"qty\":16,\"money\":510,\"price\":120,\"commandType\":\"唯一码\",\"util\":\"\"},{\"id\":\"2dbb11d3cde04c299985ac944d130ba0\",\"productSpecification\":\"150ml\",\"qty\":15,\"money\":520,\"price\":310,\"commandType\":\"唯一码\",\"util\":\"\"},{\"id\":\"f8ec261ccdf045e5a2e1f0e5485cda76\",\"productSpecification\":\"40ml\",\"qty\":13,\"money\":530,\"price\":140,\"commandType\":\"唯一码\",\"util\":\"\"},{\"id\":\"6c110b57ae56445faa8ce9be501c8997\",\"productSpecification\":\"103ml\",\"qty\":2,\"money\":504,\"price\":150,\"commandType\":\"唯一码\",\"util\":\"\"},{\"id\":\"f2ee981aaf934147a4d090a0eed2203f\",\"productSpecification\":\"120ml\",\"qty\":21,\"money\":550,\"price\":160,\"commandType\":\"唯一码\",\"util\":\"\"}]";
List<ProductEntryMdoel> dataAll = JsonUtil.getJsonToList(data, ProductEntryMdoel.class);
List<ProductEntryEntity> productEntryList = productEntryService.getProductentryEntityList(id);
List<ProductEntryListVO> productList = JsonUtil.getJsonToList(productEntryList, ProductEntryListVO.class);
for (ProductEntryListVO entry : productList) {
List<ProductEntryMdoel> dataList = new ArrayList<>();
Random random = new Random();
int num = random.nextInt(dataAll.size());
for (int i = 0; i < num; i++) {
dataList.add(dataAll.get(num));
}
entry.setDataList(dataList);
}
ListVO vo = new ListVO();
vo.setList(productList);
return ActionResult.success(vo);
}
}

View File

@@ -0,0 +1,180 @@
package com.yunzhupaas.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.controller.SuperController;
import com.yunzhupaas.base.vo.ListVO;
import com.yunzhupaas.base.vo.PageListVO;
import com.yunzhupaas.base.vo.PaginationVO;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.ProductGoodsEntity;
import com.yunzhupaas.model.productgoods.*;
import com.yunzhupaas.service.ProductGoodsService;
import com.yunzhupaas.util.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
import java.util.List;
/**
* 产品商品
*
* @版本: V3.1.0
* @版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* @作者: 云筑产品开发平台组
* @日期: 2021-07-10 15:57:50
*/
@Slf4j
@RestController
@Tag(name = "产品商品", description = "Goods")
@RequestMapping("/api/extend/saleOrder/Goods")
public class ProductGoodsController extends SuperController<ProductGoodsService, ProductGoodsEntity> {
@Autowired
private ProductGoodsService productgoodsService;
/**
* 列表
*
* @param type 类型
* @return
*/
@GetMapping("/getGoodList")
@Operation(summary = "列表")
@Parameters({
@Parameter(name = "type", description = "类型"),
})
@SaCheckPermission("saleOrder")
public ActionResult<ListVO<ProductGoodsListVO>> list(@RequestParam("type")String type) {
List<ProductGoodsEntity> list = productgoodsService.getGoodList(type);
List<ProductGoodsListVO> listVO = JsonUtil.getJsonToList(list, ProductGoodsListVO.class);
ListVO vo = new ListVO();
vo.setList(listVO);
return ActionResult.success(vo);
}
/**
* 列表
*
* @param goodsPagination 分页模型
* @return
*/
@GetMapping
@Operation(summary = "列表")
@SaCheckPermission("saleOrder")
public ActionResult<PageListVO<ProductGoodsListVO>> list(ProductGoodsPagination goodsPagination) {
List<ProductGoodsEntity> list = productgoodsService.getList(goodsPagination);
List<ProductGoodsListVO> listVO = JsonUtil.getJsonToList(list, ProductGoodsListVO.class);
PageListVO vo = new PageListVO();
vo.setList(listVO);
PaginationVO page = JsonUtil.getJsonToBean(goodsPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
* 创建
*
* @param goodsCrForm 商品模型
* @return
*/
@PostMapping
@Operation(summary = "创建")
@Parameters({
@Parameter(name = "goodsCrForm", description = "商品模型",required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult create(@RequestBody @Valid ProductGoodsCrForm goodsCrForm) {
ProductGoodsEntity entity = JsonUtil.getJsonToBean(goodsCrForm, ProductGoodsEntity.class);
productgoodsService.create(entity);
return ActionResult.success(MsgCode.SU001.get());
}
/**
* 信息
*
* @param id 主键
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult<ProductGoodsInfoVO> info(@PathVariable("id") String id) {
ProductGoodsEntity entity = productgoodsService.getInfo(id);
ProductGoodsInfoVO vo = JsonUtil.getJsonToBean(entity, ProductGoodsInfoVO.class);
return ActionResult.success(vo);
}
/**
* 更新
*
* @param id 主键
* @param goodsCrFormUpForm 商品模型
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
@Parameter(name = "goodsCrFormUpForm", description = "商品模型",required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid ProductGoodsUpForm goodsCrFormUpForm) {
ProductGoodsEntity entity = JsonUtil.getJsonToBean(goodsCrFormUpForm, ProductGoodsEntity.class);
boolean ok = productgoodsService.update(id, entity);
if (ok) {
return ActionResult.success(MsgCode.SU004.get());
}
return ActionResult.fail(MsgCode.FA002.get());
}
/**
* 删除
*
* @param id 主键
* @return
*/
@DeleteMapping("/{id}")
@Operation(summary = "删除")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult delete(@PathVariable("id") String id) {
ProductGoodsEntity entity = productgoodsService.getInfo(id);
if (entity != null) {
productgoodsService.delete(entity);
}
return ActionResult.success(MsgCode.SU003.get());
}
/**
* 下拉
*
* @param goodsPagination 下拉模型
* @return
*/
@GetMapping("/Selector")
@Operation(summary = "下拉")
@SaCheckPermission("saleOrder")
public ActionResult<ListVO<ProductGoodsListVO>> listSelect(ProductGoodsPagination goodsPagination) {
goodsPagination.setCurrentPage(1);
goodsPagination.setPageSize(50);
List<ProductGoodsEntity> list = productgoodsService.getList(goodsPagination);
List<ProductGoodsListVO> listVO = JsonUtil.getJsonToList(list, ProductGoodsListVO.class);
ListVO vo = new ListVO();
vo.setList(listVO);
return ActionResult.success(vo);
}
}

View File

@@ -0,0 +1,140 @@
package com.yunzhupaas.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.controller.SuperController;
import com.yunzhupaas.base.vo.ListVO;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.ProductclassifyEntity;
import com.yunzhupaas.model.productclassify.*;
import com.yunzhupaas.service.ProductclassifyService;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.treeutil.SumTree;
import com.yunzhupaas.util.treeutil.TreeDotUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
import java.util.List;
/**
* 产品分类
*
* @版本: V3.1.0
* @版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* @作者: 云筑产品开发平台组
* @日期: 2021-07-10 14:34:04
*/
@Slf4j
@RestController
@Tag(name = "产品分类", description = "Classify")
@RequestMapping("/api/extend/saleOrder/Classify")
public class ProductclassifyController extends SuperController<ProductclassifyService, ProductclassifyEntity> {
@Autowired
private ProductclassifyService productclassifyService;
/**
* 列表
*
* @return
*/
@GetMapping
@Operation(summary = "列表")
@SaCheckPermission("saleOrder")
public ActionResult<ListVO<ProductclassifyListVO>> list() {
List<ProductclassifyEntity> data = productclassifyService.getList();
List<ProductclassifyModel> modelList = JsonUtil.getJsonToList(data, ProductclassifyModel.class);
List<SumTree<ProductclassifyModel>> sumTrees = TreeDotUtils.convertListToTreeDot(modelList);
List<ProductclassifyListVO> list = JsonUtil.getJsonToList(sumTrees, ProductclassifyListVO.class);
ListVO vo = new ListVO();
vo.setList(list);
return ActionResult.success(vo);
}
/**
* 创建
*
* @param classifyCrForm 分类模型
* @return
*/
@PostMapping
@Operation(summary = "创建")
@Parameters({
@Parameter(name = "classifyCrForm", description = "分类模型", required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult create(@RequestBody @Valid ProductclassifyCrForm classifyCrForm) {
ProductclassifyEntity entity = JsonUtil.getJsonToBean(classifyCrForm, ProductclassifyEntity.class);
productclassifyService.create(entity);
return ActionResult.success(MsgCode.SU001.get());
}
/**
* 信息
*
* @param id 主键
* @return
*/
@GetMapping("/{id}")
@Operation(summary = "信息")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult<ProductclassifyInfoVO> info(@PathVariable("id") String id) {
ProductclassifyEntity entity = productclassifyService.getInfo(id);
ProductclassifyInfoVO vo = JsonUtil.getJsonToBean(entity, ProductclassifyInfoVO.class);
return ActionResult.success(vo);
}
/**
* 更新
*
* @param id 主键
* @param classifyUpForm 分类模型
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
@Parameter(name = "classifyUpForm", description = "分类模型", required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid ProductclassifyUpForm classifyUpForm) {
ProductclassifyEntity entity = JsonUtil.getJsonToBean(classifyUpForm, ProductclassifyEntity.class);
boolean ok = productclassifyService.update(id, entity);
if (ok) {
return ActionResult.success(MsgCode.SU004.get());
}
return ActionResult.fail(MsgCode.FA002.get());
}
/**
* 删除
*
* @param id 主键
* @return
*/
@DeleteMapping("/{id}")
@Operation(summary = "删除")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("saleOrder")
public ActionResult delete(@PathVariable("id") String id) {
ProductclassifyEntity entity = productclassifyService.getInfo(id);
if (entity != null) {
productclassifyService.delete(entity);
}
return ActionResult.success(MsgCode.SU003.get());
}
}

View File

@@ -0,0 +1,323 @@
package com.yunzhupaas.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.annotation.EncryptApi;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.Page;
import com.yunzhupaas.base.controller.SuperController;
import com.yunzhupaas.base.vo.ListVO;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.ProjectGanttEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.model.projectgantt.*;
import com.yunzhupaas.permission.entity.UserEntity;
import com.yunzhupaas.permission.service.UserService;
import com.yunzhupaas.service.ProjectGanttService;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.JsonUtilEx;
import com.yunzhupaas.util.UploaderUtil;
import com.yunzhupaas.util.treeutil.ListToTreeUtil;
import com.yunzhupaas.util.treeutil.SumTree;
import com.yunzhupaas.util.treeutil.TreeDotUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 项目计划
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Tag(name = "项目计划", description = "ProjectGantt")
@RestController
@RequestMapping("/api/extend/ProjectGantt")
public class ProjectGanttController extends SuperController<ProjectGanttService, ProjectGanttEntity> {
@Autowired
private ProjectGanttService projectGanttService;
@Autowired
private UserService userService;
/**
* 项目列表
*
* @param page 分页模型
* @return
*/
@Operation(summary = "获取项目管理列表")
@GetMapping
@SaCheckPermission("extend.projectGantt")
public ActionResult<ListVO<ProjectGanttListVO>> list(Page page) {
List<ProjectGanttEntity> data = projectGanttService.getList(page);
List<ProjectGanttListVO> list = JsonUtil.getJsonToList(data, ProjectGanttListVO.class);
//获取用户给项目参与人员列表赋值
List<String> userId = new ArrayList<>();
list.forEach(t -> {
String[] ids = t.getManagerIds().split(",");
Collections.addAll(userId, ids);
});
List<UserEntity> userList = userService.getUserName(userId);
for (ProjectGanttListVO vo : list) {
List<String> managerList = new ArrayList<>();
Collections.addAll(managerList, vo.getManagerIds().split(","));
List<UserEntity> user = userList.stream().filter(t -> managerList.contains(t.getId())).collect(Collectors.toList());
List<ProjectGanttManagerIModel> list1 = new ArrayList<>();
user.forEach(t -> {
ProjectGanttManagerIModel model1 = new ProjectGanttManagerIModel();
model1.setAccount(t.getRealName() + "/" + t.getAccount());
model1.setHeadIcon(UploaderUtil.uploaderImg(t.getHeadIcon()));
list1.add(model1);
});
vo.setManagersInfo(list1);
}
ListVO listVO = new ListVO<>();
listVO.setList(list);
return ActionResult.success(listVO);
}
/**
* 任务列表
*
* @param page 分页模型
* @param projectId 主键
* @return
*/
@Operation(summary = "获取项目任务列表")
@GetMapping("/{projectId}/Task")
@Parameters({
@Parameter(name = "projectId", description = "主键",required = true),
})
@SaCheckPermission("extend.projectGantt")
public ActionResult<ListVO<ProjectGanttTaskTreeVO>> taskList(Page page, @PathVariable("projectId") String projectId) {
List<ProjectGanttEntity> data = projectGanttService.getTaskList(projectId);
List<ProjectGanttEntity> dataAll = data;
if (!StringUtils.isEmpty(page.getKeyword())) {
data = data.stream().filter(t -> String.valueOf(t.getFullName()).contains(page.getKeyword()) || String.valueOf(t.getEnCode()).contains(page.getKeyword())).collect(Collectors.toList());
}
List<ProjectGanttEntity> list = JsonUtil.getJsonToList(ListToTreeUtil.treeWhere(data, dataAll), ProjectGanttEntity.class);
List<ProjectGanttTreeModel> treeList = JsonUtil.getJsonToList(list, ProjectGanttTreeModel.class);
List<SumTree<ProjectGanttTreeModel>> trees = TreeDotUtils.convertListToTreeDot(treeList);
List<ProjectGanttTaskTreeVO> listVO = JsonUtil.getJsonToList(trees, ProjectGanttTaskTreeVO.class);
ListVO vo = new ListVO();
vo.setList(listVO);
return ActionResult.success(vo);
}
/**
* 任务树形
*
* @param projectId 主键
* @param id 主键
* @return
*/
@Operation(summary = "获取项目计划任务树形(新建任务)")
@GetMapping("/{projectId}/Task/Selector/{id}")
@Parameters({
@Parameter(name = "projectId", description = "主键",required = true),
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("extend.projectGantt")
public ActionResult<ListVO<ProjectGanttTaskTreeVO>> taskTreeView(@PathVariable("projectId") String projectId, @PathVariable("id") String id) {
List<ProjectGanttTaskTreeModel> treeList = new ArrayList<>();
List<ProjectGanttEntity> data = projectGanttService.getTaskList(projectId);
if (!"0".equals(id)) {
//上级不能选择自己
data.remove(projectGanttService.getInfo(id));
}
for (ProjectGanttEntity entity : data) {
ProjectGanttTaskTreeModel treeModel = new ProjectGanttTaskTreeModel();
treeModel.setId(entity.getId());
treeModel.setFullName(entity.getFullName());
treeModel.setParentId(entity.getParentId());
treeList.add(treeModel);
}
List<SumTree<ProjectGanttTaskTreeModel>> trees = TreeDotUtils.convertListToTreeDotFilter(treeList);
List<ProjectGanttTaskTreeVO> listVO = JsonUtil.getJsonToList(trees, ProjectGanttTaskTreeVO.class);
ListVO vo = new ListVO();
vo.setList(listVO);
return ActionResult.success(vo);
}
/**
* 信息
*
* @param id 主键
* @return
*/
@Operation(summary = "获取项目计划信息")
@GetMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("extend.projectGantt")
public ActionResult<ProjectGanttInfoVO> info(@PathVariable("id") String id) throws DataException {
ProjectGanttEntity entity = projectGanttService.getInfo(id);
ProjectGanttInfoVO vo = JsonUtil.getJsonToBeanEx(entity, ProjectGanttInfoVO.class);
return ActionResult.success(vo);
}
/**
* 信息
*
* @param id 主键
* @return
*/
@Operation(summary = "获取项目计划信息")
@GetMapping("Task/{id}")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("extend.projectGantt")
public ActionResult<ProjectGanttTaskInfoVO> taskInfo(@PathVariable("id") String id) throws DataException {
ProjectGanttEntity entity = projectGanttService.getInfo(id);
ProjectGanttTaskInfoVO vo = JsonUtil.getJsonToBeanEx(entity, ProjectGanttTaskInfoVO.class);
return ActionResult.success(vo);
}
/**
* 删除
*
* @param id 主键
* @return
*/
@Operation(summary = "删除项目计划/任务")
@DeleteMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("extend.projectGantt")
public ActionResult delete(@PathVariable("id") String id) {
if (projectGanttService.allowDelete(id)) {
ProjectGanttEntity entity = projectGanttService.getInfo(id);
if (entity != null) {
projectGanttService.delete(entity);
return ActionResult.success(MsgCode.SU003.get());
}
return ActionResult.fail(MsgCode.FA003.get());
} else {
return ActionResult.fail(MsgCode.ETD112.get());
}
}
/**
* 创建
*
* @param projectGanttCrForm 项目模型
* @return
*/
@EncryptApi
@Operation(summary = "添加项目计划")
@PostMapping
@Parameters({
@Parameter(name = "projectGanttCrForm", description = "项目模型",required = true),
})
@SaCheckPermission("extend.projectGantt")
public ActionResult create(@RequestBody @Valid ProjectGanttCrForm projectGanttCrForm) {
ProjectGanttEntity entity = JsonUtil.getJsonToBean(projectGanttCrForm, ProjectGanttEntity.class);
entity.setType(1);
entity.setParentId("0");
if (projectGanttService.isExistByFullName(projectGanttCrForm.getFullName(), entity.getId())) {
return ActionResult.fail(MsgCode.EXIST001.get());
}
if (projectGanttService.isExistByEnCode(projectGanttCrForm.getEnCode(), entity.getId())) {
return ActionResult.fail(MsgCode.EXIST002.get());
}
projectGanttService.create(entity);
return ActionResult.success(MsgCode.SU001.get());
}
/**
* 编辑
*
* @param id 主键
* @param projectGanttUpForm 项目模型
* @return
*/
@Operation(summary = "修改项目计划")
@PutMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键",required = true),
@Parameter(name = "projectGanttUpForm", description = "项目模型",required = true),
})
@SaCheckPermission("extend.projectGantt")
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid ProjectGanttUpForm projectGanttUpForm) {
ProjectGanttEntity entity = JsonUtil.getJsonToBean(projectGanttUpForm, ProjectGanttEntity.class);
if (projectGanttService.isExistByFullName(projectGanttUpForm.getFullName(), id)) {
return ActionResult.fail(MsgCode.EXIST001.get());
}
if (projectGanttService.isExistByEnCode(projectGanttUpForm.getEnCode(), id)) {
return ActionResult.fail(MsgCode.EXIST002.get());
}
boolean flag = projectGanttService.update(id, entity);
if (flag == false) {
return ActionResult.fail(MsgCode.FA002.get());
}
return ActionResult.success(MsgCode.SU004.get());
}
/**
* 创建
*
* @param projectGanttTsakCrForm 项目模型
* @return
*/
@Operation(summary = "添加项目任务")
@PostMapping("/Task")
@Parameters({
@Parameter(name = "projectGanttTsakCrForm", description = "项目模型",required = true),
})
@SaCheckPermission("extend.projectGantt")
public ActionResult createTask(@RequestBody @Valid ProjectGanttTsakCrForm projectGanttTsakCrForm) {
ProjectGanttEntity entity = JsonUtil.getJsonToBean(projectGanttTsakCrForm, ProjectGanttEntity.class);
entity.setType(2);
if (projectGanttService.isExistByFullName(projectGanttTsakCrForm.getFullName(), entity.getId())) {
return ActionResult.fail(MsgCode.EXIST001.get());
}
projectGanttService.create(entity);
return ActionResult.success(MsgCode.SU001.get());
}
/**
* 编辑
*
* @param id 主键
* @param projectGanttTsakCrForm 项目模型
* @return
*/
@Operation(summary = "修改项目任务")
@PutMapping("/Task/{id}")
@Parameters({
@Parameter(name = "projectGanttTsakCrForm", description = "项目模型",required = true),
@Parameter(name = "id", description = "主键",required = true),
})
@SaCheckPermission("extend.projectGantt")
public ActionResult updateTask(@PathVariable("id") String id, @RequestBody @Valid ProjectGanttTsakUpForm projectGanttTsakCrForm) {
ProjectGanttEntity entity = JsonUtil.getJsonToBean(projectGanttTsakCrForm, ProjectGanttEntity.class);
if (projectGanttService.isExistByFullName(projectGanttTsakCrForm.getFullName(), id)) {
return ActionResult.fail(MsgCode.EXIST001.get());
}
boolean flag = projectGanttService.update(id, entity);
if (flag == false) {
return ActionResult.fail(MsgCode.FA002.get());
}
return ActionResult.success(MsgCode.SU004.get());
}
}

View File

@@ -0,0 +1,78 @@
package com.yunzhupaas.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.model.ReportManageModel;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.PinYinUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* 专业报表
*
* @author 云筑产品开发平台组
* @version 版 本V3.0.0
* @copyright 深圳市乐程软件有限公司
* @date 日 期2020.01.30
*/
@Tag(name = "专业报表", description = "获取专业报表列表")
@RestController
@RequestMapping("/api/extend/ReportManage")
public class ReportManageController {
/**
* 列表
*
* @return
*/
@Operation(summary = "获取专业报表列表")
@GetMapping
public ActionResult list() {
List<ReportManageModel> data = new ArrayList<>();
int num = 1000000000;
for (int i = 0; i < fullNameList().length; i++) {
ReportManageModel model = new ReportManageModel();
model.setId(String.valueOf(num+i+1));
model.setFullName(fullNameList()[i]);
model.setUrlAddress(PinYinUtil.getFullSpell(fullNameList()[i]));
if (i < 8) {
model.setCategory(categoryList()[0]);
}else if(i>=8 && i<=12){
model.setCategory(categoryList()[1]);
}else if(i>=13 && i<=14){
model.setCategory(categoryList()[2]);
}else if(i>=15 && i<=17){
model.setCategory(categoryList()[3]);
}else if(i>=18 && i<=20){
model.setCategory(categoryList()[4]);
}else if(i>=21 && i<=23){
model.setCategory(categoryList()[5]);
}else if(i>23){
model.setCategory(categoryList()[6]);
}
data.add(model);
}
return ActionResult.success(JsonUtil.listToJsonField(data));
}
private String[] categoryList() {
String[] category = {"报表示例", "Excel表格类", "Word文档类", "分栏与分组", "报表套打", "图表类", "其他示例"};
return category;
}
private String[] fullNameList() {
String[] fullName = {"房地产驾驶舱", "数字化营销", "市场营销", "SMT车间看板", "学校综合业绩表", "热线机器人数据分析", "渠道零售",
"承包方调查表", "多维透视表", "复杂交叉表", "煤矿三量基础表", "土地资源", "小学课程表", "销售合同模板", "干部任免审批表",
"单级分组", "多级分组", "分栏报表", "国航机票", "客户订单套打", "快递单套打", "常规图表", "人员离职分析", "销售分析趋势",
"标签打印", "报表水印", "文档目录"};
return fullName;
}
}

View File

@@ -0,0 +1,131 @@
package com.yunzhupaas.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.controller.SuperController;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.SalesOrderEntity;
import com.yunzhupaas.entity.SalesOrderEntryEntity;
import com.yunzhupaas.exception.WorkFlowException;
import com.yunzhupaas.model.salesorder.SalesOrderEntryEntityInfoModel;
import com.yunzhupaas.model.salesorder.SalesOrderForm;
import com.yunzhupaas.model.salesorder.SalesOrderInfoVO;
import com.yunzhupaas.service.SalesOrderService;
import com.yunzhupaas.util.GeneraterSwapUtil;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 销售订单
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-29 上午9:18
*/
@Tag(name = "销售订单", description = "SalesOrder")
@RestController
@RequestMapping("/api/extend/Form/SalesOrder")
public class SalesOrderController extends SuperController<SalesOrderService, SalesOrderEntity> {
@Autowired
private SalesOrderService salesOrderService;
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
/**
* 获取销售订单信息
*
* @param id 主键值
* @return
*/
@Operation(summary = "获取销售订单信息")
@GetMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult info(@PathVariable("id") String id) {
SalesOrderEntity entity = salesOrderService.getInfo(id);
List<SalesOrderEntryEntity> entityList = salesOrderService.getSalesEntryList(id);
SalesOrderInfoVO vo = JsonUtil.getJsonToBean(entity, SalesOrderInfoVO.class);
if (vo != null) {
vo.setEntryList(JsonUtil.getJsonToList(entityList, SalesOrderEntryEntityInfoModel.class));
}
return ActionResult.success(vo);
}
/**
* 新建销售订单
*
* @param salesOrderForm 表单对象
* @return
* @throws WorkFlowException
*/
@Operation(summary = "新建销售订单")
@PostMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
@Parameter(name = "salesOrderForm", description = "销售模型", required = true),
})
public ActionResult create(@RequestBody SalesOrderForm salesOrderForm, @PathVariable("id") String id) throws WorkFlowException {
SalesOrderEntity sales = JsonUtil.getJsonToBean(salesOrderForm, SalesOrderEntity.class);
List<SalesOrderEntryEntity> salesEntryList = JsonUtil.getJsonToList(salesOrderForm.getEntryList(), SalesOrderEntryEntity.class);
salesOrderService.submit(id, sales, salesEntryList, salesOrderForm);
return ActionResult.success(MsgCode.SU006.get());
}
/**
* 修改销售订单
*
* @param salesOrderForm 表单对象
* @param id 主键
* @return
* @throws WorkFlowException
*/
@Operation(summary = "修改销售订单")
@PutMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
@Parameter(name = "salesOrderForm", description = "销售模型", required = true),
})
public ActionResult update(@RequestBody SalesOrderForm salesOrderForm, @PathVariable("id") String id) throws WorkFlowException {
SalesOrderEntity sales = JsonUtil.getJsonToBean(salesOrderForm, SalesOrderEntity.class);
sales.setId(id);
List<SalesOrderEntryEntity> salesEntryList = JsonUtil.getJsonToList(salesOrderForm.getEntryList(), SalesOrderEntryEntity.class);
salesOrderService.submit(id, sales, salesEntryList, salesOrderForm);
return ActionResult.success(MsgCode.SU006.get());
}
/**
* 删除销售订单信息
*
* @param id 主键
*/
@Operation(summary = "删除销售订单信息")
@DeleteMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
public ActionResult delete(@PathVariable("id") String id, @RequestParam(name = "forceDel", defaultValue = "false") Boolean forceDel) {
SalesOrderEntity entity = salesOrderService.getInfo(id);
if (null != entity) {
if (!forceDel) {
String errMsg = generaterSwapUtil.deleteFlowTask(entity.getId());
if (StringUtil.isNotBlank(errMsg)) {
throw new RuntimeException(errMsg);
}
}
salesOrderService.delete(entity);
return ActionResult.success(MsgCode.SU003.get());
}
return ActionResult.fail(MsgCode.FA003.get());
}
}

View File

@@ -0,0 +1,450 @@
package com.yunzhupaas.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.Page;
import com.yunzhupaas.base.UserInfo;
import com.yunzhupaas.base.controller.SuperController;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.permission.entity.UserEntity;
import com.yunzhupaas.permission.service.UserService;
import com.yunzhupaas.util.JsonUtilEx;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.vo.PageListVO;
import com.yunzhupaas.base.vo.PaginationVO;
import com.yunzhupaas.base.UserInfo;
import com.yunzhupaas.base.service.DictionaryDataService;
import com.yunzhupaas.base.service.ProvinceService;
import com.yunzhupaas.base.vo.ListVO;
import com.yunzhupaas.entity.TableExampleEntity;
import com.yunzhupaas.base.entity.DictionaryDataEntity;
import com.yunzhupaas.base.entity.ProvinceEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.model.tableexample.*;
import com.yunzhupaas.model.tableexample.postil.PostilInfoVO;
import com.yunzhupaas.model.tableexample.postil.PostilModel;
import com.yunzhupaas.model.tableexample.postil.PostilSendForm;
import com.yunzhupaas.service.TableExampleService;
import com.yunzhupaas.util.DateUtil;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.StringUtil;
import com.yunzhupaas.util.UserProvider;
import com.yunzhupaas.util.treeutil.SumTree;
import com.yunzhupaas.util.treeutil.TreeDotUtils;
import com.yunzhupaas.util.type.StringNumber;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 表格示例数据
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Tag(name = "表格示例数据", description = "TableExample")
@RestController
@RequestMapping("/api/extend/TableExample")
public class TableExampleController extends SuperController<TableExampleService, TableExampleEntity> {
@Autowired
private TableExampleService tableExampleService;
@Autowired
private ProvinceService provinceService;
@Autowired
private DictionaryDataService dictionaryDataService;
@Autowired
private UserService userService;
/**
* 列表
*
* @param paginationTableExample 分页模型
* @return
*/
@Operation(summary = "获取表格数据列表")
@GetMapping
@SaCheckPermission("extend.tableDemo.commonTable")
public ActionResult<PageListVO<TableExampleListVO>> list(PaginationTableExample paginationTableExample) {
List<TableExampleEntity> data = tableExampleService.getList(paginationTableExample);
List<TableExampleListVO> list = JsonUtil.getJsonToList(data, TableExampleListVO.class);
List<String> userId = list.stream().map(t -> t.getRegistrant()).collect(Collectors.toList());
List<UserEntity> userList = userService.getUserName(userId);
for (TableExampleListVO tableExampleListVO : list) {
UserEntity user = userList.stream().filter(t -> t.getId().equals(tableExampleListVO.getRegistrant())).findFirst().orElse(null);
tableExampleListVO.setRegistrant(user != null ? user.getRealName() + "/" + user.getAccount() : "");
}
PaginationVO paginationVO = JsonUtil.getJsonToBean(paginationTableExample, PaginationVO.class);
return ActionResult.page(list, paginationVO);
}
/**
* 列表(树形表格)
*
* @param typeId 主键
* @param paginationTableExample 查询模型
* @return
*/
@Operation(summary = "(树形表格)")
@GetMapping("/ControlSample/{typeId}")
@Parameters({
@Parameter(name = "typeId", description = "主键", required = true),
})
@SaCheckPermission("extend.tableDemo.tableTree")
public ActionResult<PageListVO<TableExampleListVO>> list(@PathVariable("typeId") String typeId, PaginationTableExample paginationTableExample) {
List<TableExampleEntity> data = tableExampleService.getList(typeId, paginationTableExample);
List<TableExampleListVO> list = JsonUtil.getJsonToList(data, TableExampleListVO.class);
List<String> userId = list.stream().map(t -> t.getRegistrant()).collect(Collectors.toList());
List<UserEntity> userList = userService.getUserName(userId);
for (TableExampleListVO tableExampleListVO : list) {
UserEntity user = userList.stream().filter(t -> t.getId().equals(tableExampleListVO.getRegistrant())).findFirst().orElse(null);
tableExampleListVO.setRegistrant(user != null ? user.getRealName() + "/" + user.getAccount() : "");
}
PaginationVO paginationVO = JsonUtil.getJsonToBean(paginationTableExample, PaginationVO.class);
return ActionResult.page(list, paginationVO);
}
/**
* 列表
*
* @return
*/
@Operation(summary = "获取表格分组列表")
@GetMapping("/All")
@SaCheckPermission("extend.tableDemo.groupingTable")
public ActionResult<ListVO<TableExampleListAllVO>> listAll() {
List<TableExampleEntity> data = tableExampleService.getList();
List<TableExampleListAllVO> list = JsonUtil.getJsonToList(data, TableExampleListAllVO.class);
List<String> userId = list.stream().map(t -> t.getRegistrant()).collect(Collectors.toList());
List<UserEntity> userList = userService.getUserName(userId);
for (TableExampleListAllVO tableExampleListVO : list) {
UserEntity user = userList.stream().filter(t -> t.getId().equals(tableExampleListVO.getRegistrant())).findFirst().orElse(null);
tableExampleListVO.setRegistrant(user != null ? user.getRealName() + "/" + user.getAccount() : "");
}
ListVO<TableExampleListAllVO> vo = new ListVO<>();
vo.setList(list);
return ActionResult.success(vo);
}
/**
* 列表
*
* @param page 查询模型
* @return
*/
@Operation(summary = "获取延伸扩展列表(行政区划)")
@GetMapping("/IndustryList")
@SaCheckPermission("extend.tableDemo.extension")
public ActionResult<ListVO<TableExampleIndustryListVO>> industryList(Page page) {
String keyword = page.getKeyword();
List<ProvinceEntity> data = provinceService.getList("-1");
if (!StringUtil.isEmpty(keyword)) {
data = data.stream().filter(t -> t.getFullName().contains(keyword)).collect(Collectors.toList());
}
List<TableExampleIndustryListVO> listVos = JsonUtil.getJsonToList(data, TableExampleIndustryListVO.class);
ListVO<TableExampleIndustryListVO> vo = new ListVO<>();
vo.setList(listVos);
return ActionResult.success(vo);
}
/**
* 列表
*
* @param id 主键值
* @return
*/
@Operation(summary = "获取城市信息列表(获取延伸扩展列表(行政区划))")
@GetMapping("/CityList/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("extend.tableDemo.extension")
public ActionResult<ListVO<TableExampleCityListVO>> cityList(@PathVariable("id") String id) {
List<ProvinceEntity> data = provinceService.getList(id);
List<TableExampleCityListVO> listVos = JsonUtil.getJsonToList(data, TableExampleCityListVO.class);
ListVO<TableExampleCityListVO> vo = new ListVO<>();
vo.setList(listVos);
return ActionResult.success(vo);
}
/**
* 列表(表格树形)
*
* @param isTree 类型
* @return
*/
@Operation(summary = "表格树形")
@GetMapping("/ControlSample/TreeList")
@Parameters({
@Parameter(name = "isTree", description = "类型"),
})
@SaCheckPermission("extend.tableDemo.tableTree")
public ActionResult<ListVO<TableExampleTreeModel>> treeList(@RequestParam("isTree")String isTree) {
List<DictionaryDataEntity> data = dictionaryDataService.getList("d59a3cf65f9847dbb08be449e3feae16");
List<TableExampleTreeModel> treeList = new ArrayList<>();
for (DictionaryDataEntity entity : data) {
TableExampleTreeModel treeModel = new TableExampleTreeModel();
treeModel.setId(entity.getId());
treeModel.setText(entity.getFullName());
treeModel.setParentId(entity.getParentId());
treeModel.setLoaded(true);
treeModel.setExpanded(true);
treeModel.setHt(JsonUtil.entityToMap(entity));
treeList.add(treeModel);
}
if (isTree != null && StringNumber.ONE.equals(isTree)) {
List<SumTree<TableExampleTreeModel>> trees = TreeDotUtils.convertListToTreeDot(treeList);
List<TableExampleTreeModel> listVO = JsonUtil.getJsonToList(trees, TableExampleTreeModel.class);
ListVO vo = new ListVO();
vo.setList(listVO);
return ActionResult.success(vo);
}
ListVO vo = new ListVO();
vo.setList(treeList);
return ActionResult.success(vo);
}
/**
* 信息
*
* @param id 主键
* @return
*/
@Operation(summary = "获取普通表格示例信息")
@GetMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("extend.tableDemo.extension")
public ActionResult<TableExampleInfoVO> info(@PathVariable("id") String id) throws DataException {
TableExampleEntity entity = tableExampleService.getInfo(id);
TableExampleInfoVO vo = JsonUtil.getJsonToBeanEx(entity, TableExampleInfoVO.class);
return ActionResult.success(vo);
}
/**
* 删除
*
* @param id 主键
* @return
*/
@Operation(summary = "删除项目")
@DeleteMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("extend.tableDemo.extension")
public ActionResult delete(@PathVariable("id") String id) {
TableExampleEntity entity = tableExampleService.getInfo(id);
if (entity != null) {
tableExampleService.delete(entity);
return ActionResult.success(MsgCode.SU003.get());
}
return ActionResult.fail(MsgCode.FA003.get());
}
/**
* 创建
*
* @param tableExampleCrForm 项目模型
* @return
*/
@Operation(summary = "新建项目")
@PostMapping
@Parameters({
@Parameter(name = "tableExampleCrForm", description = "项目模型",required = true),
})
@SaCheckPermission("extend.tableDemo.extension")
public ActionResult create(@RequestBody @Valid TableExampleCrForm tableExampleCrForm) {
TableExampleEntity entity = JsonUtil.getJsonToBean(tableExampleCrForm, TableExampleEntity.class);
entity.setCostAmount(entity.getCostAmount() == null ? new BigDecimal("0") : entity.getCostAmount());
entity.setTunesAmount(entity.getTunesAmount() == null ? new BigDecimal("0") : entity.getTunesAmount());
entity.setProjectedIncome(entity.getProjectedIncome() == null ? new BigDecimal("0") : entity.getProjectedIncome());
entity.setSign("0000000");
tableExampleService.create(entity);
return ActionResult.success(MsgCode.SU001.get());
}
/**
* 更新
*
* @param id 主键
* @param tableExampleUpForm 项目模型
* @return
*/
@Operation(summary = "更新项目")
@PutMapping("/{id}")
@Parameters({
@Parameter(name = "tableExampleUpForm", description = "项目模型",required = true),
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("extend.tableDemo.postilTable")
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid TableExampleUpForm tableExampleUpForm) {
TableExampleEntity entity = JsonUtil.getJsonToBean(tableExampleUpForm, TableExampleEntity.class);
entity.setCostAmount(entity.getCostAmount() == null ? new BigDecimal("0") : entity.getCostAmount());
entity.setTunesAmount(entity.getTunesAmount() == null ? new BigDecimal("0") : entity.getTunesAmount());
entity.setProjectedIncome(entity.getProjectedIncome() == null ? new BigDecimal("0") : entity.getProjectedIncome());
boolean flag = tableExampleService.update(id, entity);
if (flag == false) {
return ActionResult.fail(MsgCode.FA002.get());
}
return ActionResult.success(MsgCode.SU004.get());
}
/**
* 更新标签
*
* @param id 主键
* @param tableExampleSignUpForm 项目模型
* @return
*/
@Operation(summary = "更新标记")
@PutMapping("/UpdateSign/{id}")
@Parameters({
@Parameter(name = "tableExampleSignUpForm", description = "项目模型",required = true),
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("extend.tableDemo.postilTable")
public ActionResult updateSign(@PathVariable("id") String id, @RequestBody @Valid TableExampleSignUpForm tableExampleSignUpForm) {
TableExampleEntity entity = JsonUtil.getJsonToBean(tableExampleSignUpForm, TableExampleEntity.class);
TableExampleEntity tableExampleEntity = tableExampleService.getInfo(id);
if (tableExampleEntity == null) {
return ActionResult.success(MsgCode.FA002.get());
}
tableExampleEntity.setSign(entity.getSign());
tableExampleService.update(id, entity);
return ActionResult.success(MsgCode.SU004.get());
}
/**
* 行编辑
*
* @param tableExampleRowUpForm 项目模型
* @param id 主键
* @return
*/
@Operation(summary = "行编辑")
@PutMapping("/{id}/Actions/RowsEdit")
@Parameters({
@Parameter(name = "tableExampleRowUpForm", description = "项目模型",required = true),
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("extend.tableDemo.redactTable")
public ActionResult rowEditing(@PathVariable("id") String id, @RequestBody @Valid TableExampleRowUpForm tableExampleRowUpForm) {
TableExampleEntity entity = JsonUtil.getJsonToBean(tableExampleRowUpForm, TableExampleEntity.class);
entity.setCostAmount(entity.getCostAmount() == null ? new BigDecimal("0") : entity.getCostAmount());
entity.setTunesAmount(entity.getTunesAmount() == null ? new BigDecimal("0") : entity.getTunesAmount());
entity.setProjectedIncome(entity.getProjectedIncome() == null ? new BigDecimal("0") : entity.getProjectedIncome());
entity.setId(id);
boolean falg = tableExampleService.rowEditing(entity);
if (falg == false) {
return ActionResult.fail(MsgCode.FA002.get());
}
return ActionResult.success(MsgCode.SU004.get());
}
/**
* 发送
*
* @param postilSendForm 项目模型
* @param id 主键
* @return
*/
@Operation(summary = "发送批注")
@PostMapping("/{id}/Postil")
@Parameters({
@Parameter(name = "postilSendForm", description = "项目模型",required = true),
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("extend.tableDemo.postilTable")
public ActionResult sendPostil(@PathVariable("id") String id, @RequestBody PostilSendForm postilSendForm) {
TableExampleEntity tableExampleEntity = tableExampleService.getInfo(id);
if (tableExampleEntity == null) {
return ActionResult.success(MsgCode.FA005.get());
}
UserInfo userInfo = UserProvider.getUser();
PostilModel model = new PostilModel();
model.setCreatorTime(DateUtil.getNow("+8"));
model.setText(postilSendForm.getText());
model.setUserId(userInfo != null ? userInfo.getUserName() + "/" + userInfo.getUserAccount() : "");
List<PostilModel> list = new ArrayList<>();
list.add(model);
if (!StringUtil.isEmpty(tableExampleEntity.getPostilJson())) {
list.addAll(JsonUtil.getJsonToList(tableExampleEntity.getPostilJson(), PostilModel.class));
}
String postilJson = JsonUtil.getObjectToString(list);
tableExampleEntity.setPostilJson(postilJson);
tableExampleEntity.setPostilCount(list.size());
tableExampleService.update(id, tableExampleEntity);
return ActionResult.success(MsgCode.SU012.get());
}
/**
* 发送
*
* @param id 主键值
* @return
*/
@Operation(summary = "获取批注")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
@GetMapping("/{id}/Actions/Postil")
@SaCheckPermission("extend.tableDemo.postilTable")
public ActionResult<PostilInfoVO> getPostil(@PathVariable("id") String id) {
TableExampleEntity tableExampleEntity = tableExampleService.getInfo(id);
if (tableExampleEntity == null) {
return ActionResult.success(MsgCode.FA012.get());
}
PostilInfoVO vo = new PostilInfoVO();
vo.setPostilJson(tableExampleEntity.getPostilJson());
return ActionResult.success(vo);
}
/**
* 删除批注
*
* @param id 主键值
* @param index 行数
* @return
*/
@Operation(summary = "删除批注")
@DeleteMapping("/{id}/Postil/{index}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
@Parameter(name = "index", description = "行数", required = true),
})
@SaCheckPermission("extend.tableDemo.postilTable")
public ActionResult deletePostil(@PathVariable("id") String id, @PathVariable("index") int index) {
TableExampleEntity tableExampleEntity = tableExampleService.getInfo(id);
if (tableExampleEntity == null) {
return ActionResult.success(MsgCode.FA003.get());
}
List<PostilModel> list = JsonUtil.getJsonToList(tableExampleEntity.getPostilJson(), PostilModel.class);
list.remove(index);
String postilJson = JsonUtil.getObjectToString(list);
tableExampleEntity.setPostilJson(postilJson);
tableExampleEntity.setPostilCount((list.size()));
tableExampleService.update(id, tableExampleEntity);
return ActionResult.success(MsgCode.SU003.get());
}
}

View File

@@ -0,0 +1,172 @@
package com.yunzhupaas.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.Pagination;
import com.yunzhupaas.base.controller.SuperController;
import com.yunzhupaas.base.vo.PageListVO;
import com.yunzhupaas.base.vo.PaginationVO;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.entity.WorkLogEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.model.worklog.WorkLogCrForm;
import com.yunzhupaas.model.worklog.WorkLogInfoVO;
import com.yunzhupaas.model.worklog.WorkLogListVO;
import com.yunzhupaas.model.worklog.WorkLogUpForm;
import com.yunzhupaas.permission.entity.UserEntity;
import com.yunzhupaas.permission.service.UserService;
import com.yunzhupaas.service.WorkLogService;
import com.yunzhupaas.util.JsonUtil;
import com.yunzhupaas.util.JsonUtilEx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
import java.util.Arrays;
import java.util.List;
import java.util.StringJoiner;
/**
* 工作日志
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Tag(name = "app工作日志", description = "WorkLog")
@RestController
@RequestMapping("/api/extend/WorkLog")
public class WorkLogController extends SuperController<WorkLogService, WorkLogEntity> {
@Autowired
private WorkLogService workLogService;
@Autowired
private UserService userService;
/**
* 列表(我发出的)
*
* @param pageModel 分页模型
* @return
*/
@Operation(summary = "列表")
@GetMapping("/Send")
@SaCheckPermission("reportinglog")
public ActionResult<PageListVO<WorkLogListVO>> getSendList(Pagination pageModel) {
List<WorkLogEntity> data = workLogService.getSendList(pageModel);
List<WorkLogListVO> list = JsonUtil.getJsonToList(data, WorkLogListVO.class);
PaginationVO paginationVO = JsonUtil.getJsonToBean(pageModel, PaginationVO.class);
return ActionResult.page(list, paginationVO);
}
/**
* 列表(我收到的)
*
* @param pageModel 分页模型
* @return
*/
@GetMapping("/Receive")
@SaCheckPermission("reportinglog")
public ActionResult<PageListVO<WorkLogListVO>> getReceiveList(Pagination pageModel) {
List<WorkLogEntity> data = workLogService.getReceiveList(pageModel);
List<WorkLogListVO> list = JsonUtil.getJsonToList(data, WorkLogListVO.class);
PaginationVO paginationVO = JsonUtil.getJsonToBean(pageModel, PaginationVO.class);
return ActionResult.page(list, paginationVO);
}
/**
* 信息
*
* @param id 主键
* @return
*/
@GetMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("reportinglog")
public ActionResult<WorkLogInfoVO> info(@PathVariable("id") String id) throws DataException {
WorkLogEntity entity = workLogService.getInfo(id);
StringJoiner userName = new StringJoiner(",");
StringJoiner userIds = new StringJoiner(",");
List<String> userId = Arrays.asList(entity.getToUserId().split(","));
List<UserEntity> userList = userService.getUserName(userId);
for (UserEntity user : userList) {
userIds.add(user.getId());
userName.add(user.getRealName() + "/" + user.getAccount());
}
entity.setToUserId(userName.toString());
WorkLogInfoVO vo = JsonUtilEx.getJsonToBeanEx(entity, WorkLogInfoVO.class);
vo.setUserIds(userIds.toString());
return ActionResult.success(vo);
}
/**
* 新建
*
* @param workLogCrForm 日志模型
* @return
*/
@Operation(summary = "新建")
@PostMapping
@Parameters({
@Parameter(name = "workLogCrForm", description = "日志模型",required = true),
})
@SaCheckPermission("reportinglog")
public ActionResult create(@RequestBody @Valid WorkLogCrForm workLogCrForm) {
WorkLogEntity entity = JsonUtil.getJsonToBean(workLogCrForm, WorkLogEntity.class);
workLogService.create(entity);
return ActionResult.success(MsgCode.SU001.get());
}
/**
* 更新
*
* @param id 主键
* @param workLogUpForm 日志模型
* @return
*/
@Operation(summary = "更新")
@PutMapping("/{id}")
@Parameters({
@Parameter(name = "workLogUpForm", description = "日志模型",required = true),
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("reportinglog")
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid WorkLogUpForm workLogUpForm) {
WorkLogEntity entity = JsonUtil.getJsonToBean(workLogUpForm, WorkLogEntity.class);
boolean flag = workLogService.update(id, entity);
if (flag == false) {
return ActionResult.fail(MsgCode.FA002.get());
}
return ActionResult.success(MsgCode.SU004.get());
}
/**
* 删除
*
* @param id 主键
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
})
@SaCheckPermission("reportinglog")
public ActionResult delete(@PathVariable("id") String id) {
WorkLogEntity entity = workLogService.getInfo(id);
if (entity != null) {
workLogService.delete(entity);
return ActionResult.success(MsgCode.SU003.get());
}
return ActionResult.fail(MsgCode.FA003.get());
}
}

View 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-extend</artifactId>
<groupId>com.yunzhupaas</groupId>
<version>5.2.0-RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yunzhupaas-extend-entity</artifactId>
<dependencies>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-common-all</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,34 @@
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;
/**
* 大数据测试
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Data
@TableName("ext_big_data")
public class BigDataEntity extends SuperExtendEntity<String> {
/**
* 编码
*/
@TableField("F_EN_CODE")
private String enCode;
/**
* 名称
*/
@TableField("F_FULL_NAME")
private String fullName;
}

View File

@@ -0,0 +1,51 @@
package com.yunzhupaas.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yunzhupaas.base.entity.SuperEntity;
import lombok.Data;
/**
* 客户信息
*
* @版本: V3.1.0
* @版权: 深圳市乐程软件有限公司http://www.szlecheng.cn
* @作者: 云筑产品开发平台组
* @日期: 2021-07-10 14:09:05
*/
@Data
@TableName("ext_customer")
public class CustomerEntity extends SuperEntity<String> {
/**
* 编码
*/
@TableField("F_EN_CODE")
private String code;
/**
* 客户名称
*/
@TableField("F_CUSTOMER_NAME")
private String customerName;
/**
* 地址
*/
@TableField("F_ADDRESS")
private String address;
/**
* 姓名
*/
@TableField("F_FULL_NAME")
private String name;
/**
* 联系方式
*/
@TableField("F_CONTACT_TEL")
private String contactTel;
}

View File

@@ -0,0 +1,82 @@
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;
/**
* 知识文档
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Data
@TableName("ext_document")
public class DocumentEntity extends SuperExtendEntity.SuperExtendDEEntity<String> {
/**
* 文档父级
*/
@TableField("F_PARENT_ID")
private String parentId;
/**
* 文档分类
*/
@TableField("F_TYPE")
private Integer type;
/**
* 文件名称
*/
@TableField("F_FULL_NAME")
private String fullName;
/**
* 文件路径
*/
@TableField("F_FILE_PATH")
private String filePath;
/**
* 文件大小
*/
@TableField("F_FILE_SIZE")
private String fileSize;
/**
* 文件后缀
*/
@TableField("F_FILE_EXTENSION")
private String fileExtension;
/**
* 阅读数量
*/
@TableField("F_READ_COUNT")
private Integer readCount;
/**
* 是否共享
*/
@TableField("F_IS_SHARE")
private Integer isShare;
/**
* 共享时间
*/
@TableField("F_SHARE_TIME")
private Date shareTime;
/**
* 文档下载地址
*/
@TableField("F_UPLOAD_URL")
private String uploaderUrl;
}

View File

@@ -0,0 +1,34 @@
package com.yunzhupaas.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yunzhupaas.base.entity.SuperEntity;
import lombok.Data;
/**
* 知识文档删除记录
*
* @author 云筑产品开发平台组
* @version V5.2.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024年4月10日 上午9:18
*/
@Data
@TableName("ext_document_log")
public class DocumentLogEntity extends SuperEntity<String> {
/**
* 文档主键
*/
@TableField("F_DOCUMENT_ID")
private String documentId;
/**
* 共享人员
*/
@TableField("F_CHILD_DOCUMENT")
private String childDocument;
}

View File

@@ -0,0 +1,41 @@
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;
/**
* 知识文档共享
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Data
@TableName("ext_document_share")
public class DocumentShareEntity extends SuperExtendEntity<String> {
/**
* 文档主键
*/
@TableField("F_DOCUMENT_ID")
private String documentId;
/**
* 共享人员
*/
@TableField("F_SHARE_USER_ID")
private String shareUserId;
/**
* 共享时间
*/
@TableField("F_SHARE_TIME")
private Date shareTime;
}

View File

@@ -0,0 +1,81 @@
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;
/**
* 邮件发送
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Data
@TableName("ext_email_send")
public class EmailSendEntity extends SuperExtendEntity.SuperExtendDEEntity<String> {
/**
* 类型 1-外部、0-内部
*/
@TableField("F_TYPE")
private Integer type;
/**
* 发件人
*/
@TableField("F_SENDER")
private String sender;
/**
* 收件人
*/
@TableField("F_TO")
private String recipient;
/**
* 抄送人
*/
@TableField("F_CC")
private String cc;
/**
* 密送人
*/
@TableField("F_BCC")
private String bcc;
/**
* 颜色
*/
@TableField("F_COLOUR")
private String colour;
/**
* 主题
*/
@TableField("F_SUBJECT")
private String subject;
/**
* 正文
*/
@TableField("F_BODY_TEXT")
private String bodyText;
/**
* 附件
*/
@TableField("F_ATTACHMENT")
private String attachment;
/**
* 状态 -1-草稿、0-正在投递、1-投递成功
*/
@TableField("F_STATE")
private Integer state;
}

View File

@@ -0,0 +1,107 @@
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;
/**
* 职员信息
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
*
*/
@Data
@TableName("ext_employee")
public class EmployeeEntity extends SuperExtendEntity.SuperExtendDEEntity<String> {
/**
* 工号
*/
@TableField("F_EN_CODE")
private String enCode;
/**
* 姓名
*/
@TableField("F_FULL_NAME")
private String fullName;
/**
* 性别
*/
@TableField("F_GENDER")
private String gender;
/**
* 部门
*/
@TableField("F_DEPARTMENT_NAME")
private String departmentName;
/**
* 岗位
*/
@TableField("F_POSITION_NAME")
private String positionName;
/**
* 用工性质
*/
@TableField("F_WORKING_NATURE")
private String workingNature;
/**
* 身份证号
*/
@TableField("F_ID_NUMBER")
private String idNumber;
/**
* 联系电话
*/
@TableField("F_TELEPHONE")
private String telephone;
/**
* 参加工作
*/
@TableField("F_ATTEND_WORK_TIME")
private Date attendWorkTime;
/**
* 出生年月
*/
@TableField("F_BIRTHDAY")
private Date birthday;
/**
* 最高学历
*/
@TableField("F_EDUCATION")
private String education;
/**
* 所学专业
*/
@TableField("F_MAJOR")
private String major;
/**
* 毕业院校
*/
@TableField("F_GRADUATION_ACADEMY")
private String graduationAcademy;
/**
* 毕业时间
*/
@TableField("F_GRADUATION_TIME")
private Date graduationTime;
}

View File

@@ -0,0 +1,119 @@
package com.yunzhupaas.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yunzhupaas.base.entity.SuperBaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 流程表单【请假申请】
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2023/09/27
*/
@Data
@TableName("wform_leaveapply")
public class LeaveApplyEntity extends SuperBaseEntity.SuperTBaseEntity<String> {
/**
* 流程主键
*/
@TableField("F_FLOWID")
private String flowId;
/**
* 流程标题
*/
@TableField("F_FLOWTITLE")
private String flowTitle;
/**
* 紧急程度
*/
@TableField("F_FLOWURGENT")
private Integer flowUrgent;
/**
* 单据编码
*/
@TableField("F_BILLNO")
private String billNo;
/**
* 申请人员
*/
@TableField("F_APPLYUSER")
private String applyUser;
/**
* 申请日期
*/
@TableField("F_APPLYDATE")
private Date applyDate;
/**
* 申请部门
*/
@TableField("F_APPLYDEPT")
private String applyDept;
/**
* 申请职位
*/
@TableField("F_APPLYPOST")
private String applyPost;
/**
* 请假类别
*/
@TableField("F_LEAVETYPE")
private String leaveType;
/**
* 请假原因
*/
@TableField("F_LEAVEREASON")
private String leaveReason;
/**
* 请假时间
*/
@TableField("F_LEAVESTARTTIME")
private Date leaveStartTime;
/**
* 结束时间
*/
@TableField("F_LEAVEENDTIME")
private Date leaveEndTime;
/**
* 请假天数
*/
@TableField("F_LEAVEDAYCOUNT")
private String leaveDayCount;
/**
* 请假小时
*/
@TableField("F_LEAVEHOUR")
private String leaveHour;
/**
* 相关附件
*/
@TableField("F_FILEJSON")
private String fileJson;
/**
* 备注
*/
@TableField("F_DESCRIPTION")
private String description;
}

View File

@@ -0,0 +1,120 @@
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.math.BigDecimal;
import java.util.Date;
/**
* 订单信息
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-09-26 上午9:18
*/
@Data
@TableName("ext_order")
public class OrderEntity extends SuperExtendEntity.SuperExtendDEEntity<String> {
/**
* 客户Id
*/
@TableField("F_CUSTOMER_ID")
private String customerId;
/**
* 客户名称
*/
@TableField("F_CUSTOMER_NAME")
private String customerName;
/**
* 业务员Id
*/
@TableField("F_SALESMAN_ID")
private String salesmanId;
/**
* 业务员
*/
@TableField("F_SALESMAN_NAME")
private String salesmanName;
/**
* 订单日期
*/
@TableField("F_ORDER_DATE")
private Date orderDate;
/**
* 订单编码
*/
@TableField("F_ORDER_CODE")
private String orderCode;
/**
* 运输方式
*/
@TableField("F_TRANSPORT_MODE")
private String transportMode;
/**
* 发货日期
*/
@TableField("F_DELIVERY_DATE")
private Date deliveryDate;
/**
* 发货地址
*/
@TableField("F_DELIVERY_ADDRESS")
private String deliveryAddress;
/**
* 付款方式
*/
@TableField("F_PAYMENT_MODE")
private String paymentMode;
/**
* 应收金额
*/
@TableField("F_RECEIVABLE_MONEY")
private BigDecimal receivableMoney;
/**
* 定金比率
*/
@TableField("F_EARNEST_RATE")
private BigDecimal earnestRate;
/**
* 预付定金
*/
@TableField("F_PREPAY_EARNEST")
private BigDecimal prepayEarnest;
/**
* 当前状态
*/
@TableField("F_CURRENT_STATE")
private Integer currentState;
/**
* 流程引擎
*/
@TableField("F_FLOW_ID")
private String flowId;
/**
* 附件信息
*/
@TableField("F_FILE_JSON")
private String fileJson;
}

Some files were not shown because too many files have changed in this diff Show More