进度管理大屏
This commit is contained in:
@ -6,11 +6,11 @@ import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.bigscreen.domain.dto.ProjectImageProgressDetailReq;
|
||||
import org.dromara.bigscreen.domain.progress.DesignProgressVo;
|
||||
import org.dromara.bigscreen.domain.progress.MaterialProgressDetailVo;
|
||||
import org.dromara.bigscreen.domain.progress.MilestoneProgressVo;
|
||||
import org.dromara.bigscreen.domain.progress.ProjectTotalProgressVo;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectImageProgressDetailVo;
|
||||
import org.dromara.bigscreen.service.ProgressBigScreenService;
|
||||
import org.dromara.bigscreen.service.ProjectBigScreenService;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -37,9 +37,6 @@ public class ProgressBigScreenController extends BaseController {
|
||||
@Resource
|
||||
private ProgressBigScreenService progressBigScreenService;
|
||||
|
||||
@Resource
|
||||
private ProjectBigScreenService projectBigScreenService;
|
||||
|
||||
/**
|
||||
* 获取项目总进度
|
||||
*/
|
||||
@ -71,7 +68,16 @@ public class ProgressBigScreenController extends BaseController {
|
||||
* 获取施工进度详情
|
||||
*/
|
||||
@GetMapping("/constructionProgress/detail")
|
||||
public R<List<ProjectImageProgressDetailVo>> getProjectImageProgressDetail(@Validated ProjectImageProgressDetailReq req) {
|
||||
return R.ok(projectBigScreenService.getProjectImageProgressDetail(req));
|
||||
public R<List<ProjectImageProgressDetailVo>> getProjectTotalProgressDetail(@Validated ProjectImageProgressDetailReq req) {
|
||||
return R.ok(progressBigScreenService.getProjectTotalProgressDetail(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取材料进度详情
|
||||
*/
|
||||
@GetMapping("/materialProgress/detail/{projectId}")
|
||||
public R<List<MaterialProgressDetailVo>> getMaterialProgressDetail(@NotNull(message = "项目主键不能为空")
|
||||
@PathVariable Long projectId) {
|
||||
return R.ok(progressBigScreenService.getMaterialProgressDetail(projectId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
package org.dromara.bigscreen.domain.progress;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-12-16 17:03
|
||||
*/
|
||||
@Data
|
||||
public class MaterialProgressDetailVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -4499381537680421083L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal quantity;
|
||||
|
||||
/**
|
||||
* 验收
|
||||
*/
|
||||
private BigDecimal acceptedQuantity;
|
||||
|
||||
/**
|
||||
* 缺件
|
||||
*/
|
||||
private BigDecimal shortageQuantity;
|
||||
|
||||
// region 接收单数据
|
||||
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private String contractName;
|
||||
|
||||
/**
|
||||
* 订货单位
|
||||
*/
|
||||
private String orderingUnit;
|
||||
|
||||
/**
|
||||
* 供货单位
|
||||
*/
|
||||
private String supplierUnit;
|
||||
|
||||
/**
|
||||
* 到货时间
|
||||
*/
|
||||
private LocalDate arrivalDate;
|
||||
|
||||
// endregion
|
||||
}
|
||||
@ -1,8 +1,13 @@
|
||||
package org.dromara.bigscreen.service;
|
||||
|
||||
import org.dromara.bigscreen.domain.dto.ProjectImageProgressDetailReq;
|
||||
import org.dromara.bigscreen.domain.progress.DesignProgressVo;
|
||||
import org.dromara.bigscreen.domain.progress.MaterialProgressDetailVo;
|
||||
import org.dromara.bigscreen.domain.progress.MilestoneProgressVo;
|
||||
import org.dromara.bigscreen.domain.progress.ProjectTotalProgressVo;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectImageProgressDetailVo;
|
||||
import org.dromara.bigscreen.domain.vo.wzxqysjdhdbVo;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -20,6 +25,14 @@ public interface ProgressBigScreenService {
|
||||
*/
|
||||
ProjectTotalProgressVo getProjectTotalProgress(Long projectId);
|
||||
|
||||
/**
|
||||
* 获取施工进度详情
|
||||
*
|
||||
* @param req 请求参数
|
||||
* @return 施工进度详情
|
||||
*/
|
||||
List<ProjectImageProgressDetailVo> getProjectTotalProgressDetail(@Validated ProjectImageProgressDetailReq req);
|
||||
|
||||
/**
|
||||
* 获取里程碑进度
|
||||
*
|
||||
@ -35,4 +48,20 @@ public interface ProgressBigScreenService {
|
||||
* @return 设计进度
|
||||
*/
|
||||
DesignProgressVo getDesignProgress(Long projectId);
|
||||
|
||||
/**
|
||||
* 获取物料进度详情
|
||||
*
|
||||
* @param projectId 项目 id
|
||||
* @return 物料进度详情
|
||||
*/
|
||||
List<MaterialProgressDetailVo> getMaterialProgressDetail(Long projectId);
|
||||
|
||||
/**
|
||||
* 获取物资进度
|
||||
*
|
||||
* @param projectId 项目 id
|
||||
* @return 物资进度
|
||||
*/
|
||||
List<wzxqysjdhdbVo> getMaterialProgress(Long projectId);
|
||||
}
|
||||
|
||||
@ -3,14 +3,24 @@ package org.dromara.bigscreen.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.bigscreen.domain.dto.ProjectImageProgressDetailReq;
|
||||
import org.dromara.bigscreen.domain.progress.*;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectImageProgressDetailVo;
|
||||
import org.dromara.bigscreen.domain.vo.wzxqysjdhdbVo;
|
||||
import org.dromara.bigscreen.service.ProgressBigScreenService;
|
||||
import org.dromara.bigscreen.service.ProjectBigScreenService;
|
||||
import org.dromara.cailiaoshebei.service.IBusMrpBaseService;
|
||||
import org.dromara.common.core.enums.BusinessStatusEnum;
|
||||
import org.dromara.common.core.utils.DateUtils;
|
||||
import org.dromara.common.utils.BigDecimalUtil;
|
||||
import org.dromara.design.domain.DesVolumeCatalog;
|
||||
import org.dromara.design.domain.DesVolumeFile;
|
||||
import org.dromara.design.service.IDesVolumeCatalogService;
|
||||
import org.dromara.design.service.IDesVolumeFileService;
|
||||
import org.dromara.materials.domain.MatMaterialReceive;
|
||||
import org.dromara.materials.domain.MatMaterialReceiveItem;
|
||||
import org.dromara.materials.service.IMatMaterialReceiveItemService;
|
||||
import org.dromara.materials.service.IMatMaterialReceiveService;
|
||||
import org.dromara.progress.constant.PgsProgressCategoryConstant;
|
||||
import org.dromara.progress.domain.PgsConstructionSchedulePlan;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
@ -28,6 +38,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
@ -44,6 +55,9 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class ProgressBigScreenServiceImpl implements ProgressBigScreenService {
|
||||
|
||||
@Resource
|
||||
private ProjectBigScreenService projectBigScreenService;
|
||||
|
||||
@Resource
|
||||
private IBusProjectService projectService;
|
||||
|
||||
@ -65,6 +79,15 @@ public class ProgressBigScreenServiceImpl implements ProgressBigScreenService {
|
||||
@Resource
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Resource
|
||||
private IMatMaterialReceiveService materialReceiveService;
|
||||
|
||||
@Resource
|
||||
private IMatMaterialReceiveItemService materialReceiveItemService;
|
||||
|
||||
@Resource
|
||||
private IBusMrpBaseService mrpBaseService;
|
||||
|
||||
/**
|
||||
* 获取项目总进度
|
||||
*
|
||||
@ -116,8 +139,8 @@ public class ProgressBigScreenServiceImpl implements ProgressBigScreenService {
|
||||
}
|
||||
// 获取整体完成情况
|
||||
PgsProgressCategoryValueTotalVo valueTotal = progressCategoryService.getValueTotal(children, true);
|
||||
vo.setTotalCompletionAmount(valueTotal.getTotalValue());
|
||||
vo.setCurrentCompletionAmount(valueTotal.getCurrentValue());
|
||||
vo.setTotalCompletionAmount(valueTotal.getTotalValue().divide(BigDecimal.valueOf(10000), 0, RoundingMode.HALF_UP));
|
||||
vo.setCurrentCompletionAmount(valueTotal.getCurrentValue().divide(BigDecimal.valueOf(10000), 0, RoundingMode.HALF_UP));
|
||||
// 获取详情
|
||||
Map<String, List<PgsProgressCategory>> nameMap = topList.stream()
|
||||
.collect(Collectors.groupingBy(PgsProgressCategory::getName));
|
||||
@ -144,6 +167,17 @@ public class ProgressBigScreenServiceImpl implements ProgressBigScreenService {
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取施工进度详情
|
||||
*
|
||||
* @param req 请求参数
|
||||
* @return 施工进度详情
|
||||
*/
|
||||
@Override
|
||||
public List<ProjectImageProgressDetailVo> getProjectTotalProgressDetail(ProjectImageProgressDetailReq req) {
|
||||
return projectBigScreenService.getProjectImageProgressDetail(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取里程碑进度
|
||||
*
|
||||
@ -284,6 +318,7 @@ public class ProgressBigScreenServiceImpl implements ProgressBigScreenService {
|
||||
}
|
||||
}
|
||||
}
|
||||
vo.setTotalDesign((long) fileList.size());
|
||||
vo.setReviewedDesign(reviewedDesign);
|
||||
vo.setReviewedDesignTrend(reviewedDesignThisM.compareTo(reviewedDesignLastM) >= 0);
|
||||
vo.setReviewedDesignRate(BigDecimalUtil.toLoopPercentage(reviewedDesignThisM, reviewedDesignLastM));
|
||||
@ -292,4 +327,58 @@ public class ProgressBigScreenServiceImpl implements ProgressBigScreenService {
|
||||
vo.setPendingDesignReviewRate(BigDecimalUtil.toLoopPercentage(pendingReviewDesignThisD, pendingReviewDesignLastD));
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物料进度详情
|
||||
*
|
||||
* @param projectId 项目 id
|
||||
* @return 物料进度详情
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialProgressDetailVo> getMaterialProgressDetail(Long projectId) {
|
||||
List<MatMaterialReceive> receiveList = materialReceiveService.lambdaQuery()
|
||||
.eq(MatMaterialReceive::getProjectId, projectId)
|
||||
.list();
|
||||
if (CollUtil.isEmpty(receiveList)) {
|
||||
return List.of();
|
||||
}
|
||||
List<Long> ids = receiveList.stream().map(MatMaterialReceive::getId).toList();
|
||||
List<MatMaterialReceiveItem> itemList = materialReceiveItemService.lambdaQuery()
|
||||
.in(MatMaterialReceiveItem::getReceiveId, ids)
|
||||
.list();
|
||||
if (CollUtil.isEmpty(itemList)) {
|
||||
return List.of();
|
||||
}
|
||||
Map<Long, MatMaterialReceive> receiveMap = receiveList.stream()
|
||||
.collect(Collectors.toMap(MatMaterialReceive::getId, receive -> receive));
|
||||
return itemList.stream().map(item -> {
|
||||
Long receiveId = item.getReceiveId();
|
||||
MatMaterialReceive receive = receiveMap.get(receiveId);
|
||||
if (receive == null) {
|
||||
return null;
|
||||
}
|
||||
MaterialProgressDetailVo vo = new MaterialProgressDetailVo();
|
||||
vo.setId(item.getId());
|
||||
vo.setName(item.getName());
|
||||
vo.setQuantity(item.getQuantity());
|
||||
vo.setAcceptedQuantity(item.getAcceptedQuantity());
|
||||
vo.setShortageQuantity(item.getShortageQuantity());
|
||||
vo.setContractName(receive.getContractName());
|
||||
vo.setOrderingUnit(receive.getOrderingUnit());
|
||||
vo.setSupplierUnit(receive.getSupplierUnit());
|
||||
vo.setArrivalDate(DateUtils.toLocalDate(receive.getCreateTime()));
|
||||
return vo;
|
||||
}).filter(Objects::nonNull).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资进度
|
||||
*
|
||||
* @param projectId 项目 id
|
||||
* @return 物资进度
|
||||
*/
|
||||
@Override
|
||||
public List<wzxqysjdhdbVo> getMaterialProgress(Long projectId) {
|
||||
return mrpBaseService.wzxqysjdhdb(projectId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,7 +411,12 @@ public class BusPurchaseDocServiceImpl extends ServiceImpl<BusPurchaseDocMapper,
|
||||
.eq(BusPlanDocAssociation::getDocId, purchaseDoc.getId())
|
||||
.list();
|
||||
if (CollUtil.isNotEmpty(planDocAssociationList)) {
|
||||
Map<Long, BigDecimal> map = planDocAssociationList.stream().collect(Collectors.toMap(BusPlanDocAssociation::getPlanId, BusPlanDocAssociation::getDemandQuantity));
|
||||
Map<Long, BigDecimal> map = planDocAssociationList.stream()
|
||||
.peek(item -> {
|
||||
if (item.getDemandQuantity() == null) {
|
||||
item.setDemandQuantity(BigDecimal.ZERO);
|
||||
}
|
||||
}).collect(Collectors.toMap(BusPlanDocAssociation::getPlanId, BusPlanDocAssociation::getDemandQuantity));
|
||||
items = materialbatchdemandplanService.listByIds(map.keySet());
|
||||
items.forEach(item -> item.setDemandQuantity(map.get(item.getId())));
|
||||
}
|
||||
|
||||
@ -36,8 +36,10 @@ public class BigDecimalUtil {
|
||||
if (thisNum == null || lastNum == null) {
|
||||
return BigDecimal.valueOf(0.00);
|
||||
}
|
||||
if (lastNum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
if (lastNum.compareTo(BigDecimal.ZERO) == 0 && thisNum.compareTo(BigDecimal.ZERO) > 0) {
|
||||
return BigDecimal.valueOf(100.00);
|
||||
} else if (lastNum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return BigDecimal.valueOf(0.00);
|
||||
}
|
||||
return thisNum.subtract(lastNum)
|
||||
.multiply(new BigDecimal("100"))
|
||||
|
||||
@ -5,9 +5,13 @@ import jakarta.websocket.*;
|
||||
import jakarta.websocket.server.ServerEndpoint;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.bigscreen.domain.bo.DpznglBo;
|
||||
import org.dromara.bigscreen.domain.progress.DesignProgressVo;
|
||||
import org.dromara.bigscreen.domain.progress.MilestoneProgressVo;
|
||||
import org.dromara.bigscreen.domain.progress.ProjectTotalProgressVo;
|
||||
import org.dromara.bigscreen.domain.vo.*;
|
||||
import org.dromara.bigscreen.service.DpzaglService;
|
||||
import org.dromara.bigscreen.service.IMaterialsManagementService;
|
||||
import org.dromara.bigscreen.service.ProgressBigScreenService;
|
||||
import org.dromara.cailiaoshebei.domain.vo.BusPurchaseDocVo;
|
||||
import org.dromara.cailiaoshebei.service.IBusMrpBaseService;
|
||||
import org.dromara.cailiaoshebei.service.IBusPurchaseDocService;
|
||||
@ -113,6 +117,8 @@ public class BigScreenWebSocketServer {
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
// 进度管理大屏
|
||||
getProgressBigScreenData(maps, projectId);
|
||||
break;
|
||||
case 5:
|
||||
if (materialsService != null) {
|
||||
@ -234,6 +240,7 @@ public class BigScreenWebSocketServer {
|
||||
|
||||
/**
|
||||
* 向指定订阅ID的客户端发送消息
|
||||
*
|
||||
* @param subscriptionId 订阅ID
|
||||
* @param message 消息内容
|
||||
* @return 是否发送成功
|
||||
@ -262,6 +269,7 @@ public class BigScreenWebSocketServer {
|
||||
|
||||
/**
|
||||
* 向所有订阅客户端广播消息
|
||||
*
|
||||
* @param message 消息内容
|
||||
*/
|
||||
public static void broadcastToAllSubscriptions(String message) {
|
||||
@ -342,7 +350,42 @@ public class BigScreenWebSocketServer {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取进度大屏数据
|
||||
*/
|
||||
private static void getProgressBigScreenData(List<Map<String, String>> maps, Long projectId) {
|
||||
ProgressBigScreenService service = SpringUtils.getBean(ProgressBigScreenService.class);
|
||||
if (service != null) {
|
||||
DesignProgressVo designProgress = service.getDesignProgress(projectId);
|
||||
if (designProgress != null) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("type", "progressDesignProgress");
|
||||
map.put("data", JSONUtil.toJsonStr(designProgress));
|
||||
maps.add(map);
|
||||
}
|
||||
ProjectTotalProgressVo projectTotalProgress = service.getProjectTotalProgress(projectId);
|
||||
if (projectTotalProgress != null) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("type", "progressProjectTotalProgress");
|
||||
map.put("data", JSONUtil.toJsonStr(projectTotalProgress));
|
||||
maps.add(map);
|
||||
}
|
||||
List<MilestoneProgressVo> milestoneProgress = service.getMilestoneProgress(projectId);
|
||||
if (milestoneProgress != null) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("type", "progressMilestoneProgress");
|
||||
map.put("data", JSONUtil.toJsonStr(milestoneProgress));
|
||||
maps.add(map);
|
||||
}
|
||||
List<wzxqysjdhdbVo> materialProgress = service.getMaterialProgress(projectId);
|
||||
if (materialProgress != null) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("type", "progressMaterialProgress");
|
||||
map.put("data", JSONUtil.toJsonStr(materialProgress));
|
||||
maps.add(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user