[add] 卷册目录、工程单价
This commit is contained in:
@ -75,6 +75,17 @@ public class DesVolumeCatalogController extends BaseController {
|
||||
return R.ok(volumeFileService.getVoList(volumeFiles));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户查看文件
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@GetMapping("/viewerFile/{id}")
|
||||
public R<Void> viewerFile(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return toAjax(desVolumeCatalogService.viewerFile(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增卷册目录
|
||||
*/
|
||||
|
@ -5,7 +5,6 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
@ -51,11 +50,10 @@ public class DesVolumeFileController extends BaseController {
|
||||
@Log(title = "卷册文件", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody DesVolumeFileCreateReq req) {
|
||||
public R<Void> add(@Validated @RequestBody DesVolumeFileCreateReq req) {
|
||||
return toAjax(desVolumeFileService.insertByBo(req));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除卷册文件
|
||||
*
|
||||
|
@ -103,4 +103,12 @@ public interface IDesVolumeCatalogService extends IService<DesVolumeCatalog> {
|
||||
* @return 卷册目录对象视图
|
||||
*/
|
||||
Page<DesVolumeCatalogVo> getVoPage(Page<DesVolumeCatalog> volumeCatalogPage);
|
||||
|
||||
/**
|
||||
* 登录用户卷册目录文件查看
|
||||
*
|
||||
* @param id 卷册目录id
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean viewerFile(Long id);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.design.domain.DesVolumeCatalog;
|
||||
import org.dromara.design.domain.DesVolumeFile;
|
||||
import org.dromara.design.domain.DesVolumeFileViewer;
|
||||
@ -23,13 +24,19 @@ import org.dromara.design.service.IDesVolumeCatalogService;
|
||||
import org.dromara.design.service.IDesVolumeFileService;
|
||||
import org.dromara.design.service.IDesVolumeFileViewerService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 卷册目录Service业务层处理
|
||||
@ -44,6 +51,9 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
||||
@Resource
|
||||
private IBusProjectService projectService;
|
||||
|
||||
@Resource
|
||||
private ISysUserService userService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private IDesVolumeFileService volumeFileService;
|
||||
@ -100,6 +110,8 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
||||
public List<DesVolumeFile> queryFileListById(Long id) {
|
||||
return volumeFileService.lambdaQuery()
|
||||
.eq(DesVolumeFile::getVolumeCatalogId, id)
|
||||
.orderByAsc(DesVolumeFile::getStatus)
|
||||
.orderByDesc(DesVolumeFile::getCreateDept)
|
||||
.list();
|
||||
}
|
||||
|
||||
@ -212,6 +224,24 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
||||
// 关联文件信息
|
||||
List<DesVolumeFile> volumeFiles = this.queryFileListById(volumeCatalog.getId());
|
||||
vo.setFileVoList(volumeFileService.getVoList(volumeFiles));
|
||||
// 关联查阅人信息
|
||||
List<DesVolumeFileViewer> allViewerList = volumeFileViewerService.lambdaQuery()
|
||||
.eq(DesVolumeFileViewer::getVolumeCatalogId, volumeCatalog.getId()).list();
|
||||
List<Long> userIds = allViewerList.stream().map(DesVolumeFileViewer::getUserId).distinct().toList();
|
||||
List<SysUserVo> userVoList = userService.selectUserByIds(userIds, null);
|
||||
Map<Long, SysUserVo> userVoMap = userVoList.stream().collect(Collectors.toMap(SysUserVo::getUserId, Function.identity()));
|
||||
List<SysUserVo> viewerList = new ArrayList<>();
|
||||
List<SysUserVo> noViewerList = new ArrayList<>();
|
||||
allViewerList.forEach(viewer -> {
|
||||
SysUserVo userVo = userVoMap.get(viewer.getUserId());
|
||||
if (viewer.getStatus().equals("2")) {
|
||||
viewerList.add(userVo);
|
||||
} else {
|
||||
noViewerList.add(userVo);
|
||||
}
|
||||
});
|
||||
vo.setViewerList(viewerList);
|
||||
vo.setNoViewerList(noViewerList);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@ -254,12 +284,35 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
||||
if (CollUtil.isEmpty(volumeCatalogList)) {
|
||||
return volumeCatalogVoPage;
|
||||
}
|
||||
List<DesVolumeCatalogVo> volumeCatalogVoList = volumeCatalogList.stream().map(entity -> {
|
||||
DesVolumeCatalogVo volumeCatalogVo = new DesVolumeCatalogVo();
|
||||
BeanUtils.copyProperties(entity, volumeCatalogVo);
|
||||
return volumeCatalogVo;
|
||||
}).toList();
|
||||
List<DesVolumeCatalogVo> volumeCatalogVoList = volumeCatalogList.stream().map(this::getVo).toList();
|
||||
return volumeCatalogVoPage.setRecords(volumeCatalogVoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录用户卷册目录文件查看
|
||||
*
|
||||
* @param id 卷册目录id
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean viewerFile(Long id) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
if (userId == null) {
|
||||
return false;
|
||||
}
|
||||
DesVolumeFileViewer viewer = volumeFileViewerService.lambdaQuery()
|
||||
.eq(DesVolumeFileViewer::getVolumeCatalogId, id)
|
||||
.eq(DesVolumeFileViewer::getUserId, userId)
|
||||
.eq(DesVolumeFileViewer::getStatus, "1")
|
||||
.one();
|
||||
if (viewer != null) {
|
||||
viewer.setStatus("2");
|
||||
boolean update = volumeFileViewerService.updateById(viewer);
|
||||
if (!update) {
|
||||
throw new ServiceException("卷册目录文件查看失败", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -76,54 +76,67 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
if (volumeCatalog == null) {
|
||||
throw new ServiceException("对应卷册目录不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
// 查看文件是否存在
|
||||
SysOssVo ossVo = ossService.getById(req.getFileId());
|
||||
if (ossVo == null) {
|
||||
throw new ServiceException("对应文件不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
// 判断是否需要废除其他文件
|
||||
List<Long> cancellationIds = req.getCancellationIds();
|
||||
if (CollUtil.isNotEmpty(cancellationIds)) {
|
||||
List<DesVolumeFile> list = this.listByIds(cancellationIds);
|
||||
list.forEach(item -> {
|
||||
if (item.getStatus().equals("2")) {
|
||||
return;
|
||||
}
|
||||
String name = item.getFileName();
|
||||
String modified = name.replaceAll("((\\d{8}))", "($1-已作废)");
|
||||
item.setFileName(modified);
|
||||
item.setStatus("2");
|
||||
});
|
||||
boolean update = this.updateBatchById(list);
|
||||
if (!update) {
|
||||
throw new ServiceException("更新卷册文件信息异常", HttpStatus.ERROR);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
boolean update = this.updateBatchById(list);
|
||||
if (!update) {
|
||||
throw new ServiceException("更新卷册文件信息异常", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
DesVolumeFile file = new DesVolumeFile();
|
||||
BeanUtils.copyProperties(req, file);
|
||||
String today = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
file.setFileName(ossVo.getFileName() + "(" + today + ")");
|
||||
// 新增审阅人
|
||||
List<Long> userIds = req.getUserIds();
|
||||
List<DesVolumeFileViewer> viewerList = userIds.stream().map(userId -> {
|
||||
DesVolumeFileViewer viewer = new DesVolumeFileViewer();
|
||||
viewer.setVolumeCatalogId(volumeCatalogId);
|
||||
viewer.setUserId(userId);
|
||||
return viewer;
|
||||
}).toList();
|
||||
if (CollUtil.isNotEmpty(viewerList)) {
|
||||
if (CollUtil.isNotEmpty(userIds)) {
|
||||
List<DesVolumeFileViewer> viewerList = userIds.stream().map(userId -> {
|
||||
DesVolumeFileViewer viewer = new DesVolumeFileViewer();
|
||||
viewer.setVolumeCatalogId(volumeCatalogId);
|
||||
viewer.setUserId(userId);
|
||||
return viewer;
|
||||
}).toList();
|
||||
// 删除以前的审阅人
|
||||
boolean remove = volumeFileViewerService.remove(new LambdaQueryWrapper<DesVolumeFileViewer>()
|
||||
.eq(DesVolumeFileViewer::getVolumeCatalogId, volumeCatalogId));
|
||||
if (!remove) {
|
||||
throw new ServiceException("修改审阅人失败", HttpStatus.ERROR);
|
||||
Long count = volumeFileViewerService.lambdaQuery()
|
||||
.eq(DesVolumeFileViewer::getVolumeCatalogId, volumeCatalogId)
|
||||
.count();
|
||||
if (count > 0) {
|
||||
boolean remove = volumeFileViewerService.remove(new LambdaQueryWrapper<DesVolumeFileViewer>()
|
||||
.eq(DesVolumeFileViewer::getVolumeCatalogId, volumeCatalogId));
|
||||
if (!remove) {
|
||||
throw new ServiceException("修改审阅人失败", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
boolean result = volumeFileViewerService.saveBatch(viewerList);
|
||||
if (!result) {
|
||||
throw new ServiceException("修改审阅人失败", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
boolean save = this.save(file);
|
||||
if (!save) {
|
||||
throw new ServiceException("新增卷册文件信息异常", HttpStatus.ERROR);
|
||||
// 查看文件是否存在
|
||||
if (req.getFileId() != null) {
|
||||
SysOssVo ossVo = ossService.getById(req.getFileId());
|
||||
if (ossVo == null) {
|
||||
throw new ServiceException("对应文件不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
DesVolumeFile file = new DesVolumeFile();
|
||||
BeanUtils.copyProperties(req, file);
|
||||
String today = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
file.setFileName(ossVo.getOriginalName() + "(" + today + ")");
|
||||
boolean save = this.save(file);
|
||||
if (!save) {
|
||||
throw new ServiceException("新增卷册文件信息异常", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -156,7 +169,6 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
Long fileId = volumeFile.getFileId();
|
||||
SysOssVo ossVo = ossService.getById(fileId);
|
||||
vo.setFileUrl(ossVo.getUrl());
|
||||
vo.setFileName(ossVo.getFileName());
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -67,16 +68,16 @@ public class PgsProgressPlan extends BaseEntity {
|
||||
/**
|
||||
* 计划数量/百分比
|
||||
*/
|
||||
private Long planNumber;
|
||||
private BigDecimal planNumber;
|
||||
|
||||
/**
|
||||
* 完成数量/百分比
|
||||
*/
|
||||
private Long finishedNumber;
|
||||
private BigDecimal finishedNumber;
|
||||
|
||||
/**
|
||||
* 延期数量/百分比
|
||||
*/
|
||||
private Long delayNumber;
|
||||
private BigDecimal delayNumber;
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -52,12 +53,12 @@ public class PgsProgressPlanDetail extends BaseEntity {
|
||||
/**
|
||||
* 计划数量/百分比
|
||||
*/
|
||||
private Long planNumber;
|
||||
private BigDecimal planNumber;
|
||||
|
||||
/**
|
||||
* 完成数量/百分比
|
||||
*/
|
||||
private Long finishedNumber;
|
||||
private BigDecimal finishedNumber;
|
||||
|
||||
/**
|
||||
* 完成详情
|
||||
@ -67,6 +68,6 @@ public class PgsProgressPlanDetail extends BaseEntity {
|
||||
/**
|
||||
* AI填入数量
|
||||
*/
|
||||
private Long aiFill;
|
||||
private BigDecimal aiFill;
|
||||
|
||||
}
|
||||
|
@ -1,49 +0,0 @@
|
||||
package org.dromara.progress.domain.dto.progressplan;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-07-31 11:09
|
||||
*/
|
||||
@Data
|
||||
public class PgsProgressPlanCompletionQueryReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -164680742400225346L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@NotNull(message = "项目id不能为空")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 方阵id
|
||||
*/
|
||||
private Long matrixId;
|
||||
|
||||
/**
|
||||
* 进度类型id
|
||||
*/
|
||||
private Long progressCategoryId;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailC
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -49,7 +50,7 @@ public class PgsProgressPlanCreateReq implements Serializable {
|
||||
/**
|
||||
* 计划数量/百分比
|
||||
*/
|
||||
private Long planNumber;
|
||||
private BigDecimal planNumber;
|
||||
|
||||
/**
|
||||
* 计划详情列表
|
||||
|
@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -25,6 +26,6 @@ public class PgsProgressPlanDetailCreateDto {
|
||||
/**
|
||||
* 计划数量/百分比
|
||||
*/
|
||||
private Long planNumber;
|
||||
private BigDecimal planNumber;
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
@ -23,6 +24,6 @@ public class PgsProgressPlanDetailPercentageCreateReq implements Serializable {
|
||||
/**
|
||||
* 完成数量
|
||||
*/
|
||||
private Long finishedNumber;
|
||||
private BigDecimal finishedNumber;
|
||||
|
||||
}
|
||||
|
@ -118,4 +118,22 @@ public class PgsProgressCategoryVo implements Serializable {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
@ExcelProperty(value = "计量单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 综合单价
|
||||
*/
|
||||
@ExcelProperty(value = "综合单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 产值金额
|
||||
*/
|
||||
@ExcelProperty(value = "产值金额")
|
||||
private BigDecimal outputValue;
|
||||
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
package org.dromara.progress.domain.vo.progressplan;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-07-31 11:05
|
||||
*/
|
||||
@Data
|
||||
public class PgsProgressPlanCompletionVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -8747773569107876299L;
|
||||
|
||||
/**
|
||||
* 子项目id
|
||||
*/
|
||||
private Long subProjectId;
|
||||
|
||||
/**
|
||||
* 子项目名称
|
||||
*/
|
||||
private String subProjectName;
|
||||
|
||||
/**
|
||||
* 方阵id
|
||||
*/
|
||||
private Long matrixId;
|
||||
|
||||
/**
|
||||
* 方阵名称
|
||||
*/
|
||||
private String matrixName;
|
||||
}
|
@ -10,6 +10,7 @@ import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNu
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -64,24 +65,24 @@ public class PgsProgressPlanVo implements Serializable {
|
||||
* 计划数量/百分比
|
||||
*/
|
||||
@ExcelProperty(value = "计划数量/百分比")
|
||||
private Long planNumber;
|
||||
private BigDecimal planNumber;
|
||||
|
||||
/**
|
||||
* 完成数量/百分比
|
||||
*/
|
||||
@ExcelProperty(value = "完成数量/百分比")
|
||||
private Long finishedNumber;
|
||||
private BigDecimal finishedNumber;
|
||||
|
||||
/**
|
||||
* 延期数量/百分比
|
||||
*/
|
||||
@ExcelProperty(value = "延迟数量/百分比")
|
||||
private Long delayNumber;
|
||||
private BigDecimal delayNumber;
|
||||
|
||||
/**
|
||||
* AI自动填入
|
||||
*/
|
||||
private Long aiFill;
|
||||
private BigDecimal aiFill;
|
||||
|
||||
/**
|
||||
* 进度计划详情
|
||||
|
@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -30,16 +31,16 @@ public class PgsProgressPlanDetailNumVo {
|
||||
/**
|
||||
* 计划数量/百分比
|
||||
*/
|
||||
private Long planNumber;
|
||||
private BigDecimal planNumber;
|
||||
|
||||
/**
|
||||
* 完成数量/百分比
|
||||
*/
|
||||
private Long finishedNumber;
|
||||
private BigDecimal finishedNumber;
|
||||
|
||||
/**
|
||||
* AI填入数量
|
||||
*/
|
||||
private Long aiFill;
|
||||
private BigDecimal aiFill;
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.progress.domain.vo.progressplandetail;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import org.dromara.progress.domain.PgsProgressPlanDetail;
|
||||
@ -54,19 +55,18 @@ public class PgsProgressPlanDetailVo implements Serializable {
|
||||
* 计划数量/百分比
|
||||
*/
|
||||
@ExcelProperty(value = "计划数量/百分比")
|
||||
private Long planNumber;
|
||||
private BigDecimal planNumber;
|
||||
|
||||
/**
|
||||
* 完成数量/百分比
|
||||
*/
|
||||
@ExcelProperty(value = "完成数量/百分比")
|
||||
private Long finishedNumber;
|
||||
private BigDecimal finishedNumber;
|
||||
|
||||
/**
|
||||
* AI填入数量
|
||||
*/
|
||||
@ExcelProperty(value = "AI填入数量")
|
||||
private Long aiFill;
|
||||
|
||||
private BigDecimal aiFill;
|
||||
|
||||
}
|
||||
|
@ -7,12 +7,11 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.domain.PgsProgressPlan;
|
||||
import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanCompletionQueryReq;
|
||||
import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanQueryReq;
|
||||
import org.dromara.progress.domain.vo.progressplan.PgsProgressPlanCompletionVo;
|
||||
import org.dromara.progress.domain.vo.progressplan.PgsProgressPlanVo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -40,15 +39,6 @@ public interface IPgsProgressPlanService extends IService<PgsProgressPlan> {
|
||||
*/
|
||||
TableDataInfo<PgsProgressPlanVo> queryPageList(PgsProgressPlanQueryReq req, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 分项工程完成明细列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 分项工程完成明细列表
|
||||
*/
|
||||
TableDataInfo<PgsProgressPlanCompletionVo> queryPageCompletionDetailList(PgsProgressPlanCompletionQueryReq req, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的进度计划列表
|
||||
*
|
||||
@ -103,7 +93,7 @@ public interface IPgsProgressPlanService extends IService<PgsProgressPlan> {
|
||||
* @param planNumber 计划数量
|
||||
* @param progressCategory 进度类别
|
||||
*/
|
||||
void validPlanNumber(Long planNumber, PgsProgressCategory progressCategory);
|
||||
void validPlanNumber(BigDecimal planNumber, PgsProgressCategory progressCategory);
|
||||
|
||||
/**
|
||||
* 校验计划是否延迟
|
||||
|
@ -593,7 +593,7 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
PgsProgressPlanDetailDateVo detailDateVo = new PgsProgressPlanDetailDateVo();
|
||||
detailDateVo.setId(detail.getId());
|
||||
detailDateVo.setDate(detail.getDate());
|
||||
detailDateVo.setFinishedNumber(new BigDecimal(detail.getFinishedNumber()));
|
||||
detailDateVo.setFinishedNumber(detail.getFinishedNumber());
|
||||
String finishedDetail = detail.getFinishedDetail();
|
||||
if (StringUtils.isNotBlank(finishedDetail)) {
|
||||
List<PgsProgressPlanDetailFinishedVo> finishedVoList = JSONUtil.toList(finishedDetail, PgsProgressPlanDetailFinishedVo.class);
|
||||
|
@ -14,6 +14,7 @@ import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.utils.PageConvertUtil;
|
||||
import org.dromara.facility.domain.FacBoxTransformer;
|
||||
import org.dromara.facility.domain.FacInverter;
|
||||
import org.dromara.facility.domain.FacPhotovoltaicPanel;
|
||||
@ -38,7 +39,6 @@ import org.dromara.progress.mapper.PgsProgressPlanDetailMapper;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.progress.service.IPgsProgressPlanDetailService;
|
||||
import org.dromara.progress.service.IPgsProgressPlanService;
|
||||
import org.dromara.common.utils.PageConvertUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -187,7 +187,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
||||
PgsProgressPlanDetail detail = new PgsProgressPlanDetail();
|
||||
detail.setId(id);
|
||||
detail.setFinishedDetail(JSONUtil.toJsonStr(finishedDetailList));
|
||||
detail.setFinishedNumber(progressPlanDetail.getFinishedNumber() + size);
|
||||
detail.setFinishedNumber(progressPlanDetail.getFinishedNumber().add(BigDecimal.valueOf(size)));
|
||||
boolean update = this.updateById(detail);
|
||||
if (!update) {
|
||||
throw new ServiceException("更新进度计划详情异常", HttpStatus.ERROR);
|
||||
@ -221,14 +221,16 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertPercentageDetail(PgsProgressPlanDetailPercentageCreateReq req) {
|
||||
// 校验
|
||||
Long finishedNumber = req.getFinishedNumber();
|
||||
BigDecimal finishedNumber = req.getFinishedNumber();
|
||||
if (finishedNumber == null) {
|
||||
throw new ServiceException("完成百分比不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (finishedNumber < 0) {
|
||||
// 判断是否小于 0
|
||||
if (finishedNumber.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException("完成百分比不能小于0", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (finishedNumber > 100) {
|
||||
// 判断是否大于 100
|
||||
if (finishedNumber.compareTo(BigDecimal.valueOf(100)) > 0) {
|
||||
throw new ServiceException("完成百分比不能大于100", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
Long id = req.getId();
|
||||
@ -246,8 +248,8 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
||||
if (progressCategory == null) {
|
||||
throw new ServiceException("进度计划类别信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
Long number = progressPlanDetail.getFinishedNumber();
|
||||
Long finishedNumberTotal = progressPlan.getFinishedNumber();
|
||||
BigDecimal number = progressPlanDetail.getFinishedNumber();
|
||||
BigDecimal finishedNumberTotal = progressPlan.getFinishedNumber();
|
||||
// todo 是否判断完成百分比是否大于计划进度
|
||||
/* if (finishedNumberTotal + finishedNumber > progressPlan.getPlanNumber()) {
|
||||
throw new ServiceException("完成百分比不能大于计划进度", HttpStatus.BAD_REQUEST);
|
||||
@ -258,13 +260,13 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
||||
if (!update) {
|
||||
throw new ServiceException("更新进度计划详情异常", HttpStatus.ERROR);
|
||||
}
|
||||
progressPlan.setFinishedNumber(finishedNumberTotal - number + finishedNumber);
|
||||
progressPlan.setFinishedNumber(finishedNumberTotal.subtract(number).add(finishedNumber));
|
||||
boolean result = progressPlanService.updateById(progressPlan);
|
||||
if (!result) {
|
||||
throw new ServiceException("更新进度计划异常", HttpStatus.ERROR);
|
||||
}
|
||||
BigDecimal completed = progressCategory.getCompleted();
|
||||
BigDecimal completedTotal = completed.subtract(new BigDecimal(number)).add(new BigDecimal(finishedNumber));
|
||||
BigDecimal completedTotal = completed.subtract(number).add(finishedNumber);
|
||||
progressCategory.setCompleted(completedTotal);
|
||||
if (completedTotal.compareTo(progressCategory.getTotal()) == 0) {
|
||||
progressCategory.setStatus(PgsFinishStatusEnum.FINISH.getValue());
|
||||
@ -464,9 +466,9 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
||||
})
|
||||
.toList();
|
||||
progressPlanDetail.setFinishedDetail(JSONUtil.toJsonStr(newList));
|
||||
progressPlanDetail.setFinishedNumber((long) newList.size());
|
||||
long aiFill = progressPlanDetail.getAiFill() - (long) finishType2Count.get();
|
||||
progressPlanDetail.setAiFill(Math.max(aiFill, 0L));
|
||||
progressPlanDetail.setFinishedNumber(BigDecimal.valueOf(newList.size()));
|
||||
BigDecimal aiFill = progressPlanDetail.getAiFill().subtract(BigDecimal.valueOf(finishType2Count.get()));
|
||||
progressPlanDetail.setAiFill(aiFill.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : aiFill);
|
||||
boolean updatePlanDetail = this.updateById(progressPlanDetail);
|
||||
if (!updatePlanDetail) {
|
||||
throw new ServiceException("修改进度计划详情失败,数据库异常", HttpStatus.ERROR);
|
||||
|
@ -17,13 +17,11 @@ import org.dromara.facility.service.IFacMatrixService;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.domain.PgsProgressPlan;
|
||||
import org.dromara.progress.domain.PgsProgressPlanDetail;
|
||||
import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanCompletionQueryReq;
|
||||
import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanQueryReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateDto;
|
||||
import org.dromara.progress.domain.enums.PgsDelayStatusEnum;
|
||||
import org.dromara.progress.domain.enums.PgsFinishStatusEnum;
|
||||
import org.dromara.progress.domain.vo.progressplan.PgsProgressPlanCompletionVo;
|
||||
import org.dromara.progress.domain.vo.progressplan.PgsProgressPlanVo;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNumVo;
|
||||
import org.dromara.progress.mapper.PgsProgressPlanMapper;
|
||||
@ -94,18 +92,6 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
return TableDataInfo.build(this.getVoPage(result));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分项工程完成明细列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 分项工程完成明细列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<PgsProgressPlanCompletionVo> queryPageCompletionDetailList(PgsProgressPlanCompletionQueryReq req, PageQuery pageQuery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的进度计划列表
|
||||
*
|
||||
@ -211,7 +197,7 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
}
|
||||
Long projectId = progressPlan.getProjectId();
|
||||
projectService.validAuth(projectId, userId);
|
||||
if (progressPlan.getPlanNumber() != null && progressPlan.getPlanNumber() != 0) {
|
||||
if (progressPlan.getPlanNumber() != null && progressPlan.getPlanNumber().compareTo(BigDecimal.ZERO) != 0) {
|
||||
throw new ServiceException("已存在完成的设施,无法删除", HttpStatus.CONFLICT);
|
||||
}
|
||||
// 删除数据
|
||||
@ -317,11 +303,12 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
// 获取详情列表
|
||||
Long id = progressPlan.getId();
|
||||
List<PgsProgressPlanDetailNumVo> numDetailList = new ArrayList<>();
|
||||
long aiFill = 0L;
|
||||
BigDecimal aiFill = new BigDecimal(0);
|
||||
if (detailMap.containsKey(id)) {
|
||||
numDetailList = progressPlanDetailService.getNumVoList(detailMap.get(id));
|
||||
for (PgsProgressPlanDetailNumVo vo : numDetailList) {
|
||||
aiFill += vo.getAiFill() != null ? vo.getAiFill() : 0L;
|
||||
BigDecimal fill = vo.getAiFill() != null ? vo.getAiFill() : BigDecimal.ZERO;
|
||||
aiFill = aiFill.add(fill);
|
||||
}
|
||||
}
|
||||
progressPlanVo.setDetailList(numDetailList);
|
||||
@ -339,14 +326,14 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
* @param progressCategory 进度类别
|
||||
*/
|
||||
@Override
|
||||
public void validPlanNumber(Long planNumber, PgsProgressCategory progressCategory) {
|
||||
public void validPlanNumber(BigDecimal planNumber, PgsProgressCategory progressCategory) {
|
||||
if (progressCategory == null) {
|
||||
throw new ServiceException("进度类别不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
BigDecimal total = progressCategory.getTotal();
|
||||
BigDecimal completed = progressCategory.getCompleted();
|
||||
BigDecimal planTotal = total.subtract(completed);
|
||||
if (planNumber.compareTo(planTotal.longValue()) > 0) {
|
||||
if (planNumber.compareTo(planTotal) > 0) {
|
||||
throw new ServiceException("计划数量不能大于剩余数量", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@ -382,7 +369,7 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
List<PgsProgressPlan> delayList = value.stream().map(progressPlan -> {
|
||||
PgsProgressPlan newProgressPlan = new PgsProgressPlan();
|
||||
newProgressPlan.setId(progressPlan.getId());
|
||||
newProgressPlan.setDelayNumber(progressPlan.getPlanNumber() - progressPlan.getFinishedNumber());
|
||||
newProgressPlan.setDelayNumber(progressPlan.getPlanNumber().subtract(progressPlan.getFinishedNumber()));
|
||||
return newProgressPlan;
|
||||
}).toList();
|
||||
progressPlanList.addAll(delayList);
|
||||
|
Reference in New Issue
Block a user