25 changed files with 1418 additions and 27 deletions
@ -0,0 +1,151 @@ |
|||
package com.kms.yxgh.df.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 缺陷记录 bs_sgc_df_xcqx |
|||
* |
|||
* @author sy |
|||
* @date 2024-01-04 |
|||
*/ |
|||
@TableName("bs_sgc_df_xcqx") |
|||
@Data |
|||
@ApiModel("缺陷记录") |
|||
public class DfCheckingProblemV2 extends SyBaseEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 问题等级 |
|||
*/ |
|||
@ApiModelProperty("问题等级") |
|||
private String issueLevel; |
|||
|
|||
/** |
|||
* 项目id |
|||
*/ |
|||
@ApiModelProperty("项目id") |
|||
private String projectId; |
|||
|
|||
/** |
|||
* 记录id |
|||
*/ |
|||
@ApiModelProperty("记录id") |
|||
private String recordId; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 巡查状态字典:patrol_maintenance_status |
|||
*/ |
|||
@ApiModelProperty("巡查状态字典:patrol_maintenance_status") |
|||
private String status; |
|||
|
|||
|
|||
|
|||
/** |
|||
* name |
|||
*/ |
|||
@ApiModelProperty("name") |
|||
private String name; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 巡查类型 字典:patrol_maintenance_type |
|||
*/ |
|||
@ApiModelProperty("巡查类型 字典:patrol_maintenance_type") |
|||
private String type; |
|||
|
|||
/** |
|||
* 巡查类别字典:key_jf_patrol_category |
|||
*/ |
|||
@ApiModelProperty("巡查类别字典:patrol_maintenance_category") |
|||
private String category; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 巡查责任人 |
|||
*/ |
|||
@ApiModelProperty("巡查责任人") |
|||
private String dutyHolderName; |
|||
|
|||
/** |
|||
* 巡查责任人id |
|||
*/ |
|||
@ApiModelProperty("巡查责任人id") |
|||
private String dutyHolderId; |
|||
|
|||
/** |
|||
* 堤防代码 |
|||
*/ |
|||
@ApiModelProperty("堤防代码") |
|||
private String dikeCode; |
|||
|
|||
|
|||
/** |
|||
* 堤防代码名称 |
|||
*/ |
|||
@ApiModelProperty("堤防代码名称") |
|||
private String dikeName; |
|||
|
|||
/** |
|||
* 巡查开始时间 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty("巡查开始时间") |
|||
private Date startTime; |
|||
|
|||
/** |
|||
* 巡查结束时间 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty("巡查结束时间") |
|||
private Date endTime; |
|||
|
|||
/** |
|||
* 描述 |
|||
*/ |
|||
@ApiModelProperty("描述") |
|||
private String describe; |
|||
|
|||
|
|||
/** |
|||
* 问题位置 |
|||
*/ |
|||
@ApiModelProperty("问题位置") |
|||
private String problemLocation; |
|||
|
|||
|
|||
/** |
|||
* 文档 |
|||
*/ |
|||
@ApiModelProperty("文档") |
|||
private String doc; |
|||
|
|||
/** |
|||
* 创建人id |
|||
*/ |
|||
@ApiModelProperty("创建人id") |
|||
private String createUid; |
|||
|
|||
|
|||
/** |
|||
* 附加配置 |
|||
*/ |
|||
@ApiModelProperty("备注") |
|||
private String remark; |
|||
|
|||
|
|||
} |
@ -0,0 +1,122 @@ |
|||
package com.kms.yxgh.df.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 害堤动物防治计划对象 bs_sgc_df_xcitem |
|||
* |
|||
* @author sy |
|||
* @date 2024-01-04 |
|||
*/ |
|||
@TableName("bs_sgc_df_xcitem") |
|||
@Data |
|||
@ApiModel("项目管理记录") |
|||
public class DfCheckingRecord extends SyBaseEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 巡查范围 |
|||
*/ |
|||
@ApiModelProperty("巡查范围") |
|||
private String scope; |
|||
|
|||
/** |
|||
* 巡查开始时间 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty("巡查开始时间") |
|||
private Date startTime; |
|||
|
|||
/** |
|||
* 巡查结束时间 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty("巡查结束时间") |
|||
private Date endTime; |
|||
|
|||
/** |
|||
* 项目id |
|||
*/ |
|||
@ApiModelProperty("项目id") |
|||
private String projectId; |
|||
|
|||
/** |
|||
* 巡查状态字典:patrol_maintenance_status |
|||
*/ |
|||
@ApiModelProperty("巡查状态字典:patrol_maintenance_status") |
|||
private String status; |
|||
|
|||
/** |
|||
* 巡查责任人 |
|||
*/ |
|||
@ApiModelProperty("巡查责任人") |
|||
private String dutyHolderName; |
|||
|
|||
/** |
|||
* 巡查责任人id |
|||
*/ |
|||
@ApiModelProperty("巡查责任人id") |
|||
private String dutyHolderId; |
|||
|
|||
/** |
|||
* 项目名称 |
|||
*/ |
|||
@ApiModelProperty("项目名称") |
|||
private String name; |
|||
|
|||
/** |
|||
* 巡查类型 字典:patrol_maintenance_type |
|||
*/ |
|||
@ApiModelProperty("巡查类型 字典:patrol_maintenance_type") |
|||
private String type; |
|||
|
|||
/** |
|||
* 巡查类别字典:key_jf_patrol_category |
|||
*/ |
|||
@ApiModelProperty("巡查类别字典:patrol_maintenance_category") |
|||
private String category; |
|||
|
|||
/** |
|||
* 堤防代码 |
|||
*/ |
|||
@ApiModelProperty("堤防代码") |
|||
private String dikeCode; |
|||
|
|||
|
|||
/** |
|||
* 堤防代码名称 |
|||
*/ |
|||
@ApiModelProperty("堤防代码名称") |
|||
private String dikeName; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 创建人id |
|||
*/ |
|||
@ApiModelProperty("创建人id") |
|||
private String createUid; |
|||
|
|||
|
|||
/** |
|||
* 附加配置 |
|||
*/ |
|||
@ApiModelProperty("备注") |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建人名称 |
|||
*/ |
|||
@ApiModelProperty("创建人名称") |
|||
private String createName; |
|||
|
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.kms.yxgh.df.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 项目管理子项 |
|||
* |
|||
* @author sy |
|||
* @date 2024-01-04 |
|||
*/ |
|||
@TableName("bs_sgc_df_xcitem") |
|||
@Data |
|||
@ApiModel("项目管理子项") |
|||
public class DfCheckingV2ProjectItem extends SyBaseEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 项目id |
|||
*/ |
|||
@ApiModelProperty("项目id") |
|||
private Integer projectId; |
|||
|
|||
/** |
|||
* 检查部位 |
|||
*/ |
|||
@ApiModelProperty("检查部位") |
|||
private String parts; |
|||
|
|||
/** |
|||
* 检查内容 |
|||
*/ |
|||
@ApiModelProperty("检查内容") |
|||
private String content; |
|||
|
|||
|
|||
} |
@ -0,0 +1,72 @@ |
|||
package com.kms.yxgh.df.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import com.shuili.common.annotation.Excel; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 害堤动物防治计划对象 bs_sgc_df_hdjh |
|||
* |
|||
* @author sy |
|||
* @date 2024-01-04 |
|||
*/ |
|||
@TableName("bs_sgc_df_xmgl") |
|||
@Data |
|||
@ApiModel("项目管理") |
|||
public class DfCheckingV2ProjectManage extends SyBaseEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 堤防代码 |
|||
*/ |
|||
@ApiModelProperty("堤防代码") |
|||
private String dikeCode; |
|||
|
|||
|
|||
/** |
|||
* 堤防代码名称 |
|||
*/ |
|||
@ApiModelProperty("堤防代码名称") |
|||
private String dikeName; |
|||
|
|||
/** |
|||
* 项目名称 |
|||
*/ |
|||
@ApiModelProperty("项目名称") |
|||
private String name; |
|||
|
|||
|
|||
/** |
|||
* 巡查类型 字典:patrol_maintenance_type |
|||
*/ |
|||
@ApiModelProperty("巡查类型 字典:patrol_maintenance_type") |
|||
private String type; |
|||
|
|||
|
|||
/** |
|||
* 巡查类别字典:key_jf_patrol_category |
|||
*/ |
|||
@ApiModelProperty("巡查类别字典:patrol_maintenance_category") |
|||
private String category; |
|||
|
|||
/** |
|||
* 附加配置 |
|||
*/ |
|||
@ApiModelProperty("备注") |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建人名称 |
|||
*/ |
|||
@ApiModelProperty("创建人名称") |
|||
private String createName; |
|||
|
|||
|
|||
} |
@ -0,0 +1,163 @@ |
|||
package com.kms.yxgh.df.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 缺陷记录 bs_sgc_df_xcqx |
|||
* |
|||
* @author sy |
|||
* @date 2024-01-04 |
|||
*/ |
|||
@TableName("bs_sgc_df_xcyj") |
|||
@Data |
|||
@ApiModel("堤防巡视养护管理表") |
|||
public class DfYhV2V2 extends SyBaseEntity { |
|||
|
|||
/** |
|||
* 巡查项目id |
|||
*/ |
|||
@ApiModelProperty("巡查项目id") |
|||
private String projectId; |
|||
/** |
|||
* 缺陷id |
|||
*/ |
|||
@ApiModelProperty("缺陷id") |
|||
private String defectId; |
|||
/** |
|||
* 文档 |
|||
*/ |
|||
@ApiModelProperty("文档") |
|||
private String doc; |
|||
|
|||
|
|||
/** |
|||
* 维养责任人id |
|||
*/ |
|||
@ApiModelProperty("维养责任人id") |
|||
private String dutyHolderId; |
|||
|
|||
/** |
|||
* 维养责任人名称 |
|||
*/ |
|||
@ApiModelProperty("维养责任人名称") |
|||
private String dutyHolderName; |
|||
|
|||
/** |
|||
* 描述 |
|||
*/ |
|||
@ApiModelProperty("描述") |
|||
private String details; |
|||
|
|||
|
|||
/** |
|||
* 问题等级 |
|||
*/ |
|||
@ApiModelProperty("问题等级") |
|||
private String issueLevel; |
|||
|
|||
|
|||
/** |
|||
* 记录id |
|||
*/ |
|||
@ApiModelProperty("记录id") |
|||
private String recordId; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 巡查状态字典:patrol_maintenance_status |
|||
*/ |
|||
@ApiModelProperty("巡查状态字典:patrol_maintenance_status") |
|||
private String status; |
|||
|
|||
|
|||
|
|||
/** |
|||
* name |
|||
*/ |
|||
@ApiModelProperty("name") |
|||
private String name; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 巡查类型 字典:patrol_maintenance_type |
|||
*/ |
|||
@ApiModelProperty("巡查类型 字典:patrol_maintenance_type") |
|||
private String type; |
|||
|
|||
/** |
|||
* 巡查类别字典:key_jf_patrol_category |
|||
*/ |
|||
@ApiModelProperty("巡查类别字典:patrol_maintenance_category") |
|||
private String category; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 堤防代码 |
|||
*/ |
|||
@ApiModelProperty("堤防代码") |
|||
private String dikeCode; |
|||
|
|||
|
|||
/** |
|||
* 堤防代码名称 |
|||
*/ |
|||
@ApiModelProperty("堤防代码名称") |
|||
private String dikeName; |
|||
|
|||
/** |
|||
* 维养开始时间 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty("维养开始时间") |
|||
private Date startTime; |
|||
|
|||
/** |
|||
* 维养结束时间 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty("维养结束时间") |
|||
private Date endDate; |
|||
|
|||
/** |
|||
* 描述 |
|||
*/ |
|||
@ApiModelProperty("描述") |
|||
private String describe; |
|||
|
|||
|
|||
/** |
|||
* 问题位置 |
|||
*/ |
|||
@ApiModelProperty("问题位置") |
|||
private String problemLocation; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 创建人id |
|||
*/ |
|||
@ApiModelProperty("创建人id") |
|||
private String createUid; |
|||
|
|||
|
|||
/** |
|||
* 附加配置 |
|||
*/ |
|||
@ApiModelProperty("备注") |
|||
private String remark; |
|||
|
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.kms.yxgh.df.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.df.domain.DfCheckingProblemV2; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* DfCheckingProblemV2Mapper |
|||
* |
|||
* @author sy |
|||
* @date 2024-01-04 |
|||
*/ |
|||
@Repository |
|||
public interface DfCheckingProblemV2Mapper extends BaseMapper<DfCheckingProblemV2> { |
|||
|
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.kms.yxgh.df.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.df.domain.DfCheckingRecord; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* 害堤动物防治计划Mapper接口 |
|||
* |
|||
* @author sy |
|||
* @date 2024-01-04 |
|||
*/ |
|||
@Repository |
|||
public interface DfCheckingRecordV2Mapper extends BaseMapper<DfCheckingRecord> { |
|||
|
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.kms.yxgh.df.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.df.domain.DfCheckingV2ProjectManage; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* 害堤动物防治计划Mapper接口 |
|||
* |
|||
* @author sy |
|||
* @date 2024-01-04 |
|||
*/ |
|||
@Repository |
|||
public interface DfCheckingV2Mapper extends BaseMapper<DfCheckingV2ProjectManage> { |
|||
|
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.kms.yxgh.df.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.df.domain.DfCheckingV2ProjectItem; |
|||
import com.kms.yxgh.df.domain.DfCheckingV2ProjectManage; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* DfCheckingV2ProjectItemMapper |
|||
* |
|||
* @author sy |
|||
* @date 2024-01-04 |
|||
*/ |
|||
@Repository |
|||
public interface DfCheckingV2ProjectItemMapper extends BaseMapper<DfCheckingV2ProjectItem> { |
|||
|
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.kms.yxgh.df.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.df.domain.DfYhV2V2; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* DfYhV2Mapper |
|||
* |
|||
* @author sy |
|||
* @date 2024-01-04 |
|||
*/ |
|||
@Repository |
|||
public interface DfYhV2Mapper extends BaseMapper<DfYhV2V2> { |
|||
|
|||
|
|||
} |
@ -0,0 +1,99 @@ |
|||
package com.kms.yxgh.df.service; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.kms.yxgh.df.dto.v2.DfProblemV2Dto; |
|||
import com.kms.yxgh.df.dto.v2.DfRecordSearchV2Dto; |
|||
import com.shuili.common.core.domain.SearchParam; |
|||
import com.shuili.common.core.service.BaseService; |
|||
import com.shuili.common.utils.BeanUtils; |
|||
import lombok.AllArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
import com.kms.yxgh.df.mapper.DfCheckingProblemV2Mapper; |
|||
import com.kms.yxgh.df.domain.DfCheckingProblemV2; |
|||
|
|||
import java.util.List; |
|||
import java.util.Optional; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 项目管理记录 |
|||
* |
|||
* @author sy |
|||
* @date 2023-11-09 |
|||
*/ |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class DfCheckingProblemV2Service extends BaseService<DfCheckingProblemV2Mapper, DfCheckingProblemV2> { |
|||
|
|||
|
|||
public IPage<DfProblemV2Dto> list(SearchParam<DfRecordSearchV2Dto> sp) { |
|||
// 分页参数
|
|||
Page<DfCheckingProblemV2> page = new Page<>(sp.getPageNum(), sp.getPageSize()); |
|||
DfRecordSearchV2Dto data = sp.getData(); |
|||
|
|||
// 构建查询条件
|
|||
LambdaQueryWrapper<DfCheckingProblemV2> queryWrapper = new LambdaQueryWrapper<>(); |
|||
if (!ObjectUtils.isEmpty(data)) { |
|||
Optional.ofNullable(data.getCategory()) |
|||
.filter(com.baomidou.mybatisplus.core.toolkit.StringUtils::isNotBlank) |
|||
.ifPresent(category -> queryWrapper.eq(DfCheckingProblemV2::getCategory, category)); |
|||
|
|||
Optional.ofNullable(data.getType()) |
|||
.filter(com.baomidou.mybatisplus.core.toolkit.StringUtils::isNotBlank) |
|||
.ifPresent(type -> queryWrapper.eq(DfCheckingProblemV2::getType, type)); |
|||
|
|||
Optional.ofNullable(data.getName()) |
|||
.filter(com.baomidou.mybatisplus.core.toolkit.StringUtils::isNotBlank) |
|||
.ifPresent(name -> queryWrapper.like(DfCheckingProblemV2::getName, name)); |
|||
|
|||
Optional.ofNullable(data.getDutyHolder()) |
|||
.filter(com.baomidou.mybatisplus.core.toolkit.StringUtils::isNotBlank) |
|||
.ifPresent(dutyHolder -> queryWrapper.like(DfCheckingProblemV2::getDutyHolderName, dutyHolder)); |
|||
|
|||
Optional.ofNullable(data.getStatus()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(status -> queryWrapper.like(DfCheckingProblemV2::getStatus, status)); |
|||
|
|||
Optional.ofNullable(data.getStartTime()) |
|||
.filter(startTime -> startTime != null) |
|||
.ifPresent(startTime -> queryWrapper.ge(DfCheckingProblemV2::getCreateTime, startTime)); |
|||
|
|||
Optional.ofNullable(data.getProblemLevel()) |
|||
.filter(problemLevel -> problemLevel != null) |
|||
.ifPresent(problemLevel -> queryWrapper.le(DfCheckingProblemV2::getIssueLevel, problemLevel)); |
|||
|
|||
Optional.ofNullable(data.getRecordId()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(recordId -> queryWrapper.eq(DfCheckingProblemV2::getIssueLevel, recordId)); |
|||
|
|||
} |
|||
|
|||
// 查询分页数据
|
|||
Page<DfCheckingProblemV2> queryPage = page(page, queryWrapper); |
|||
if (queryPage == null) { |
|||
return new Page<>(); |
|||
} |
|||
|
|||
// 转换为 DTO 分页对象
|
|||
Page<DfProblemV2Dto> dtoPage = new Page<>(); |
|||
BeanUtils.copyProperties(queryPage, dtoPage); |
|||
|
|||
// 处理查询结果
|
|||
List<DfProblemV2Dto> vos = queryPage.getRecords().stream() |
|||
.map(record -> { |
|||
DfProblemV2Dto dto = new DfProblemV2Dto(); |
|||
BeanUtils.copyProperties(record, dto); |
|||
return dto; |
|||
}) |
|||
.collect(Collectors.toList()); |
|||
dtoPage.setRecords(vos); |
|||
return dtoPage; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,186 @@ |
|||
package com.kms.yxgh.df.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.kms.yxgh.df.domain.DfCheckingProblemV2; |
|||
import com.kms.yxgh.df.domain.DfCheckingRecord; |
|||
import com.kms.yxgh.df.domain.DfCheckingV2ProjectItem; |
|||
import com.kms.yxgh.df.dto.DfCheckingDetailDto; |
|||
import com.kms.yxgh.df.dto.v2.DfProblemV2Dto; |
|||
import com.kms.yxgh.df.dto.v2.DfRecordDetailV2Dto; |
|||
import com.kms.yxgh.df.dto.v2.DfRecordSearchV2Dto; |
|||
import com.kms.yxgh.df.mapper.DfCheckingRecordV2Mapper; |
|||
import com.kms.yxgh.util.ListUtil; |
|||
import com.shuili.common.core.domain.SearchParam; |
|||
import com.shuili.common.core.service.BaseService; |
|||
import com.shuili.common.utils.BeanUtils; |
|||
import lombok.AllArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 项目管理记录 |
|||
* |
|||
* @author sy |
|||
* @date 2023-11-09 |
|||
*/ |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class DfCheckingRecordV2Service extends BaseService<DfCheckingRecordV2Mapper, DfCheckingRecord> { |
|||
|
|||
|
|||
private final DfCheckingV2ProjectItemV2Service dfCheckingV2ProjectItemV2Service; |
|||
|
|||
private final DfCheckingProblemV2Service dfCheckingProblemV2Service; |
|||
public IPage<DfRecordDetailV2Dto> list(SearchParam<DfRecordSearchV2Dto> sp) { |
|||
// 分页参数
|
|||
Page<DfCheckingRecord> page = new Page<>(sp.getPageNum(), sp.getPageSize()); |
|||
DfRecordSearchV2Dto data = sp.getData(); |
|||
|
|||
// 构建查询条件
|
|||
LambdaQueryWrapper<DfCheckingRecord> queryWrapper = new LambdaQueryWrapper<>(); |
|||
if (!ObjectUtils.isEmpty(data)) { |
|||
Optional.ofNullable(data.getCategory()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(category -> queryWrapper.eq(DfCheckingRecord::getCategory, category)); |
|||
|
|||
Optional.ofNullable(data.getType()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(type -> queryWrapper.eq(DfCheckingRecord::getType, type)); |
|||
|
|||
Optional.ofNullable(data.getName()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(name -> queryWrapper.like(DfCheckingRecord::getName, name)); |
|||
|
|||
Optional.ofNullable(data.getDutyHolder()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(dutyHolder -> queryWrapper.like(DfCheckingRecord::getDutyHolderName, dutyHolder)); |
|||
|
|||
Optional.ofNullable(data.getStatus()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(status -> queryWrapper.like(DfCheckingRecord::getStatus, status)); |
|||
|
|||
Optional.ofNullable(data.getStartTime()) |
|||
.filter(startTime -> startTime != null) |
|||
.ifPresent(startTime -> queryWrapper.ge(DfCheckingRecord::getCreateTime, startTime)); |
|||
|
|||
Optional.ofNullable(data.getEndTime()) |
|||
.filter(endTime -> endTime != null) |
|||
.ifPresent(endTime -> queryWrapper.le(DfCheckingRecord::getCreateTime, endTime)); |
|||
|
|||
} |
|||
|
|||
// 查询分页数据
|
|||
Page<DfCheckingRecord> queryPage = page(page, queryWrapper); |
|||
if (queryPage == null) { |
|||
return new Page<>(); |
|||
} |
|||
|
|||
// 转换为 DTO 分页对象
|
|||
Page<DfRecordDetailV2Dto> dtoPage = new Page<>(); |
|||
BeanUtils.copyProperties(queryPage, dtoPage); |
|||
|
|||
// 处理查询结果
|
|||
List<DfRecordDetailV2Dto> vos = queryPage.getRecords().stream() |
|||
.map(record -> { |
|||
DfRecordDetailV2Dto dto = new DfRecordDetailV2Dto(); |
|||
BeanUtils.copyProperties(record, dto); |
|||
return dto; |
|||
}) |
|||
.collect(Collectors.toList()); |
|||
dtoPage.setRecords(vos); |
|||
return dtoPage; |
|||
|
|||
} |
|||
|
|||
public DfRecordDetailV2Dto getInfo(String id) { |
|||
DfRecordDetailV2Dto dto=new DfRecordDetailV2Dto(); |
|||
DfCheckingRecord dfCheckingRecord = getById(id); |
|||
if (dfCheckingRecord != null) { |
|||
BeanUtils.copyProperties(dfCheckingRecord, dto); |
|||
|
|||
List<DfCheckingV2ProjectItem> items = dfCheckingV2ProjectItemV2Service.list( |
|||
Wrappers.<DfCheckingV2ProjectItem>lambdaQuery() |
|||
.eq(DfCheckingV2ProjectItem::getProjectId, id) |
|||
); |
|||
dto.setItems(items.stream() |
|||
.map(DfCheckingV2Service::convertToItemDto) |
|||
.collect(Collectors.toList())); |
|||
} |
|||
// 巡查详情列表
|
|||
SearchParam<DfRecordSearchV2Dto> sp=new SearchParam<>(); |
|||
DfRecordSearchV2Dto searchV2Dto=new DfRecordSearchV2Dto(); |
|||
searchV2Dto.setRecordId(dfCheckingRecord.getId()); |
|||
sp.setData(searchV2Dto); |
|||
sp.setPageSize(Integer.MAX_VALUE); |
|||
sp.setPageNum(1); |
|||
IPage<DfProblemV2Dto> list = dfCheckingProblemV2Service.list(sp); |
|||
if (null != list) { |
|||
List<DfProblemV2Dto> records = list.getRecords(); |
|||
List<DfRecordDetailV2Dto.DfRecordItemDetailV2Dto> dtoList = |
|||
ListUtil.copyListToResultList(records, DfRecordDetailV2Dto.DfRecordItemDetailV2Dto.class); |
|||
dto.setProblems(dtoList); |
|||
} |
|||
// 子项
|
|||
return dto; |
|||
} |
|||
|
|||
public DfRecordDetailV2Dto edit(DfRecordDetailV2Dto dfRecord, Boolean commit) { |
|||
if (commit) { |
|||
|
|||
List<String> ids = dfRecord.getProblems() |
|||
.stream() |
|||
.map(DfRecordDetailV2Dto.DfRecordItemDetailV2Dto::getId).collect(Collectors.toList()); |
|||
if (CollectionUtils.isNotEmpty(ids)) { |
|||
dfCheckingProblemV2Service.remove(new LambdaQueryWrapper<DfCheckingProblemV2>().in(DfCheckingProblemV2::getId,ids)); |
|||
} |
|||
DfCheckingRecord dfCheckingRecord=new DfCheckingRecord(); |
|||
BeanUtils.copyProperties(dfRecord, dfCheckingRecord); |
|||
updateById(dfCheckingRecord); |
|||
List<DfRecordDetailV2Dto.DfRecordItemDetailV2Dto> problems = dfRecord.getProblems(); |
|||
List<DfCheckingProblemV2> dfCheckingProblemV2s = ListUtil.copyListToResultList(problems, DfCheckingProblemV2.class); |
|||
dfCheckingProblemV2Service.updateBatchById(dfCheckingProblemV2s); |
|||
return dfRecord; |
|||
} |
|||
DfCheckingRecord dfCheckingRecord=new DfCheckingRecord(); |
|||
BeanUtils.copyProperties(dfRecord, dfCheckingRecord); |
|||
save(dfCheckingRecord); |
|||
List<DfRecordDetailV2Dto.DfRecordItemDetailV2Dto> problems = dfRecord.getProblems(); |
|||
List<DfCheckingProblemV2> dfCheckingProblemV2s = ListUtil.copyListToResultList(problems, DfCheckingProblemV2.class); |
|||
dfCheckingProblemV2Service.saveBatch(dfCheckingProblemV2s); |
|||
return dfRecord; |
|||
|
|||
} |
|||
|
|||
public Boolean myRemove(String[] ids) { |
|||
return Optional.ofNullable(ids) |
|||
.filter(array -> array.length > 0) |
|||
.map(array -> { |
|||
int count = dfCheckingProblemV2Service.count(new LambdaQueryWrapper<DfCheckingProblemV2>() |
|||
.eq(DfCheckingProblemV2::getProjectId, DfCheckingV2Service.getIntList(array)) |
|||
); |
|||
if (count > 0) { |
|||
throw new RuntimeException("请先删除项目子项"); |
|||
} |
|||
Arrays.stream(array) |
|||
.parallel() // 使用并行流
|
|||
.forEach(e->{ |
|||
dfCheckingProblemV2Service.remove(new LambdaQueryWrapper<DfCheckingProblemV2>().eq(DfCheckingProblemV2::getRecordId,e)); |
|||
}); |
|||
return removeById(ids); |
|||
}) |
|||
.orElse(false); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,17 @@ |
|||
package com.kms.yxgh.df.service; |
|||
import com.kms.yxgh.df.domain.DfCheckingV2ProjectItem; |
|||
import com.kms.yxgh.df.mapper.DfCheckingV2ProjectItemMapper; |
|||
import com.shuili.common.core.service.BaseService; |
|||
import lombok.AllArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
/** |
|||
* 项目管理项 |
|||
* |
|||
* @author sy |
|||
* @date 2023-11-09 |
|||
*/ |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class DfCheckingV2ProjectItemV2Service extends BaseService<DfCheckingV2ProjectItemMapper, DfCheckingV2ProjectItem> { |
|||
|
|||
} |
@ -0,0 +1,231 @@ |
|||
package com.kms.yxgh.df.service; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.kms.yxgh.df.domain.DfCheckingV2ProjectItem; |
|||
import com.kms.yxgh.df.domain.DfCheckingV2ProjectManage; |
|||
import com.kms.yxgh.df.dto.DfCheckingDetailDto; |
|||
import com.kms.yxgh.df.dto.v2.DfV2CheckingDto; |
|||
import com.kms.yxgh.df.dto.v2.DfV2CheckingSearchDto; |
|||
import com.kms.yxgh.df.mapper.DfCheckingV2Mapper; |
|||
import com.shuili.common.core.domain.SearchParam; |
|||
import com.shuili.common.core.service.BaseService; |
|||
import com.shuili.common.utils.BeanUtils; |
|||
import lombok.AllArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
/** |
|||
* 项目管理 |
|||
* |
|||
* @author sy |
|||
* @date 2023-11-09 |
|||
*/ |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class DfCheckingV2Service extends BaseService<DfCheckingV2Mapper, DfCheckingV2ProjectManage> { |
|||
|
|||
private final DfCheckingV2ProjectItemV2Service dfCheckingV2ProjectItemV2Service; |
|||
|
|||
|
|||
public IPage<DfV2CheckingDto> list(SearchParam<DfV2CheckingSearchDto> sp) { |
|||
// 分页参数
|
|||
Page<DfCheckingV2ProjectManage> page = new Page<>(sp.getPageNum(), sp.getPageSize()); |
|||
DfV2CheckingSearchDto data = sp.getData(); |
|||
|
|||
// 构建查询条件
|
|||
LambdaQueryWrapper<DfCheckingV2ProjectManage> queryWrapper = new LambdaQueryWrapper<>(); |
|||
if (!ObjectUtils.isEmpty(data)) { |
|||
Optional.ofNullable(data.getCategory()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(category -> queryWrapper.eq(DfCheckingV2ProjectManage::getCategory, category)); |
|||
|
|||
Optional.ofNullable(data.getType()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(type -> queryWrapper.eq(DfCheckingV2ProjectManage::getType, type)); |
|||
|
|||
Optional.ofNullable(data.getName()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(name -> queryWrapper.like(DfCheckingV2ProjectManage::getName, name)); |
|||
} |
|||
|
|||
// 查询分页数据
|
|||
Page<DfCheckingV2ProjectManage> queryPage = page(page, queryWrapper); |
|||
if (queryPage == null) { |
|||
return new Page<>(); |
|||
} |
|||
|
|||
// 转换为 DTO 分页对象
|
|||
Page<DfV2CheckingDto> dtoPage = new Page<>(); |
|||
BeanUtils.copyProperties(queryPage, dtoPage); |
|||
|
|||
// 处理查询结果
|
|||
List<DfV2CheckingDto> vos = queryPage.getRecords().stream() |
|||
.map(record -> { |
|||
DfV2CheckingDto dto = new DfV2CheckingDto(); |
|||
BeanUtils.copyProperties(record, dto); |
|||
return dto; |
|||
}) |
|||
.collect(Collectors.toList()); |
|||
|
|||
// 获取关联的项目项
|
|||
List<String> ids = vos.stream() |
|||
.map(DfV2CheckingDto::getId) |
|||
.collect(Collectors.toList()); |
|||
|
|||
List<DfCheckingV2ProjectItem> items = dfCheckingV2ProjectItemV2Service.list( |
|||
Wrappers.<DfCheckingV2ProjectItem>lambdaQuery() |
|||
.in(DfCheckingV2ProjectItem::getProjectId, ids) |
|||
); |
|||
|
|||
// 将项目项关联到 DTO
|
|||
vos.forEach(dto -> { |
|||
List<DfCheckingDetailDto.DfCheckingItemDto> itemDtos = items.stream() |
|||
.filter(item -> Objects.equals(item.getProjectId(),dto.getId())) |
|||
.map(DfCheckingV2Service::convertToItemDto) |
|||
.collect(Collectors.toList()); |
|||
dto.setItems(itemDtos); |
|||
}); |
|||
|
|||
dtoPage.setRecords(vos); |
|||
return dtoPage; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 将 DfCheckingV2ProjectItem 转换为 DfCheckingDetailDto.DfCheckingItemDto |
|||
* |
|||
* @param item 原始对象 |
|||
* @return 转换后的 DTO 对象 |
|||
*/ |
|||
public static DfCheckingDetailDto.DfCheckingItemDto convertToItemDto(DfCheckingV2ProjectItem item) { |
|||
DfCheckingDetailDto.DfCheckingItemDto itemDto = new DfCheckingDetailDto.DfCheckingItemDto(); |
|||
itemDto.setId(item.getId()); |
|||
itemDto.setContent(item.getContent()); |
|||
|
|||
// 处理 parts 字段
|
|||
Optional.ofNullable(item.getParts()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(parts -> itemDto.setParts(Arrays.asList(parts.split(",")))); |
|||
|
|||
return itemDto; |
|||
} |
|||
|
|||
public DfV2CheckingDto getInfo(String id) { |
|||
DfCheckingV2ProjectManage dfCheckingV2ProjectManage = getById(id); |
|||
DfV2CheckingDto dto = new DfV2CheckingDto(); |
|||
if (dfCheckingV2ProjectManage != null) { |
|||
BeanUtils.copyProperties(dfCheckingV2ProjectManage, dto); |
|||
|
|||
List<DfCheckingV2ProjectItem> items = dfCheckingV2ProjectItemV2Service.list( |
|||
Wrappers.<DfCheckingV2ProjectItem>lambdaQuery() |
|||
.eq(DfCheckingV2ProjectItem::getProjectId, id) |
|||
); |
|||
|
|||
dto.setItems(items.stream() |
|||
.map(DfCheckingV2Service::convertToItemDto) |
|||
.collect(Collectors.toList())); |
|||
} |
|||
return dto; |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public DfV2CheckingDto add(DfV2CheckingDto dto) { |
|||
// 将 DTO 转换为实体对象
|
|||
DfCheckingV2ProjectManage dfCheckingV2ProjectManage = new DfCheckingV2ProjectManage(); |
|||
BeanUtils.copyProperties(dto, dfCheckingV2ProjectManage); |
|||
|
|||
// 保存实体对象
|
|||
if (!save(dfCheckingV2ProjectManage)) { |
|||
throw new RuntimeException("保存失败"); |
|||
} |
|||
|
|||
// 处理关联的 items
|
|||
Optional.ofNullable(dto.getItems()) |
|||
.filter(items -> !items.isEmpty()) |
|||
.ifPresent(items -> { |
|||
List<DfCheckingV2ProjectItem> projectItems = items.parallelStream() // 使用并行流
|
|||
.map(item -> { |
|||
DfCheckingV2ProjectItem projectItem = new DfCheckingV2ProjectItem(); |
|||
projectItem.setProjectId(Integer.valueOf(dfCheckingV2ProjectManage.getId())); |
|||
projectItem.setContent(item.getContent()); |
|||
projectItem.setParts(String.join(",", item.getParts())); |
|||
return projectItem; |
|||
}) |
|||
.collect(Collectors.toList()); |
|||
// 批量保存 items
|
|||
dfCheckingV2ProjectItemV2Service.saveBatch(projectItems); |
|||
}); |
|||
return dto; |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public DfV2CheckingDto edit(DfV2CheckingDto dfV2Ck) { |
|||
if (StringUtils.isBlank(dfV2Ck.getId())) { |
|||
return null; |
|||
} |
|||
|
|||
DfCheckingV2ProjectManage dfCheckingV2ProjectManage = getById(dfV2Ck.getId()); |
|||
if (dfCheckingV2ProjectManage == null) { |
|||
return null; |
|||
} |
|||
|
|||
BeanUtils.copyProperties(dfV2Ck, dfCheckingV2ProjectManage); |
|||
|
|||
if (!updateById(dfCheckingV2ProjectManage)) { |
|||
throw new RuntimeException("修改失败"); |
|||
} |
|||
|
|||
List<DfCheckingV2ProjectItem> items = dfV2Ck.getItems().stream() |
|||
.map(item -> { |
|||
DfCheckingV2ProjectItem projectItem = new DfCheckingV2ProjectItem(); |
|||
projectItem.setId(item.getId()); |
|||
projectItem.setProjectId(Integer.valueOf(dfV2Ck.getId())); |
|||
projectItem.setContent(item.getContent()); |
|||
projectItem.setParts(String.join(",", item.getParts())); |
|||
return projectItem; |
|||
}) |
|||
.collect(Collectors.toList()); |
|||
|
|||
if (!dfCheckingV2ProjectItemV2Service.updateBatchById(items)) { |
|||
throw new RuntimeException("项目子项修改失败"); |
|||
} |
|||
|
|||
return dfV2Ck; |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public boolean myRemove(String[] ids) { |
|||
return Optional.ofNullable(ids) |
|||
.filter(array -> array.length > 0) |
|||
.map(array -> { |
|||
int count = dfCheckingV2ProjectItemV2Service.count(new LambdaQueryWrapper<DfCheckingV2ProjectItem>() |
|||
.eq(DfCheckingV2ProjectItem::getProjectId, getIntList(array)) |
|||
); |
|||
if (count > 0) { |
|||
throw new RuntimeException("请先删除项目子项"); |
|||
} |
|||
Arrays.stream(array) |
|||
.parallel() // 使用并行流
|
|||
.forEach(dfCheckingV2ProjectItemV2Service::removeById); |
|||
return removeById(ids); |
|||
}) |
|||
.orElse(false); |
|||
} |
|||
public static List<Integer> getIntList(String[] ids) { |
|||
if (ids == null) { |
|||
return new ArrayList<>(); |
|||
} |
|||
return Arrays.stream(ids) |
|||
.map(Integer::valueOf) |
|||
.collect(Collectors.toList()); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,136 @@ |
|||
package com.kms.yxgh.df.service; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.kms.yxgh.df.domain.DfYhV2V2; |
|||
import com.kms.yxgh.df.dto.v2.*; |
|||
import com.kms.yxgh.df.mapper.DfYhV2Mapper; |
|||
import com.shuili.common.core.domain.SearchParam; |
|||
import com.shuili.common.core.service.BaseService; |
|||
import com.shuili.common.utils.BeanUtils; |
|||
import lombok.AllArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Optional; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 项目管理记录 |
|||
* |
|||
* @author sy |
|||
* @date 2023-11-09 |
|||
*/ |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class DfYhV2V2Service extends BaseService<DfYhV2Mapper, DfYhV2V2> { |
|||
|
|||
public IPage<DfYhListV2Dto> list(SearchParam<DfRecordSearchV2Dto> sp) { |
|||
// 分页参数
|
|||
Page<DfYhV2V2> page = new Page<>(sp.getPageNum(), sp.getPageSize()); |
|||
DfRecordSearchV2Dto data = sp.getData(); |
|||
|
|||
// 构建查询条件
|
|||
LambdaQueryWrapper<DfYhV2V2> queryWrapper = new LambdaQueryWrapper<>(); |
|||
if (!ObjectUtils.isEmpty(data)) { |
|||
Optional.ofNullable(data.getCategory()) |
|||
.filter(com.baomidou.mybatisplus.core.toolkit.StringUtils::isNotBlank) |
|||
.ifPresent(category -> queryWrapper.eq(DfYhV2V2::getCategory, category)); |
|||
|
|||
Optional.ofNullable(data.getType()) |
|||
.filter(com.baomidou.mybatisplus.core.toolkit.StringUtils::isNotBlank) |
|||
.ifPresent(type -> queryWrapper.eq(DfYhV2V2::getType, type)); |
|||
|
|||
Optional.ofNullable(data.getName()) |
|||
.filter(com.baomidou.mybatisplus.core.toolkit.StringUtils::isNotBlank) |
|||
.ifPresent(name -> queryWrapper.like(DfYhV2V2::getName, name)); |
|||
|
|||
Optional.ofNullable(data.getDutyHolder()) |
|||
.filter(com.baomidou.mybatisplus.core.toolkit.StringUtils::isNotBlank) |
|||
.ifPresent(dutyHolder -> queryWrapper.like(DfYhV2V2::getDutyHolderName, dutyHolder)); |
|||
|
|||
Optional.ofNullable(data.getStatus()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(status -> queryWrapper.like(DfYhV2V2::getStatus, status)); |
|||
|
|||
Optional.ofNullable(data.getStartTime()) |
|||
.filter(startTime -> startTime != null) |
|||
.ifPresent(startTime -> queryWrapper.ge(DfYhV2V2::getCreateTime, startTime)); |
|||
|
|||
Optional.ofNullable(data.getProblemLevel()) |
|||
.filter(problemLevel -> problemLevel != null) |
|||
.ifPresent(problemLevel -> queryWrapper.le(DfYhV2V2::getIssueLevel, problemLevel)); |
|||
|
|||
Optional.ofNullable(data.getRecordId()) |
|||
.filter(StringUtils::isNotBlank) |
|||
.ifPresent(recordId -> queryWrapper.eq(DfYhV2V2::getIssueLevel, recordId)); |
|||
|
|||
} |
|||
|
|||
// 查询分页数据
|
|||
Page<DfYhV2V2> queryPage = page(page, queryWrapper); |
|||
if (queryPage == null) { |
|||
return new Page<>(); |
|||
} |
|||
|
|||
// 转换为 DTO 分页对象
|
|||
Page<DfYhListV2Dto> dtoPage = new Page<>(); |
|||
BeanUtils.copyProperties(queryPage, dtoPage); |
|||
|
|||
// 处理查询结果
|
|||
List<DfYhListV2Dto> vos = queryPage.getRecords().stream() |
|||
.map(record -> { |
|||
DfYhListV2Dto dto = new DfYhListV2Dto(); |
|||
BeanUtils.copyProperties(record, dto); |
|||
return dto; |
|||
}) |
|||
.collect(Collectors.toList()); |
|||
dtoPage.setRecords(vos); |
|||
return dtoPage; |
|||
} |
|||
|
|||
|
|||
public DfYhDetailV2Dto getInfo(String id) { |
|||
DfYhDetailV2Dto dto=new DfYhDetailV2Dto(); |
|||
DfYhV2V2 dfYhV2V2 = getById(id); |
|||
if (dfYhV2V2 != null) { |
|||
BeanUtils.copyProperties(dfYhV2V2, dto); |
|||
} |
|||
return dto; |
|||
} |
|||
|
|||
|
|||
public Boolean myRemove(String[] ids) { |
|||
return Optional.ofNullable(ids) |
|||
.filter(array -> array.length > 0) |
|||
.map(array -> { |
|||
Arrays.stream(array) |
|||
.parallel() // 使用并行流
|
|||
.forEach(this::removeById); |
|||
return removeById(ids); |
|||
}) |
|||
.orElse(false); |
|||
} |
|||
|
|||
public DfYhDetailV2Dto edit(DfRecordDetailV2Dto dfYh, Boolean commit) { |
|||
DfYhDetailV2Dto dto=new DfYhDetailV2Dto(); |
|||
DfYhV2V2 dfYhV2V2=new DfYhV2V2(); |
|||
if (commit) { |
|||
BeanUtils.copyProperties(dfYhV2V2, dfYh); |
|||
updateById(dfYhV2V2); |
|||
} |
|||
BeanUtils.copyProperties(dfYhV2V2, dfYh); |
|||
updateById(dfYhV2V2); |
|||
BeanUtils.copyProperties(dfYhV2V2, dto); |
|||
return dto; |
|||
|
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,60 @@ |
|||
package com.kms.yxgh.util; |
|||
import com.shuili.common.utils.BeanUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Objects; |
|||
import java.util.concurrent.ConcurrentHashMap; |
|||
import java.util.function.Function; |
|||
import java.util.function.Predicate; |
|||
import java.util.stream.Collectors; |
|||
public class ListUtil { |
|||
public ListUtil() { |
|||
} |
|||
|
|||
public static <T> Predicate<T> distinctByKey(Function<? super T, Object> keyExtractor) { |
|||
Map<Object, Boolean> seen = new ConcurrentHashMap(1024); |
|||
return (object) -> { |
|||
return seen.putIfAbsent(keyExtractor.apply(object), Boolean.TRUE) == null; |
|||
}; |
|||
} |
|||
|
|||
|
|||
public static boolean isNull(List list) { |
|||
return list == null || list.size() == 0; |
|||
} |
|||
|
|||
public static <T, F> List<F> copyListToResultList(List<T> sourceList, Class<F> targetObj) { |
|||
List<F> targetList = new ArrayList(); |
|||
if (!Objects.isNull(sourceList)) { |
|||
sourceList.forEach((item) -> { |
|||
try { |
|||
F data = targetObj.newInstance(); |
|||
BeanUtils.copyProperties(item, data); |
|||
targetList.add(data); |
|||
} catch (IllegalAccessException | InstantiationException var4) { |
|||
} |
|||
|
|||
}); |
|||
} |
|||
|
|||
return targetList; |
|||
} |
|||
|
|||
public static List getListByPage(Integer current, Integer size, List sourceList) { |
|||
if (sourceList != null && !sourceList.isEmpty()) { |
|||
if (current != 0 && current != 1) { |
|||
if (sourceList.size() < (current - 1) * size) { |
|||
return getListByPage(1, size, sourceList); |
|||
} else { |
|||
return sourceList.size() < current * size ? sourceList.subList((current - 1) * size, sourceList.size()) : sourceList.subList((current - 1) * size, current * size); |
|||
} |
|||
} else { |
|||
return sourceList.size() > size ? sourceList.subList(0, size) : sourceList; |
|||
} |
|||
} else { |
|||
return sourceList; |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue