初始代码

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

View File

@@ -0,0 +1,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 {
}