增加项目结构
This commit is contained in:
@ -0,0 +1,39 @@
|
||||
package org.dromara.facility.domain.vo.matrix;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryStructureVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-08-23 01:17
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FacMatrixStructureVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 7526403047030009646L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 方阵名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 分项工程
|
||||
*/
|
||||
private List<PgsProgressCategoryStructureVo> children;
|
||||
|
||||
}
|
@ -239,16 +239,19 @@ public class FacBoxTransformerServiceImpl extends ServiceImpl<FacBoxTransformerM
|
||||
.stream().collect(Collectors.groupingBy(FacBoxTransformer::getProgressCategoryId));
|
||||
for (PgsProgressCategory progressCategory : progressCategoryList) {
|
||||
Long progressCategoryId = progressCategory.getId();
|
||||
BigDecimal unitPrice = progressCategory.getOwnerPrice();
|
||||
// todo BigDecimal unitPrice = progressCategory.getUnitPrice();
|
||||
BigDecimal ownerPrice = progressCategory.getOwnerPrice();
|
||||
BigDecimal constructionPrice = progressCategory.getConstructionPrice();
|
||||
int total = 0;
|
||||
if (countMap.containsKey(progressCategoryId)) {
|
||||
total = countMap.get(progressCategoryId).size();
|
||||
}
|
||||
progressCategory.setTotal(BigDecimal.valueOf(total));
|
||||
// 如果单价不为 0 则计算产值
|
||||
if (unitPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setOwnerOutputValue(unitPrice.multiply(BigDecimal.valueOf(total)));
|
||||
if (ownerPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total)));
|
||||
}
|
||||
if (constructionPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setOwnerOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total)));
|
||||
}
|
||||
}
|
||||
boolean result = progressCategoryService.updateBatchById(progressCategoryList);
|
||||
@ -303,14 +306,14 @@ public class FacBoxTransformerServiceImpl extends ServiceImpl<FacBoxTransformerM
|
||||
}
|
||||
BigDecimal total = BigDecimal.valueOf(newBoxTransformerList.size());
|
||||
progressCategory.setTotal(total);
|
||||
/* todo progressCategory.setOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));*/
|
||||
progressCategory.setOwnerOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getOwnerPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));
|
||||
progressCategory.setConstructionOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getConstructionPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));
|
||||
boolean result = progressCategoryService.updateById(progressCategory);
|
||||
if (!result) {
|
||||
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||
|
@ -239,16 +239,19 @@ public class FacInverterServiceImpl extends ServiceImpl<FacInverterMapper, FacIn
|
||||
.stream().collect(Collectors.groupingBy(FacInverter::getProgressCategoryId));
|
||||
for (PgsProgressCategory progressCategory : progressCategoryList) {
|
||||
Long progressCategoryId = progressCategory.getId();
|
||||
// todo BigDecimal unitPrice = progressCategory.getUnitPrice();
|
||||
BigDecimal unitPrice = progressCategory.getOwnerPrice();
|
||||
BigDecimal ownerPrice = progressCategory.getOwnerPrice();
|
||||
BigDecimal constructionPrice = progressCategory.getConstructionPrice();
|
||||
int total = 0;
|
||||
if (countMap.containsKey(progressCategoryId)) {
|
||||
total = countMap.get(progressCategoryId).size();
|
||||
}
|
||||
progressCategory.setTotal(BigDecimal.valueOf(total));
|
||||
// 如果单价不为 0 则计算产值
|
||||
if (unitPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setOwnerOutputValue(unitPrice.multiply(BigDecimal.valueOf(total)));
|
||||
if (ownerPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total)));
|
||||
}
|
||||
if (constructionPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setConstructionOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total)));
|
||||
}
|
||||
}
|
||||
boolean result = progressCategoryService.updateBatchById(progressCategoryList);
|
||||
@ -307,10 +310,10 @@ public class FacInverterServiceImpl extends ServiceImpl<FacInverterMapper, FacIn
|
||||
Optional.ofNullable(progressCategory.getOwnerPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));
|
||||
/* todo progressCategory.setOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||
progressCategory.setConstructionOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getConstructionPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));*/
|
||||
));
|
||||
boolean result = progressCategoryService.updateById(progressCategory);
|
||||
if (!result) {
|
||||
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||
|
@ -179,10 +179,10 @@ public class FacPhotovoltaicPanelColumnServiceImpl extends ServiceImpl<FacPhotov
|
||||
Optional.ofNullable(progressCategory.getOwnerPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));
|
||||
/* todo progressCategory.setOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||
progressCategory.setConstructionOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getConstructionPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));*/
|
||||
));
|
||||
boolean result = progressCategoryService.updateById(progressCategory);
|
||||
if (!result) {
|
||||
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||
|
@ -469,8 +469,8 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
|
||||
.stream().collect(Collectors.groupingBy(FacPhotovoltaicPanelSupport::getProgressCategoryId));
|
||||
for (PgsProgressCategory progressCategory : progressCategoryList) {
|
||||
Long progressCategoryId = progressCategory.getId();
|
||||
// todo BigDecimal unitPrice = progressCategory.getUnitPrice();
|
||||
BigDecimal unitPrice = progressCategory.getOwnerPrice();
|
||||
BigDecimal ownerPrice = progressCategory.getOwnerPrice();
|
||||
BigDecimal constructionPrice = progressCategory.getConstructionPrice();
|
||||
int total = 0;
|
||||
if (pointCountMap.containsKey(progressCategoryId)) {
|
||||
total = pointCountMap.get(progressCategoryId).size();
|
||||
@ -481,8 +481,11 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
|
||||
}
|
||||
progressCategory.setTotal(BigDecimal.valueOf(total));
|
||||
// 如果单价不为 0 则计算产值
|
||||
if (unitPrice != null && unitPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setOwnerOutputValue(unitPrice.multiply(BigDecimal.valueOf(total)));
|
||||
if (ownerPrice != null && ownerPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total)));
|
||||
}
|
||||
if (constructionPrice != null && constructionPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setConstructionOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total)));
|
||||
}
|
||||
}
|
||||
boolean result = progressCategoryService.updateBatchById(progressCategoryList);
|
||||
|
@ -179,10 +179,10 @@ public class FacPhotovoltaicPanelPointServiceImpl extends ServiceImpl<FacPhotovo
|
||||
Optional.ofNullable(progressCategory.getOwnerPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));
|
||||
/* todo progressCategory.setOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||
progressCategory.setConstructionOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getConstructionPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));*/
|
||||
));
|
||||
boolean result = progressCategoryService.updateById(progressCategory);
|
||||
if (!result) {
|
||||
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||
|
@ -369,16 +369,19 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
|
||||
.stream().collect(Collectors.groupingBy(FacPhotovoltaicPanel::getProgressCategoryId));
|
||||
for (PgsProgressCategory progressCategory : progressCategoryList) {
|
||||
Long progressCategoryId = progressCategory.getId();
|
||||
// todo BigDecimal unitPrice = progressCategory.getUnitPrice();
|
||||
BigDecimal unitPrice = progressCategory.getOwnerPrice();
|
||||
BigDecimal ownerPrice = progressCategory.getOwnerPrice();
|
||||
BigDecimal constructionPrice = progressCategory.getConstructionPrice();
|
||||
int total = 0;
|
||||
if (countMap.containsKey(progressCategoryId)) {
|
||||
total = countMap.get(progressCategoryId).size();
|
||||
}
|
||||
progressCategory.setTotal(BigDecimal.valueOf(total));
|
||||
// 如果单价不为 0 则计算产值
|
||||
if (unitPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setOwnerOutputValue(unitPrice.multiply(BigDecimal.valueOf(total)));
|
||||
if (ownerPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setOwnerOutputValue(ownerPrice.multiply(BigDecimal.valueOf(total)));
|
||||
}
|
||||
if (constructionPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||
progressCategory.setConstructionOutputValue(constructionPrice.multiply(BigDecimal.valueOf(total)));
|
||||
}
|
||||
}
|
||||
boolean result = progressCategoryService.updateBatchById(progressCategoryList);
|
||||
@ -508,14 +511,14 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
|
||||
}
|
||||
BigDecimal total = BigDecimal.valueOf(newPanelList.size());
|
||||
progressCategory.setTotal(total);
|
||||
/* todo progressCategory.setOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
)); */
|
||||
progressCategory.setOwnerOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getOwnerPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));
|
||||
progressCategory.setConstructionOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getConstructionPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));
|
||||
boolean result = progressCategoryService.updateById(progressCategory);
|
||||
if (!result) {
|
||||
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||
|
@ -179,10 +179,10 @@ public class FacPhotovoltaicPanelSupportServiceImpl extends ServiceImpl<FacPhoto
|
||||
Optional.ofNullable(progressCategory.getOwnerPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));
|
||||
/* todo progressCategory.setOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||
progressCategory.setConstructionOutputValue(total.multiply(
|
||||
Optional.ofNullable(progressCategory.getConstructionPrice())
|
||||
.orElse(BigDecimal.ZERO)
|
||||
));*/
|
||||
));
|
||||
boolean result = progressCategoryService.updateById(progressCategory);
|
||||
if (!result) {
|
||||
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||
|
@ -49,6 +49,11 @@ public class PgsConstructionSchedulePlan extends BaseEntity {
|
||||
*/
|
||||
private Long projectStructure;
|
||||
|
||||
/**
|
||||
* 对应项目结构名称
|
||||
*/
|
||||
private String projectStructureName;
|
||||
|
||||
/**
|
||||
* 预计开始时间
|
||||
*/
|
||||
|
@ -41,6 +41,11 @@ public class PgsConstructionSchedulePlanCreateReq implements Serializable {
|
||||
*/
|
||||
private Long projectStructure;
|
||||
|
||||
/**
|
||||
* 对应项目结构名称
|
||||
*/
|
||||
private String projectStructureName;
|
||||
|
||||
/**
|
||||
* 预计开始时间
|
||||
*/
|
||||
|
@ -25,6 +25,11 @@ public class PgsConstructionSchedulePlanQueryReq implements Serializable {
|
||||
*/
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 对应项目结构名称
|
||||
*/
|
||||
private String projectStructureName;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
|
@ -32,6 +32,11 @@ public class PgsConstructionSchedulePlanUpdateReq implements Serializable {
|
||||
*/
|
||||
private Long projectStructure;
|
||||
|
||||
/**
|
||||
* 对应项目结构名称
|
||||
*/
|
||||
private String projectStructureName;
|
||||
|
||||
/**
|
||||
* 实际开始时间
|
||||
*/
|
||||
|
@ -58,6 +58,12 @@ public class PgsConstructionSchedulePlanVo implements Serializable {
|
||||
@ExcelProperty(value = "对应项目结构")
|
||||
private Long projectStructure;
|
||||
|
||||
/**
|
||||
* 对应项目结构名称
|
||||
*/
|
||||
@ExcelProperty(value = "对应项目结构名称")
|
||||
private String projectStructureName;
|
||||
|
||||
/**
|
||||
* 预计开始时间
|
||||
*/
|
||||
|
@ -0,0 +1,37 @@
|
||||
package org.dromara.progress.domain.vo.progresscategory;
|
||||
|
||||
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-23 01:19
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PgsProgressCategoryStructureVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -8392912623299656962L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类别名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 子类别
|
||||
*/
|
||||
private List<PgsProgressCategoryStructureVo> children;
|
||||
}
|
@ -52,6 +52,12 @@ public class PgsProgressCategoryVo implements Serializable {
|
||||
*/
|
||||
private Long matrixId;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
@ExcelProperty(value = "祖级列表")
|
||||
private String ancestors;
|
||||
|
||||
/**
|
||||
* 类别名称
|
||||
*/
|
||||
@ -66,24 +72,22 @@ public class PgsProgressCategoryVo implements Serializable {
|
||||
private String unitType;
|
||||
|
||||
/**
|
||||
* 总数量/百分比
|
||||
* 总数量
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalToIntegerSerializer.class)
|
||||
@ExcelProperty(value = "总数量/百分比")
|
||||
@ExcelProperty(value = "总数量")
|
||||
private BigDecimal total;
|
||||
|
||||
/**
|
||||
* 已完成数量/百分比
|
||||
* 已完成数量
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalToIntegerSerializer.class)
|
||||
@ExcelProperty(value = "已完成数量/百分比")
|
||||
private BigDecimal completed;
|
||||
|
||||
/**
|
||||
* 计划总数量/百分比
|
||||
* 计划总数量
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalToIntegerSerializer.class)
|
||||
@ExcelProperty(value = "计划总数量/百分比")
|
||||
private BigDecimal planTotal;
|
||||
|
||||
/**
|
||||
@ -101,23 +105,13 @@ public class PgsProgressCategoryVo implements Serializable {
|
||||
/**
|
||||
* 是否超期(0否 1是)
|
||||
*/
|
||||
@ExcelProperty(value = "是否超期", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0=否,1=是")
|
||||
private String isDelay;
|
||||
|
||||
/**
|
||||
* 完成状态(0未开始 1进行中 2已完成)
|
||||
*/
|
||||
@ExcelProperty(value = "完成状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0=未开始,1=进行中,2=已完成")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
@ -139,13 +133,11 @@ public class PgsProgressCategoryVo implements Serializable {
|
||||
/**
|
||||
* 产值金额(业主)
|
||||
*/
|
||||
@ExcelProperty(value = "产值金额(业主)")
|
||||
private BigDecimal ownerOutputValue;
|
||||
|
||||
/**
|
||||
* 产值金额(分包)
|
||||
*/
|
||||
@ExcelProperty(value = "产值金额(分包)")
|
||||
private BigDecimal constructionOutputValue;
|
||||
|
||||
/**
|
||||
@ -153,4 +145,10 @@ public class PgsProgressCategoryVo implements Serializable {
|
||||
*/
|
||||
private String workType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
@ -181,8 +181,8 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByReq(PgsProgressCategoryCreateReq req) {
|
||||
// todo BigDecimal unitPrice = req.getUnitPrice();
|
||||
BigDecimal unitPrice = req.getOwnerPrice();
|
||||
BigDecimal ownerPrice = req.getOwnerPrice();
|
||||
BigDecimal constructionPrice = req.getConstructionPrice();
|
||||
BigDecimal total = req.getTotal();
|
||||
String workType = req.getWorkType();
|
||||
PgsProgressCategory progressCategory = new PgsProgressCategory();
|
||||
@ -200,8 +200,11 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
progressCategory.setAncestors(parent.getAncestors() + StringUtils.SEPARATOR + progressCategory.getParentId());
|
||||
}
|
||||
// 计算产值
|
||||
if (unitPrice != null && total != null && unitPrice.compareTo(BigDecimal.ZERO) >= 0 && total.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
progressCategory.setOwnerOutputValue(unitPrice.multiply(total));
|
||||
if (ownerPrice != null && total != null && ownerPrice.compareTo(BigDecimal.ZERO) >= 0 && total.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
progressCategory.setOwnerOutputValue(ownerPrice.multiply(total));
|
||||
}
|
||||
if (constructionPrice != null && total != null && constructionPrice.compareTo(BigDecimal.ZERO) >= 0 && total.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
progressCategory.setConstructionOutputValue(constructionPrice.multiply(total));
|
||||
}
|
||||
if (StringUtils.isNotBlank(workType) && PgsProgressCategoryConstant.WORK_TYPE_LIST.contains(workType)) {
|
||||
List<PgsProgressCategory> progressCategoryList = this.lambdaQuery()
|
||||
@ -260,18 +263,21 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
throw new ServiceException("该分项工程不存在", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 计算产值
|
||||
// todo BigDecimal unitPrice = req.getUnitPrice();
|
||||
BigDecimal unitPrice = req.getOwnerPrice();
|
||||
BigDecimal outputValue = BigDecimal.ZERO;
|
||||
BigDecimal ownerPrice = req.getOwnerPrice();
|
||||
BigDecimal constructionPrice = req.getConstructionPrice();
|
||||
BigDecimal ownerOutputValue = BigDecimal.ZERO;
|
||||
BigDecimal constructionOutputValue = BigDecimal.ZERO;
|
||||
if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue())) {
|
||||
progressCategory.setTotal(req.getTotal());
|
||||
outputValue = req.getTotal().multiply(unitPrice);
|
||||
ownerOutputValue = req.getTotal().multiply(ownerPrice);
|
||||
constructionOutputValue = req.getTotal().multiply(constructionPrice);
|
||||
} else if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.NUMBER.getValue()) && progressCategory.getWorkType() != null) {
|
||||
BigDecimal total = progressCategory.getTotal();
|
||||
if (total == null || total.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new ServiceException("请导入分项工程数量后再添加单价", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
outputValue = total.multiply(unitPrice);
|
||||
ownerOutputValue = total.multiply(ownerPrice);
|
||||
constructionOutputValue = total.multiply(constructionPrice);
|
||||
} else if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.NUMBER.getValue())) {
|
||||
BigDecimal total = progressCategory.getTotal();
|
||||
if (total == null || total.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
@ -280,13 +286,15 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
if (total == null || total.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new ServiceException("请输入分项工程数量", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
outputValue = total.multiply(unitPrice);
|
||||
ownerOutputValue = total.multiply(ownerPrice);
|
||||
constructionOutputValue = total.multiply(constructionPrice);
|
||||
}
|
||||
// 填入数据
|
||||
progressCategory.setUnit(req.getUnit());
|
||||
progressCategory.setOwnerPrice(unitPrice);
|
||||
// todo progressCategory.setUnitPrice(unitPrice);
|
||||
progressCategory.setOwnerOutputValue(outputValue);
|
||||
progressCategory.setOwnerPrice(ownerPrice);
|
||||
progressCategory.setConstructionPrice(constructionPrice);
|
||||
progressCategory.setOwnerOutputValue(ownerOutputValue);
|
||||
progressCategory.setConstructionOutputValue(constructionOutputValue);
|
||||
// 写入数据库
|
||||
return this.updateById(progressCategory);
|
||||
}
|
||||
|
@ -100,6 +100,18 @@ public class BusProjectController extends BaseController {
|
||||
return R.ok(projectService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目结构
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("project:project:projectStructure")
|
||||
@GetMapping("/projectStructure/{id}")
|
||||
public R<BusProjectStructureVo> getProjectStructure(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(projectService.getStructure(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目以及项目下的分包公司列表
|
||||
*/
|
||||
|
@ -0,0 +1,33 @@
|
||||
package org.dromara.project.domain.vo.project;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-08-23 01:14
|
||||
*/
|
||||
@Data
|
||||
public class BusProjectStructureVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1774638688311795906L;
|
||||
|
||||
/**
|
||||
* 项目主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 子项目列表
|
||||
*/
|
||||
private List<BusSubProjectStructureVo> children;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package org.dromara.project.domain.vo.project;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixStructureVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-08-23 01:15
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BusSubProjectStructureVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 6993209784456857540L;
|
||||
|
||||
/**
|
||||
* 项目主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 方阵列表
|
||||
*/
|
||||
private List<FacMatrixStructureVo> children;
|
||||
}
|
@ -187,4 +187,12 @@ public interface IBusProjectService extends IService<BusProject> {
|
||||
* @return 项目地址信息列表
|
||||
*/
|
||||
List<BusProjectGisVo> getGisList();
|
||||
|
||||
/**
|
||||
* 获取项目结构信息
|
||||
*
|
||||
* @param projectId 项目id
|
||||
* @return 项目结构信息
|
||||
*/
|
||||
BusProjectStructureVo getStructure(Long projectId);
|
||||
}
|
||||
|
@ -32,9 +32,13 @@ import org.dromara.contractor.service.ISubContractorService;
|
||||
import org.dromara.design.service.IDesTechnicalStandardService;
|
||||
import org.dromara.facility.domain.FacMatrix;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixBySubProjectVo;
|
||||
import org.dromara.facility.domain.vo.matrix.FacMatrixStructureVo;
|
||||
import org.dromara.facility.service.IFacMatrixService;
|
||||
import org.dromara.manager.weathermanager.WeatherConstant;
|
||||
import org.dromara.manager.weathermanager.WeatherManager;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryStructureVo;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryTemplateService;
|
||||
import org.dromara.project.constant.BusProjectConstant;
|
||||
import org.dromara.project.domain.BusProject;
|
||||
@ -131,6 +135,10 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
||||
@Resource
|
||||
private IPgsProgressCategoryTemplateService progressCategoryTemplateService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private IPgsProgressCategoryService progressCategoryService;
|
||||
|
||||
private final Cache<String, String> WEATHER_CACHE =
|
||||
Caffeine.newBuilder().initialCapacity(1024)
|
||||
.maximumSize(10000L)
|
||||
@ -905,6 +913,106 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目结构信息
|
||||
*
|
||||
* @param projectId 项目id
|
||||
* @return 项目结构信息
|
||||
*/
|
||||
@Override
|
||||
public BusProjectStructureVo getStructure(Long projectId) {
|
||||
// 获取项目
|
||||
BusProject project = this.getById(projectId);
|
||||
if (project == null) {
|
||||
throw new ServiceException("项目信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
BusProjectStructureVo vo = new BusProjectStructureVo();
|
||||
vo.setId(project.getId());
|
||||
vo.setName(project.getProjectName());
|
||||
|
||||
// 获取项目子项
|
||||
List<BusProject> subProjects = this.lambdaQuery()
|
||||
.eq(BusProject::getPId, projectId)
|
||||
.list();
|
||||
if (CollUtil.isEmpty(subProjects)) {
|
||||
return vo;
|
||||
}
|
||||
Set<Long> subProjectIds = subProjects.stream().map(BusProject::getId).collect(Collectors.toSet());
|
||||
|
||||
// 获取方阵信息
|
||||
List<FacMatrix> matrixList = matrixService.lambdaQuery()
|
||||
.in(FacMatrix::getProjectId, subProjectIds)
|
||||
.list();
|
||||
|
||||
Map<Long, List<FacMatrix>> matrixMap = matrixList.stream()
|
||||
.collect(Collectors.groupingBy(FacMatrix::getProjectId));
|
||||
|
||||
// 获取分项工程
|
||||
Set<Long> matrixIds = matrixList.stream().map(FacMatrix::getId).collect(Collectors.toSet());
|
||||
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
||||
.in(PgsProgressCategory::getMatrixId, matrixIds)
|
||||
.list();
|
||||
|
||||
// 构造子项目结构
|
||||
List<BusSubProjectStructureVo> subProjectStructures = subProjects.stream().map(subProject -> {
|
||||
BusSubProjectStructureVo subProjectVo = new BusSubProjectStructureVo();
|
||||
subProjectVo.setId(subProject.getId());
|
||||
subProjectVo.setName(subProject.getProjectName());
|
||||
|
||||
// 找到该子项目下的方阵
|
||||
List<FacMatrix> matrices = matrixMap.getOrDefault(subProject.getId(), new ArrayList<>());
|
||||
List<FacMatrixStructureVo> matrixVos = matrices.stream().map(matrix -> {
|
||||
FacMatrixStructureVo matrixVo = new FacMatrixStructureVo();
|
||||
matrixVo.setId(matrix.getId());
|
||||
matrixVo.setName(matrix.getMatrixName());
|
||||
|
||||
// 找到该方阵下的分项工程
|
||||
List<PgsProgressCategory> categories = progressCategoryList.stream()
|
||||
.filter(c -> Objects.equals(c.getMatrixId(), matrix.getId()))
|
||||
.toList();
|
||||
|
||||
// 构造分项工程树
|
||||
List<PgsProgressCategoryStructureVo> categoryTree = buildCategoryTree(categories);
|
||||
matrixVo.setChildren(categoryTree);
|
||||
return matrixVo;
|
||||
}).toList();
|
||||
|
||||
subProjectVo.setChildren(matrixVos);
|
||||
return subProjectVo;
|
||||
}).toList();
|
||||
|
||||
vo.setChildren(subProjectStructures);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造分项工程树
|
||||
*/
|
||||
private List<PgsProgressCategoryStructureVo> buildCategoryTree(List<PgsProgressCategory> categories) {
|
||||
Map<Long, PgsProgressCategoryStructureVo> map = new HashMap<>();
|
||||
List<PgsProgressCategoryStructureVo> roots = new ArrayList<>();
|
||||
|
||||
for (PgsProgressCategory c : categories) {
|
||||
PgsProgressCategoryStructureVo node = new PgsProgressCategoryStructureVo(c.getId(), c.getName(), new ArrayList<>());
|
||||
map.put(c.getId(), node);
|
||||
}
|
||||
|
||||
for (PgsProgressCategory c : categories) {
|
||||
PgsProgressCategoryStructureVo node = map.get(c.getId());
|
||||
if (c.getParentId() == 0) {
|
||||
roots.add(node);
|
||||
} else {
|
||||
PgsProgressCategoryStructureVo parent = map.get(c.getParentId());
|
||||
if (parent != null) {
|
||||
parent.getChildren().add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return roots;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据天气图标获取天气类别
|
||||
*
|
||||
|
Reference in New Issue
Block a user