[update] 修改施工进度计划、填报

This commit is contained in:
lcj
2025-08-05 09:26:39 +08:00
parent 89e88a957f
commit ce68cca915
24 changed files with 554 additions and 55 deletions

View File

@ -5,15 +5,16 @@ import org.dromara.common.core.domain.R;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsCreateByGeoJsonReq;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsCreateReq;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
import org.dromara.facility.service.IFacPhotovoltaicPanelPartsService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* 设施-光伏板桩点、立柱、支架
@ -29,6 +30,14 @@ public class FacPhotovoltaicPanelPartsController extends BaseController {
@Resource
private IFacPhotovoltaicPanelPartsService photovoltaicPanelPartsService;
/**
* 查询设施-光伏板桩点、立柱、支架根据光伏板名称
*/
@GetMapping("/list/byPanelName")
public R<TableDataInfo<FacPhotovoltaicPanelPartsByPanelNameVo>> queryPageListByPanelName(FacPhotovoltaicPanelPartsQueryReq req, PageQuery pageQuery) {
return R.ok(photovoltaicPanelPartsService.queryPageListByPanelName(req, pageQuery));
}
/**
* 通过GeoJson新增设施-光伏板桩点、立柱、支架
*/

View File

@ -106,9 +106,4 @@ public class FacPhotovoltaicPanelPointController extends BaseController {
return toAjax(facPhotovoltaicPanelPointService.deleteWithValidByIds(List.of(ids), true));
}
@GetMapping("/test")
public R<Void> test() {
facPhotovoltaicPanelPointService.test();
return toAjax(true);
}
}

View File

@ -1,5 +1,6 @@
package org.dromara.facility.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -79,4 +80,10 @@ public class FacPhotovoltaicPanelColumn extends BaseEntity {
*/
private String remark;
/**
* 光伏板名称
*/
@TableField(exist = false)
private String panelName;
}

View File

@ -1,5 +1,6 @@
package org.dromara.facility.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -79,4 +80,10 @@ public class FacPhotovoltaicPanelPoint extends BaseEntity {
*/
private String remark;
/**
* 光伏板名称
*/
@TableField(exist = false)
private String panelName;
}

View File

@ -1,5 +1,6 @@
package org.dromara.facility.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -79,4 +80,10 @@ public class FacPhotovoltaicPanelSupport extends BaseEntity {
*/
private String remark;
/**
* 光伏板名称
*/
@TableField(exist = false)
private String panelName;
}

View File

@ -0,0 +1,33 @@
package org.dromara.facility.domain.dto.photovoltaicpanelparts;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
/**
* @author lilemy
* @date 2025-08-04 10:35
*/
@Data
public class FacPhotovoltaicPanelPartsQueryReq implements Serializable {
@Serial
private static final long serialVersionUID = -3165283945470753140L;
/**
* 光伏板名称
*/
private String panelName;
/**
* 进度类别id
*/
private Long progressCategoryId;
/**
* 完成状态
*/
private List<String> finishStatusList;
}

View File

@ -0,0 +1,63 @@
package org.dromara.facility.domain.vo.photovoltaicpanelparts;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
/**
* @author lilemy
* @date 2025-08-04 10:37
*/
@Data
public class FacPhotovoltaicPanelPartsByPanelNameVo implements Serializable {
@Serial
private static final long serialVersionUID = -3560638633508857432L;
/**
* 光伏板名称
*/
private String panelName;
/**
* 光伏板桩点列表
*/
private List<Children> children;
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class Children {
/**
* 主键
*/
private Long id;
/**
* 光伏板桩点名称
*/
private String name;
/**
* 完成状态0未开始 1进行中 2完成
*/
private String status;
/**
* 完成类型1手动填报 2AI填报
*/
private String finishType;
/**
* 备注
*/
private String remark;
}
}

View File

@ -1,8 +1,13 @@
package org.dromara.facility.mapper;
import org.dromara.facility.domain.FacPhotovoltaicPanelColumn;
import org.dromara.facility.domain.vo.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.facility.domain.FacPhotovoltaicPanelColumn;
import org.dromara.facility.domain.FacPhotovoltaicPanelPoint;
import org.dromara.facility.domain.vo.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnVo;
import java.util.List;
/**
* 设施-光伏板立柱Mapper接口
@ -12,4 +17,12 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
*/
public interface FacPhotovoltaicPanelColumnMapper extends BaseMapperPlus<FacPhotovoltaicPanelColumn, FacPhotovoltaicPanelColumnVo> {
/**
* 分页查询 panelName即 name 的前三段)
*/
Page<String> selectPanelNamePage(Page<FacPhotovoltaicPanelPoint> page,
@Param("progressCategoryId") Long progressCategoryId,
@Param("panelName") String panelName,
@Param("statusList") List<String> statusList);
}

View File

@ -1,12 +1,12 @@
package org.dromara.facility.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.facility.domain.FacPhotovoltaicPanelPoint;
import org.dromara.facility.domain.vo.photovoltaicpanelpoint.FacPhotovoltaicPanelPointVo;
import java.util.Map;
import java.util.List;
/**
* 设施-光伏板桩点Mapper接口
@ -17,22 +17,10 @@ import java.util.Map;
public interface FacPhotovoltaicPanelPointMapper extends BaseMapperPlus<FacPhotovoltaicPanelPoint, FacPhotovoltaicPanelPointVo> {
/**
* 按 code 的前三段(即取到第 3 个 "." 之前)做前缀分组,
* 并分页返回每组的 prefix前缀和 cnt该组记录数
* <p>
* 例如:
* G11101.06.22.05 → G11101.06.22
* G11008.02.05#2.01 → G11008.02.05#2
* 分页查询 panelName即 name 的前三段)
*/
default <P extends IPage<Map<String, Object>>> P selectNameGroups(P page, Long progressCategoryId) {
return this.selectMapsPage(page,
new QueryWrapper<FacPhotovoltaicPanelPoint>()
.select("SUBSTRING_INDEX(name, '.', 3) AS prefix",
"COUNT(*) AS cnt")
.in("status", "0", "1")
.eq("progress_category_id", progressCategoryId)
.groupBy("prefix")
);
}
Page<String> selectPanelNamePage(Page<FacPhotovoltaicPanelPoint> page,
@Param("progressCategoryId") Long progressCategoryId,
@Param("panelName") String panelName,
@Param("statusList") List<String> statusList);
}

View File

@ -1,8 +1,13 @@
package org.dromara.facility.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.facility.domain.FacPhotovoltaicPanelPoint;
import org.dromara.facility.domain.FacPhotovoltaicPanelSupport;
import org.dromara.facility.domain.vo.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import java.util.List;
/**
* 设施-光伏板支架Mapper接口
@ -12,4 +17,12 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
*/
public interface FacPhotovoltaicPanelSupportMapper extends BaseMapperPlus<FacPhotovoltaicPanelSupport, FacPhotovoltaicPanelSupportVo> {
/**
* 分页查询 panelName即 name 的前三段)
*/
Page<String> selectPanelNamePage(Page<FacPhotovoltaicPanelPoint> page,
@Param("progressCategoryId") Long progressCategoryId,
@Param("panelName") String panelName,
@Param("statusList") List<String> statusList);
}

View File

@ -9,7 +9,9 @@ import org.dromara.facility.domain.FacPhotovoltaicPanelColumn;
import org.dromara.facility.domain.dto.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnCreateReq;
import org.dromara.facility.domain.dto.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnQueryReq;
import org.dromara.facility.domain.dto.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnUpdateReq;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
import org.dromara.facility.domain.vo.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnVo;
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
import java.util.Collection;
import java.util.List;
@ -96,4 +98,14 @@ public interface IFacPhotovoltaicPanelColumnService extends IService<FacPhotovol
*/
Page<FacPhotovoltaicPanelColumnVo> getVoPage(Page<FacPhotovoltaicPanelColumn> photovoltaicPanelColumnPage);
/**
* 获取设施-光伏板立柱分页对象视图
*
* @param req 查询条件
* @param pageQuery 分页参数
* @return 设施-光伏板立柱分页对象视图
*/
TableDataInfo<FacPhotovoltaicPanelPartsByPanelNameVo> queryPageListByPanelName(FacPhotovoltaicPanelPartsQueryReq req,
PageQuery pageQuery);
}

View File

@ -1,10 +1,14 @@
package org.dromara.facility.service;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.facility.domain.FacPhotovoltaicPanelColumn;
import org.dromara.facility.domain.FacPhotovoltaicPanelPoint;
import org.dromara.facility.domain.FacPhotovoltaicPanelSupport;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsCreateByGeoJsonReq;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsCreateReq;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
import java.util.Collection;
import java.util.Date;
@ -18,6 +22,16 @@ import java.util.List;
*/
public interface IFacPhotovoltaicPanelPartsService {
/**
* 查询光伏板(桩点、立柱、支架)列表
*
* @param req 查询参数
* @param pageQuery 分页参数
* @return 光伏板(桩点、立柱、支架)列表
*/
TableDataInfo<FacPhotovoltaicPanelPartsByPanelNameVo> queryPageListByPanelName(FacPhotovoltaicPanelPartsQueryReq req,
PageQuery pageQuery);
/**
* 批量新增设施-光伏板(桩点、立柱、支架)
*

View File

@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.facility.domain.FacPhotovoltaicPanelPoint;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
import org.dromara.facility.domain.dto.photovoltaicpanelpoint.FacPhotovoltaicPanelPointCreateReq;
import org.dromara.facility.domain.dto.photovoltaicpanelpoint.FacPhotovoltaicPanelPointQueryReq;
import org.dromara.facility.domain.dto.photovoltaicpanelpoint.FacPhotovoltaicPanelPointUpdateReq;
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
import org.dromara.facility.domain.vo.photovoltaicpanelpoint.FacPhotovoltaicPanelPointVo;
import java.util.Collection;
@ -96,5 +98,13 @@ public interface IFacPhotovoltaicPanelPointService extends IService<FacPhotovolt
*/
Page<FacPhotovoltaicPanelPointVo> getVoPage(Page<FacPhotovoltaicPanelPoint> photovoltaicPanelPointPage);
void test();
/**
* 获取设施-光伏板桩点分页对象视图
*
* @param req 查询条件
* @param pageQuery 分页参数
* @return 设施-光伏板桩点分页对象视图
*/
TableDataInfo<FacPhotovoltaicPanelPartsByPanelNameVo> queryPageListByPanelName(FacPhotovoltaicPanelPartsQueryReq req,
PageQuery pageQuery);
}

View File

@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.facility.domain.FacPhotovoltaicPanelSupport;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
import org.dromara.facility.domain.dto.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportCreateReq;
import org.dromara.facility.domain.dto.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportQueryReq;
import org.dromara.facility.domain.dto.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportUpdateReq;
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
import org.dromara.facility.domain.vo.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportVo;
import java.util.Collection;
@ -96,4 +98,14 @@ public interface IFacPhotovoltaicPanelSupportService extends IService<FacPhotovo
*/
Page<FacPhotovoltaicPanelSupportVo> getVoPage(Page<FacPhotovoltaicPanelSupport> photovoltaicPanelSupportPage);
/**
* 获取设施-光伏板支架分页对象视图
*
* @param req 查询条件
* @param pageQuery 分页参数
* @return 设施-光伏板支架分页对象视图
*/
TableDataInfo<FacPhotovoltaicPanelPartsByPanelNameVo> queryPageListByPanelName(FacPhotovoltaicPanelPartsQueryReq req,
PageQuery pageQuery);
}

View File

@ -3,6 +3,7 @@ package org.dromara.facility.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
@ -17,7 +18,10 @@ import org.dromara.facility.domain.FacPhotovoltaicPanelColumn;
import org.dromara.facility.domain.dto.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnCreateReq;
import org.dromara.facility.domain.dto.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnQueryReq;
import org.dromara.facility.domain.dto.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnUpdateReq;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
import org.dromara.facility.domain.enums.FacFinishStatusEnum;
import org.dromara.facility.domain.vo.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnVo;
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
import org.dromara.facility.mapper.FacPhotovoltaicPanelColumnMapper;
import org.dromara.facility.service.IFacMatrixService;
import org.dromara.facility.service.IFacPhotovoltaicPanelColumnService;
@ -26,8 +30,11 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 设施-光伏板立柱Service业务层处理
@ -277,4 +284,60 @@ public class FacPhotovoltaicPanelColumnServiceImpl extends ServiceImpl<FacPhotov
return photovoltaicPanelColumnVoPage;
}
/**
* 获取设施-光伏板立柱分页对象视图
*
* @param req 查询条件
* @param pageQuery 分页参数
* @return 设施-光伏板立柱分页对象视图
*/
@Override
public TableDataInfo<FacPhotovoltaicPanelPartsByPanelNameVo> queryPageListByPanelName(FacPhotovoltaicPanelPartsQueryReq req, PageQuery pageQuery) {
Long progressCategoryId = req.getProgressCategoryId();
if (progressCategoryId == null) {
throw new ServiceException("请选择进度类别", HttpStatus.BAD_REQUEST);
}
List<String> finishStatusList = req.getFinishStatusList();
if (CollUtil.isEmpty(finishStatusList)) {
finishStatusList = List.of(FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
}
// 第一步:分页获取 panelName
Page<String> panelNamePage = baseMapper.selectPanelNamePage(
pageQuery.build(), progressCategoryId,
req.getPanelName(), req.getFinishStatusList());
List<String> panelNameList = panelNamePage.getRecords();
if (CollUtil.isEmpty(panelNameList)) {
return TableDataInfo.build();
}
// 第二步:获取这些 panelName 对应的所有记录
QueryWrapper<FacPhotovoltaicPanelColumn> qw = new QueryWrapper<>();
qw.select("*", "SUBSTRING_INDEX(name, '.', 3) AS panelName")
.eq("progress_category_id", progressCategoryId)
.in("status", finishStatusList)
.orderByAsc("panelName");
// 拼接 panelName 列表到 SQL
String inClause = panelNameList.stream()
.map(s -> "'" + s + "'")
.collect(Collectors.joining(","));
qw.apply("SUBSTRING_INDEX(name, '.', 3) IN (" + inClause + ")");
List<FacPhotovoltaicPanelColumn> columnList = this.list(qw);
Map<String, List<FacPhotovoltaicPanelColumn>> map = columnList.stream().collect(Collectors.groupingBy(FacPhotovoltaicPanelColumn::getPanelName));
List<FacPhotovoltaicPanelPartsByPanelNameVo> result = new ArrayList<>();
for (Map.Entry<String, List<FacPhotovoltaicPanelColumn>> entry : map.entrySet()) {
FacPhotovoltaicPanelPartsByPanelNameVo vo = new FacPhotovoltaicPanelPartsByPanelNameVo();
String key = entry.getKey();
List<FacPhotovoltaicPanelColumn> value = entry.getValue();
vo.setPanelName(key);
vo.setChildren(value.stream().map(column -> new FacPhotovoltaicPanelPartsByPanelNameVo.Children(
column.getId(),
column.getName(),
column.getStatus(),
column.getFinishType(),
column.getRemark()
)).toList());
result.add(vo);
}
return new TableDataInfo<>(result, panelNamePage.getTotal());
}
}

View File

@ -9,6 +9,8 @@ import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.constant.HttpStatus;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.sse.dto.SseMessageDto;
import org.dromara.common.sse.utils.SseMessageUtils;
@ -22,8 +24,10 @@ import org.dromara.facility.domain.FacPhotovoltaicPanelSupport;
import org.dromara.facility.domain.dto.geojson.FacFeatureByPoint;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsCreateByGeoJsonReq;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsCreateReq;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
import org.dromara.facility.domain.enums.FacFinishStatusEnum;
import org.dromara.facility.domain.enums.FacFinishTypeEnum;
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
import org.dromara.facility.service.*;
import org.dromara.progress.constant.PgsProgressCategoryConstant;
import org.dromara.progress.domain.PgsProgressCategory;
@ -82,6 +86,35 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
@Resource
private FacPhotovoltaicPanelPartsServiceImpl self; // 注入自己
/**
* 查询光伏板(桩点、立柱、支架)列表
*
* @param req 查询参数
* @param pageQuery 分页参数
* @return 光伏板(桩点、立柱、支架)列表
*/
@Override
public TableDataInfo<FacPhotovoltaicPanelPartsByPanelNameVo> queryPageListByPanelName(FacPhotovoltaicPanelPartsQueryReq req, PageQuery pageQuery) {
Long progressCategoryId = req.getProgressCategoryId();
if (progressCategoryId == null) {
throw new ServiceException("请选择进度类别", HttpStatus.BAD_REQUEST);
}
PgsProgressCategory progressCategory = progressCategoryService.getById(progressCategoryId);
if (progressCategory == null) {
throw new ServiceException("进度类别不存在", HttpStatus.NOT_FOUND);
}
String workType = progressCategory.getWorkType();
return switch (workType) {
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE ->
photovoltaicPanelPointService.queryPageListByPanelName(req, pageQuery);
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE ->
photovoltaicPanelColumnService.queryPageListByPanelName(req, pageQuery);
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE ->
photovoltaicPanelSupportService.queryPageListByPanelName(req, pageQuery);
case null, default -> throw new ServiceException("未定义的进度计划类别", HttpStatus.BAD_REQUEST);
};
}
/**
* 批量新增设施-光伏板(桩点、立柱、支架)
*

View File

@ -3,7 +3,7 @@ package org.dromara.facility.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
@ -15,9 +15,12 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.facility.domain.FacPhotovoltaicPanelPoint;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
import org.dromara.facility.domain.dto.photovoltaicpanelpoint.FacPhotovoltaicPanelPointCreateReq;
import org.dromara.facility.domain.dto.photovoltaicpanelpoint.FacPhotovoltaicPanelPointQueryReq;
import org.dromara.facility.domain.dto.photovoltaicpanelpoint.FacPhotovoltaicPanelPointUpdateReq;
import org.dromara.facility.domain.enums.FacFinishStatusEnum;
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
import org.dromara.facility.domain.vo.photovoltaicpanelpoint.FacPhotovoltaicPanelPointVo;
import org.dromara.facility.mapper.FacPhotovoltaicPanelPointMapper;
import org.dromara.facility.service.IFacMatrixService;
@ -27,9 +30,11 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 设施-光伏板桩点Service业务层处理
@ -279,11 +284,60 @@ public class FacPhotovoltaicPanelPointServiceImpl extends ServiceImpl<FacPhotovo
return photovoltaicPanelPointVoPage;
}
/**
* 获取设施-光伏板桩点分页对象视图
*
* @param req 查询条件
* @param pageQuery 分页参数
* @return 设施-光伏板桩点分页对象视图
*/
@Override
public void test() {
Page<Map<String, Object>> page = new Page<>(1, 20);
IPage<Map<String, Object>> result = baseMapper.selectNameGroups(page, 1951552040378360699L);
System.out.println(result);
public TableDataInfo<FacPhotovoltaicPanelPartsByPanelNameVo> queryPageListByPanelName(FacPhotovoltaicPanelPartsQueryReq req, PageQuery pageQuery) {
Long progressCategoryId = req.getProgressCategoryId();
if (progressCategoryId == null) {
throw new ServiceException("请选择进度类别", HttpStatus.BAD_REQUEST);
}
List<String> finishStatusList = req.getFinishStatusList();
if (CollUtil.isEmpty(finishStatusList)) {
finishStatusList = List.of(FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
}
// 第一步:分页获取 panelName
Page<String> panelNamePage = baseMapper.selectPanelNamePage(
pageQuery.build(), progressCategoryId,
req.getPanelName(), req.getFinishStatusList());
List<String> panelNameList = panelNamePage.getRecords();
if (CollUtil.isEmpty(panelNameList)) {
return TableDataInfo.build();
}
// 第二步:获取这些 panelName 对应的所有记录
QueryWrapper<FacPhotovoltaicPanelPoint> qw = new QueryWrapper<>();
qw.select("*", "SUBSTRING_INDEX(name, '.', 3) AS panelName")
.eq("progress_category_id", progressCategoryId)
.in("status", finishStatusList)
.orderByAsc("panelName");
// 拼接 panelName 列表到 SQL
String inClause = panelNameList.stream()
.map(s -> "'" + s + "'")
.collect(Collectors.joining(","));
qw.apply("SUBSTRING_INDEX(name, '.', 3) IN (" + inClause + ")");
List<FacPhotovoltaicPanelPoint> pointList = this.list(qw);
Map<String, List<FacPhotovoltaicPanelPoint>> map = pointList.stream().collect(Collectors.groupingBy(FacPhotovoltaicPanelPoint::getPanelName));
List<FacPhotovoltaicPanelPartsByPanelNameVo> result = new ArrayList<>();
for (Map.Entry<String, List<FacPhotovoltaicPanelPoint>> entry : map.entrySet()) {
FacPhotovoltaicPanelPartsByPanelNameVo vo = new FacPhotovoltaicPanelPartsByPanelNameVo();
String key = entry.getKey();
List<FacPhotovoltaicPanelPoint> value = entry.getValue();
vo.setPanelName(key);
vo.setChildren(value.stream().map(point -> new FacPhotovoltaicPanelPartsByPanelNameVo.Children(
point.getId(),
point.getName(),
point.getStatus(),
point.getFinishType(),
point.getRemark()
)).toList());
result.add(vo);
}
return new TableDataInfo<>(result, panelNamePage.getTotal());
}
}

View File

@ -3,6 +3,7 @@ package org.dromara.facility.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
@ -14,9 +15,12 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.facility.domain.FacPhotovoltaicPanelSupport;
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
import org.dromara.facility.domain.dto.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportCreateReq;
import org.dromara.facility.domain.dto.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportQueryReq;
import org.dromara.facility.domain.dto.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportUpdateReq;
import org.dromara.facility.domain.enums.FacFinishStatusEnum;
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
import org.dromara.facility.domain.vo.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportVo;
import org.dromara.facility.mapper.FacPhotovoltaicPanelSupportMapper;
import org.dromara.facility.service.IFacMatrixService;
@ -26,8 +30,11 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 设施-光伏板支架Service业务层处理
@ -277,4 +284,60 @@ public class FacPhotovoltaicPanelSupportServiceImpl extends ServiceImpl<FacPhoto
return photovoltaicPanelSupportVoPage;
}
/**
* 获取设施-光伏板支架分页对象视图
*
* @param req 查询条件
* @param pageQuery 分页参数
* @return 设施-光伏板支架分页对象视图
*/
@Override
public TableDataInfo<FacPhotovoltaicPanelPartsByPanelNameVo> queryPageListByPanelName(FacPhotovoltaicPanelPartsQueryReq req, PageQuery pageQuery) {
Long progressCategoryId = req.getProgressCategoryId();
if (progressCategoryId == null) {
throw new ServiceException("请选择进度类别", HttpStatus.BAD_REQUEST);
}
List<String> finishStatusList = req.getFinishStatusList();
if (CollUtil.isEmpty(finishStatusList)) {
finishStatusList = List.of(FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
}
// 第一步:分页获取 panelName
Page<String> panelNamePage = baseMapper.selectPanelNamePage(
pageQuery.build(), progressCategoryId,
req.getPanelName(), req.getFinishStatusList());
List<String> panelNameList = panelNamePage.getRecords();
if (CollUtil.isEmpty(panelNameList)) {
return TableDataInfo.build();
}
// 第二步:获取这些 panelName 对应的所有记录
QueryWrapper<FacPhotovoltaicPanelSupport> qw = new QueryWrapper<>();
qw.select("*", "SUBSTRING_INDEX(name, '.', 3) AS panelName")
.eq("progress_category_id", progressCategoryId)
.in("status", finishStatusList)
.orderByAsc("panelName");
// 拼接 panelName 列表到 SQL
String inClause = panelNameList.stream()
.map(s -> "'" + s + "'")
.collect(Collectors.joining(","));
qw.apply("SUBSTRING_INDEX(name, '.', 3) IN (" + inClause + ")");
List<FacPhotovoltaicPanelSupport> supportList = this.list(qw);
Map<String, List<FacPhotovoltaicPanelSupport>> map = supportList.stream().collect(Collectors.groupingBy(FacPhotovoltaicPanelSupport::getPanelName));
List<FacPhotovoltaicPanelPartsByPanelNameVo> result = new ArrayList<>();
for (Map.Entry<String, List<FacPhotovoltaicPanelSupport>> entry : map.entrySet()) {
FacPhotovoltaicPanelPartsByPanelNameVo vo = new FacPhotovoltaicPanelPartsByPanelNameVo();
String key = entry.getKey();
List<FacPhotovoltaicPanelSupport> value = entry.getValue();
vo.setPanelName(key);
vo.setChildren(value.stream().map(support -> new FacPhotovoltaicPanelPartsByPanelNameVo.Children(
support.getId(),
support.getName(),
support.getStatus(),
support.getFinishType(),
support.getRemark()
)).toList());
result.add(vo);
}
return new TableDataInfo<>(result, panelNamePage.getTotal());
}
}

View File

@ -43,6 +43,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
@ -138,7 +139,8 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
// 获取当前进度数量和完成数量总和
BigDecimal allNumber = progressPlanService.getCurrentPlanAndFinishedNumber(progressCategory);
PgsProgressCategoryLastTimeVo lastTimeVo = new PgsProgressCategoryLastTimeVo();
BigDecimal total = progressCategory.getTotal();
BigDecimal total = PgsProgressUnitTypeEnum.PERCENTAGE.getValue().equals(progressCategory.getUnitType()) ?
new BigDecimal(100) : progressCategory.getTotal();
// 剩余数量
BigDecimal planTotal = total.subtract(allNumber);
lastTimeVo.setLeftNum(planTotal);
@ -327,17 +329,41 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
String pidStatus = getPidStatus(children);
// 累加子节点数据
BigDecimal total = children.stream().map(PgsProgressCategory::getTotal).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal completed = children.stream().map(PgsProgressCategory::getCompleted).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal planTotal = children.stream().map(PgsProgressCategory::getPlanTotal).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal completed = BigDecimal.ZERO;
BigDecimal planTotal = BigDecimal.ZERO;
for (PgsProgressCategory child : children) {
if (PgsProgressUnitTypeEnum.PERCENTAGE.getValue().equals(child.getUnitType())) {
completed = completed.add(child.getCompleted()
.multiply(child.getTotal())
.divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP));
planTotal = planTotal.add(child.getPlanTotal()
.multiply(child.getTotal())
.divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP));
} else {
completed = completed.add(child.getCompleted());
planTotal = planTotal.add(child.getPlanTotal());
}
}
// 可以在 VO 中额外设置这些总和值(或替换原有字段)
vo.setTotal(total);
vo.setCompleted(completed);
vo.setPlanTotal(planTotal);
vo.setStatus(pidStatus);
}
// 计算百分比(避免除以 0
vo.setCompletedPercentage(BigDecimalUtil.toPercentage(vo.getCompleted(), vo.getTotal()));
vo.setPlanTotalPercentage(BigDecimalUtil.toPercentage(vo.getPlanTotal(), vo.getTotal()));
// 计算百分比
BigDecimal total = vo.getTotal();
BigDecimal completed = vo.getCompleted();
BigDecimal planTotal = vo.getPlanTotal();
if (PgsProgressUnitTypeEnum.PERCENTAGE.getValue().equals(vo.getUnitType())) {
completed = completed.multiply(total)
.divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
planTotal = planTotal.multiply(total)
.divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
}
vo.setCompleted(completed);
vo.setPlanTotal(planTotal);
vo.setCompletedPercentage(BigDecimalUtil.toPercentage(completed, total));
vo.setPlanTotalPercentage(BigDecimalUtil.toPercentage(planTotal, total));
return vo;
}).toList();
}

View File

@ -119,6 +119,12 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
if (progressPlanDetail == null) {
throw new ServiceException("进度计划详情信息不存在", HttpStatus.NOT_FOUND);
}
Long progressPlanId = progressPlanDetail.getProgressPlanId();
PgsProgressPlan progressPlan = progressPlanService.getById(progressPlanId);
if (progressPlan == null) {
throw new ServiceException("进度计划信息不存在", HttpStatus.NOT_FOUND);
}
BigDecimal oldFinishedNumber = progressPlan.getFinishedNumber();
// todo 判断完成时间是否大于当前时间
Date planDate = progressPlanDetail.getDate();
/* if (planDate.after(new Date())) {
@ -253,13 +259,17 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
if (!update) {
throw new ServiceException("更新进度计划详情异常", HttpStatus.ERROR);
}
boolean result = progressPlanService.lambdaUpdate()
.eq(PgsProgressPlan::getId, progressPlanDetail.getProgressPlanId())
.setSql("finished_number = finished_number + " + size)
.update();
progressPlan.setFinishedNumber(progressPlan.getFinishedNumber().add(BigDecimal.valueOf(size)));
boolean result = progressPlanService.updateById(progressPlan);
if (!result) {
throw new ServiceException("更新进度计划异常", HttpStatus.ERROR);
}
// 判断当前是否已完成计划数量
BigDecimal nowFinishedNumber = progressPlan.getFinishedNumber();
if (oldFinishedNumber.compareTo(progressPlan.getPlanNumber()) < 0
&& nowFinishedNumber.compareTo(progressPlan.getPlanNumber()) >= 0) {
progressCategory.setPlanTotal(progressCategory.getPlanTotal().subtract(progressPlan.getPlanNumber()));
}
BigDecimal completedTotal = progressCategory.getCompleted().add(new BigDecimal(size));
progressCategory.setCompleted(completedTotal);
if (completedTotal.compareTo(progressCategory.getTotal()) == 0) {
@ -299,6 +309,10 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
if (progressPlanDetail == null) {
throw new ServiceException("进度计划详情信息不存在", HttpStatus.NOT_FOUND);
}
// 判断总进度不能大于 100
if (progressPlanDetail.getFinishedNumber().add(finishedNumber).compareTo(BigDecimal.valueOf(100)) > 0) {
throw new ServiceException("总进度不能大于100", HttpStatus.BAD_REQUEST);
}
Long progressPlanId = progressPlanDetail.getProgressPlanId();
PgsProgressPlan progressPlan = progressPlanService.getById(progressPlanId);
if (progressPlan == null) {
@ -310,14 +324,14 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
throw new ServiceException("进度计划类别信息不存在", HttpStatus.NOT_FOUND);
}
BigDecimal number = progressPlanDetail.getFinishedNumber();
BigDecimal finishedNumberTotal = progressPlan.getFinishedNumber();
BigDecimal oldFinishedNumberTotal = progressPlan.getFinishedNumber();
progressPlanDetail.setFinishedNumber(finishedNumber);
// 更新
boolean update = this.updateById(progressPlanDetail);
if (!update) {
throw new ServiceException("更新进度计划详情异常", HttpStatus.ERROR);
}
progressPlan.setFinishedNumber(finishedNumberTotal.subtract(number).add(finishedNumber));
progressPlan.setFinishedNumber(oldFinishedNumberTotal.subtract(number).add(finishedNumber));
boolean result = progressPlanService.updateById(progressPlan);
if (!result) {
throw new ServiceException("更新进度计划异常", HttpStatus.ERROR);
@ -328,6 +342,12 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
if (completedTotal.compareTo(progressCategory.getTotal()) == 0) {
progressCategory.setStatus(PgsFinishStatusEnum.FINISH.getValue());
}
// 判断当前是否已完成计划数量
BigDecimal nowFinishedNumber = progressPlan.getFinishedNumber();
if (oldFinishedNumberTotal.compareTo(progressPlan.getPlanNumber()) < 0
&& nowFinishedNumber.compareTo(progressPlan.getPlanNumber()) >= 0) {
progressCategory.setPlanTotal(progressCategory.getPlanTotal().subtract(progressPlan.getPlanNumber()));
}
boolean updateCategory = progressCategoryService.updateById(progressCategory);
if (!updateCategory) {
throw new ServiceException("更新进度分类异常", HttpStatus.ERROR);

View File

@ -171,7 +171,7 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
// 更新进度分类计划总数量
boolean update = progressCategoryService.lambdaUpdate()
.eq(PgsProgressCategory::getId, progressCategoryId)
.set(PgsProgressCategory::getPlanTotal, progressPlan.getPlanNumber())
.set(PgsProgressCategory::getPlanTotal, progressCategory.getPlanTotal().add(progressPlan.getPlanNumber()))
.set(PgsProgressCategory::getStatus, PgsFinishStatusEnum.INPROGRESS.getValue())
.set(PgsProgressCategory::getIsDelay, PgsDelayStatusEnum.UNDELAY.getValue())
.update();
@ -415,15 +415,27 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
}).toList();
progressPlanList.addAll(delayList);
}
List<PgsProgressCategory> progressCategoryList = progressCategoryService.listByIds(categoryIdList);
if (CollUtil.isEmpty(progressCategoryList) || progressCategoryList.size() != categoryIdList.size()) {
log.error("进度类别不存在id{}entry{}", categoryIdList, progressCategoryList);
return false;
}
// 批量更新
boolean result = this.updateBatchById(progressPlanList);
if (!result) {
throw new ServiceException("更新施工进度失败", HttpStatus.ERROR);
}
boolean update = progressCategoryService.lambdaUpdate()
.in(PgsProgressCategory::getId, categoryIdList)
.set(PgsProgressCategory::getIsDelay, PgsDelayStatusEnum.DELAY.getValue())
.update();
List<PgsProgressCategory> updateCategoryList = progressCategoryList.stream().map(category -> {
PgsProgressCategory progressCategory = new PgsProgressCategory();
Long id = category.getId();
progressCategory.setId(id);
progressCategory.setIsDelay(PgsDelayStatusEnum.DELAY.getValue());
List<PgsProgressPlan> plans = delayPlanMap.get(id);
BigDecimal planNumber = plans.stream().map(PgsProgressPlan::getPlanNumber).reduce(BigDecimal.ZERO, BigDecimal::add);
progressCategory.setPlanTotal(progressCategory.getPlanTotal().subtract(planNumber));
return progressCategory;
}).toList();
boolean update = progressCategoryService.updateBatchById(updateCategoryList);
if (!update) {
throw new ServiceException("更新进度类别异常", HttpStatus.ERROR);
}

View File

@ -4,4 +4,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.facility.mapper.FacPhotovoltaicPanelColumnMapper">
<select id="selectPanelNamePage" resultType="java.lang.String">
SELECT DISTINCT SUBSTRING_INDEX(name, '.', 3) AS panelName
FROM fac_photovoltaic_panel_column
WHERE progress_category_id = #{progressCategoryId}
<if test="statusList != null and statusList.size() > 0">
AND status IN
<foreach collection="statusList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="panelName != null and panelName != ''">
AND SUBSTRING_INDEX(name, '.', 3) LIKE CONCAT('%', #{panelName}, '%')
</if>
ORDER BY panelName
</select>
</mapper>

View File

@ -4,4 +4,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.facility.mapper.FacPhotovoltaicPanelPointMapper">
<select id="selectPanelNamePage" resultType="java.lang.String">
SELECT DISTINCT SUBSTRING_INDEX(name, '.', 3) AS panelName
FROM fac_photovoltaic_panel_point
WHERE progress_category_id = #{progressCategoryId}
<if test="statusList != null and statusList.size() > 0">
AND status IN
<foreach collection="statusList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="panelName != null and panelName != ''">
AND SUBSTRING_INDEX(name, '.', 3) LIKE CONCAT('%', #{panelName}, '%')
</if>
ORDER BY panelName
</select>
</mapper>

View File

@ -4,4 +4,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.facility.mapper.FacPhotovoltaicPanelSupportMapper">
<select id="selectPanelNamePage" resultType="java.lang.String">
SELECT DISTINCT SUBSTRING_INDEX(name, '.', 3) AS panelName
FROM fac_photovoltaic_panel_support
WHERE progress_category_id = #{progressCategoryId}
<if test="statusList != null and statusList.size() > 0">
AND status IN
<foreach collection="statusList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="panelName != null and panelName != ''">
AND SUBSTRING_INDEX(name, '.', 3) LIKE CONCAT('%', #{panelName}, '%')
</if>
ORDER BY panelName
</select>
</mapper>