[update] 人员关联、进度计划
This commit is contained in:
@ -1,15 +0,0 @@
|
|||||||
package org.dromara.facility.constant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lilemy
|
|
||||||
* @date 2025/5/23 11:29
|
|
||||||
*/
|
|
||||||
public interface FacPhotovoltaicPanelPartsConstant {
|
|
||||||
|
|
||||||
String POINT = "钻孔";
|
|
||||||
|
|
||||||
String COLUMN = "桩基";
|
|
||||||
|
|
||||||
String SUPPORT = "支架";
|
|
||||||
|
|
||||||
}
|
|
@ -11,6 +11,7 @@ import org.dromara.facility.domain.dto.boxtransformer.FacBoxTransformerCreateReq
|
|||||||
import org.dromara.facility.domain.dto.boxtransformer.FacBoxTransformerQueryReq;
|
import org.dromara.facility.domain.dto.boxtransformer.FacBoxTransformerQueryReq;
|
||||||
import org.dromara.facility.domain.dto.boxtransformer.FacBoxTransformerUpdateReq;
|
import org.dromara.facility.domain.dto.boxtransformer.FacBoxTransformerUpdateReq;
|
||||||
import org.dromara.facility.domain.vo.boxtransformer.FacBoxTransformerVo;
|
import org.dromara.facility.domain.vo.boxtransformer.FacBoxTransformerVo;
|
||||||
|
import org.dromara.progress.domain.PgsProgressCategory;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -64,6 +65,14 @@ public interface IFacBoxTransformerService extends IService<FacBoxTransformer> {
|
|||||||
*/
|
*/
|
||||||
Boolean insertByGeoJson(FacBoxTransformerCreateByGeoJsonReq geoJson);
|
Boolean insertByGeoJson(FacBoxTransformerCreateByGeoJsonReq geoJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板创建箱变数据
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-箱变
|
* 修改设施-箱变
|
||||||
*
|
*
|
||||||
|
@ -11,6 +11,7 @@ import org.dromara.facility.domain.dto.inverter.FacInverterCreateReq;
|
|||||||
import org.dromara.facility.domain.dto.inverter.FacInverterQueryReq;
|
import org.dromara.facility.domain.dto.inverter.FacInverterQueryReq;
|
||||||
import org.dromara.facility.domain.dto.inverter.FacInverterUpdateReq;
|
import org.dromara.facility.domain.dto.inverter.FacInverterUpdateReq;
|
||||||
import org.dromara.facility.domain.vo.inverter.FacInverterVo;
|
import org.dromara.facility.domain.vo.inverter.FacInverterVo;
|
||||||
|
import org.dromara.progress.domain.PgsProgressCategory;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -64,6 +65,14 @@ public interface IFacInverterService extends IService<FacInverter> {
|
|||||||
*/
|
*/
|
||||||
Boolean insertByGeoJson(FacInverterCreateByGeoJsonReq geoJson);
|
Boolean insertByGeoJson(FacInverterCreateByGeoJsonReq geoJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板创建逆变器数据
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-逆变器
|
* 修改设施-逆变器
|
||||||
*
|
*
|
||||||
|
@ -12,6 +12,7 @@ import org.dromara.facility.domain.dto.photovoltaicpanelcolumn.FacPhotovoltaicPa
|
|||||||
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
|
import org.dromara.facility.domain.dto.photovoltaicpanelparts.FacPhotovoltaicPanelPartsQueryReq;
|
||||||
import org.dromara.facility.domain.vo.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnVo;
|
import org.dromara.facility.domain.vo.photovoltaicpanelcolumn.FacPhotovoltaicPanelColumnVo;
|
||||||
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
|
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
|
||||||
|
import org.dromara.progress.domain.PgsProgressCategory;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -57,6 +58,14 @@ public interface IFacPhotovoltaicPanelColumnService extends IService<FacPhotovol
|
|||||||
*/
|
*/
|
||||||
Long insertByBo(FacPhotovoltaicPanelColumnCreateReq req);
|
Long insertByBo(FacPhotovoltaicPanelColumnCreateReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板创建光伏板立柱数据
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-光伏板立柱
|
* 修改设施-光伏板立柱
|
||||||
*
|
*
|
||||||
|
@ -12,6 +12,7 @@ import org.dromara.facility.domain.dto.photovoltaicpanelpoint.FacPhotovoltaicPan
|
|||||||
import org.dromara.facility.domain.dto.photovoltaicpanelpoint.FacPhotovoltaicPanelPointUpdateReq;
|
import org.dromara.facility.domain.dto.photovoltaicpanelpoint.FacPhotovoltaicPanelPointUpdateReq;
|
||||||
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
|
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
|
||||||
import org.dromara.facility.domain.vo.photovoltaicpanelpoint.FacPhotovoltaicPanelPointVo;
|
import org.dromara.facility.domain.vo.photovoltaicpanelpoint.FacPhotovoltaicPanelPointVo;
|
||||||
|
import org.dromara.progress.domain.PgsProgressCategory;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -57,6 +58,14 @@ public interface IFacPhotovoltaicPanelPointService extends IService<FacPhotovolt
|
|||||||
*/
|
*/
|
||||||
Long insertByBo(FacPhotovoltaicPanelPointCreateReq req);
|
Long insertByBo(FacPhotovoltaicPanelPointCreateReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板创建光伏板桩点数据
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-光伏板桩点
|
* 修改设施-光伏板桩点
|
||||||
*
|
*
|
||||||
|
@ -11,6 +11,7 @@ import org.dromara.facility.domain.dto.photovoltaicpanel.FacPhotovoltaicPanelCre
|
|||||||
import org.dromara.facility.domain.dto.photovoltaicpanel.FacPhotovoltaicPanelQueryReq;
|
import org.dromara.facility.domain.dto.photovoltaicpanel.FacPhotovoltaicPanelQueryReq;
|
||||||
import org.dromara.facility.domain.dto.photovoltaicpanel.FacPhotovoltaicPanelUpdateReq;
|
import org.dromara.facility.domain.dto.photovoltaicpanel.FacPhotovoltaicPanelUpdateReq;
|
||||||
import org.dromara.facility.domain.vo.photovoltaicpanel.FacPhotovoltaicPanelVo;
|
import org.dromara.facility.domain.vo.photovoltaicpanel.FacPhotovoltaicPanelVo;
|
||||||
|
import org.dromara.progress.domain.PgsProgressCategory;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -78,6 +79,14 @@ public interface IFacPhotovoltaicPanelService extends IService<FacPhotovoltaicPa
|
|||||||
*/
|
*/
|
||||||
void deleteBatchInner(List<FacPhotovoltaicPanel> photovoltaicPanelList);
|
void deleteBatchInner(List<FacPhotovoltaicPanel> photovoltaicPanelList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板创建光伏板数据
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-光伏板
|
* 修改设施-光伏板
|
||||||
*
|
*
|
||||||
|
@ -12,6 +12,7 @@ import org.dromara.facility.domain.dto.photovoltaicpanelsupport.FacPhotovoltaicP
|
|||||||
import org.dromara.facility.domain.dto.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportUpdateReq;
|
import org.dromara.facility.domain.dto.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportUpdateReq;
|
||||||
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
|
import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPanelPartsByPanelNameVo;
|
||||||
import org.dromara.facility.domain.vo.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportVo;
|
import org.dromara.facility.domain.vo.photovoltaicpanelsupport.FacPhotovoltaicPanelSupportVo;
|
||||||
|
import org.dromara.progress.domain.PgsProgressCategory;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -57,6 +58,14 @@ public interface IFacPhotovoltaicPanelSupportService extends IService<FacPhotovo
|
|||||||
*/
|
*/
|
||||||
Long insertByBo(FacPhotovoltaicPanelSupportCreateReq req);
|
Long insertByBo(FacPhotovoltaicPanelSupportCreateReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板创建光伏板支架数据
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-光伏板支架
|
* 修改设施-光伏板支架
|
||||||
*
|
*
|
||||||
|
@ -36,10 +36,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -179,7 +176,9 @@ public class FacBoxTransformerServiceImpl extends ServiceImpl<FacBoxTransformerM
|
|||||||
}
|
}
|
||||||
// 获取进度类别信息
|
// 获取进度类别信息
|
||||||
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
||||||
.in(PgsProgressCategory::getWorkType, PgsProgressCategoryConstant.BOX_TRANSFORMER_PROGRESS_CATEGORY_WORK_TYPE).list();
|
.eq(PgsProgressCategory::getProjectId, projectId)
|
||||||
|
.likeRight(PgsProgressCategory::getWorkType, PgsProgressCategoryConstant.BOX_TRANSFORMER_WORK_TYPE + "_")
|
||||||
|
.list();
|
||||||
Map<Long, List<PgsProgressCategory>> progressCategoryMap = progressCategoryList
|
Map<Long, List<PgsProgressCategory>> progressCategoryMap = progressCategoryList
|
||||||
.stream().collect(Collectors.groupingBy(PgsProgressCategory::getMatrixId));
|
.stream().collect(Collectors.groupingBy(PgsProgressCategory::getMatrixId));
|
||||||
List<FacBoxTransformer> boxTransformerList = new ArrayList<>();
|
List<FacBoxTransformer> boxTransformerList = new ArrayList<>();
|
||||||
@ -258,6 +257,61 @@ public class FacBoxTransformerServiceImpl extends ServiceImpl<FacBoxTransformerM
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板创建箱变数据
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp) {
|
||||||
|
Set<Long> tempIds = temp.stream().map(PgsProgressCategory::getId).collect(Collectors.toSet());
|
||||||
|
List<FacBoxTransformer> boxTransformers = this.lambdaQuery()
|
||||||
|
.in(FacBoxTransformer::getProgressCategoryId, tempIds)
|
||||||
|
.list();
|
||||||
|
if (CollUtil.isEmpty(boxTransformers)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<Long, List<FacBoxTransformer>> tempMap = boxTransformers.stream()
|
||||||
|
.collect(Collectors.groupingBy(FacBoxTransformer::getProgressCategoryId));
|
||||||
|
List<FacBoxTransformer> boxTransformerList = new ArrayList<>();
|
||||||
|
for (Map.Entry<Long, List<FacBoxTransformer>> entry : tempMap.entrySet()) {
|
||||||
|
if (CollUtil.isNotEmpty(entry.getValue())) {
|
||||||
|
boxTransformerList.addAll(entry.getValue());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(boxTransformerList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<FacBoxTransformer> newBoxTransformerList = boxTransformerList.stream().map(boxTransformer -> {
|
||||||
|
FacBoxTransformer newBoxTransformer = new FacBoxTransformer();
|
||||||
|
newBoxTransformer.setProjectId(progressCategory.getProjectId());
|
||||||
|
newBoxTransformer.setMatrixId(progressCategory.getMatrixId());
|
||||||
|
newBoxTransformer.setName(boxTransformer.getName());
|
||||||
|
newBoxTransformer.setPositions(boxTransformer.getPositions());
|
||||||
|
newBoxTransformer.setProgressCategoryId(progressCategory.getId());
|
||||||
|
newBoxTransformer.setProgressCategoryName(progressCategory.getName());
|
||||||
|
newBoxTransformer.setRemark(boxTransformer.getRemark());
|
||||||
|
return newBoxTransformer;
|
||||||
|
}).toList();
|
||||||
|
boolean saved = this.saveBatch(newBoxTransformerList);
|
||||||
|
if (!saved) {
|
||||||
|
throw new ServiceException("新增箱变失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
BigDecimal total = BigDecimal.valueOf(newBoxTransformerList.size());
|
||||||
|
progressCategory.setTotal(total);
|
||||||
|
progressCategory.setOutputValue(total.multiply(
|
||||||
|
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||||
|
.orElse(BigDecimal.ZERO)
|
||||||
|
));
|
||||||
|
boolean result = progressCategoryService.updateById(progressCategory);
|
||||||
|
if (!result) {
|
||||||
|
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-箱变
|
* 修改设施-箱变
|
||||||
*
|
*
|
||||||
|
@ -36,10 +36,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -157,7 +154,7 @@ public class FacInverterServiceImpl extends ServiceImpl<FacInverterMapper, FacIn
|
|||||||
if (CollUtil.isEmpty(matrixList)) {
|
if (CollUtil.isEmpty(matrixList)) {
|
||||||
throw new ServiceException("项目下无方阵数据,请先创建方阵信息后再添加逆变器信息", HttpStatus.NOT_FOUND);
|
throw new ServiceException("项目下无方阵数据,请先创建方阵信息后再添加逆变器信息", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
// 获取箱变信息
|
// 获取逆变器信息
|
||||||
List<FacInverter> oldInverterList = this.lambdaQuery()
|
List<FacInverter> oldInverterList = this.lambdaQuery()
|
||||||
.eq(FacInverter::getProjectId, projectId).list();
|
.eq(FacInverter::getProjectId, projectId).list();
|
||||||
Map<String, FacInverter> inverterMap = oldInverterList.stream().collect(Collectors.toMap(
|
Map<String, FacInverter> inverterMap = oldInverterList.stream().collect(Collectors.toMap(
|
||||||
@ -179,14 +176,16 @@ public class FacInverterServiceImpl extends ServiceImpl<FacInverterMapper, FacIn
|
|||||||
}
|
}
|
||||||
// 获取进度类别信息
|
// 获取进度类别信息
|
||||||
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
||||||
.in(PgsProgressCategory::getWorkType, PgsProgressCategoryConstant.INVERTER_PROGRESS_CATEGORY_WORK_TYPE).list();
|
.eq(PgsProgressCategory::getProjectId, projectId)
|
||||||
|
.likeRight(PgsProgressCategory::getWorkType, PgsProgressCategoryConstant.INVERTER_WORK_TYPE + "_")
|
||||||
|
.list();
|
||||||
Map<Long, List<PgsProgressCategory>> progressCategoryMap = progressCategoryList.stream()
|
Map<Long, List<PgsProgressCategory>> progressCategoryMap = progressCategoryList.stream()
|
||||||
.collect(Collectors.groupingBy(PgsProgressCategory::getMatrixId));
|
.collect(Collectors.groupingBy(PgsProgressCategory::getMatrixId));
|
||||||
List<FacInverter> inverterList = new ArrayList<>();
|
List<FacInverter> inverterList = new ArrayList<>();
|
||||||
for (FacFeatureByPoint locationFeature : locationGeoJson) {
|
for (FacFeatureByPoint locationFeature : locationGeoJson) {
|
||||||
FacGeometryByPoint geometry = locationFeature.getGeometry();
|
FacGeometryByPoint geometry = locationFeature.getGeometry();
|
||||||
List<Double> coordinates = geometry.getCoordinates();
|
List<Double> coordinates = geometry.getCoordinates();
|
||||||
// 判断箱变在哪个方阵里
|
// 判断逆变器在哪个方阵里
|
||||||
FacMatrix matrix = matrixService.getMatrixIdByCoordinates(matrixList, coordinates);
|
FacMatrix matrix = matrixService.getMatrixIdByCoordinates(matrixList, coordinates);
|
||||||
if (matrix == null) {
|
if (matrix == null) {
|
||||||
continue;
|
continue;
|
||||||
@ -206,7 +205,7 @@ public class FacInverterServiceImpl extends ServiceImpl<FacInverterMapper, FacIn
|
|||||||
inverter.setProjectId(projectId);
|
inverter.setProjectId(projectId);
|
||||||
inverter.setPositions(JSONUtil.toJsonStr(coordinates));
|
inverter.setPositions(JSONUtil.toJsonStr(coordinates));
|
||||||
String mapKey = name + "_" + progressCategory.getId();
|
String mapKey = name + "_" + progressCategory.getId();
|
||||||
// 如果有同名同类别箱变,则获取该箱变完成状态
|
// 如果有同名同类别逆变器,则获取该逆变器完成状态
|
||||||
if (CollUtil.isNotEmpty(inverterMap) && inverterMap.containsKey(mapKey)) {
|
if (CollUtil.isNotEmpty(inverterMap) && inverterMap.containsKey(mapKey)) {
|
||||||
FacInverter oldInverter = inverterMap.get(mapKey);
|
FacInverter oldInverter = inverterMap.get(mapKey);
|
||||||
inverter.setFinishType(oldInverter.getFinishType());
|
inverter.setFinishType(oldInverter.getFinishType());
|
||||||
@ -258,6 +257,61 @@ public class FacInverterServiceImpl extends ServiceImpl<FacInverterMapper, FacIn
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板插入逆变器
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp) {
|
||||||
|
Set<Long> tempIds = temp.stream().map(PgsProgressCategory::getId).collect(Collectors.toSet());
|
||||||
|
List<FacInverter> inverters = this.lambdaQuery()
|
||||||
|
.in(FacInverter::getProgressCategoryId, tempIds)
|
||||||
|
.list();
|
||||||
|
if (CollUtil.isEmpty(inverters)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<Long, List<FacInverter>> tempMap = inverters.stream()
|
||||||
|
.collect(Collectors.groupingBy(FacInverter::getProgressCategoryId));
|
||||||
|
List<FacInverter> inverterList = new ArrayList<>();
|
||||||
|
for (Map.Entry<Long, List<FacInverter>> entry : tempMap.entrySet()) {
|
||||||
|
if (CollUtil.isNotEmpty(entry.getValue())) {
|
||||||
|
inverterList.addAll(entry.getValue());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(inverterList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<FacInverter> newInverterList = inverterList.stream().map(inverter -> {
|
||||||
|
FacInverter newInverter = new FacInverter();
|
||||||
|
newInverter.setProjectId(progressCategory.getProjectId());
|
||||||
|
newInverter.setMatrixId(progressCategory.getMatrixId());
|
||||||
|
newInverter.setName(inverter.getName());
|
||||||
|
newInverter.setPositions(inverter.getPositions());
|
||||||
|
newInverter.setProgressCategoryId(progressCategory.getId());
|
||||||
|
newInverter.setProgressCategoryName(progressCategory.getName());
|
||||||
|
newInverter.setRemark(inverter.getRemark());
|
||||||
|
return newInverter;
|
||||||
|
}).toList();
|
||||||
|
boolean saved = this.saveBatch(newInverterList);
|
||||||
|
if (!saved) {
|
||||||
|
throw new ServiceException("新增逆变器失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
BigDecimal total = BigDecimal.valueOf(newInverterList.size());
|
||||||
|
progressCategory.setTotal(total);
|
||||||
|
progressCategory.setOutputValue(total.multiply(
|
||||||
|
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||||
|
.orElse(BigDecimal.ZERO)
|
||||||
|
));
|
||||||
|
boolean result = progressCategoryService.updateById(progressCategory);
|
||||||
|
if (!result) {
|
||||||
|
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-逆变器
|
* 修改设施-逆变器
|
||||||
*
|
*
|
||||||
|
@ -25,15 +25,15 @@ import org.dromara.facility.domain.vo.photovoltaicpanelparts.FacPhotovoltaicPane
|
|||||||
import org.dromara.facility.mapper.FacPhotovoltaicPanelColumnMapper;
|
import org.dromara.facility.mapper.FacPhotovoltaicPanelColumnMapper;
|
||||||
import org.dromara.facility.service.IFacMatrixService;
|
import org.dromara.facility.service.IFacMatrixService;
|
||||||
import org.dromara.facility.service.IFacPhotovoltaicPanelColumnService;
|
import org.dromara.facility.service.IFacPhotovoltaicPanelColumnService;
|
||||||
|
import org.dromara.progress.domain.PgsProgressCategory;
|
||||||
|
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.math.BigDecimal;
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,6 +52,9 @@ public class FacPhotovoltaicPanelColumnServiceImpl extends ServiceImpl<FacPhotov
|
|||||||
@Resource
|
@Resource
|
||||||
private IFacMatrixService matrixService;
|
private IFacMatrixService matrixService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPgsProgressCategoryService progressCategoryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设施-光伏板立柱
|
* 查询设施-光伏板立柱
|
||||||
*
|
*
|
||||||
@ -127,6 +130,61 @@ public class FacPhotovoltaicPanelColumnServiceImpl extends ServiceImpl<FacPhotov
|
|||||||
return photovoltaicPanelColumn.getId();
|
return photovoltaicPanelColumn.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板创建光伏板立柱数据
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp) {
|
||||||
|
Set<Long> tempIds = temp.stream().map(PgsProgressCategory::getId).collect(Collectors.toSet());
|
||||||
|
List<FacPhotovoltaicPanelColumn> columns = this.lambdaQuery()
|
||||||
|
.in(FacPhotovoltaicPanelColumn::getProgressCategoryId, tempIds)
|
||||||
|
.list();
|
||||||
|
if (CollUtil.isEmpty(columns)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<Long, List<FacPhotovoltaicPanelColumn>> tempMap = columns.stream()
|
||||||
|
.collect(Collectors.groupingBy(FacPhotovoltaicPanelColumn::getProgressCategoryId));
|
||||||
|
List<FacPhotovoltaicPanelColumn> PhotovoltaicPanelColumnList = new ArrayList<>();
|
||||||
|
for (Map.Entry<Long, List<FacPhotovoltaicPanelColumn>> entry : tempMap.entrySet()) {
|
||||||
|
if (CollUtil.isNotEmpty(entry.getValue())) {
|
||||||
|
PhotovoltaicPanelColumnList.addAll(entry.getValue());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(PhotovoltaicPanelColumnList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<FacPhotovoltaicPanelColumn> newColumnList = PhotovoltaicPanelColumnList.stream().map(PhotovoltaicPanelColumn -> {
|
||||||
|
FacPhotovoltaicPanelColumn newColumn = new FacPhotovoltaicPanelColumn();
|
||||||
|
newColumn.setProjectId(progressCategory.getProjectId());
|
||||||
|
newColumn.setMatrixId(progressCategory.getMatrixId());
|
||||||
|
newColumn.setName(PhotovoltaicPanelColumn.getName());
|
||||||
|
newColumn.setPositions(PhotovoltaicPanelColumn.getPositions());
|
||||||
|
newColumn.setProgressCategoryId(progressCategory.getId());
|
||||||
|
newColumn.setProgressCategoryName(progressCategory.getName());
|
||||||
|
newColumn.setRemark(PhotovoltaicPanelColumn.getRemark());
|
||||||
|
return newColumn;
|
||||||
|
}).toList();
|
||||||
|
boolean saved = this.saveBatch(newColumnList);
|
||||||
|
if (!saved) {
|
||||||
|
throw new ServiceException("新增光伏板立柱失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
BigDecimal total = BigDecimal.valueOf(newColumnList.size());
|
||||||
|
progressCategory.setTotal(total);
|
||||||
|
progressCategory.setOutputValue(total.multiply(
|
||||||
|
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||||
|
.orElse(BigDecimal.ZERO)
|
||||||
|
));
|
||||||
|
boolean result = progressCategoryService.updateById(progressCategory);
|
||||||
|
if (!result) {
|
||||||
|
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-光伏板立柱
|
* 修改设施-光伏板立柱
|
||||||
*
|
*
|
||||||
|
@ -15,7 +15,6 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
|||||||
import org.dromara.common.sse.dto.SseMessageDto;
|
import org.dromara.common.sse.dto.SseMessageDto;
|
||||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||||
import org.dromara.common.utils.JSTUtil;
|
import org.dromara.common.utils.JSTUtil;
|
||||||
import org.dromara.facility.constant.FacPhotovoltaicPanelPartsConstant;
|
|
||||||
import org.dromara.facility.constant.FacRedisKeyConstant;
|
import org.dromara.facility.constant.FacRedisKeyConstant;
|
||||||
import org.dromara.facility.domain.FacPhotovoltaicPanel;
|
import org.dromara.facility.domain.FacPhotovoltaicPanel;
|
||||||
import org.dromara.facility.domain.FacPhotovoltaicPanelColumn;
|
import org.dromara.facility.domain.FacPhotovoltaicPanelColumn;
|
||||||
@ -206,19 +205,20 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
|
|||||||
*/
|
*/
|
||||||
private void saveBatch(Long projectId, List<FacFeatureByPoint> features, Long userId) {
|
private void saveBatch(Long projectId, List<FacFeatureByPoint> features, Long userId) {
|
||||||
// 获取进度类别 Map
|
// 获取进度类别 Map
|
||||||
List<String> progressCategoryNameList = List.of(
|
|
||||||
FacPhotovoltaicPanelPartsConstant.POINT,
|
|
||||||
FacPhotovoltaicPanelPartsConstant.COLUMN,
|
|
||||||
FacPhotovoltaicPanelPartsConstant.SUPPORT
|
|
||||||
);
|
|
||||||
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
||||||
.select(PgsProgressCategory::getId, PgsProgressCategory::getName, PgsProgressCategory::getMatrixId)
|
.select(PgsProgressCategory::getId, PgsProgressCategory::getName, PgsProgressCategory::getMatrixId, PgsProgressCategory::getWorkType)
|
||||||
.in(PgsProgressCategory::getName, progressCategoryNameList)
|
.eq(PgsProgressCategory::getProjectId, projectId)
|
||||||
.in(PgsProgressCategory::getProjectId, projectId, PgsProgressCategoryConstant.PUBLIC_PROJECT_ID)
|
.and(lqw -> lqw
|
||||||
|
.likeRight(PgsProgressCategory::getWorkType, PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE + "_")
|
||||||
|
.or()
|
||||||
|
.likeRight(PgsProgressCategory::getWorkType, PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE + "_")
|
||||||
|
.or()
|
||||||
|
.likeRight(PgsProgressCategory::getWorkType, PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE + "_")
|
||||||
|
)
|
||||||
.list();
|
.list();
|
||||||
Map<String, List<PgsProgressCategory>> progressCategoryMap = progressCategoryList.stream()
|
Map<String, List<PgsProgressCategory>> progressCategoryMap = progressCategoryList.stream()
|
||||||
.collect(Collectors.groupingBy(
|
.collect(Collectors.groupingBy(
|
||||||
progressCategory -> progressCategory.getMatrixId() + "_" + progressCategory.getName()
|
progressCategory -> progressCategory.getMatrixId() + "_" + progressCategory.getWorkType().split("_")[0]
|
||||||
));
|
));
|
||||||
// 查询项目下光伏板
|
// 查询项目下光伏板
|
||||||
List<FacPhotovoltaicPanel> photovoltaicPanelList = photovoltaicPanelService.lambdaQuery()
|
List<FacPhotovoltaicPanel> photovoltaicPanelList = photovoltaicPanelService.lambdaQuery()
|
||||||
@ -299,68 +299,80 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
|
|||||||
Long matrixId = photovoltaicPanel.getMatrixId();
|
Long matrixId = photovoltaicPanel.getMatrixId();
|
||||||
String jsonStr = JSONUtil.toJsonStr(list);
|
String jsonStr = JSONUtil.toJsonStr(list);
|
||||||
// 创建 Point
|
// 创建 Point
|
||||||
FacPhotovoltaicPanelPoint point = new FacPhotovoltaicPanelPoint();
|
String pointMapKey = matrixId + "_" + PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE;
|
||||||
point.setProjectId(projectId);
|
|
||||||
point.setMatrixId(matrixId);
|
|
||||||
point.setName(name);
|
|
||||||
point.setPositions(jsonStr);
|
|
||||||
point.setCreateBy(userId);
|
|
||||||
point.setUpdateBy(userId);
|
|
||||||
if (oldPointMap.containsKey(name)) {
|
|
||||||
FacPhotovoltaicPanelPoint oldPoint = oldPointMap.get(name);
|
|
||||||
point.setFinishType(oldPoint.getFinishType());
|
|
||||||
point.setFinishDate(oldPoint.getFinishDate());
|
|
||||||
point.setStatus(oldPoint.getStatus());
|
|
||||||
}
|
|
||||||
String pointMapKey = matrixId + "_" + FacPhotovoltaicPanelPartsConstant.POINT;
|
|
||||||
if (progressCategoryMap.containsKey(pointMapKey)) {
|
if (progressCategoryMap.containsKey(pointMapKey)) {
|
||||||
PgsProgressCategory cat = progressCategoryMap.get(pointMapKey).getFirst();
|
List<PgsProgressCategory> categoryList = progressCategoryMap.get(pointMapKey);
|
||||||
point.setProgressCategoryId(cat.getId());
|
if (CollUtil.isNotEmpty(categoryList)) {
|
||||||
point.setProgressCategoryName(cat.getName());
|
for (PgsProgressCategory category : categoryList) {
|
||||||
|
FacPhotovoltaicPanelPoint point = new FacPhotovoltaicPanelPoint();
|
||||||
|
point.setProjectId(projectId);
|
||||||
|
point.setMatrixId(matrixId);
|
||||||
|
point.setName(name);
|
||||||
|
point.setPositions(jsonStr);
|
||||||
|
point.setCreateBy(userId);
|
||||||
|
point.setUpdateBy(userId);
|
||||||
|
if (oldPointMap.containsKey(name)) {
|
||||||
|
FacPhotovoltaicPanelPoint oldPoint = oldPointMap.get(name);
|
||||||
|
point.setFinishType(oldPoint.getFinishType());
|
||||||
|
point.setFinishDate(oldPoint.getFinishDate());
|
||||||
|
point.setStatus(oldPoint.getStatus());
|
||||||
|
}
|
||||||
|
point.setProgressCategoryId(category.getId());
|
||||||
|
point.setProgressCategoryName(category.getName());
|
||||||
|
pointList.add(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pointList.add(point);
|
|
||||||
// 创建 Column
|
// 创建 Column
|
||||||
FacPhotovoltaicPanelColumn column = new FacPhotovoltaicPanelColumn();
|
String columnMapKey = matrixId + "_" + PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE;
|
||||||
column.setProjectId(projectId);
|
|
||||||
column.setMatrixId(matrixId);
|
|
||||||
column.setName(name);
|
|
||||||
column.setPositions(jsonStr);
|
|
||||||
column.setCreateBy(userId);
|
|
||||||
column.setUpdateBy(userId);
|
|
||||||
if (oldColumnMap.containsKey(name)) {
|
|
||||||
FacPhotovoltaicPanelColumn oldColumn = oldColumnMap.get(name);
|
|
||||||
column.setFinishType(oldColumn.getFinishType());
|
|
||||||
column.setFinishDate(oldColumn.getFinishDate());
|
|
||||||
column.setStatus(oldColumn.getStatus());
|
|
||||||
}
|
|
||||||
String columnMapKey = matrixId + "_" + FacPhotovoltaicPanelPartsConstant.COLUMN;
|
|
||||||
if (progressCategoryMap.containsKey(columnMapKey)) {
|
if (progressCategoryMap.containsKey(columnMapKey)) {
|
||||||
PgsProgressCategory cat = progressCategoryMap.get(columnMapKey).getFirst();
|
List<PgsProgressCategory> categoryList = progressCategoryMap.get(columnMapKey);
|
||||||
column.setProgressCategoryId(cat.getId());
|
if (CollUtil.isNotEmpty(categoryList)) {
|
||||||
column.setProgressCategoryName(cat.getName());
|
for (PgsProgressCategory category : categoryList) {
|
||||||
|
FacPhotovoltaicPanelColumn column = new FacPhotovoltaicPanelColumn();
|
||||||
|
column.setProjectId(projectId);
|
||||||
|
column.setMatrixId(matrixId);
|
||||||
|
column.setName(name);
|
||||||
|
column.setPositions(jsonStr);
|
||||||
|
column.setCreateBy(userId);
|
||||||
|
column.setUpdateBy(userId);
|
||||||
|
if (oldColumnMap.containsKey(name)) {
|
||||||
|
FacPhotovoltaicPanelColumn oldColumn = oldColumnMap.get(name);
|
||||||
|
column.setFinishType(oldColumn.getFinishType());
|
||||||
|
column.setFinishDate(oldColumn.getFinishDate());
|
||||||
|
column.setStatus(oldColumn.getStatus());
|
||||||
|
}
|
||||||
|
column.setProgressCategoryId(category.getId());
|
||||||
|
column.setProgressCategoryName(category.getName());
|
||||||
|
columnList.add(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
columnList.add(column);
|
|
||||||
// 创建 Support
|
// 创建 Support
|
||||||
FacPhotovoltaicPanelSupport support = new FacPhotovoltaicPanelSupport();
|
String supportMapKey = matrixId + "_" + PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE;
|
||||||
support.setProjectId(projectId);
|
|
||||||
support.setMatrixId(matrixId);
|
|
||||||
support.setName(name);
|
|
||||||
support.setPositions(jsonStr);
|
|
||||||
support.setCreateBy(userId);
|
|
||||||
support.setUpdateBy(userId);
|
|
||||||
if (oldSupportMap.containsKey(name)) {
|
|
||||||
FacPhotovoltaicPanelSupport oldSupport = oldSupportMap.get(name);
|
|
||||||
support.setFinishType(oldSupport.getFinishType());
|
|
||||||
support.setFinishDate(oldSupport.getFinishDate());
|
|
||||||
support.setStatus(oldSupport.getStatus());
|
|
||||||
}
|
|
||||||
String supportMapKey = matrixId + "_" + FacPhotovoltaicPanelPartsConstant.SUPPORT;
|
|
||||||
if (progressCategoryMap.containsKey(supportMapKey)) {
|
if (progressCategoryMap.containsKey(supportMapKey)) {
|
||||||
PgsProgressCategory cat = progressCategoryMap.get(supportMapKey).getFirst();
|
List<PgsProgressCategory> categoryList = progressCategoryMap.get(supportMapKey);
|
||||||
support.setProgressCategoryId(cat.getId());
|
if (CollUtil.isNotEmpty(categoryList)) {
|
||||||
support.setProgressCategoryName(cat.getName());
|
for (PgsProgressCategory category : categoryList) {
|
||||||
|
FacPhotovoltaicPanelSupport support = new FacPhotovoltaicPanelSupport();
|
||||||
|
support.setProjectId(projectId);
|
||||||
|
support.setMatrixId(matrixId);
|
||||||
|
support.setName(name);
|
||||||
|
support.setPositions(jsonStr);
|
||||||
|
support.setCreateBy(userId);
|
||||||
|
support.setUpdateBy(userId);
|
||||||
|
if (oldSupportMap.containsKey(name)) {
|
||||||
|
FacPhotovoltaicPanelSupport oldSupport = oldSupportMap.get(name);
|
||||||
|
support.setFinishType(oldSupport.getFinishType());
|
||||||
|
support.setFinishDate(oldSupport.getFinishDate());
|
||||||
|
support.setStatus(oldSupport.getStatus());
|
||||||
|
}
|
||||||
|
support.setProgressCategoryId(category.getId());
|
||||||
|
support.setProgressCategoryName(category.getName());
|
||||||
|
supportList.add(support);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
supportList.add(support);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -389,68 +401,94 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
|
|||||||
int batchSize = 1000;
|
int batchSize = 1000;
|
||||||
// 保存所有批次任务
|
// 保存所有批次任务
|
||||||
List<CompletableFuture<Void>> deleteFutures = new ArrayList<>();
|
List<CompletableFuture<Void>> deleteFutures = new ArrayList<>();
|
||||||
int deleteSize = oldPointList.size();
|
int oldTotalPointSize = oldPointList.size();
|
||||||
for (int i = 0; i < deleteSize; i += batchSize) {
|
int oldTotalColumnSize = oldColumnList.size();
|
||||||
int endIndex = Math.min(i + batchSize, deleteSize);
|
int oldTotalSupportSize = oldSupportList.size();
|
||||||
List<FacPhotovoltaicPanelPoint> batchPointList = oldPointList.subList(i, endIndex);
|
// 最大批次数根据最长的列表来
|
||||||
List<FacPhotovoltaicPanelColumn> batchColumnList = oldColumnList.subList(i, endIndex);
|
int oldTotalSize = Math.max(Math.max(oldTotalPointSize, oldTotalColumnSize), oldTotalSupportSize);
|
||||||
List<FacPhotovoltaicPanelSupport> batchSupportList = oldSupportList.subList(i, endIndex);
|
for (int i = 0; i < oldTotalSize; i += batchSize) {
|
||||||
// 使用事务处理每批数据
|
// 分别计算每个列表的 endIndex,防止越界
|
||||||
|
int endPointIndex = Math.min(i + batchSize, oldTotalPointSize);
|
||||||
|
int endColumnIndex = Math.min(i + batchSize, oldTotalColumnSize);
|
||||||
|
int endSupportIndex = Math.min(i + batchSize, oldTotalSupportSize);
|
||||||
|
// 防止 subList 起始下标超出
|
||||||
|
List<FacPhotovoltaicPanelPoint> batchPointList =
|
||||||
|
i < oldTotalPointSize ? oldPointList.subList(i, endPointIndex) : Collections.emptyList();
|
||||||
|
List<FacPhotovoltaicPanelColumn> batchColumnList =
|
||||||
|
i < oldTotalColumnSize ? oldColumnList.subList(i, endColumnIndex) : Collections.emptyList();
|
||||||
|
List<FacPhotovoltaicPanelSupport> batchSupportList =
|
||||||
|
i < oldTotalSupportSize ? oldSupportList.subList(i, endSupportIndex) : Collections.emptyList();
|
||||||
// 获取代理
|
// 获取代理
|
||||||
FacPhotovoltaicPanelPartsServiceImpl photovoltaicPanelPartsService = self;
|
FacPhotovoltaicPanelPartsServiceImpl photovoltaicPanelPartsService = self;
|
||||||
// 异步处理每批数据,将任务添加到异步任务列表
|
// 异步处理每批数据
|
||||||
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> photovoltaicPanelPartsService.batchDeletePartsInner(batchPointList, batchColumnList, batchSupportList), customExecutor);
|
CompletableFuture<Void> future = CompletableFuture.runAsync(
|
||||||
|
() -> photovoltaicPanelPartsService.batchDeletePartsInner(batchPointList, batchColumnList, batchSupportList),
|
||||||
|
customExecutor
|
||||||
|
);
|
||||||
deleteFutures.add(future);
|
deleteFutures.add(future);
|
||||||
}
|
}
|
||||||
// 等待所有批次完成操作
|
// 等待所有批次完成操作
|
||||||
CompletableFuture.allOf(deleteFutures.toArray(new CompletableFuture[0])).join();
|
CompletableFuture.allOf(deleteFutures.toArray(new CompletableFuture[0])).join();
|
||||||
// 保存所有批次任务
|
// 保存所有批次任务
|
||||||
List<CompletableFuture<Void>> insertFutures = new ArrayList<>();
|
List<CompletableFuture<Void>> insertFutures = new ArrayList<>();
|
||||||
int totalSize = pointList.size();
|
int totalPointSize = pointList.size();
|
||||||
|
int totalColumnSize = columnList.size();
|
||||||
|
int totalSupportSize = supportList.size();
|
||||||
|
// 最大批次数 = 三个列表中最长的长度
|
||||||
|
int totalSize = Math.max(Math.max(totalPointSize, totalColumnSize), totalSupportSize);
|
||||||
for (int i = 0; i < totalSize; i += batchSize) {
|
for (int i = 0; i < totalSize; i += batchSize) {
|
||||||
int endIndex = Math.min(i + batchSize, totalSize);
|
// 分别计算三个列表的 endIndex,防止越界
|
||||||
List<FacPhotovoltaicPanelPoint> batchPointList = pointList.subList(i, endIndex);
|
int endPointIndex = Math.min(i + batchSize, totalPointSize);
|
||||||
List<FacPhotovoltaicPanelColumn> batchColumnList = columnList.subList(i, endIndex);
|
int endColumnIndex = Math.min(i + batchSize, totalColumnSize);
|
||||||
List<FacPhotovoltaicPanelSupport> batchSupportList = supportList.subList(i, endIndex);
|
int endSupportIndex = Math.min(i + batchSize, totalSupportSize);
|
||||||
// 使用事务处理每批数据
|
// 如果起始索引已经超出长度,就给空列表
|
||||||
// 获取代理
|
List<FacPhotovoltaicPanelPoint> batchPointList =
|
||||||
|
i < totalPointSize ? pointList.subList(i, endPointIndex) : Collections.emptyList();
|
||||||
|
List<FacPhotovoltaicPanelColumn> batchColumnList =
|
||||||
|
i < totalColumnSize ? columnList.subList(i, endColumnIndex) : Collections.emptyList();
|
||||||
|
List<FacPhotovoltaicPanelSupport> batchSupportList =
|
||||||
|
i < totalSupportSize ? supportList.subList(i, endSupportIndex) : Collections.emptyList();
|
||||||
FacPhotovoltaicPanelPartsServiceImpl photovoltaicPanelPartsService = self;
|
FacPhotovoltaicPanelPartsServiceImpl photovoltaicPanelPartsService = self;
|
||||||
// 异步处理每批数据,将任务添加到异步任务列表
|
CompletableFuture<Void> future = CompletableFuture.runAsync(
|
||||||
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> photovoltaicPanelPartsService.batchInsertPartsInner(batchPointList, batchColumnList, batchSupportList), customExecutor);
|
() -> photovoltaicPanelPartsService.batchInsertPartsInner(batchPointList, batchColumnList, batchSupportList),
|
||||||
|
customExecutor
|
||||||
|
);
|
||||||
insertFutures.add(future);
|
insertFutures.add(future);
|
||||||
}
|
}
|
||||||
// 等待所有批次完成操作
|
// 等待所有批次完成操作
|
||||||
CompletableFuture.allOf(insertFutures.toArray(new CompletableFuture[0])).join();
|
CompletableFuture.allOf(insertFutures.toArray(new CompletableFuture[0])).join();
|
||||||
// 关闭线程池
|
// 关闭线程池
|
||||||
customExecutor.shutdown();
|
customExecutor.shutdown();
|
||||||
// 更新数量
|
if (CollUtil.isNotEmpty(progressCategoryList)) {
|
||||||
Map<Long, List<FacPhotovoltaicPanelPoint>> pointCountMap = pointList
|
// 更新数量
|
||||||
.stream().collect(Collectors.groupingBy(FacPhotovoltaicPanelPoint::getProgressCategoryId));
|
Map<Long, List<FacPhotovoltaicPanelPoint>> pointCountMap = pointList
|
||||||
Map<Long, List<FacPhotovoltaicPanelColumn>> columnCountMap = columnList
|
.stream().collect(Collectors.groupingBy(FacPhotovoltaicPanelPoint::getProgressCategoryId));
|
||||||
.stream().collect(Collectors.groupingBy(FacPhotovoltaicPanelColumn::getProgressCategoryId));
|
Map<Long, List<FacPhotovoltaicPanelColumn>> columnCountMap = columnList
|
||||||
Map<Long, List<FacPhotovoltaicPanelSupport>> supportCountMap = supportList
|
.stream().collect(Collectors.groupingBy(FacPhotovoltaicPanelColumn::getProgressCategoryId));
|
||||||
.stream().collect(Collectors.groupingBy(FacPhotovoltaicPanelSupport::getProgressCategoryId));
|
Map<Long, List<FacPhotovoltaicPanelSupport>> supportCountMap = supportList
|
||||||
for (PgsProgressCategory progressCategory : progressCategoryList) {
|
.stream().collect(Collectors.groupingBy(FacPhotovoltaicPanelSupport::getProgressCategoryId));
|
||||||
Long progressCategoryId = progressCategory.getId();
|
for (PgsProgressCategory progressCategory : progressCategoryList) {
|
||||||
BigDecimal unitPrice = progressCategory.getUnitPrice();
|
Long progressCategoryId = progressCategory.getId();
|
||||||
int total = 0;
|
BigDecimal unitPrice = progressCategory.getUnitPrice();
|
||||||
if (pointCountMap.containsKey(progressCategoryId)) {
|
int total = 0;
|
||||||
total = pointCountMap.get(progressCategoryId).size();
|
if (pointCountMap.containsKey(progressCategoryId)) {
|
||||||
} else if (columnCountMap.containsKey(progressCategoryId)) {
|
total = pointCountMap.get(progressCategoryId).size();
|
||||||
total = columnCountMap.get(progressCategoryId).size();
|
} else if (columnCountMap.containsKey(progressCategoryId)) {
|
||||||
} else if (supportCountMap.containsKey(progressCategoryId)) {
|
total = columnCountMap.get(progressCategoryId).size();
|
||||||
total = supportCountMap.get(progressCategoryId).size();
|
} else if (supportCountMap.containsKey(progressCategoryId)) {
|
||||||
|
total = supportCountMap.get(progressCategoryId).size();
|
||||||
|
}
|
||||||
|
progressCategory.setTotal(BigDecimal.valueOf(total));
|
||||||
|
// 如果单价不为 0 则计算产值
|
||||||
|
if (unitPrice != null && unitPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
|
progressCategory.setOutputValue(unitPrice.multiply(BigDecimal.valueOf(total)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
progressCategory.setTotal(BigDecimal.valueOf(total));
|
boolean result = progressCategoryService.updateBatchById(progressCategoryList);
|
||||||
// 如果单价不为 0 则计算产值
|
if (!result) {
|
||||||
if (unitPrice.compareTo(BigDecimal.ZERO) != 0) {
|
throw new ServiceException("更新进度类别失败,数据库异常", HttpStatus.ERROR);
|
||||||
progressCategory.setOutputValue(unitPrice.multiply(BigDecimal.valueOf(total)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean result = progressCategoryService.updateBatchById(progressCategoryList);
|
|
||||||
if (!result) {
|
|
||||||
throw new ServiceException("更新进度类别失败,数据库异常", HttpStatus.ERROR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,15 +25,15 @@ import org.dromara.facility.domain.vo.photovoltaicpanelpoint.FacPhotovoltaicPane
|
|||||||
import org.dromara.facility.mapper.FacPhotovoltaicPanelPointMapper;
|
import org.dromara.facility.mapper.FacPhotovoltaicPanelPointMapper;
|
||||||
import org.dromara.facility.service.IFacMatrixService;
|
import org.dromara.facility.service.IFacMatrixService;
|
||||||
import org.dromara.facility.service.IFacPhotovoltaicPanelPointService;
|
import org.dromara.facility.service.IFacPhotovoltaicPanelPointService;
|
||||||
|
import org.dromara.progress.domain.PgsProgressCategory;
|
||||||
|
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.math.BigDecimal;
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,6 +52,9 @@ public class FacPhotovoltaicPanelPointServiceImpl extends ServiceImpl<FacPhotovo
|
|||||||
@Resource
|
@Resource
|
||||||
private IFacMatrixService matrixService;
|
private IFacMatrixService matrixService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPgsProgressCategoryService progressCategoryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设施-光伏板桩点
|
* 查询设施-光伏板桩点
|
||||||
*
|
*
|
||||||
@ -127,6 +130,61 @@ public class FacPhotovoltaicPanelPointServiceImpl extends ServiceImpl<FacPhotovo
|
|||||||
return photovoltaicPanelPoint.getId();
|
return photovoltaicPanelPoint.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板创建光伏板桩点数据
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp) {
|
||||||
|
Set<Long> tempIds = temp.stream().map(PgsProgressCategory::getId).collect(Collectors.toSet());
|
||||||
|
List<FacPhotovoltaicPanelPoint> points = this.lambdaQuery()
|
||||||
|
.in(FacPhotovoltaicPanelPoint::getProgressCategoryId, tempIds)
|
||||||
|
.list();
|
||||||
|
if (CollUtil.isEmpty(points)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<Long, List<FacPhotovoltaicPanelPoint>> tempMap = points.stream()
|
||||||
|
.collect(Collectors.groupingBy(FacPhotovoltaicPanelPoint::getProgressCategoryId));
|
||||||
|
List<FacPhotovoltaicPanelPoint> PhotovoltaicPanelPointList = new ArrayList<>();
|
||||||
|
for (Map.Entry<Long, List<FacPhotovoltaicPanelPoint>> entry : tempMap.entrySet()) {
|
||||||
|
if (CollUtil.isNotEmpty(entry.getValue())) {
|
||||||
|
PhotovoltaicPanelPointList.addAll(entry.getValue());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(PhotovoltaicPanelPointList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<FacPhotovoltaicPanelPoint> newPointList = PhotovoltaicPanelPointList.stream().map(PhotovoltaicPanelPoint -> {
|
||||||
|
FacPhotovoltaicPanelPoint newPoint = new FacPhotovoltaicPanelPoint();
|
||||||
|
newPoint.setProjectId(progressCategory.getProjectId());
|
||||||
|
newPoint.setMatrixId(progressCategory.getMatrixId());
|
||||||
|
newPoint.setName(PhotovoltaicPanelPoint.getName());
|
||||||
|
newPoint.setPositions(PhotovoltaicPanelPoint.getPositions());
|
||||||
|
newPoint.setProgressCategoryId(progressCategory.getId());
|
||||||
|
newPoint.setProgressCategoryName(progressCategory.getName());
|
||||||
|
newPoint.setRemark(PhotovoltaicPanelPoint.getRemark());
|
||||||
|
return newPoint;
|
||||||
|
}).toList();
|
||||||
|
boolean saved = this.saveBatch(newPointList);
|
||||||
|
if (!saved) {
|
||||||
|
throw new ServiceException("新增光伏板桩点失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
BigDecimal total = BigDecimal.valueOf(newPointList.size());
|
||||||
|
progressCategory.setTotal(total);
|
||||||
|
progressCategory.setOutputValue(total.multiply(
|
||||||
|
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||||
|
.orElse(BigDecimal.ZERO)
|
||||||
|
));
|
||||||
|
boolean result = progressCategoryService.updateById(progressCategory);
|
||||||
|
if (!result) {
|
||||||
|
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-光伏板桩点
|
* 修改设施-光伏板桩点
|
||||||
*
|
*
|
||||||
|
@ -253,7 +253,9 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
|
|||||||
));
|
));
|
||||||
// 获取进度类别信息
|
// 获取进度类别信息
|
||||||
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
||||||
.in(PgsProgressCategory::getWorkType, PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_PROGRESS_CATEGORY_WORK_TYPE).list();
|
.eq(PgsProgressCategory::getProjectId, projectId)
|
||||||
|
.likeRight(PgsProgressCategory::getWorkType, PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_WORK_TYPE + "_")
|
||||||
|
.list();
|
||||||
Map<Long, List<PgsProgressCategory>> progressCategoryMap = progressCategoryList.stream()
|
Map<Long, List<PgsProgressCategory>> progressCategoryMap = progressCategoryList.stream()
|
||||||
.collect(Collectors.groupingBy(PgsProgressCategory::getMatrixId));
|
.collect(Collectors.groupingBy(PgsProgressCategory::getMatrixId));
|
||||||
List<FacPhotovoltaicPanel> allPanels = new ArrayList<>();
|
List<FacPhotovoltaicPanel> allPanels = new ArrayList<>();
|
||||||
@ -460,6 +462,61 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板插入光伏板
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp) {
|
||||||
|
Set<Long> tempIds = temp.stream().map(PgsProgressCategory::getId).collect(Collectors.toSet());
|
||||||
|
List<FacPhotovoltaicPanel> panels = this.lambdaQuery()
|
||||||
|
.in(FacPhotovoltaicPanel::getProgressCategoryId, tempIds)
|
||||||
|
.list();
|
||||||
|
if (CollUtil.isEmpty(panels)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<Long, List<FacPhotovoltaicPanel>> tempMap = panels.stream()
|
||||||
|
.collect(Collectors.groupingBy(FacPhotovoltaicPanel::getProgressCategoryId));
|
||||||
|
List<FacPhotovoltaicPanel> photovoltaicPanelList = new ArrayList<>();
|
||||||
|
for (Map.Entry<Long, List<FacPhotovoltaicPanel>> entry : tempMap.entrySet()) {
|
||||||
|
if (CollUtil.isNotEmpty(entry.getValue())) {
|
||||||
|
photovoltaicPanelList.addAll(entry.getValue());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(photovoltaicPanelList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<FacPhotovoltaicPanel> newPanelList = photovoltaicPanelList.stream().map(photovoltaicPanel -> {
|
||||||
|
FacPhotovoltaicPanel newPanel = new FacPhotovoltaicPanel();
|
||||||
|
newPanel.setProjectId(progressCategory.getProjectId());
|
||||||
|
newPanel.setMatrixId(progressCategory.getMatrixId());
|
||||||
|
newPanel.setName(photovoltaicPanel.getName());
|
||||||
|
newPanel.setPositions(photovoltaicPanel.getPositions());
|
||||||
|
newPanel.setProgressCategoryId(progressCategory.getId());
|
||||||
|
newPanel.setProgressCategoryName(progressCategory.getName());
|
||||||
|
newPanel.setRemark(photovoltaicPanel.getRemark());
|
||||||
|
return newPanel;
|
||||||
|
}).toList();
|
||||||
|
boolean saved = this.saveBatch(newPanelList);
|
||||||
|
if (!saved) {
|
||||||
|
throw new ServiceException("新增光伏板失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
BigDecimal total = BigDecimal.valueOf(newPanelList.size());
|
||||||
|
progressCategory.setTotal(total);
|
||||||
|
progressCategory.setOutputValue(total.multiply(
|
||||||
|
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||||
|
.orElse(BigDecimal.ZERO)
|
||||||
|
));
|
||||||
|
boolean result = progressCategoryService.updateById(progressCategory);
|
||||||
|
if (!result) {
|
||||||
|
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-光伏板
|
* 修改设施-光伏板
|
||||||
*
|
*
|
||||||
|
@ -25,15 +25,15 @@ import org.dromara.facility.domain.vo.photovoltaicpanelsupport.FacPhotovoltaicPa
|
|||||||
import org.dromara.facility.mapper.FacPhotovoltaicPanelSupportMapper;
|
import org.dromara.facility.mapper.FacPhotovoltaicPanelSupportMapper;
|
||||||
import org.dromara.facility.service.IFacMatrixService;
|
import org.dromara.facility.service.IFacMatrixService;
|
||||||
import org.dromara.facility.service.IFacPhotovoltaicPanelSupportService;
|
import org.dromara.facility.service.IFacPhotovoltaicPanelSupportService;
|
||||||
|
import org.dromara.progress.domain.PgsProgressCategory;
|
||||||
|
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.math.BigDecimal;
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,6 +52,9 @@ public class FacPhotovoltaicPanelSupportServiceImpl extends ServiceImpl<FacPhoto
|
|||||||
@Resource
|
@Resource
|
||||||
private IFacMatrixService matrixService;
|
private IFacMatrixService matrixService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPgsProgressCategoryService progressCategoryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设施-光伏板支架
|
* 查询设施-光伏板支架
|
||||||
*
|
*
|
||||||
@ -127,6 +130,61 @@ public class FacPhotovoltaicPanelSupportServiceImpl extends ServiceImpl<FacPhoto
|
|||||||
return photovoltaicPanelSupport.getId();
|
return photovoltaicPanelSupport.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类别模板创建光伏板支架数据
|
||||||
|
*
|
||||||
|
* @param progressCategory 需新建数据的类别
|
||||||
|
* @param temp 旧类别列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void insertByCategoryTemp(PgsProgressCategory progressCategory, List<PgsProgressCategory> temp) {
|
||||||
|
Set<Long> tempIds = temp.stream().map(PgsProgressCategory::getId).collect(Collectors.toSet());
|
||||||
|
List<FacPhotovoltaicPanelSupport> supports = this.lambdaQuery()
|
||||||
|
.in(FacPhotovoltaicPanelSupport::getProgressCategoryId, tempIds)
|
||||||
|
.list();
|
||||||
|
if (CollUtil.isEmpty(supports)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<Long, List<FacPhotovoltaicPanelSupport>> tempMap = supports.stream()
|
||||||
|
.collect(Collectors.groupingBy(FacPhotovoltaicPanelSupport::getProgressCategoryId));
|
||||||
|
List<FacPhotovoltaicPanelSupport> PhotovoltaicPanelSupportList = new ArrayList<>();
|
||||||
|
for (Map.Entry<Long, List<FacPhotovoltaicPanelSupport>> entry : tempMap.entrySet()) {
|
||||||
|
if (CollUtil.isNotEmpty(entry.getValue())) {
|
||||||
|
PhotovoltaicPanelSupportList.addAll(entry.getValue());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(PhotovoltaicPanelSupportList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<FacPhotovoltaicPanelSupport> newSupportList = PhotovoltaicPanelSupportList.stream().map(PhotovoltaicPanelSupport -> {
|
||||||
|
FacPhotovoltaicPanelSupport newSupport = new FacPhotovoltaicPanelSupport();
|
||||||
|
newSupport.setProjectId(progressCategory.getProjectId());
|
||||||
|
newSupport.setMatrixId(progressCategory.getMatrixId());
|
||||||
|
newSupport.setName(PhotovoltaicPanelSupport.getName());
|
||||||
|
newSupport.setPositions(PhotovoltaicPanelSupport.getPositions());
|
||||||
|
newSupport.setProgressCategoryId(progressCategory.getId());
|
||||||
|
newSupport.setProgressCategoryName(progressCategory.getName());
|
||||||
|
newSupport.setRemark(PhotovoltaicPanelSupport.getRemark());
|
||||||
|
return newSupport;
|
||||||
|
}).toList();
|
||||||
|
boolean saved = this.saveBatch(newSupportList);
|
||||||
|
if (!saved) {
|
||||||
|
throw new ServiceException("新增光伏板支架失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
BigDecimal total = BigDecimal.valueOf(newSupportList.size());
|
||||||
|
progressCategory.setTotal(total);
|
||||||
|
progressCategory.setOutputValue(total.multiply(
|
||||||
|
Optional.ofNullable(progressCategory.getUnitPrice())
|
||||||
|
.orElse(BigDecimal.ZERO)
|
||||||
|
));
|
||||||
|
boolean result = progressCategoryService.updateById(progressCategory);
|
||||||
|
if (!result) {
|
||||||
|
throw new ServiceException("更新进度失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设施-光伏板支架
|
* 修改设施-光伏板支架
|
||||||
*
|
*
|
||||||
|
@ -18,62 +18,46 @@ public interface PgsProgressCategoryConstant {
|
|||||||
*/
|
*/
|
||||||
Long PUBLIC_PROJECT_ID = 0L;
|
Long PUBLIC_PROJECT_ID = 0L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 光伏板进度类别
|
||||||
|
*/
|
||||||
|
String PHOTOVOLTAIC_PANEL_WORK_TYPE = "1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逆变器进度类别
|
||||||
|
*/
|
||||||
|
String INVERTER_WORK_TYPE = "2";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 箱变进度类别
|
||||||
|
*/
|
||||||
|
String BOX_TRANSFORMER_WORK_TYPE = "3";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 光伏板钻孔进度类别
|
* 光伏板钻孔进度类别
|
||||||
*/
|
*/
|
||||||
String PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE = "12";
|
String PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE = "4";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 光伏板桩基进度类别
|
* 光伏板桩基进度类别
|
||||||
*/
|
*/
|
||||||
String PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE = "13";
|
String PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE = "5";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 光伏板支架进度类别
|
* 光伏板支架进度类别
|
||||||
*/
|
*/
|
||||||
String PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE = "14";
|
String PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE = "6";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 光伏板进度类别名称
|
* 进度工作类别列表
|
||||||
*/
|
*/
|
||||||
List<String> PHOTOVOLTAIC_PANEL_PROGRESS_CATEGORY_WORK_TYPE = List.of(
|
List<String> WORK_TYPE_LIST = List.of(
|
||||||
"15",
|
PHOTOVOLTAIC_PANEL_WORK_TYPE,
|
||||||
"16",
|
INVERTER_WORK_TYPE,
|
||||||
"17"
|
BOX_TRANSFORMER_WORK_TYPE,
|
||||||
);
|
PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE,
|
||||||
|
PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE,
|
||||||
/**
|
PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE
|
||||||
* 关联光伏板进度类别名称
|
|
||||||
*/
|
|
||||||
List<String> RELEVANCE_PHOTOVOLTAIC_PANEL_WORK_TYPE = List.of(
|
|
||||||
"12",
|
|
||||||
"13",
|
|
||||||
"14"
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 逆变器进度类别名称
|
|
||||||
*/
|
|
||||||
List<String> INVERTER_PROGRESS_CATEGORY_WORK_TYPE = List.of(
|
|
||||||
"2",
|
|
||||||
"3",
|
|
||||||
"4",
|
|
||||||
"18",
|
|
||||||
"19",
|
|
||||||
"20",
|
|
||||||
"21"
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 箱变进度类别名称
|
|
||||||
*/
|
|
||||||
List<String> BOX_TRANSFORMER_PROGRESS_CATEGORY_WORK_TYPE = List.of(
|
|
||||||
"23",
|
|
||||||
"24",
|
|
||||||
"25",
|
|
||||||
"26",
|
|
||||||
"27",
|
|
||||||
"28"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import org.dromara.common.log.annotation.Log;
|
|||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreatePriceReq;
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreatePriceReq;
|
||||||
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreateReq;
|
||||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq;
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq;
|
||||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq;
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq;
|
||||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryCoordinateVo;
|
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryCoordinateVo;
|
||||||
@ -118,6 +119,17 @@ public class PgsProgressCategoryController extends BaseController {
|
|||||||
return toAjax(pgsProgressCategoryService.insertPrice(req));
|
return toAjax(pgsProgressCategoryService.insertPrice(req));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增进度类别
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("progress:progressCategory:add")
|
||||||
|
@Log(title = "进度类别", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> insert(@Validated @RequestBody PgsProgressCategoryCreateReq req) {
|
||||||
|
return toAjax(pgsProgressCategoryService.insertByReq(req));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改进度类别
|
* 修改进度类别
|
||||||
*/
|
*/
|
||||||
|
@ -52,6 +52,11 @@ public class PgsProgressCategoryTemplate implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工类型
|
||||||
|
*/
|
||||||
|
private String constructionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
package org.dromara.progress.domain.dto.progresscategory;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lilemy
|
||||||
|
* @date 2025-08-07 19:35
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PgsProgressCategoryCreateReq implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 6264724604334298318L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父类别id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "父类别id不能为空")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方阵id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "方阵id不能为空")
|
||||||
|
private Long matrixId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类别名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "类别名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计量方式(0无 1数量 2百分比)
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "计量方式不能为空")
|
||||||
|
private String unitType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计量单位
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "计量单位不能为空")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合单价
|
||||||
|
*/
|
||||||
|
@NotNull(message = "综合单价不能为空")
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总数量
|
||||||
|
*/
|
||||||
|
private BigDecimal total;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作类型
|
||||||
|
*/
|
||||||
|
private String workType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.progress.domain.dto.progresscategory;
|
package org.dromara.progress.domain.dto.progresscategory;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -14,6 +15,7 @@ public class PgsProgressCategoryUpdateReq {
|
|||||||
/**
|
/**
|
||||||
* 主键id
|
* 主键id
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "id不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,11 +23,6 @@ public class PgsProgressCategoryUpdateReq {
|
|||||||
*/
|
*/
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 项目id
|
|
||||||
*/
|
|
||||||
private Long projectId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类别名称
|
* 类别名称
|
||||||
*/
|
*/
|
||||||
@ -41,26 +38,6 @@ public class PgsProgressCategoryUpdateReq {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal total;
|
private BigDecimal total;
|
||||||
|
|
||||||
/**
|
|
||||||
* 已完成数量/百分比
|
|
||||||
*/
|
|
||||||
private BigDecimal completed;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 计划总数量/百分比
|
|
||||||
*/
|
|
||||||
private BigDecimal planTotal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否超期(0否 1是)
|
|
||||||
*/
|
|
||||||
private String isDelay;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 完成状态(0未开始 1进行中 2已完成)
|
|
||||||
*/
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package org.dromara.progress.domain.dto.progresscategorytemplate;
|
package org.dromara.progress.domain.dto.progresscategorytemplate;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
@ -18,23 +20,37 @@ public class PgsProgressCategoryTemplateCreateReq implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 父类别id
|
* 父类别id
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "父类别id不能为空")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类别名称
|
* 类别名称
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "类别名称不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计量方式(0无 1数量 2百分比)
|
* 计量方式(0无 1数量 2百分比)
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "计量方式不能为空")
|
||||||
private String unitType;
|
private String unitType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作类型
|
||||||
|
*/
|
||||||
|
private String workType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目id(0表示共用)
|
* 项目id(0表示共用)
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "项目id不能为空")
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工类型
|
||||||
|
*/
|
||||||
|
private String constructionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ -34,4 +34,9 @@ public class PgsProgressCategoryTemplateQueryReq implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工类型
|
||||||
|
*/
|
||||||
|
private String constructionType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.progress.domain.dto.progresscategorytemplate;
|
package org.dromara.progress.domain.dto.progresscategorytemplate;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
@ -18,13 +19,21 @@ public class PgsProgressCategoryTemplateUpdateReq implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 主键id
|
* 主键id
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "主键id不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父类别id
|
* 父类别id
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "父类别id不能为空")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "项目id不能为空")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类别名称
|
* 类别名称
|
||||||
*/
|
*/
|
||||||
@ -35,6 +44,16 @@ public class PgsProgressCategoryTemplateUpdateReq implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String unitType;
|
private String unitType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作类型
|
||||||
|
*/
|
||||||
|
private String workType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工类型
|
||||||
|
*/
|
||||||
|
private String constructionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ -136,4 +136,9 @@ public class PgsProgressCategoryVo implements Serializable {
|
|||||||
@ExcelProperty(value = "产值金额")
|
@ExcelProperty(value = "产值金额")
|
||||||
private BigDecimal outputValue;
|
private BigDecimal outputValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作类型
|
||||||
|
*/
|
||||||
|
private String workType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
package org.dromara.progress.domain.vo.progresscategorytemplate;
|
package org.dromara.progress.domain.vo.progresscategorytemplate;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
|
||||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
|
||||||
import org.dromara.progress.domain.PgsProgressCategoryTemplate;
|
import org.dromara.progress.domain.PgsProgressCategoryTemplate;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
@ -19,7 +15,6 @@ import java.io.Serializable;
|
|||||||
* @date 2025-05-22
|
* @date 2025-05-22
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
|
||||||
@AutoMapper(target = PgsProgressCategoryTemplate.class)
|
@AutoMapper(target = PgsProgressCategoryTemplate.class)
|
||||||
public class PgsProgressCategoryTemplateVo implements Serializable {
|
public class PgsProgressCategoryTemplateVo implements Serializable {
|
||||||
|
|
||||||
@ -29,38 +24,41 @@ public class PgsProgressCategoryTemplateVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 主键id
|
* 主键id
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "主键id")
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父类别id
|
* 父类别id
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "父类别id")
|
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类别名称
|
* 类别名称
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "类别名称")
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计量方式(0无 1数量 2百分比)
|
* 计量方式(0无 1数量 2百分比)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "计量方式", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(readConverterExp = "1=数量,2=百分比")
|
|
||||||
private String unitType;
|
private String unitType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作类型
|
||||||
|
*/
|
||||||
|
private String workType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目id(0表示共用)
|
* 项目id(0表示共用)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "项目id")
|
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工类型
|
||||||
|
*/
|
||||||
|
private String constructionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "备注")
|
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import org.dromara.facility.domain.FacMatrix;
|
import org.dromara.facility.domain.FacMatrix;
|
||||||
import org.dromara.progress.domain.PgsProgressCategory;
|
import org.dromara.progress.domain.PgsProgressCategory;
|
||||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreatePriceReq;
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreatePriceReq;
|
||||||
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreateReq;
|
||||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq;
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq;
|
||||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq;
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq;
|
||||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryCoordinateVo;
|
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryCoordinateVo;
|
||||||
@ -47,6 +48,14 @@ public interface IPgsProgressCategoryService extends IService<PgsProgressCategor
|
|||||||
*/
|
*/
|
||||||
PgsProgressCategoryLastTimeVo queryLastTimeById(Long id);
|
PgsProgressCategoryLastTimeVo queryLastTimeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增进度类别
|
||||||
|
*
|
||||||
|
* @param req 进度类别
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByReq(PgsProgressCategoryCreateReq req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增分项工程单价
|
* 新增分项工程单价
|
||||||
*
|
*
|
||||||
|
@ -72,6 +72,14 @@ public interface IPgsProgressCategoryTemplateService extends IService<PgsProgres
|
|||||||
*/
|
*/
|
||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据项目初始化进度类别模版
|
||||||
|
*
|
||||||
|
* @param projectId 项目id
|
||||||
|
* @return 是否初始化成功
|
||||||
|
*/
|
||||||
|
Boolean initTemplateByProject(Long projectId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取进度类别模版视图对象
|
* 获取进度类别模版视图对象
|
||||||
*
|
*
|
||||||
|
@ -22,6 +22,7 @@ import org.dromara.progress.domain.PgsProgressCategoryTemplate;
|
|||||||
import org.dromara.progress.domain.PgsProgressPlan;
|
import org.dromara.progress.domain.PgsProgressPlan;
|
||||||
import org.dromara.progress.domain.PgsProgressPlanDetail;
|
import org.dromara.progress.domain.PgsProgressPlanDetail;
|
||||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreatePriceReq;
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreatePriceReq;
|
||||||
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreateReq;
|
||||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq;
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq;
|
||||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq;
|
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq;
|
||||||
import org.dromara.progress.domain.enums.PgsCoordinateTypeEnum;
|
import org.dromara.progress.domain.enums.PgsCoordinateTypeEnum;
|
||||||
@ -91,6 +92,18 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
|||||||
@Resource
|
@Resource
|
||||||
private IFacMatrixService matrixService;
|
private IFacMatrixService matrixService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private IFacPhotovoltaicPanelPointService photovoltaicPanelPointService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private IFacPhotovoltaicPanelColumnService photovoltaicPanelColumnService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private IFacPhotovoltaicPanelSupportService photovoltaicPanelSupportService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询进度类别
|
* 查询进度类别
|
||||||
*
|
*
|
||||||
@ -159,6 +172,68 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
|||||||
return lastTimeVo;
|
return lastTimeVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增进度类别
|
||||||
|
*
|
||||||
|
* @param req 进度类别
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean insertByReq(PgsProgressCategoryCreateReq req) {
|
||||||
|
BigDecimal unitPrice = req.getUnitPrice();
|
||||||
|
BigDecimal total = req.getTotal();
|
||||||
|
String workType = req.getWorkType();
|
||||||
|
PgsProgressCategory progressCategory = new PgsProgressCategory();
|
||||||
|
BeanUtils.copyProperties(req, progressCategory);
|
||||||
|
validEntityBeforeSave(progressCategory);
|
||||||
|
// 计算产值
|
||||||
|
if (unitPrice != null && total != null && unitPrice.compareTo(BigDecimal.ZERO) >= 0 && total.compareTo(BigDecimal.ZERO) >= 0) {
|
||||||
|
progressCategory.setOutputValue(unitPrice.multiply(total));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(workType) && PgsProgressCategoryConstant.WORK_TYPE_LIST.contains(workType)) {
|
||||||
|
List<PgsProgressCategory> progressCategoryList = this.lambdaQuery()
|
||||||
|
.eq(PgsProgressCategory::getMatrixId, req.getMatrixId())
|
||||||
|
.likeRight(PgsProgressCategory::getWorkType, workType + "_")
|
||||||
|
.list();
|
||||||
|
// 获取当前关联数据类别的最大数
|
||||||
|
int maxNum = progressCategoryList.stream()
|
||||||
|
.map(PgsProgressCategory::getWorkType)
|
||||||
|
.mapToInt(s -> Integer.parseInt(s.substring(s.indexOf('_') + 1)))
|
||||||
|
.max()
|
||||||
|
.orElse(0);
|
||||||
|
progressCategory.setWorkType(workType + "_" + (maxNum + 1));
|
||||||
|
// 保存新添加的进度类别
|
||||||
|
boolean save = this.save(progressCategory);
|
||||||
|
if (!save) {
|
||||||
|
throw new ServiceException("新增分项工程信息异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(progressCategoryList)) {
|
||||||
|
// 根据模版创建数据
|
||||||
|
switch (workType) {
|
||||||
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_WORK_TYPE ->
|
||||||
|
photovoltaicPanelService.insertByCategoryTemp(progressCategory, progressCategoryList);
|
||||||
|
case PgsProgressCategoryConstant.INVERTER_WORK_TYPE ->
|
||||||
|
inverterService.insertByCategoryTemp(progressCategory, progressCategoryList);
|
||||||
|
case PgsProgressCategoryConstant.BOX_TRANSFORMER_WORK_TYPE ->
|
||||||
|
boxTransformerService.insertByCategoryTemp(progressCategory, progressCategoryList);
|
||||||
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE ->
|
||||||
|
photovoltaicPanelPointService.insertByCategoryTemp(progressCategory, progressCategoryList);
|
||||||
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE ->
|
||||||
|
photovoltaicPanelColumnService.insertByCategoryTemp(progressCategory, progressCategoryList);
|
||||||
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE ->
|
||||||
|
photovoltaicPanelSupportService.insertByCategoryTemp(progressCategory, progressCategoryList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
boolean save = this.save(progressCategory);
|
||||||
|
if (!save) {
|
||||||
|
throw new ServiceException("新增分项工程信息异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增分项工程单价
|
* 新增分项工程单价
|
||||||
*
|
*
|
||||||
@ -178,10 +253,19 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
|||||||
if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue())) {
|
if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue())) {
|
||||||
progressCategory.setTotal(req.getTotal());
|
progressCategory.setTotal(req.getTotal());
|
||||||
outputValue = req.getTotal().multiply(unitPrice);
|
outputValue = req.getTotal().multiply(unitPrice);
|
||||||
|
} 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);
|
||||||
} else if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.NUMBER.getValue())) {
|
} else if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.NUMBER.getValue())) {
|
||||||
BigDecimal total = progressCategory.getTotal();
|
BigDecimal total = progressCategory.getTotal();
|
||||||
if (total.compareTo(BigDecimal.ZERO) <= 0) {
|
if (total == null || total.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
throw new ServiceException("请导入分项工程数量后再添加单价", HttpStatus.BAD_REQUEST);
|
total = req.getTotal();
|
||||||
|
}
|
||||||
|
if (total == null || total.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
throw new ServiceException("请输入分项工程数量", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
outputValue = total.multiply(unitPrice);
|
outputValue = total.multiply(unitPrice);
|
||||||
}
|
}
|
||||||
@ -222,28 +306,25 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
|||||||
* 保存前的数据校验
|
* 保存前的数据校验
|
||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(PgsProgressCategory entity) {
|
private void validEntityBeforeSave(PgsProgressCategory entity) {
|
||||||
// TODO 做一些数据校验,如唯一约束
|
Long matrixId = entity.getMatrixId();
|
||||||
Long projectId = entity.getProjectId();
|
|
||||||
Long parentId = entity.getParentId();
|
Long parentId = entity.getParentId();
|
||||||
if (projectId != null && projectId != 0) {
|
if (matrixId != null && matrixId != 0) {
|
||||||
if (projectService.getById(projectId) == null) {
|
FacMatrix matrix = matrixService.getById(matrixId);
|
||||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
if (matrix == null) {
|
||||||
|
throw new ServiceException("对应方阵不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
entity.setProjectId(matrix.getProjectId());
|
||||||
}
|
}
|
||||||
if (parentId != null && parentId != 0) {
|
if (parentId != null && parentId != 0) {
|
||||||
if (this.getById(parentId) == null) {
|
if (this.getById(parentId) == null) {
|
||||||
throw new ServiceException("对应进度类别不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("对应父进度类别不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 名称唯一性校验
|
// 名称唯一性校验
|
||||||
LambdaQueryWrapper<PgsProgressCategory> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PgsProgressCategory> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(PgsProgressCategory::getName, entity.getName());
|
lqw.eq(PgsProgressCategory::getName, entity.getName());
|
||||||
if (projectId != null && projectId != 0) {
|
lqw.eq(PgsProgressCategory::getMatrixId, entity.getMatrixId());
|
||||||
lqw.eq(PgsProgressCategory::getProjectId, entity.getProjectId());
|
lqw.eq(PgsProgressCategory::getParentId, entity.getParentId());
|
||||||
}
|
|
||||||
if (parentId != null && parentId != 0) {
|
|
||||||
lqw.eq(PgsProgressCategory::getParentId, entity.getParentId());
|
|
||||||
}
|
|
||||||
if (entity.getId() != null) {
|
if (entity.getId() != null) {
|
||||||
// 排除自身
|
// 排除自身
|
||||||
lqw.ne(PgsProgressCategory::getId, entity.getId());
|
lqw.ne(PgsProgressCategory::getId, entity.getId());
|
||||||
@ -263,6 +344,7 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
// todo 添加校验
|
||||||
return this.removeBatchByIds(ids);
|
return this.removeBatchByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,6 +362,10 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
|||||||
// 对象转封装类
|
// 对象转封装类
|
||||||
PgsProgressCategoryVo progressCategoryVo = new PgsProgressCategoryVo();
|
PgsProgressCategoryVo progressCategoryVo = new PgsProgressCategoryVo();
|
||||||
BeanUtils.copyProperties(progressCategory, progressCategoryVo);
|
BeanUtils.copyProperties(progressCategory, progressCategoryVo);
|
||||||
|
String workType = progressCategory.getWorkType();
|
||||||
|
if (StringUtils.isNotBlank(workType)) {
|
||||||
|
progressCategoryVo.setWorkType(workType.split("_")[0]);
|
||||||
|
}
|
||||||
return progressCategoryVo;
|
return progressCategoryVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,6 +408,10 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
|||||||
return progressCategoryList.stream().map(progressCategory -> {
|
return progressCategoryList.stream().map(progressCategory -> {
|
||||||
PgsProgressCategoryVo vo = new PgsProgressCategoryVo();
|
PgsProgressCategoryVo vo = new PgsProgressCategoryVo();
|
||||||
BeanUtils.copyProperties(progressCategory, vo);
|
BeanUtils.copyProperties(progressCategory, vo);
|
||||||
|
String workType = progressCategory.getWorkType();
|
||||||
|
if (StringUtils.isNotBlank(workType)) {
|
||||||
|
vo.setWorkType(workType.split("_")[0]);
|
||||||
|
}
|
||||||
// 如果是父节点,计算其子节点的总和
|
// 如果是父节点,计算其子节点的总和
|
||||||
if (progressCategory.getParentId() == 0) {
|
if (progressCategory.getParentId() == 0) {
|
||||||
List<PgsProgressCategory> children = parentIdToChildrenMap.getOrDefault(progressCategory.getId(), Collections.emptyList());
|
List<PgsProgressCategory> children = parentIdToChildrenMap.getOrDefault(progressCategory.getId(), Collections.emptyList());
|
||||||
@ -381,7 +471,7 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
|||||||
public Boolean insertByTemplate(Long projectId, List<FacMatrix> matrixList, List<FacMatrix> oldMatrixList) {
|
public Boolean insertByTemplate(Long projectId, List<FacMatrix> matrixList, List<FacMatrix> oldMatrixList) {
|
||||||
// 获取模板进度类别
|
// 获取模板进度类别
|
||||||
List<PgsProgressCategoryTemplate> categoryTemplateList = pgsProgressCategoryTemplateService.lambdaQuery()
|
List<PgsProgressCategoryTemplate> categoryTemplateList = pgsProgressCategoryTemplateService.lambdaQuery()
|
||||||
.in(PgsProgressCategoryTemplate::getProjectId, projectId, PgsProgressCategoryConstant.PUBLIC_PROJECT_ID)
|
.eq(PgsProgressCategoryTemplate::getProjectId, projectId)
|
||||||
.list();
|
.list();
|
||||||
// 遍历模板进度类别,复制数据
|
// 遍历模板进度类别,复制数据
|
||||||
if (CollUtil.isEmpty(categoryTemplateList)) {
|
if (CollUtil.isEmpty(categoryTemplateList)) {
|
||||||
@ -563,62 +653,68 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
|||||||
String workType = progressCategory.getWorkType();
|
String workType = progressCategory.getWorkType();
|
||||||
List<PgsProgressCategoryFacilityVo> facilityList;
|
List<PgsProgressCategoryFacilityVo> facilityList;
|
||||||
PgsProgressCategoryCoordinateVo coordinateVo = new PgsProgressCategoryCoordinateVo();
|
PgsProgressCategoryCoordinateVo coordinateVo = new PgsProgressCategoryCoordinateVo();
|
||||||
if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
String type = workType.split("_")[0];
|
||||||
List<FacPhotovoltaicPanel> list = photovoltaicPanelService.lambdaQuery()
|
switch (type) {
|
||||||
.eq(FacPhotovoltaicPanel::getProjectId, progressCategory.getProjectId())
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_WORK_TYPE -> {
|
||||||
.eq(FacPhotovoltaicPanel::getMatrixId, progressCategory.getMatrixId())
|
List<FacPhotovoltaicPanel> list = photovoltaicPanelService.lambdaQuery()
|
||||||
.eq(FacPhotovoltaicPanel::getProgressCategoryId, progressCategory.getId())
|
.eq(FacPhotovoltaicPanel::getProjectId, progressCategory.getProjectId())
|
||||||
.list();
|
.eq(FacPhotovoltaicPanel::getMatrixId, progressCategory.getMatrixId())
|
||||||
facilityList = list.stream().map(fac -> {
|
.eq(FacPhotovoltaicPanel::getProgressCategoryId, progressCategory.getId())
|
||||||
JSONArray jsonArray = JSONUtil.parseArray(fac.getPositions());
|
.list();
|
||||||
int depth = JsonDimensionUtil.getJsonArrayDepth(jsonArray);
|
facilityList = list.stream().map(fac -> {
|
||||||
return new PgsProgressCategoryFacilityVo(
|
JSONArray jsonArray = JSONUtil.parseArray(fac.getPositions());
|
||||||
fac.getId(),
|
int depth = JsonDimensionUtil.getJsonArrayDepth(jsonArray);
|
||||||
fac.getName(),
|
return new PgsProgressCategoryFacilityVo(
|
||||||
jsonArray,
|
fac.getId(),
|
||||||
PgsCoordinateTypeEnum.getTextByValue(depth),
|
fac.getName(),
|
||||||
fac.getStatus(),
|
jsonArray,
|
||||||
fac.getFinishDate()
|
PgsCoordinateTypeEnum.getTextByValue(depth),
|
||||||
);
|
fac.getStatus(),
|
||||||
}).toList();
|
fac.getFinishDate()
|
||||||
} else if (PgsProgressCategoryConstant.INVERTER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
);
|
||||||
List<FacInverter> list = inverterService.lambdaQuery()
|
}).toList();
|
||||||
.eq(FacInverter::getProjectId, progressCategory.getProjectId())
|
}
|
||||||
.eq(FacInverter::getMatrixId, progressCategory.getMatrixId())
|
case PgsProgressCategoryConstant.INVERTER_WORK_TYPE -> {
|
||||||
.eq(FacInverter::getProgressCategoryId, progressCategory.getId())
|
List<FacInverter> list = inverterService.lambdaQuery()
|
||||||
.list();
|
.eq(FacInverter::getProjectId, progressCategory.getProjectId())
|
||||||
facilityList = list.stream().map(fac -> {
|
.eq(FacInverter::getMatrixId, progressCategory.getMatrixId())
|
||||||
JSONArray jsonArray = JSONUtil.parseArray(fac.getPositions());
|
.eq(FacInverter::getProgressCategoryId, progressCategory.getId())
|
||||||
int depth = JsonDimensionUtil.getJsonArrayDepth(jsonArray);
|
.list();
|
||||||
return new PgsProgressCategoryFacilityVo(
|
facilityList = list.stream().map(fac -> {
|
||||||
fac.getId(),
|
JSONArray jsonArray = JSONUtil.parseArray(fac.getPositions());
|
||||||
fac.getName(),
|
int depth = JsonDimensionUtil.getJsonArrayDepth(jsonArray);
|
||||||
jsonArray,
|
return new PgsProgressCategoryFacilityVo(
|
||||||
PgsCoordinateTypeEnum.getTextByValue(depth),
|
fac.getId(),
|
||||||
fac.getStatus(),
|
fac.getName(),
|
||||||
fac.getFinishDate()
|
jsonArray,
|
||||||
);
|
PgsCoordinateTypeEnum.getTextByValue(depth),
|
||||||
}).toList();
|
fac.getStatus(),
|
||||||
} else if (PgsProgressCategoryConstant.BOX_TRANSFORMER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
fac.getFinishDate()
|
||||||
List<FacBoxTransformer> list = boxTransformerService.lambdaQuery()
|
);
|
||||||
.eq(FacBoxTransformer::getProjectId, progressCategory.getProjectId())
|
}).toList();
|
||||||
.eq(FacBoxTransformer::getMatrixId, progressCategory.getMatrixId())
|
}
|
||||||
.eq(FacBoxTransformer::getProgressCategoryId, progressCategory.getId())
|
case PgsProgressCategoryConstant.BOX_TRANSFORMER_WORK_TYPE -> {
|
||||||
.list();
|
List<FacBoxTransformer> list = boxTransformerService.lambdaQuery()
|
||||||
facilityList = list.stream().map(fac -> {
|
.eq(FacBoxTransformer::getProjectId, progressCategory.getProjectId())
|
||||||
JSONArray jsonArray = JSONUtil.parseArray(fac.getPositions());
|
.eq(FacBoxTransformer::getMatrixId, progressCategory.getMatrixId())
|
||||||
int depth = JsonDimensionUtil.getJsonArrayDepth(jsonArray);
|
.eq(FacBoxTransformer::getProgressCategoryId, progressCategory.getId())
|
||||||
return new PgsProgressCategoryFacilityVo(
|
.list();
|
||||||
fac.getId(),
|
facilityList = list.stream().map(fac -> {
|
||||||
fac.getName(),
|
JSONArray jsonArray = JSONUtil.parseArray(fac.getPositions());
|
||||||
jsonArray,
|
int depth = JsonDimensionUtil.getJsonArrayDepth(jsonArray);
|
||||||
PgsCoordinateTypeEnum.getTextByValue(depth),
|
return new PgsProgressCategoryFacilityVo(
|
||||||
fac.getStatus(),
|
fac.getId(),
|
||||||
fac.getFinishDate()
|
fac.getName(),
|
||||||
);
|
jsonArray,
|
||||||
}).toList();
|
PgsCoordinateTypeEnum.getTextByValue(depth),
|
||||||
} else {
|
fac.getStatus(),
|
||||||
return coordinateVo;
|
fac.getFinishDate()
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
case null, default -> {
|
||||||
|
return coordinateVo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
List<PgsProgressPlanDetailDateVo> detailList = progressPlanDetailService.lambdaQuery()
|
List<PgsProgressPlanDetailDateVo> detailList = progressPlanDetailService.lambdaQuery()
|
||||||
.select(PgsProgressPlanDetail::getId,
|
.select(PgsProgressPlanDetail::getId,
|
||||||
|
@ -2,9 +2,12 @@ package org.dromara.progress.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.constant.HttpStatus;
|
import org.dromara.common.core.constant.HttpStatus;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.utils.ObjectUtils;
|
import org.dromara.common.core.utils.ObjectUtils;
|
||||||
@ -19,12 +22,13 @@ import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCateg
|
|||||||
import org.dromara.progress.domain.vo.progresscategorytemplate.PgsProgressCategoryTemplateVo;
|
import org.dromara.progress.domain.vo.progresscategorytemplate.PgsProgressCategoryTemplateVo;
|
||||||
import org.dromara.progress.mapper.PgsProgressCategoryTemplateMapper;
|
import org.dromara.progress.mapper.PgsProgressCategoryTemplateMapper;
|
||||||
import org.dromara.progress.service.IPgsProgressCategoryTemplateService;
|
import org.dromara.progress.service.IPgsProgressCategoryTemplateService;
|
||||||
|
import org.dromara.project.domain.BusProject;
|
||||||
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进度类别模版Service业务层处理
|
* 进度类别模版Service业务层处理
|
||||||
@ -32,10 +36,14 @@ import java.util.List;
|
|||||||
* @author lilemy
|
* @author lilemy
|
||||||
* @date 2025-05-22
|
* @date 2025-05-22
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl<PgsProgressCategoryTemplateMapper, PgsProgressCategoryTemplate>
|
public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl<PgsProgressCategoryTemplateMapper, PgsProgressCategoryTemplate>
|
||||||
implements IPgsProgressCategoryTemplateService {
|
implements IPgsProgressCategoryTemplateService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusProjectService projectService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询进度类别模版
|
* 查询进度类别模版
|
||||||
*
|
*
|
||||||
@ -87,8 +95,14 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl<PgsProgr
|
|||||||
// 将实体类和 DTO 进行转换
|
// 将实体类和 DTO 进行转换
|
||||||
PgsProgressCategoryTemplate progressCategoryTemplate = new PgsProgressCategoryTemplate();
|
PgsProgressCategoryTemplate progressCategoryTemplate = new PgsProgressCategoryTemplate();
|
||||||
BeanUtils.copyProperties(req, progressCategoryTemplate);
|
BeanUtils.copyProperties(req, progressCategoryTemplate);
|
||||||
|
Long projectId = req.getProjectId();
|
||||||
|
String constructionType = req.getConstructionType();
|
||||||
|
if (projectId == 0 && constructionType == null) {
|
||||||
|
throw new ServiceException("请选择项目施工类型", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
// 数据校验
|
// 数据校验
|
||||||
validEntityBeforeSave(progressCategoryTemplate);
|
validEntityBeforeSave(progressCategoryTemplate);
|
||||||
|
progressCategoryTemplate.setWorkType(this.getTempWorkType(progressCategoryTemplate));
|
||||||
// 写入数据库
|
// 写入数据库
|
||||||
boolean result = this.save(progressCategoryTemplate);
|
boolean result = this.save(progressCategoryTemplate);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
@ -114,6 +128,7 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl<PgsProgr
|
|||||||
}
|
}
|
||||||
// 数据校验
|
// 数据校验
|
||||||
validEntityBeforeSave(progressCategoryTemplate);
|
validEntityBeforeSave(progressCategoryTemplate);
|
||||||
|
progressCategoryTemplate.setWorkType(this.getTempWorkType(progressCategoryTemplate));
|
||||||
// 写入数据库
|
// 写入数据库
|
||||||
boolean result = this.updateById(progressCategoryTemplate);
|
boolean result = this.updateById(progressCategoryTemplate);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
@ -128,26 +143,26 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl<PgsProgr
|
|||||||
private void validEntityBeforeSave(PgsProgressCategoryTemplate entity) {
|
private void validEntityBeforeSave(PgsProgressCategoryTemplate entity) {
|
||||||
// TODO 做一些数据校验,如唯一约束
|
// TODO 做一些数据校验,如唯一约束
|
||||||
Long projectId = entity.getProjectId();
|
Long projectId = entity.getProjectId();
|
||||||
Long pid = entity.getParentId();
|
Long parentId = entity.getParentId();
|
||||||
if (projectId != null && projectId != 0) {
|
if (projectId != 0) {
|
||||||
if (this.getById(projectId) == null) {
|
BusProject project = projectService.getById(projectId);
|
||||||
|
if (project == null) {
|
||||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
if (entity.getConstructionType() == null) {
|
||||||
|
entity.setConstructionType(project.getProjectType());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pid != null && pid != 0) {
|
if (parentId != 0) {
|
||||||
if (this.getById(pid) == null) {
|
if (this.getById(parentId) == null) {
|
||||||
throw new ServiceException("对应进度类别模版不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("对应进度类别模版不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 名称唯一性校验
|
// 名称唯一性校验
|
||||||
LambdaQueryWrapper<PgsProgressCategoryTemplate> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PgsProgressCategoryTemplate> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(PgsProgressCategoryTemplate::getName, entity.getName());
|
lqw.eq(PgsProgressCategoryTemplate::getName, entity.getName());
|
||||||
if (projectId != null && projectId != 0) {
|
lqw.eq(PgsProgressCategoryTemplate::getProjectId, entity.getProjectId());
|
||||||
lqw.eq(PgsProgressCategoryTemplate::getProjectId, entity.getProjectId());
|
lqw.eq(PgsProgressCategoryTemplate::getParentId, entity.getParentId());
|
||||||
}
|
|
||||||
if (pid != null && pid != 0) {
|
|
||||||
lqw.eq(PgsProgressCategoryTemplate::getParentId, entity.getParentId());
|
|
||||||
}
|
|
||||||
if (entity.getId() != null) {
|
if (entity.getId() != null) {
|
||||||
// 排除自身
|
// 排除自身
|
||||||
lqw.ne(PgsProgressCategoryTemplate::getId, entity.getId());
|
lqw.ne(PgsProgressCategoryTemplate::getId, entity.getId());
|
||||||
@ -179,6 +194,61 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl<PgsProgr
|
|||||||
return this.removeBatchByIds(ids);
|
return this.removeBatchByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据项目初始化进度类别模版
|
||||||
|
*
|
||||||
|
* @param projectId 项目id
|
||||||
|
* @return 是否初始化成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean initTemplateByProject(Long projectId) {
|
||||||
|
BusProject project = projectService.getById(projectId);
|
||||||
|
if (project == null) {
|
||||||
|
throw new ServiceException("项目不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
// 获取模板进度类别
|
||||||
|
List<PgsProgressCategoryTemplate> categoryTemplateList = this.lambdaQuery()
|
||||||
|
.eq(PgsProgressCategoryTemplate::getProjectId, PgsProgressCategoryConstant.PUBLIC_PROJECT_ID)
|
||||||
|
.eq(PgsProgressCategoryTemplate::getConstructionType, project.getProjectType())
|
||||||
|
.list();
|
||||||
|
// 遍历模板进度类别,复制数据
|
||||||
|
if (CollUtil.isEmpty(categoryTemplateList)) {
|
||||||
|
throw new ServiceException("对应模板进度类别不存在", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
// templateId -> newId
|
||||||
|
Map<Long, Long> localIdMap = new HashMap<>();
|
||||||
|
List<PgsProgressCategoryTemplate> localList = new ArrayList<>();
|
||||||
|
for (PgsProgressCategoryTemplate temp : categoryTemplateList) {
|
||||||
|
Long newId = IdWorker.getId();
|
||||||
|
localIdMap.put(temp.getId(), newId);
|
||||||
|
PgsProgressCategoryTemplate newTemp = new PgsProgressCategoryTemplate();
|
||||||
|
newTemp.setId(newId);
|
||||||
|
newTemp.setName(temp.getName());
|
||||||
|
newTemp.setUnitType(temp.getUnitType());
|
||||||
|
newTemp.setWorkType(temp.getWorkType());
|
||||||
|
newTemp.setProjectId(projectId);
|
||||||
|
newTemp.setConstructionType(temp.getConstructionType());
|
||||||
|
newTemp.setRemark(temp.getRemark());
|
||||||
|
// 先临时设置旧 pid
|
||||||
|
newTemp.setParentId(temp.getParentId());
|
||||||
|
localList.add(newTemp);
|
||||||
|
}
|
||||||
|
// 修正本 matrix 的 pid
|
||||||
|
for (PgsProgressCategoryTemplate template : localList) {
|
||||||
|
Long oldPid = template.getParentId();
|
||||||
|
if (oldPid != 0) {
|
||||||
|
template.setParentId(localIdMap.getOrDefault(oldPid, 0L));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 批量保存新进度类别模版
|
||||||
|
boolean save = this.saveBatch(localList);
|
||||||
|
if (!save) {
|
||||||
|
throw new ServiceException("创建进度类别模版失败", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取进度类别模版视图对象
|
* 获取进度类别模版视图对象
|
||||||
*
|
*
|
||||||
@ -193,6 +263,10 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl<PgsProgr
|
|||||||
// 对象转封装类
|
// 对象转封装类
|
||||||
PgsProgressCategoryTemplateVo progressCategoryTemplateVo = new PgsProgressCategoryTemplateVo();
|
PgsProgressCategoryTemplateVo progressCategoryTemplateVo = new PgsProgressCategoryTemplateVo();
|
||||||
BeanUtils.copyProperties(progressCategoryTemplate, progressCategoryTemplateVo);
|
BeanUtils.copyProperties(progressCategoryTemplate, progressCategoryTemplateVo);
|
||||||
|
String workType = progressCategoryTemplate.getWorkType();
|
||||||
|
if (StringUtils.isNotBlank(workType)) {
|
||||||
|
progressCategoryTemplateVo.setWorkType(workType.split("_")[0]);
|
||||||
|
}
|
||||||
return progressCategoryTemplateVo;
|
return progressCategoryTemplateVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,9 +313,38 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl<PgsProgr
|
|||||||
// 对象转封装类
|
// 对象转封装类
|
||||||
PgsProgressCategoryTemplateVo progressCategoryTemplateVo = new PgsProgressCategoryTemplateVo();
|
PgsProgressCategoryTemplateVo progressCategoryTemplateVo = new PgsProgressCategoryTemplateVo();
|
||||||
BeanUtils.copyProperties(progressCategoryTemplate, progressCategoryTemplateVo);
|
BeanUtils.copyProperties(progressCategoryTemplate, progressCategoryTemplateVo);
|
||||||
|
String workType = progressCategoryTemplate.getWorkType();
|
||||||
|
if (StringUtils.isNotBlank(workType)) {
|
||||||
|
progressCategoryTemplateVo.setWorkType(workType.split("_")[0]);
|
||||||
|
}
|
||||||
return progressCategoryTemplateVo;
|
return progressCategoryTemplateVo;
|
||||||
}).toList();
|
}).toList();
|
||||||
progressCategoryTemplateVoPage.setRecords(progressCategoryTemplateVoList);
|
progressCategoryTemplateVoPage.setRecords(progressCategoryTemplateVoList);
|
||||||
return progressCategoryTemplateVoPage;
|
return progressCategoryTemplateVoPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目进度类别模板关联数据
|
||||||
|
*
|
||||||
|
* @param newTemplate 新进度类型模版
|
||||||
|
* @return 关联数据字符串,例如:1_2 2_4 3_5
|
||||||
|
*/
|
||||||
|
private String getTempWorkType(PgsProgressCategoryTemplate newTemplate) {
|
||||||
|
String workType = newTemplate.getWorkType();
|
||||||
|
if (StringUtils.isNotBlank(workType) && PgsProgressCategoryConstant.WORK_TYPE_LIST.contains(workType)) {
|
||||||
|
List<PgsProgressCategoryTemplate> progressCategoryList = this.lambdaQuery()
|
||||||
|
.eq(PgsProgressCategoryTemplate::getProjectId, newTemplate.getProjectId())
|
||||||
|
.likeRight(PgsProgressCategoryTemplate::getWorkType, workType + "_")
|
||||||
|
.list();
|
||||||
|
// 获取当前关联数据类别的最大数
|
||||||
|
int maxNum = progressCategoryList.stream()
|
||||||
|
.map(PgsProgressCategoryTemplate::getWorkType)
|
||||||
|
.mapToInt(s -> Integer.parseInt(s.substring(s.indexOf('_') + 1)))
|
||||||
|
.max()
|
||||||
|
.orElse(0);
|
||||||
|
return workType + "_" + (maxNum + 1);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
|||||||
throw new ServiceException("进度计划类别信息不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("进度计划类别信息不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
String workType = progressCategory.getWorkType();
|
String workType = progressCategory.getWorkType();
|
||||||
|
String type = workType.split("_")[0];
|
||||||
List<PgsProgressPlanDetailFinishedVo> finishedDetailList = JSONUtil.toList(progressPlanDetail.getFinishedDetail(), PgsProgressPlanDetailFinishedVo.class);
|
List<PgsProgressPlanDetailFinishedVo> finishedDetailList = JSONUtil.toList(progressPlanDetail.getFinishedDetail(), PgsProgressPlanDetailFinishedVo.class);
|
||||||
Set<Long> idSet = new HashSet<>(finishedDetailIdList);
|
Set<Long> idSet = new HashSet<>(finishedDetailIdList);
|
||||||
List<String> matchedNames = finishedDetailList.stream()
|
List<String> matchedNames = finishedDetailList.stream()
|
||||||
@ -146,110 +147,116 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
|||||||
if (CollUtil.isNotEmpty(matchedNames)) {
|
if (CollUtil.isNotEmpty(matchedNames)) {
|
||||||
throw new ServiceException("设施:" + String.join(",", matchedNames) + "已完成,请勿重复提交", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("设施:" + String.join(",", matchedNames) + "已完成,请勿重复提交", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
switch (type) {
|
||||||
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_WORK_TYPE -> {
|
||||||
projectId,
|
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
||||||
progressCategoryId,
|
projectId,
|
||||||
finishedDetailIdList,
|
progressCategoryId,
|
||||||
planDate,
|
finishedDetailIdList,
|
||||||
photovoltaicPanelService,
|
planDate,
|
||||||
FacPhotovoltaicPanel::getId,
|
photovoltaicPanelService,
|
||||||
FacPhotovoltaicPanel::getName,
|
FacPhotovoltaicPanel::getId,
|
||||||
FacPhotovoltaicPanel::getFinishType,
|
FacPhotovoltaicPanel::getName,
|
||||||
FacPhotovoltaicPanel::getFinishDate,
|
FacPhotovoltaicPanel::getFinishType,
|
||||||
FacPhotovoltaicPanel::getProjectId,
|
FacPhotovoltaicPanel::getFinishDate,
|
||||||
FacPhotovoltaicPanel::getProgressCategoryId,
|
FacPhotovoltaicPanel::getProjectId,
|
||||||
FacPhotovoltaicPanel::getId,
|
FacPhotovoltaicPanel::getProgressCategoryId,
|
||||||
FacPhotovoltaicPanel::getStatus
|
FacPhotovoltaicPanel::getId,
|
||||||
);
|
FacPhotovoltaicPanel::getStatus
|
||||||
finishedDetailList.addAll(finishedVoList);
|
);
|
||||||
} else if (PgsProgressCategoryConstant.INVERTER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
finishedDetailList.addAll(finishedVoList);
|
||||||
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
}
|
||||||
projectId,
|
case PgsProgressCategoryConstant.INVERTER_WORK_TYPE -> {
|
||||||
progressCategoryId,
|
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
||||||
finishedDetailIdList,
|
projectId,
|
||||||
planDate,
|
progressCategoryId,
|
||||||
inverterService,
|
finishedDetailIdList,
|
||||||
FacInverter::getId,
|
planDate,
|
||||||
FacInverter::getName,
|
inverterService,
|
||||||
FacInverter::getFinishType,
|
FacInverter::getId,
|
||||||
FacInverter::getFinishDate,
|
FacInverter::getName,
|
||||||
FacInverter::getProjectId,
|
FacInverter::getFinishType,
|
||||||
FacInverter::getProgressCategoryId,
|
FacInverter::getFinishDate,
|
||||||
FacInverter::getId,
|
FacInverter::getProjectId,
|
||||||
FacInverter::getStatus
|
FacInverter::getProgressCategoryId,
|
||||||
);
|
FacInverter::getId,
|
||||||
finishedDetailList.addAll(finishedVoList);
|
FacInverter::getStatus
|
||||||
} else if (PgsProgressCategoryConstant.BOX_TRANSFORMER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
);
|
||||||
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
finishedDetailList.addAll(finishedVoList);
|
||||||
projectId,
|
}
|
||||||
progressCategoryId,
|
case PgsProgressCategoryConstant.BOX_TRANSFORMER_WORK_TYPE -> {
|
||||||
finishedDetailIdList,
|
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
||||||
planDate,
|
projectId,
|
||||||
boxTransformerService,
|
progressCategoryId,
|
||||||
FacBoxTransformer::getId,
|
finishedDetailIdList,
|
||||||
FacBoxTransformer::getName,
|
planDate,
|
||||||
FacBoxTransformer::getFinishType,
|
boxTransformerService,
|
||||||
FacBoxTransformer::getFinishDate,
|
FacBoxTransformer::getId,
|
||||||
FacBoxTransformer::getProjectId,
|
FacBoxTransformer::getName,
|
||||||
FacBoxTransformer::getProgressCategoryId,
|
FacBoxTransformer::getFinishType,
|
||||||
FacBoxTransformer::getId,
|
FacBoxTransformer::getFinishDate,
|
||||||
FacBoxTransformer::getStatus
|
FacBoxTransformer::getProjectId,
|
||||||
);
|
FacBoxTransformer::getProgressCategoryId,
|
||||||
finishedDetailList.addAll(finishedVoList);
|
FacBoxTransformer::getId,
|
||||||
} else if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE.contains(workType)) {
|
FacBoxTransformer::getStatus
|
||||||
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
);
|
||||||
projectId,
|
finishedDetailList.addAll(finishedVoList);
|
||||||
progressCategoryId,
|
}
|
||||||
finishedDetailIdList,
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE -> {
|
||||||
planDate,
|
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
||||||
photovoltaicPanelPointService,
|
projectId,
|
||||||
FacPhotovoltaicPanelPoint::getId,
|
progressCategoryId,
|
||||||
FacPhotovoltaicPanelPoint::getName,
|
finishedDetailIdList,
|
||||||
FacPhotovoltaicPanelPoint::getFinishType,
|
planDate,
|
||||||
FacPhotovoltaicPanelPoint::getFinishDate,
|
photovoltaicPanelPointService,
|
||||||
FacPhotovoltaicPanelPoint::getProjectId,
|
FacPhotovoltaicPanelPoint::getId,
|
||||||
FacPhotovoltaicPanelPoint::getProgressCategoryId,
|
FacPhotovoltaicPanelPoint::getName,
|
||||||
FacPhotovoltaicPanelPoint::getId,
|
FacPhotovoltaicPanelPoint::getFinishType,
|
||||||
FacPhotovoltaicPanelPoint::getStatus
|
FacPhotovoltaicPanelPoint::getFinishDate,
|
||||||
);
|
FacPhotovoltaicPanelPoint::getProjectId,
|
||||||
finishedDetailList.addAll(finishedVoList);
|
FacPhotovoltaicPanelPoint::getProgressCategoryId,
|
||||||
} else if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE.contains(workType)) {
|
FacPhotovoltaicPanelPoint::getId,
|
||||||
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
FacPhotovoltaicPanelPoint::getStatus
|
||||||
projectId,
|
);
|
||||||
progressCategoryId,
|
finishedDetailList.addAll(finishedVoList);
|
||||||
finishedDetailIdList,
|
}
|
||||||
planDate,
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE -> {
|
||||||
photovoltaicPanelColumnService,
|
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
||||||
FacPhotovoltaicPanelColumn::getId,
|
projectId,
|
||||||
FacPhotovoltaicPanelColumn::getName,
|
progressCategoryId,
|
||||||
FacPhotovoltaicPanelColumn::getFinishType,
|
finishedDetailIdList,
|
||||||
FacPhotovoltaicPanelColumn::getFinishDate,
|
planDate,
|
||||||
FacPhotovoltaicPanelColumn::getProjectId,
|
photovoltaicPanelColumnService,
|
||||||
FacPhotovoltaicPanelColumn::getProgressCategoryId,
|
FacPhotovoltaicPanelColumn::getId,
|
||||||
FacPhotovoltaicPanelColumn::getId,
|
FacPhotovoltaicPanelColumn::getName,
|
||||||
FacPhotovoltaicPanelColumn::getStatus
|
FacPhotovoltaicPanelColumn::getFinishType,
|
||||||
);
|
FacPhotovoltaicPanelColumn::getFinishDate,
|
||||||
finishedDetailList.addAll(finishedVoList);
|
FacPhotovoltaicPanelColumn::getProjectId,
|
||||||
} else if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE.contains(workType)) {
|
FacPhotovoltaicPanelColumn::getProgressCategoryId,
|
||||||
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
FacPhotovoltaicPanelColumn::getId,
|
||||||
projectId,
|
FacPhotovoltaicPanelColumn::getStatus
|
||||||
progressCategoryId,
|
);
|
||||||
finishedDetailIdList,
|
finishedDetailList.addAll(finishedVoList);
|
||||||
planDate,
|
}
|
||||||
photovoltaicPanelSupportService,
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE -> {
|
||||||
FacPhotovoltaicPanelSupport::getId,
|
List<PgsProgressPlanDetailFinishedVo> finishedVoList = handleFacilityFinish(
|
||||||
FacPhotovoltaicPanelSupport::getName,
|
projectId,
|
||||||
FacPhotovoltaicPanelSupport::getFinishType,
|
progressCategoryId,
|
||||||
FacPhotovoltaicPanelSupport::getFinishDate,
|
finishedDetailIdList,
|
||||||
FacPhotovoltaicPanelSupport::getProjectId,
|
planDate,
|
||||||
FacPhotovoltaicPanelSupport::getProgressCategoryId,
|
photovoltaicPanelSupportService,
|
||||||
FacPhotovoltaicPanelSupport::getId,
|
FacPhotovoltaicPanelSupport::getId,
|
||||||
FacPhotovoltaicPanelSupport::getStatus
|
FacPhotovoltaicPanelSupport::getName,
|
||||||
);
|
FacPhotovoltaicPanelSupport::getFinishType,
|
||||||
finishedDetailList.addAll(finishedVoList);
|
FacPhotovoltaicPanelSupport::getFinishDate,
|
||||||
} else {
|
FacPhotovoltaicPanelSupport::getProjectId,
|
||||||
throw new ServiceException("未定义的进度计划类别", HttpStatus.BAD_REQUEST);
|
FacPhotovoltaicPanelSupport::getProgressCategoryId,
|
||||||
|
FacPhotovoltaicPanelSupport::getId,
|
||||||
|
FacPhotovoltaicPanelSupport::getStatus
|
||||||
|
);
|
||||||
|
finishedDetailList.addAll(finishedVoList);
|
||||||
|
}
|
||||||
|
case null, default -> throw new ServiceException("未定义的进度计划类别", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
PgsProgressPlanDetail detail = new PgsProgressPlanDetail();
|
PgsProgressPlanDetail detail = new PgsProgressPlanDetail();
|
||||||
detail.setId(id);
|
detail.setId(id);
|
||||||
@ -392,98 +399,105 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
|||||||
throw new ServiceException("进度计划类别信息不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("进度计划类别信息不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
String workType = progressCategory.getWorkType();
|
String workType = progressCategory.getWorkType();
|
||||||
if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
String type = workType.split("_")[0];
|
||||||
LambdaQueryWrapper<FacPhotovoltaicPanel> lqw = new LambdaQueryWrapper<>();
|
switch (type) {
|
||||||
lqw.select(FacPhotovoltaicPanel::getId, FacPhotovoltaicPanel::getName, FacPhotovoltaicPanel::getStatus);
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_WORK_TYPE -> {
|
||||||
lqw.eq(FacPhotovoltaicPanel::getProjectId, progressPlanDetail.getProjectId());
|
LambdaQueryWrapper<FacPhotovoltaicPanel> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(FacPhotovoltaicPanel::getProgressCategoryId, progressCategoryId);
|
lqw.select(FacPhotovoltaicPanel::getId, FacPhotovoltaicPanel::getName, FacPhotovoltaicPanel::getStatus);
|
||||||
lqw.in(FacPhotovoltaicPanel::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
lqw.eq(FacPhotovoltaicPanel::getProjectId, progressPlanDetail.getProjectId());
|
||||||
Page<FacPhotovoltaicPanel> page = photovoltaicPanelService.page(pageQuery.build(), lqw);
|
lqw.eq(FacPhotovoltaicPanel::getProgressCategoryId, progressCategoryId);
|
||||||
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
lqw.in(FacPhotovoltaicPanel::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
||||||
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
Page<FacPhotovoltaicPanel> page = photovoltaicPanelService.page(pageQuery.build(), lqw);
|
||||||
vo.setId(entity.getId());
|
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
||||||
vo.setName(entity.getName());
|
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
||||||
vo.setStatus(entity.getStatus());
|
vo.setId(entity.getId());
|
||||||
return vo;
|
vo.setName(entity.getName());
|
||||||
});
|
vo.setStatus(entity.getStatus());
|
||||||
return TableDataInfo.build(voPage);
|
return vo;
|
||||||
} else if (PgsProgressCategoryConstant.INVERTER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
});
|
||||||
LambdaQueryWrapper<FacInverter> lqw = new LambdaQueryWrapper<>();
|
return TableDataInfo.build(voPage);
|
||||||
lqw.select(FacInverter::getId, FacInverter::getName, FacInverter::getStatus);
|
}
|
||||||
lqw.eq(FacInverter::getProjectId, progressPlanDetail.getProjectId());
|
case PgsProgressCategoryConstant.INVERTER_WORK_TYPE -> {
|
||||||
lqw.eq(FacInverter::getProgressCategoryId, progressCategoryId);
|
LambdaQueryWrapper<FacInverter> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.in(FacInverter::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
lqw.select(FacInverter::getId, FacInverter::getName, FacInverter::getStatus);
|
||||||
Page<FacInverter> page = inverterService.page(pageQuery.build(), lqw);
|
lqw.eq(FacInverter::getProjectId, progressPlanDetail.getProjectId());
|
||||||
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
lqw.eq(FacInverter::getProgressCategoryId, progressCategoryId);
|
||||||
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
lqw.in(FacInverter::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
||||||
vo.setId(entity.getId());
|
Page<FacInverter> page = inverterService.page(pageQuery.build(), lqw);
|
||||||
vo.setName(entity.getName());
|
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
||||||
vo.setStatus(entity.getStatus());
|
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
||||||
return vo;
|
vo.setId(entity.getId());
|
||||||
});
|
vo.setName(entity.getName());
|
||||||
return TableDataInfo.build(voPage);
|
vo.setStatus(entity.getStatus());
|
||||||
} else if (PgsProgressCategoryConstant.BOX_TRANSFORMER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
return vo;
|
||||||
LambdaQueryWrapper<FacBoxTransformer> lqw = new LambdaQueryWrapper<>();
|
});
|
||||||
lqw.select(FacBoxTransformer::getId, FacBoxTransformer::getName, FacBoxTransformer::getStatus);
|
return TableDataInfo.build(voPage);
|
||||||
lqw.eq(FacBoxTransformer::getProjectId, progressPlanDetail.getProjectId());
|
}
|
||||||
lqw.eq(FacBoxTransformer::getProgressCategoryId, progressCategoryId);
|
case PgsProgressCategoryConstant.BOX_TRANSFORMER_WORK_TYPE -> {
|
||||||
lqw.in(FacBoxTransformer::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
LambdaQueryWrapper<FacBoxTransformer> lqw = new LambdaQueryWrapper<>();
|
||||||
Page<FacBoxTransformer> page = boxTransformerService.page(pageQuery.build(), lqw);
|
lqw.select(FacBoxTransformer::getId, FacBoxTransformer::getName, FacBoxTransformer::getStatus);
|
||||||
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
lqw.eq(FacBoxTransformer::getProjectId, progressPlanDetail.getProjectId());
|
||||||
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
lqw.eq(FacBoxTransformer::getProgressCategoryId, progressCategoryId);
|
||||||
vo.setId(entity.getId());
|
lqw.in(FacBoxTransformer::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
||||||
vo.setName(entity.getName());
|
Page<FacBoxTransformer> page = boxTransformerService.page(pageQuery.build(), lqw);
|
||||||
vo.setStatus(entity.getStatus());
|
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
||||||
return vo;
|
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
||||||
});
|
vo.setId(entity.getId());
|
||||||
return TableDataInfo.build(voPage);
|
vo.setName(entity.getName());
|
||||||
} else if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE.contains(workType)) {
|
vo.setStatus(entity.getStatus());
|
||||||
LambdaQueryWrapper<FacPhotovoltaicPanelPoint> lqw = new LambdaQueryWrapper<>();
|
return vo;
|
||||||
lqw.select(FacPhotovoltaicPanelPoint::getId, FacPhotovoltaicPanelPoint::getName, FacPhotovoltaicPanelPoint::getStatus);
|
});
|
||||||
lqw.eq(FacPhotovoltaicPanelPoint::getProjectId, progressPlanDetail.getProjectId());
|
return TableDataInfo.build(voPage);
|
||||||
lqw.eq(FacPhotovoltaicPanelPoint::getProgressCategoryId, progressCategoryId);
|
}
|
||||||
lqw.in(FacPhotovoltaicPanelPoint::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE -> {
|
||||||
Page<FacPhotovoltaicPanelPoint> page = photovoltaicPanelPointService.page(pageQuery.build(), lqw);
|
LambdaQueryWrapper<FacPhotovoltaicPanelPoint> lqw = new LambdaQueryWrapper<>();
|
||||||
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
lqw.select(FacPhotovoltaicPanelPoint::getId, FacPhotovoltaicPanelPoint::getName, FacPhotovoltaicPanelPoint::getStatus);
|
||||||
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
lqw.eq(FacPhotovoltaicPanelPoint::getProjectId, progressPlanDetail.getProjectId());
|
||||||
vo.setId(entity.getId());
|
lqw.eq(FacPhotovoltaicPanelPoint::getProgressCategoryId, progressCategoryId);
|
||||||
vo.setName(entity.getName());
|
lqw.in(FacPhotovoltaicPanelPoint::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
||||||
vo.setStatus(entity.getStatus());
|
Page<FacPhotovoltaicPanelPoint> page = photovoltaicPanelPointService.page(pageQuery.build(), lqw);
|
||||||
return vo;
|
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
||||||
});
|
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
||||||
return TableDataInfo.build(voPage);
|
vo.setId(entity.getId());
|
||||||
} else if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE.contains(workType)) {
|
vo.setName(entity.getName());
|
||||||
LambdaQueryWrapper<FacPhotovoltaicPanelColumn> lqw = new LambdaQueryWrapper<>();
|
vo.setStatus(entity.getStatus());
|
||||||
lqw.select(FacPhotovoltaicPanelColumn::getId, FacPhotovoltaicPanelColumn::getName, FacPhotovoltaicPanelColumn::getStatus);
|
return vo;
|
||||||
lqw.eq(FacPhotovoltaicPanelColumn::getProjectId, progressPlanDetail.getProjectId());
|
});
|
||||||
lqw.eq(FacPhotovoltaicPanelColumn::getProgressCategoryId, progressCategoryId);
|
return TableDataInfo.build(voPage);
|
||||||
lqw.in(FacPhotovoltaicPanelColumn::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
}
|
||||||
Page<FacPhotovoltaicPanelColumn> page = photovoltaicPanelColumnService.page(pageQuery.build(), lqw);
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE -> {
|
||||||
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
LambdaQueryWrapper<FacPhotovoltaicPanelColumn> lqw = new LambdaQueryWrapper<>();
|
||||||
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
lqw.select(FacPhotovoltaicPanelColumn::getId, FacPhotovoltaicPanelColumn::getName, FacPhotovoltaicPanelColumn::getStatus);
|
||||||
vo.setId(entity.getId());
|
lqw.eq(FacPhotovoltaicPanelColumn::getProjectId, progressPlanDetail.getProjectId());
|
||||||
vo.setName(entity.getName());
|
lqw.eq(FacPhotovoltaicPanelColumn::getProgressCategoryId, progressCategoryId);
|
||||||
vo.setStatus(entity.getStatus());
|
lqw.in(FacPhotovoltaicPanelColumn::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
||||||
return vo;
|
Page<FacPhotovoltaicPanelColumn> page = photovoltaicPanelColumnService.page(pageQuery.build(), lqw);
|
||||||
});
|
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
||||||
return TableDataInfo.build(voPage);
|
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
||||||
} else if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE.contains(workType)) {
|
vo.setId(entity.getId());
|
||||||
LambdaQueryWrapper<FacPhotovoltaicPanelSupport> lqw = new LambdaQueryWrapper<>();
|
vo.setName(entity.getName());
|
||||||
lqw.select(FacPhotovoltaicPanelSupport::getId, FacPhotovoltaicPanelSupport::getName, FacPhotovoltaicPanelSupport::getStatus);
|
vo.setStatus(entity.getStatus());
|
||||||
lqw.eq(FacPhotovoltaicPanelSupport::getProjectId, progressPlanDetail.getProjectId());
|
return vo;
|
||||||
lqw.eq(FacPhotovoltaicPanelSupport::getProgressCategoryId, progressCategoryId);
|
});
|
||||||
lqw.in(FacPhotovoltaicPanelSupport::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
return TableDataInfo.build(voPage);
|
||||||
Page<FacPhotovoltaicPanelSupport> page = photovoltaicPanelSupportService.page(pageQuery.build(), lqw);
|
}
|
||||||
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE -> {
|
||||||
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
LambdaQueryWrapper<FacPhotovoltaicPanelSupport> lqw = new LambdaQueryWrapper<>();
|
||||||
vo.setId(entity.getId());
|
lqw.select(FacPhotovoltaicPanelSupport::getId, FacPhotovoltaicPanelSupport::getName, FacPhotovoltaicPanelSupport::getStatus);
|
||||||
vo.setName(entity.getName());
|
lqw.eq(FacPhotovoltaicPanelSupport::getProjectId, progressPlanDetail.getProjectId());
|
||||||
vo.setStatus(entity.getStatus());
|
lqw.eq(FacPhotovoltaicPanelSupport::getProgressCategoryId, progressCategoryId);
|
||||||
return vo;
|
lqw.in(FacPhotovoltaicPanelSupport::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
||||||
});
|
Page<FacPhotovoltaicPanelSupport> page = photovoltaicPanelSupportService.page(pageQuery.build(), lqw);
|
||||||
return TableDataInfo.build(voPage);
|
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
||||||
} else {
|
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
||||||
throw new ServiceException("未定义的进度计划类别", HttpStatus.BAD_REQUEST);
|
vo.setId(entity.getId());
|
||||||
|
vo.setName(entity.getName());
|
||||||
|
vo.setStatus(entity.getStatus());
|
||||||
|
return vo;
|
||||||
|
});
|
||||||
|
return TableDataInfo.build(voPage);
|
||||||
|
}
|
||||||
|
case null, default -> throw new ServiceException("未定义的进度计划类别", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,104 +539,111 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
|||||||
List<PgsProgressPlanDetailFinishedVo> finishedVoList = JSONUtil.toList(finishedDetail, PgsProgressPlanDetailFinishedVo.class);
|
List<PgsProgressPlanDetailFinishedVo> finishedVoList = JSONUtil.toList(finishedDetail, PgsProgressPlanDetailFinishedVo.class);
|
||||||
PgsProgressCategory progressCategory = progressCategoryService.getById(progressPlanDetail.getProgressCategoryId());
|
PgsProgressCategory progressCategory = progressCategoryService.getById(progressPlanDetail.getProgressCategoryId());
|
||||||
String workType = progressCategory.getWorkType();
|
String workType = progressCategory.getWorkType();
|
||||||
if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
String type = workType.split("_")[0];
|
||||||
List<FacPhotovoltaicPanel> list = photovoltaicPanelService.lambdaQuery()
|
switch (type) {
|
||||||
.in(FacPhotovoltaicPanel::getId, detailIdList)
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_WORK_TYPE -> {
|
||||||
.list();
|
List<FacPhotovoltaicPanel> list = photovoltaicPanelService.lambdaQuery()
|
||||||
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
.in(FacPhotovoltaicPanel::getId, detailIdList)
|
||||||
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
.list();
|
||||||
|
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
||||||
|
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
LambdaUpdateWrapper<FacPhotovoltaicPanel> lqw = new LambdaUpdateWrapper<>();
|
||||||
|
lqw.in(FacPhotovoltaicPanel::getId, detailIdList);
|
||||||
|
lqw.set(FacPhotovoltaicPanel::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
||||||
|
lqw.set(FacPhotovoltaicPanel::getFinishType, null);
|
||||||
|
lqw.set(FacPhotovoltaicPanel::getFinishDate, null);
|
||||||
|
boolean update = photovoltaicPanelService.update(lqw);
|
||||||
|
if (!update) {
|
||||||
|
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LambdaUpdateWrapper<FacPhotovoltaicPanel> lqw = new LambdaUpdateWrapper<>();
|
case PgsProgressCategoryConstant.INVERTER_WORK_TYPE -> {
|
||||||
lqw.in(FacPhotovoltaicPanel::getId, detailIdList);
|
List<FacInverter> list = inverterService.lambdaQuery()
|
||||||
lqw.set(FacPhotovoltaicPanel::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
.in(FacInverter::getId, detailIdList)
|
||||||
lqw.set(FacPhotovoltaicPanel::getFinishType, null);
|
.list();
|
||||||
lqw.set(FacPhotovoltaicPanel::getFinishDate, null);
|
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
||||||
boolean update = photovoltaicPanelService.update(lqw);
|
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
||||||
if (!update) {
|
}
|
||||||
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
LambdaUpdateWrapper<FacInverter> lqw = new LambdaUpdateWrapper<>();
|
||||||
|
lqw.in(FacInverter::getId, detailIdList);
|
||||||
|
lqw.set(FacInverter::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
||||||
|
lqw.set(FacInverter::getFinishType, null);
|
||||||
|
lqw.set(FacInverter::getFinishDate, null);
|
||||||
|
boolean update = inverterService.update(lqw);
|
||||||
|
if (!update) {
|
||||||
|
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (PgsProgressCategoryConstant.INVERTER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
case PgsProgressCategoryConstant.BOX_TRANSFORMER_WORK_TYPE -> {
|
||||||
List<FacInverter> list = inverterService.lambdaQuery()
|
List<FacBoxTransformer> list = boxTransformerService.lambdaQuery()
|
||||||
.in(FacInverter::getId, detailIdList)
|
.in(FacBoxTransformer::getId, detailIdList)
|
||||||
.list();
|
.list();
|
||||||
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
||||||
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
LambdaUpdateWrapper<FacBoxTransformer> lqw = new LambdaUpdateWrapper<>();
|
||||||
|
lqw.in(FacBoxTransformer::getId, detailIdList);
|
||||||
|
lqw.set(FacBoxTransformer::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
||||||
|
lqw.set(FacBoxTransformer::getFinishType, null);
|
||||||
|
lqw.set(FacBoxTransformer::getFinishDate, null);
|
||||||
|
boolean update = boxTransformerService.update(lqw);
|
||||||
|
if (!update) {
|
||||||
|
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LambdaUpdateWrapper<FacInverter> lqw = new LambdaUpdateWrapper<>();
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE -> {
|
||||||
lqw.in(FacInverter::getId, detailIdList);
|
List<FacPhotovoltaicPanelPoint> list = photovoltaicPanelPointService.lambdaQuery()
|
||||||
lqw.set(FacInverter::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
.in(FacPhotovoltaicPanelPoint::getId, detailIdList)
|
||||||
lqw.set(FacInverter::getFinishType, null);
|
.list();
|
||||||
lqw.set(FacInverter::getFinishDate, null);
|
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
||||||
boolean update = inverterService.update(lqw);
|
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
||||||
if (!update) {
|
}
|
||||||
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
LambdaUpdateWrapper<FacPhotovoltaicPanelPoint> lqw = new LambdaUpdateWrapper<>();
|
||||||
|
lqw.in(FacPhotovoltaicPanelPoint::getId, detailIdList);
|
||||||
|
lqw.set(FacPhotovoltaicPanelPoint::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
||||||
|
lqw.set(FacPhotovoltaicPanelPoint::getFinishType, null);
|
||||||
|
lqw.set(FacPhotovoltaicPanelPoint::getFinishDate, null);
|
||||||
|
boolean update = photovoltaicPanelPointService.update(lqw);
|
||||||
|
if (!update) {
|
||||||
|
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (PgsProgressCategoryConstant.BOX_TRANSFORMER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE -> {
|
||||||
List<FacBoxTransformer> list = boxTransformerService.lambdaQuery()
|
List<FacPhotovoltaicPanelColumn> list = photovoltaicPanelColumnService.lambdaQuery()
|
||||||
.in(FacBoxTransformer::getId, detailIdList)
|
.in(FacPhotovoltaicPanelColumn::getId, detailIdList)
|
||||||
.list();
|
.list();
|
||||||
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
||||||
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
LambdaUpdateWrapper<FacPhotovoltaicPanelColumn> lqw = new LambdaUpdateWrapper<>();
|
||||||
|
lqw.in(FacPhotovoltaicPanelColumn::getId, detailIdList);
|
||||||
|
lqw.set(FacPhotovoltaicPanelColumn::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
||||||
|
lqw.set(FacPhotovoltaicPanelColumn::getFinishType, null);
|
||||||
|
lqw.set(FacPhotovoltaicPanelColumn::getFinishDate, null);
|
||||||
|
boolean update = photovoltaicPanelColumnService.update(lqw);
|
||||||
|
if (!update) {
|
||||||
|
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LambdaUpdateWrapper<FacBoxTransformer> lqw = new LambdaUpdateWrapper<>();
|
case PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE -> {
|
||||||
lqw.in(FacBoxTransformer::getId, detailIdList);
|
List<FacPhotovoltaicPanelSupport> list = photovoltaicPanelSupportService.lambdaQuery()
|
||||||
lqw.set(FacBoxTransformer::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
.in(FacPhotovoltaicPanelSupport::getId, detailIdList)
|
||||||
lqw.set(FacBoxTransformer::getFinishType, null);
|
.list();
|
||||||
lqw.set(FacBoxTransformer::getFinishDate, null);
|
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
||||||
boolean update = boxTransformerService.update(lqw);
|
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
||||||
if (!update) {
|
}
|
||||||
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
LambdaUpdateWrapper<FacPhotovoltaicPanelSupport> lqw = new LambdaUpdateWrapper<>();
|
||||||
|
lqw.in(FacPhotovoltaicPanelSupport::getId, detailIdList);
|
||||||
|
lqw.set(FacPhotovoltaicPanelSupport::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
||||||
|
lqw.set(FacPhotovoltaicPanelSupport::getFinishType, null);
|
||||||
|
lqw.set(FacPhotovoltaicPanelSupport::getFinishDate, null);
|
||||||
|
boolean update = photovoltaicPanelSupportService.update(lqw);
|
||||||
|
if (!update) {
|
||||||
|
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_POINT_WORK_TYPE.contains(workType)) {
|
case null, default -> throw new ServiceException("未定义的进度计划类别", HttpStatus.BAD_REQUEST);
|
||||||
List<FacPhotovoltaicPanelPoint> list = photovoltaicPanelPointService.lambdaQuery()
|
|
||||||
.in(FacPhotovoltaicPanelPoint::getId, detailIdList)
|
|
||||||
.list();
|
|
||||||
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
|
||||||
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
|
||||||
}
|
|
||||||
LambdaUpdateWrapper<FacPhotovoltaicPanelPoint> lqw = new LambdaUpdateWrapper<>();
|
|
||||||
lqw.in(FacPhotovoltaicPanelPoint::getId, detailIdList);
|
|
||||||
lqw.set(FacPhotovoltaicPanelPoint::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
|
||||||
lqw.set(FacPhotovoltaicPanelPoint::getFinishType, null);
|
|
||||||
lqw.set(FacPhotovoltaicPanelPoint::getFinishDate, null);
|
|
||||||
boolean update = photovoltaicPanelPointService.update(lqw);
|
|
||||||
if (!update) {
|
|
||||||
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
|
||||||
}
|
|
||||||
} else if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_COLUMN_WORK_TYPE.contains(workType)) {
|
|
||||||
List<FacPhotovoltaicPanelColumn> list = photovoltaicPanelColumnService.lambdaQuery()
|
|
||||||
.in(FacPhotovoltaicPanelColumn::getId, detailIdList)
|
|
||||||
.list();
|
|
||||||
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
|
||||||
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
|
||||||
}
|
|
||||||
LambdaUpdateWrapper<FacPhotovoltaicPanelColumn> lqw = new LambdaUpdateWrapper<>();
|
|
||||||
lqw.in(FacPhotovoltaicPanelColumn::getId, detailIdList);
|
|
||||||
lqw.set(FacPhotovoltaicPanelColumn::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
|
||||||
lqw.set(FacPhotovoltaicPanelColumn::getFinishType, null);
|
|
||||||
lqw.set(FacPhotovoltaicPanelColumn::getFinishDate, null);
|
|
||||||
boolean update = photovoltaicPanelColumnService.update(lqw);
|
|
||||||
if (!update) {
|
|
||||||
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
|
||||||
}
|
|
||||||
} else if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_SUPPORT_WORK_TYPE.contains(workType)) {
|
|
||||||
List<FacPhotovoltaicPanelSupport> list = photovoltaicPanelSupportService.lambdaQuery()
|
|
||||||
.in(FacPhotovoltaicPanelSupport::getId, detailIdList)
|
|
||||||
.list();
|
|
||||||
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
|
||||||
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
|
||||||
}
|
|
||||||
LambdaUpdateWrapper<FacPhotovoltaicPanelSupport> lqw = new LambdaUpdateWrapper<>();
|
|
||||||
lqw.in(FacPhotovoltaicPanelSupport::getId, detailIdList);
|
|
||||||
lqw.set(FacPhotovoltaicPanelSupport::getStatus, FacFinishStatusEnum.UNFINISH.getValue());
|
|
||||||
lqw.set(FacPhotovoltaicPanelSupport::getFinishType, null);
|
|
||||||
lqw.set(FacPhotovoltaicPanelSupport::getFinishDate, null);
|
|
||||||
boolean update = photovoltaicPanelSupportService.update(lqw);
|
|
||||||
if (!update) {
|
|
||||||
throw new ServiceException("修改设施数据失败,数据库异常", HttpStatus.ERROR);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new ServiceException("未定义的进度计划类别", HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
}
|
||||||
AtomicInteger finishType2Count = new AtomicInteger(0);
|
AtomicInteger finishType2Count = new AtomicInteger(0);
|
||||||
// 过滤出不需要删除的,生成新列表
|
// 过滤出不需要删除的,生成新列表
|
||||||
|
@ -22,6 +22,7 @@ import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanQueryReq;
|
|||||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateDto;
|
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateDto;
|
||||||
import org.dromara.progress.domain.enums.PgsDelayStatusEnum;
|
import org.dromara.progress.domain.enums.PgsDelayStatusEnum;
|
||||||
import org.dromara.progress.domain.enums.PgsFinishStatusEnum;
|
import org.dromara.progress.domain.enums.PgsFinishStatusEnum;
|
||||||
|
import org.dromara.progress.domain.enums.PgsProgressUnitTypeEnum;
|
||||||
import org.dromara.progress.domain.vo.progressplan.PgsProgressPlanVo;
|
import org.dromara.progress.domain.vo.progressplan.PgsProgressPlanVo;
|
||||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNumVo;
|
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNumVo;
|
||||||
import org.dromara.progress.mapper.PgsProgressPlanMapper;
|
import org.dromara.progress.mapper.PgsProgressPlanMapper;
|
||||||
@ -329,20 +330,30 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
|||||||
if (progressCategory == null) {
|
if (progressCategory == null) {
|
||||||
throw new ServiceException("进度类别不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("进度类别不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
if (planNumber.compareTo(BigDecimal.ZERO) <= 0) {
|
String unitTypeMsg = "数量";
|
||||||
throw new ServiceException("计划数量不能小于等于0", HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
|
||||||
BigDecimal total = progressCategory.getTotal();
|
BigDecimal total = progressCategory.getTotal();
|
||||||
|
// 百分比项目需乘以总数
|
||||||
|
if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue())) {
|
||||||
|
planNumber = planNumber.multiply(total);
|
||||||
|
unitTypeMsg = "百分比";
|
||||||
|
}
|
||||||
|
if (planNumber.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
throw new ServiceException("计划" + unitTypeMsg + "不能小于等于0", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
BigDecimal completed = progressCategory.getCompleted();
|
BigDecimal completed = progressCategory.getCompleted();
|
||||||
BigDecimal planTotal = total.subtract(completed);
|
BigDecimal planTotal = total.subtract(completed);
|
||||||
if (planNumber.compareTo(planTotal) > 0) {
|
if (planNumber.compareTo(planTotal) > 0) {
|
||||||
throw new ServiceException("计划数量不能大于剩余数量", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("计划" + unitTypeMsg + "不能大于剩余" + unitTypeMsg, HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
// 如果计划数量大于未完成和计划的数量,则计划数量不合法
|
// 如果计划数量大于未完成和计划的数量,则计划数量不合法
|
||||||
BigDecimal planAndFinishedNumberNumber = this.getCurrentPlanAndFinishedNumber(progressCategory);
|
BigDecimal planAndFinishedNumberNumber = this.getCurrentPlanAndFinishedNumber(progressCategory);
|
||||||
BigDecimal leftNumber = progressCategory.getTotal().subtract(planAndFinishedNumberNumber);
|
// 百分比项目需乘以总数
|
||||||
|
if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue())) {
|
||||||
|
planAndFinishedNumberNumber = planAndFinishedNumberNumber.multiply(total);
|
||||||
|
}
|
||||||
|
BigDecimal leftNumber = total.subtract(planAndFinishedNumberNumber);
|
||||||
if (planNumber.compareTo(leftNumber) > 0) {
|
if (planNumber.compareTo(leftNumber) > 0) {
|
||||||
throw new ServiceException("计划数量不能大于当前完成数量和计划数量总和", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("计划" + unitTypeMsg + "不能大于当前完成" + unitTypeMsg + "和计划" + unitTypeMsg + "总和", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.common.constant.DesignMapFileConstant;
|
||||||
import org.dromara.common.core.constant.HttpStatus;
|
import org.dromara.common.core.constant.HttpStatus;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.utils.ObjectUtils;
|
import org.dromara.common.core.utils.ObjectUtils;
|
||||||
@ -20,7 +21,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.common.sse.dto.SseMessageDto;
|
import org.dromara.common.sse.dto.SseMessageDto;
|
||||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||||
import org.dromara.common.constant.DesignMapFileConstant;
|
import org.dromara.common.utils.Dxf2JsonUtil;
|
||||||
import org.dromara.project.domain.BusProject;
|
import org.dromara.project.domain.BusProject;
|
||||||
import org.dromara.project.domain.BusProjectFile;
|
import org.dromara.project.domain.BusProjectFile;
|
||||||
import org.dromara.project.domain.dto.projectfile.BusProjectFileQueryReq;
|
import org.dromara.project.domain.dto.projectfile.BusProjectFileQueryReq;
|
||||||
@ -30,7 +31,6 @@ import org.dromara.project.domain.vo.projectfile.BusProjectFileVo;
|
|||||||
import org.dromara.project.mapper.BusProjectFileMapper;
|
import org.dromara.project.mapper.BusProjectFileMapper;
|
||||||
import org.dromara.project.service.IBusProjectFileService;
|
import org.dromara.project.service.IBusProjectFileService;
|
||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.dromara.common.utils.Dxf2JsonUtil;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -197,12 +197,13 @@ public class BusProjectFileServiceImpl extends ServiceImpl<BusProjectFileMapper,
|
|||||||
throw new ServiceException("文件格式不正确,只能解析json文件", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("文件格式不正确,只能解析json文件", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
JSONObject jsonObject;
|
JSONObject jsonObject;
|
||||||
|
String property = System.getProperty("user.dir");
|
||||||
|
Path path = Paths.get(property, filePath);
|
||||||
try {
|
try {
|
||||||
String property = System.getProperty("user.dir");
|
|
||||||
Path path = Paths.get(property, filePath);
|
|
||||||
String jsonStr = Files.readString(path, StandardCharsets.UTF_8);
|
String jsonStr = Files.readString(path, StandardCharsets.UTF_8);
|
||||||
jsonObject = JSONUtil.parseObj(jsonStr);
|
jsonObject = JSONUtil.parseObj(jsonStr);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
log.error("项目文件读取失败:读取路径{}", path);
|
||||||
throw new ServiceException("文件读取失败", HttpStatus.ERROR);
|
throw new ServiceException("文件读取失败", HttpStatus.ERROR);
|
||||||
}
|
}
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
|
@ -2,7 +2,6 @@ package org.dromara.project.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.PhoneUtil;
|
import cn.hutool.core.util.PhoneUtil;
|
||||||
@ -11,7 +10,6 @@ import cn.hutool.json.JSONArray;
|
|||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@ -37,6 +35,7 @@ import org.dromara.facility.domain.vo.matrix.FacMatrixBySubProjectVo;
|
|||||||
import org.dromara.facility.service.IFacMatrixService;
|
import org.dromara.facility.service.IFacMatrixService;
|
||||||
import org.dromara.manager.weathermanager.WeatherConstant;
|
import org.dromara.manager.weathermanager.WeatherConstant;
|
||||||
import org.dromara.manager.weathermanager.WeatherManager;
|
import org.dromara.manager.weathermanager.WeatherManager;
|
||||||
|
import org.dromara.progress.service.IPgsProgressCategoryTemplateService;
|
||||||
import org.dromara.project.constant.BusProjectConstant;
|
import org.dromara.project.constant.BusProjectConstant;
|
||||||
import org.dromara.project.domain.BusProject;
|
import org.dromara.project.domain.BusProject;
|
||||||
import org.dromara.project.domain.BusProjectFile;
|
import org.dromara.project.domain.BusProjectFile;
|
||||||
@ -60,7 +59,6 @@ import org.dromara.system.domain.enums.SysDeptTypeEnum;
|
|||||||
import org.dromara.system.mapper.SysDeptMapper;
|
import org.dromara.system.mapper.SysDeptMapper;
|
||||||
import org.dromara.workflow.service.IFlwDefinitionService;
|
import org.dromara.workflow.service.IFlwDefinitionService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.data.redis.core.ValueOperations;
|
import org.springframework.data.redis.core.ValueOperations;
|
||||||
@ -129,9 +127,13 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
|||||||
@Resource
|
@Resource
|
||||||
private IBusProjectService self;
|
private IBusProjectService self;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private IBusProjectPunchrangeService busProjectPunchrangeService;
|
private IBusProjectPunchrangeService busProjectPunchrangeService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private IPgsProgressCategoryTemplateService progressCategoryTemplateService;
|
||||||
|
|
||||||
private final Cache<String, String> WEATHER_CACHE =
|
private final Cache<String, String> WEATHER_CACHE =
|
||||||
Caffeine.newBuilder().initialCapacity(1024)
|
Caffeine.newBuilder().initialCapacity(1024)
|
||||||
.maximumSize(10000L)
|
.maximumSize(10000L)
|
||||||
@ -397,6 +399,7 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
|||||||
BusProject subProject = new BusProject();
|
BusProject subProject = new BusProject();
|
||||||
subProject.setPId(pId);
|
subProject.setPId(pId);
|
||||||
subProject.setProjectName(projectName);
|
subProject.setProjectName(projectName);
|
||||||
|
subProject.setProjectType(project.getProjectType());
|
||||||
boolean save = this.save(subProject);
|
boolean save = this.save(subProject);
|
||||||
if (!save) {
|
if (!save) {
|
||||||
throw new ServiceException("新增子项目失败,数据库异常", HttpStatus.ERROR);
|
throw new ServiceException("新增子项目失败,数据库异常", HttpStatus.ERROR);
|
||||||
@ -414,6 +417,11 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
|||||||
if (!saveRelevancy) {
|
if (!saveRelevancy) {
|
||||||
throw new ServiceException("新增用户与项目关联失败,数据库异常", HttpStatus.ERROR);
|
throw new ServiceException("新增用户与项目关联失败,数据库异常", HttpStatus.ERROR);
|
||||||
}
|
}
|
||||||
|
// 初始化施工类型模版
|
||||||
|
Boolean init = progressCategoryTemplateService.initTemplateByProject(subProjectId);
|
||||||
|
if (!init) {
|
||||||
|
throw new ServiceException("初始化项目施工类型模版失败,数据库异常", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
return subProjectId;
|
return subProjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,7 +494,7 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 操作数据库
|
// 操作数据库
|
||||||
if (this.updateById(project)){
|
if (this.updateById(project)) {
|
||||||
if (!req.getPunchrangeList().isEmpty()) {
|
if (!req.getPunchrangeList().isEmpty()) {
|
||||||
//删除所有旧的范围
|
//删除所有旧的范围
|
||||||
busProjectPunchrangeService.remove(Wrappers.lambdaQuery(BusProjectPunchrange.class).eq(BusProjectPunchrange::getProjectId, project.getId()));
|
busProjectPunchrangeService.remove(Wrappers.lambdaQuery(BusProjectPunchrange.class).eq(BusProjectPunchrange::getProjectId, project.getId()));
|
||||||
|
@ -2,7 +2,6 @@ package org.dromara.project.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -20,14 +19,17 @@ import org.dromara.contractor.service.ISubConstructionUserService;
|
|||||||
import org.dromara.project.domain.BusConstructionUserExit;
|
import org.dromara.project.domain.BusConstructionUserExit;
|
||||||
import org.dromara.project.domain.BusProjectTeam;
|
import org.dromara.project.domain.BusProjectTeam;
|
||||||
import org.dromara.project.domain.BusProjectTeamMember;
|
import org.dromara.project.domain.BusProjectTeamMember;
|
||||||
import org.dromara.project.domain.enums.BusProjectTeamMemberPostEnum;
|
|
||||||
import org.dromara.project.domain.dto.projectteammember.BusProjectTeamMemberCreateReq;
|
import org.dromara.project.domain.dto.projectteammember.BusProjectTeamMemberCreateReq;
|
||||||
import org.dromara.project.domain.dto.projectteammember.BusProjectTeamMemberExitReq;
|
import org.dromara.project.domain.dto.projectteammember.BusProjectTeamMemberExitReq;
|
||||||
import org.dromara.project.domain.dto.projectteammember.BusProjectTeamMemberQueryReq;
|
import org.dromara.project.domain.dto.projectteammember.BusProjectTeamMemberQueryReq;
|
||||||
import org.dromara.project.domain.dto.projectteammember.BusProjectTeamMemberUpdateReq;
|
import org.dromara.project.domain.dto.projectteammember.BusProjectTeamMemberUpdateReq;
|
||||||
|
import org.dromara.project.domain.enums.BusProjectTeamMemberPostEnum;
|
||||||
import org.dromara.project.domain.vo.projectteammember.BusProjectTeamMemberVo;
|
import org.dromara.project.domain.vo.projectteammember.BusProjectTeamMemberVo;
|
||||||
import org.dromara.project.mapper.BusProjectTeamMemberMapper;
|
import org.dromara.project.mapper.BusProjectTeamMemberMapper;
|
||||||
import org.dromara.project.service.*;
|
import org.dromara.project.service.*;
|
||||||
|
import org.dromara.system.domain.SysUser;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
|
import org.dromara.system.service.ISysUserService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -35,7 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,6 +53,9 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
|||||||
@Resource
|
@Resource
|
||||||
private ISubConstructionUserService constructionUserService;
|
private ISubConstructionUserService constructionUserService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IBusProjectTeamService projectTeamService;
|
private IBusProjectTeamService projectTeamService;
|
||||||
|
|
||||||
@ -125,11 +130,13 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
|||||||
if (projectTeam == null) {
|
if (projectTeam == null) {
|
||||||
throw new ServiceException("对应班组不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("对应班组不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
Long memberId = projectTeamMember.getMemberId();
|
||||||
|
SubConstructionUser constructionUser = constructionUserService.getBySysUserId(memberId);
|
||||||
// 判断用户是否已经被拉黑
|
// 判断用户是否已经被拉黑
|
||||||
constructionBlacklistService.validUserInBlacklist(projectTeamMember.getMemberId(), projectTeamMember.getProjectId());
|
constructionBlacklistService.validUserInBlacklist(constructionUser.getId(), projectTeamMember.getProjectId());
|
||||||
// 判断对应的用户与项目关联是否存在
|
// 判断对应的用户与项目关联是否存在
|
||||||
BusProjectTeamMember teamMember = this.getOne(new LambdaQueryWrapper<BusProjectTeamMember>()
|
BusProjectTeamMember teamMember = this.getOne(new LambdaQueryWrapper<BusProjectTeamMember>()
|
||||||
.eq(BusProjectTeamMember::getMemberId, projectTeamMember.getMemberId())
|
.eq(BusProjectTeamMember::getMemberId, memberId)
|
||||||
.eq(BusProjectTeamMember::getProjectId, projectTeamMember.getProjectId()));
|
.eq(BusProjectTeamMember::getProjectId, projectTeamMember.getProjectId()));
|
||||||
if (teamMember != null) {
|
if (teamMember != null) {
|
||||||
throw new ServiceException("当前用户已入场", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("当前用户已入场", HttpStatus.BAD_REQUEST);
|
||||||
@ -141,7 +148,7 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
|||||||
}
|
}
|
||||||
// 同步修改用户表的team_id字段并添加入场时间
|
// 同步修改用户表的team_id字段并添加入场时间
|
||||||
LambdaUpdateWrapper<SubConstructionUser> constructionUserLuw = Wrappers.lambdaUpdate(SubConstructionUser.class)
|
LambdaUpdateWrapper<SubConstructionUser> constructionUserLuw = Wrappers.lambdaUpdate(SubConstructionUser.class)
|
||||||
.eq(SubConstructionUser::getId, projectTeamMember.getMemberId())
|
.eq(SubConstructionUser::getId, constructionUser.getId())
|
||||||
.set(SubConstructionUser::getTeamId, projectTeamMember.getTeamId())
|
.set(SubConstructionUser::getTeamId, projectTeamMember.getTeamId())
|
||||||
.set(SubConstructionUser::getTeamName, projectTeam.getTeamName())
|
.set(SubConstructionUser::getTeamName, projectTeam.getTeamName())
|
||||||
.set(SubConstructionUser::getEntryDate, new Date())
|
.set(SubConstructionUser::getEntryDate, new Date())
|
||||||
@ -175,10 +182,12 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
|||||||
if (oldProjectTeamMember == null) {
|
if (oldProjectTeamMember == null) {
|
||||||
throw new ServiceException("修改项目班组下的成员,数据不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("修改项目班组下的成员,数据不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
Long memberId = projectTeamMember.getMemberId();
|
||||||
|
SubConstructionUser constructionUser = constructionUserService.getBySysUserId(memberId);
|
||||||
// 如果修改了班组信息,同步修改用户表的字段
|
// 如果修改了班组信息,同步修改用户表的字段
|
||||||
if (!oldProjectTeamMember.getTeamId().equals(teamId)) {
|
if (!oldProjectTeamMember.getTeamId().equals(teamId)) {
|
||||||
LambdaUpdateWrapper<SubConstructionUser> constructionUserLuw = Wrappers.lambdaUpdate(SubConstructionUser.class)
|
LambdaUpdateWrapper<SubConstructionUser> constructionUserLuw = Wrappers.lambdaUpdate(SubConstructionUser.class)
|
||||||
.eq(SubConstructionUser::getId, projectTeamMember.getMemberId())
|
.eq(SubConstructionUser::getId, constructionUser.getId())
|
||||||
.set(SubConstructionUser::getTeamId, projectTeamMember.getTeamId())
|
.set(SubConstructionUser::getTeamId, projectTeamMember.getTeamId())
|
||||||
.set(SubConstructionUser::getTeamName, projectTeam.getTeamName());
|
.set(SubConstructionUser::getTeamName, projectTeam.getTeamName());
|
||||||
constructionUserService.update(constructionUserLuw);
|
constructionUserService.update(constructionUserLuw);
|
||||||
@ -210,7 +219,7 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
|||||||
if (projectService.getById(projectId) == null) {
|
if (projectService.getById(projectId) == null) {
|
||||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
if (constructionUserService.getById(memberId) == null) {
|
if (userService.selectUserById(memberId) == null) {
|
||||||
throw new ServiceException("对应人员不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("对应人员不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,7 +250,8 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
|||||||
throw new ServiceException("删除项目班组下的成员失败,数据库异常", HttpStatus.ERROR);
|
throw new ServiceException("删除项目班组下的成员失败,数据库异常", HttpStatus.ERROR);
|
||||||
}
|
}
|
||||||
// 将文件信息保存到数据库
|
// 将文件信息保存到数据库
|
||||||
SubConstructionUser constructionUser = constructionUserService.getById(projectTeamMember.getMemberId());
|
Long memberId = projectTeamMember.getMemberId();
|
||||||
|
SubConstructionUser constructionUser = constructionUserService.getBySysUserId(memberId);
|
||||||
BusConstructionUserExit constructionUserExit = new BusConstructionUserExit();
|
BusConstructionUserExit constructionUserExit = new BusConstructionUserExit();
|
||||||
constructionUserExit.setProjectId(constructionUser.getProjectId());
|
constructionUserExit.setProjectId(constructionUser.getProjectId());
|
||||||
constructionUserExit.setUserId(constructionUser.getId());
|
constructionUserExit.setUserId(constructionUser.getId());
|
||||||
@ -254,7 +264,7 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
|||||||
constructionUserExitService.save(constructionUserExit);
|
constructionUserExitService.save(constructionUserExit);
|
||||||
// 同步修改用户表的team_id字段
|
// 同步修改用户表的team_id字段
|
||||||
LambdaUpdateWrapper<SubConstructionUser> constructionUserLuw = Wrappers.lambdaUpdate(SubConstructionUser.class)
|
LambdaUpdateWrapper<SubConstructionUser> constructionUserLuw = Wrappers.lambdaUpdate(SubConstructionUser.class)
|
||||||
.eq(SubConstructionUser::getId, projectTeamMember.getMemberId())
|
.eq(SubConstructionUser::getId, constructionUser.getId())
|
||||||
.set(SubConstructionUser::getTeamId, null)
|
.set(SubConstructionUser::getTeamId, null)
|
||||||
.set(SubConstructionUser::getLeaveDate, new Date());
|
.set(SubConstructionUser::getLeaveDate, new Date());
|
||||||
constructionUserService.update(constructionUserLuw);
|
constructionUserService.update(constructionUserLuw);
|
||||||
@ -277,8 +287,8 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
|||||||
BeanUtils.copyProperties(projectTeamMember, projectTeamMemberVo);
|
BeanUtils.copyProperties(projectTeamMember, projectTeamMemberVo);
|
||||||
// 关联获取施工人员信息
|
// 关联获取施工人员信息
|
||||||
Long memberId = projectTeamMember.getMemberId();
|
Long memberId = projectTeamMember.getMemberId();
|
||||||
SubConstructionUser constructionUser = constructionUserService.getById(memberId);
|
SysUserVo userVo = userService.selectUserById(memberId);
|
||||||
projectTeamMemberVo.setMemberName(constructionUser.getUserName());
|
projectTeamMemberVo.setMemberName(userVo.getNickName());
|
||||||
return projectTeamMemberVo;
|
return projectTeamMemberVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,11 +314,12 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
|||||||
String remark = req.getRemark();
|
String remark = req.getRemark();
|
||||||
// 联表查询
|
// 联表查询
|
||||||
if (StringUtils.isNotBlank(memberName)) {
|
if (StringUtils.isNotBlank(memberName)) {
|
||||||
QueryWrapper<SubConstructionUser> constructionUserQueryWrapper = new QueryWrapper<>();
|
LambdaQueryWrapper<SysUser> sysUserLqw = new LambdaQueryWrapper<>();
|
||||||
constructionUserQueryWrapper.select("id");
|
sysUserLqw.select(SysUser::getUserId);
|
||||||
constructionUserQueryWrapper.like("user_name", memberName);
|
sysUserLqw.like(SysUser::getNickName, memberName);
|
||||||
List<Long> constructionUserIdList = constructionUserService.listObjs(constructionUserQueryWrapper, obj -> (Long) obj);
|
List<SysUserVo> userVos = userService.selectUserListByNikeName(memberName);
|
||||||
lqw.in(BusProjectTeamMember::getMemberId, constructionUserIdList);
|
List<Long> userIds = userVos.stream().map(SysUserVo::getUserId).distinct().filter(Objects::nonNull).toList();
|
||||||
|
lqw.in(BusProjectTeamMember::getMemberId, userIds);
|
||||||
}
|
}
|
||||||
// 模糊查询
|
// 模糊查询
|
||||||
lqw.like(StringUtils.isNotBlank(remark), BusProjectTeamMember::getRemark, remark);
|
lqw.like(StringUtils.isNotBlank(remark), BusProjectTeamMember::getRemark, remark);
|
||||||
@ -338,18 +349,18 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
|||||||
return projectTeamMemberVoPage;
|
return projectTeamMemberVoPage;
|
||||||
}
|
}
|
||||||
// 关联查询施工人员信息
|
// 关联查询施工人员信息
|
||||||
Set<Long> teamMemberIdSet = projectTeamMemberList.stream().map(BusProjectTeamMember::getMemberId)
|
List<Long> teamMemberIds = projectTeamMemberList.stream().map(BusProjectTeamMember::getMemberId)
|
||||||
.collect(Collectors.toSet());
|
.distinct().toList();
|
||||||
Map<Long, List<SubConstructionUser>> contractorIdContractorList = constructionUserService.listByIds(teamMemberIdSet).stream()
|
List<SysUserVo> userVos = userService.selectUserByIds(teamMemberIds, null);
|
||||||
.collect(Collectors.groupingBy(SubConstructionUser::getId));
|
Map<Long, SysUserVo> userVoMap = userVos.stream().collect(Collectors.toMap(SysUserVo::getUserId, userVo -> userVo));
|
||||||
// 填充信息
|
// 填充信息
|
||||||
List<BusProjectTeamMemberVo> projectTeamMemberVoList = projectTeamMemberList.stream().map(projectTeamMember -> {
|
List<BusProjectTeamMemberVo> projectTeamMemberVoList = projectTeamMemberList.stream().map(projectTeamMember -> {
|
||||||
BusProjectTeamMemberVo projectTeamMemberVo = new BusProjectTeamMemberVo();
|
BusProjectTeamMemberVo projectTeamMemberVo = new BusProjectTeamMemberVo();
|
||||||
BeanUtils.copyProperties(projectTeamMember, projectTeamMemberVo);
|
BeanUtils.copyProperties(projectTeamMember, projectTeamMemberVo);
|
||||||
Long memberId = projectTeamMember.getMemberId();
|
Long memberId = projectTeamMember.getMemberId();
|
||||||
String memberName = null;
|
String memberName = null;
|
||||||
if (contractorIdContractorList.containsKey(memberId)) {
|
if (userVoMap.containsKey(memberId)) {
|
||||||
memberName = contractorIdContractorList.get(memberId).get(0).getUserName();
|
memberName = userVoMap.get(memberId).getNickName();
|
||||||
}
|
}
|
||||||
projectTeamMemberVo.setMemberName(memberName);
|
projectTeamMemberVo.setMemberName(memberName);
|
||||||
return projectTeamMemberVo;
|
return projectTeamMemberVo;
|
||||||
|
@ -91,6 +91,14 @@ public interface ISysUserService {
|
|||||||
*/
|
*/
|
||||||
String selectUserPostGroup(Long userId);
|
String selectUserPostGroup(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户昵称获取用户列表
|
||||||
|
*
|
||||||
|
* @param nickName 用户昵称
|
||||||
|
* @return 用户列表
|
||||||
|
*/
|
||||||
|
List<SysUserVo> selectUserListByNikeName(String nickName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验用户名称是否唯一
|
* 校验用户名称是否唯一
|
||||||
*
|
*
|
||||||
|
@ -251,6 +251,18 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
return StreamUtils.join(list, SysPostVo::getPostName);
|
return StreamUtils.join(list, SysPostVo::getPostName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户昵称获取用户列表
|
||||||
|
*
|
||||||
|
* @param nickName 用户昵称
|
||||||
|
* @return 用户列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysUserVo> selectUserListByNikeName(String nickName) {
|
||||||
|
return baseMapper.selectUserList(new LambdaQueryWrapper<SysUser>()
|
||||||
|
.like(StringUtils.isNotBlank(nickName), SysUser::getNickName, nickName));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验用户名称是否唯一
|
* 校验用户名称是否唯一
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user