[add] 新增进度计划添加计划、日报相关接口 [update] 修改进度计划、设施相关接口
This commit is contained in:
@ -0,0 +1,24 @@
|
||||
package org.dromara.facility.domain.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/5/28 10:17
|
||||
*/
|
||||
@Getter
|
||||
public enum FacFinishTypeEnum {
|
||||
|
||||
HAND("手动填报", "1"),
|
||||
AI("AI填报", "2");
|
||||
|
||||
private final String text;
|
||||
|
||||
private final String value;
|
||||
|
||||
FacFinishTypeEnum(String text, String value) {
|
||||
this.text = text;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
@ -30,7 +30,7 @@ import org.dromara.progress.constant.PgsProgressCategoryConstant;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.utils.JSTUtils;
|
||||
import org.dromara.utils.JSTUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -191,7 +191,7 @@ public class FacBoxTransformerServiceImpl extends ServiceImpl<FacBoxTransformerM
|
||||
continue;
|
||||
}
|
||||
// 获取箱变名称
|
||||
String name = JSTUtils.findNearestText(coordinates, nameGeoJson);
|
||||
String name = JSTUtil.findNearestText(coordinates, nameGeoJson);
|
||||
if (name == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import org.dromara.progress.constant.PgsProgressCategoryConstant;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.utils.JSTUtils;
|
||||
import org.dromara.utils.JSTUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -191,7 +191,7 @@ public class FacInverterServiceImpl extends ServiceImpl<FacInverterMapper, FacIn
|
||||
continue;
|
||||
}
|
||||
// 获取逆变器名称
|
||||
String name = JSTUtils.findNearestText(coordinates, nameGeoJson);
|
||||
String name = JSTUtil.findNearestText(coordinates, nameGeoJson);
|
||||
if (name == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import org.dromara.facility.service.*;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.utils.JSTUtils;
|
||||
import org.dromara.utils.JSTUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
@ -289,9 +289,9 @@ public class FacMatrixServiceImpl extends ServiceImpl<FacMatrixMapper, FacMatrix
|
||||
matrix.setProjectId(projectId);
|
||||
FacGeometry geometry = feature.getGeometry();
|
||||
// 获取坐标信息
|
||||
List<List<Double>> coordinatesList = JSTUtils.getTwoDimensionalCoordinates(geometry);
|
||||
List<List<Double>> coordinatesList = JSTUtil.getTwoDimensionalCoordinates(geometry);
|
||||
// 获取方阵名称
|
||||
String nameStr = JSTUtils.findNearestPointText(coordinatesList, nameFeatures);
|
||||
String nameStr = JSTUtil.findNearestPointText(coordinatesList, nameFeatures);
|
||||
String name = nameStr.split(" ")[0];
|
||||
if (name == null) {
|
||||
continue;
|
||||
@ -528,7 +528,7 @@ public class FacMatrixServiceImpl extends ServiceImpl<FacMatrixMapper, FacMatrix
|
||||
for (String s : arr) {
|
||||
positionList.add(JSONUtil.toList(s, Double.class));
|
||||
}
|
||||
Boolean result = JSTUtils.pointIsWithInPlane(positionList, coordinates);
|
||||
Boolean result = JSTUtil.pointIsWithInPlane(positionList, coordinates);
|
||||
if (result) {
|
||||
matchMatrix = matrix;
|
||||
break;
|
||||
@ -554,12 +554,12 @@ public class FacMatrixServiceImpl extends ServiceImpl<FacMatrixMapper, FacMatrix
|
||||
for (String s : arr) {
|
||||
positionList.add(JSONUtil.toList(s, Double.class));
|
||||
}
|
||||
Boolean result = JSTUtils.planeIsWithInPlane(positionList, coordinates);
|
||||
Boolean result = JSTUtil.planeIsWithInPlane(positionList, coordinates);
|
||||
if (result) {
|
||||
matchMatrix = matrix;
|
||||
break;
|
||||
} else {
|
||||
Boolean areResult = JSTUtils.arePolygonsIntersecting(positionList, coordinates);
|
||||
Boolean areResult = JSTUtil.arePolygonsIntersecting(positionList, coordinates);
|
||||
if (areResult) {
|
||||
matchMatrix = matrix;
|
||||
break;
|
||||
|
@ -25,7 +25,7 @@ import org.dromara.progress.constant.PgsProgressCategoryConstant;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.utils.JSTUtils;
|
||||
import org.dromara.utils.JSTUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
@ -224,7 +224,7 @@ public class FacPhotovoltaicPanelPartsServiceImpl implements IFacPhotovoltaicPan
|
||||
positionList.add(JSONUtil.toList(s, Double.class));
|
||||
}
|
||||
// 获取点在面内的点
|
||||
List<List<Double>> pointInPlaneList = JSTUtils.getPointInPlaneList(positionList, pointPositionList);
|
||||
List<List<Double>> pointInPlaneList = JSTUtil.getPointInPlaneList(positionList, pointPositionList);
|
||||
// 删除点在面内的点
|
||||
pointPositionList.removeAll(pointInPlaneList);
|
||||
// 判断点在面内的点是否为空
|
||||
|
@ -32,7 +32,7 @@ import org.dromara.progress.constant.PgsProgressCategoryConstant;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.utils.JSTUtils;
|
||||
import org.dromara.utils.JSTUtil;
|
||||
import org.springframework.aop.framework.AopContext;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@ -216,7 +216,7 @@ public class FacPhotovoltaicPanelServiceImpl extends ServiceImpl<FacPhotovoltaic
|
||||
FacMatrix matrix = matrixService.getMatrixIdBy2Coordinates(matrixList, coordinates);
|
||||
if (matrix == null) return Collections.emptyList();
|
||||
// ③ 获取名称
|
||||
String name = JSTUtils.findNearestPointText(coordinates, nameFeatures);
|
||||
String name = JSTUtil.findNearestPointText(coordinates, nameFeatures);
|
||||
if (name == null) return Collections.emptyList();
|
||||
// ④ 获取进度类别
|
||||
Long matrixId = matrix.getId();
|
||||
|
@ -16,6 +16,7 @@ import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreateReq;
|
||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq;
|
||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq;
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryLastTimeVo;
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryVo;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -70,6 +71,18 @@ public class PgsProgressCategoryController extends BaseController {
|
||||
return R.ok(pgsProgressCategoryService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取进度类别最后一次进度信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("progress:progressCategory:query")
|
||||
@GetMapping("/lastTime/{id}")
|
||||
public R<PgsProgressCategoryLastTimeVo> getLastTimeInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(pgsProgressCategoryService.queryLastTimeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增进度类别
|
||||
*/
|
||||
|
@ -83,13 +83,13 @@ public class PgsProgressPlanController extends BaseController {
|
||||
/**
|
||||
* 删除进度计划
|
||||
*
|
||||
* @param ids 主键串
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("progress:progressPlan:remove")
|
||||
@Log(title = "进度计划", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@DeleteMapping("/{id}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(pgsProgressPlanService.deleteWithValidByIds(List.of(ids), true));
|
||||
@PathVariable Long id) {
|
||||
return toAjax(pgsProgressPlanService.deleteById(id));
|
||||
}
|
||||
}
|
||||
|
@ -2,27 +2,20 @@ package org.dromara.progress.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailQueryReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailUpdateReq;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFacilityVo;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailVo;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailPercentageCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailRemoveReq;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailUnFinishVo;
|
||||
import org.dromara.progress.service.IPgsProgressPlanDetailService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 进度计划详情
|
||||
*
|
||||
@ -38,59 +31,56 @@ public class PgsProgressPlanDetailController extends BaseController {
|
||||
private IPgsProgressPlanDetailService pgsProgressPlanDetailService;
|
||||
|
||||
/**
|
||||
* 查询进度计划详情列表
|
||||
* 新增进度计划详情(普通设施)
|
||||
*/
|
||||
@SaCheckPermission("progress:progressPlanDetail:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<PgsProgressPlanDetailVo> list(PgsProgressPlanDetailQueryReq req, PageQuery pageQuery) {
|
||||
return pgsProgressPlanDetailService.queryPageList(req, pageQuery);
|
||||
@SaCheckPermission("progress:progressPlanDetail:insert")
|
||||
@PostMapping("/insert/detail")
|
||||
public R<Void> insertFinishedDetail(@Validated @RequestBody PgsProgressPlanDetailFinishedCreateReq req) {
|
||||
return toAjax(pgsProgressPlanDetailService.insertFinishedDetail(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出进度计划详情列表
|
||||
* 新增进度计划详情(百分比设施)
|
||||
*/
|
||||
@SaCheckPermission("progress:progressPlanDetail:export")
|
||||
@Log(title = "进度计划详情", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(PgsProgressPlanDetailQueryReq req, HttpServletResponse response) {
|
||||
List<PgsProgressPlanDetailVo> list = pgsProgressPlanDetailService.queryList(req);
|
||||
ExcelUtil.exportExcel(list, "进度计划详情", PgsProgressPlanDetailVo.class, response);
|
||||
@SaCheckPermission("progress:progressPlanDetail:insert")
|
||||
@PostMapping("/insert/percentage")
|
||||
public R<Void> insertPercentageDetail(@Validated @RequestBody PgsProgressPlanDetailPercentageCreateReq req) {
|
||||
return toAjax(pgsProgressPlanDetailService.insertPercentageDetail(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取进度计划详情详细信息
|
||||
* 获取进度计划详情已完成设施详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("progress:progressPlanDetail:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<PgsProgressPlanDetailVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(pgsProgressPlanDetailService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取进度计划详情详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("progress:progressPlanDetail:query")
|
||||
@GetMapping("/detail/{id}")
|
||||
public R<TableDataInfo<PgsProgressPlanDetailFacilityVo>> getDetail(@NotNull(message = "主键不能为空")
|
||||
@GetMapping("/detail/finished/{id}")
|
||||
public TableDataInfo<PgsProgressPlanDetailFinishedVo> getFinishedDetail(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id,
|
||||
PageQuery pageQuery) {
|
||||
return R.ok(pgsProgressPlanDetailService.queryFacilityById(id, pageQuery));
|
||||
return pgsProgressPlanDetailService.queryFinishedById(id, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改进度计划详情
|
||||
* 获取进度计划详情未完成设施详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("progress:progressPlanDetail:edit")
|
||||
@Log(title = "进度计划详情", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody PgsProgressPlanDetailUpdateReq req) {
|
||||
return toAjax(pgsProgressPlanDetailService.updateByBo(req));
|
||||
@SaCheckPermission("progress:progressPlanDetail:query")
|
||||
@GetMapping("/detail/unFinish/{id}")
|
||||
public TableDataInfo<PgsProgressPlanDetailUnFinishVo> getUnFinishDetail(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id,
|
||||
PageQuery pageQuery) {
|
||||
return pgsProgressPlanDetailService.queryUnFinishById(id, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除进度计划详情
|
||||
*/
|
||||
@SaCheckPermission("progress:progressPlanDetail:remove")
|
||||
@DeleteMapping("/remove/detail")
|
||||
public R<Void> removeDetail(@Validated PgsProgressPlanDetailRemoveReq req) {
|
||||
return toAjax(pgsProgressPlanDetailService.removeDetail(req));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,6 +75,11 @@ public class PgsProgressPlan extends BaseEntity {
|
||||
*/
|
||||
private Long finishedNumber;
|
||||
|
||||
/**
|
||||
* 延期数量/百分比
|
||||
*/
|
||||
private Long delayNumber;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
|
@ -40,6 +40,11 @@ public class PgsProgressPlanDetail extends BaseEntity {
|
||||
*/
|
||||
private Long progressPlanId;
|
||||
|
||||
/**
|
||||
* 进度类型id
|
||||
*/
|
||||
private Long progressCategoryId;
|
||||
|
||||
/**
|
||||
* 计划时间
|
||||
*/
|
||||
@ -55,6 +60,11 @@ public class PgsProgressPlanDetail extends BaseEntity {
|
||||
*/
|
||||
private Long finishedNumber;
|
||||
|
||||
/**
|
||||
* 完成详情
|
||||
*/
|
||||
private String finishedDetail;
|
||||
|
||||
/**
|
||||
* AI填入数量
|
||||
*/
|
||||
|
@ -0,0 +1,34 @@
|
||||
package org.dromara.progress.domain.dto.progressplandetail;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/5/28 9:36
|
||||
*/
|
||||
@Data
|
||||
public class PgsProgressPlanDetailFinishedCreateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -5685368912659847672L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 完成详情id列表
|
||||
*/
|
||||
private List<Long> finishedDetailIdList;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package org.dromara.progress.domain.dto.progressplandetail;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/5/28 16:06
|
||||
*/
|
||||
@Data
|
||||
public class PgsProgressPlanDetailPercentageCreateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -2987044313320050949L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 完成数量
|
||||
*/
|
||||
private Long finishedNumber;
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package org.dromara.progress.domain.dto.progressplandetail;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/5/27 10:58
|
||||
*/
|
||||
@Data
|
||||
public class PgsProgressPlanDetailQueryReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -1135087412952022463L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 进度计划id
|
||||
*/
|
||||
private Long progressPlanId;
|
||||
|
||||
/**
|
||||
* 计划时间
|
||||
*/
|
||||
private Date date;
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package org.dromara.progress.domain.dto.progressplandetail;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/5/28 16:34
|
||||
*/
|
||||
@Data
|
||||
public class PgsProgressPlanDetailRemoveReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 2345733680238879534L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 详情id列表
|
||||
*/
|
||||
private List<Long> detailIdList;
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package org.dromara.progress.domain.dto.progressplandetail;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/5/27 10:58
|
||||
*/
|
||||
@Data
|
||||
public class PgsProgressPlanDetailUpdateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -3397212461695330079L;
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.dromara.progress.domain.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/5/28 18:49
|
||||
*/
|
||||
@Getter
|
||||
public enum PgsFinishStatusEnum {
|
||||
|
||||
UNFINISH("未开始", "0"),
|
||||
INPROGRESS("进行中", "1"),
|
||||
FINISH("已完成", "2");
|
||||
|
||||
private final String text;
|
||||
|
||||
private final String value;
|
||||
|
||||
PgsFinishStatusEnum(String text, String value) {
|
||||
this.text = text;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package org.dromara.progress.domain.vo.progresscategory;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/5/28 11:36
|
||||
*/
|
||||
@Data
|
||||
public class PgsProgressCategoryLastTimeVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -3509755254504905644L;
|
||||
|
||||
/**
|
||||
* 计划结束时间
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
private BigDecimal leftNum;
|
||||
|
||||
}
|
@ -89,12 +89,14 @@ public class PgsProgressCategoryVo implements Serializable {
|
||||
/**
|
||||
* 已完成数量百分比
|
||||
*/
|
||||
private String completedPercentage;
|
||||
@JsonSerialize(using = BigDecimalToIntegerSerializer.class)
|
||||
private BigDecimal completedPercentage;
|
||||
|
||||
/**
|
||||
* 计划中数量百分比
|
||||
*/
|
||||
private String planTotalPercentage;
|
||||
@JsonSerialize(using = BigDecimalToIntegerSerializer.class)
|
||||
private BigDecimal planTotalPercentage;
|
||||
|
||||
/**
|
||||
* 是否超期(0否 1是)
|
||||
|
@ -2,6 +2,7 @@ package org.dromara.progress.domain.vo.progressplan;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.progress.domain.PgsProgressPlan;
|
||||
@ -48,12 +49,14 @@ public class PgsProgressPlanVo implements Serializable {
|
||||
/**
|
||||
* 计划开始时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ExcelProperty(value = "计划开始时间")
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 计划结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ExcelProperty(value = "计划结束时间")
|
||||
private Date endDate;
|
||||
|
||||
@ -69,6 +72,17 @@ public class PgsProgressPlanVo implements Serializable {
|
||||
@ExcelProperty(value = "完成数量/百分比")
|
||||
private Long finishedNumber;
|
||||
|
||||
/**
|
||||
* 延期数量/百分比
|
||||
*/
|
||||
@ExcelProperty(value = "延迟数量/百分比")
|
||||
private Long delayNumber;
|
||||
|
||||
/**
|
||||
* AI自动填入
|
||||
*/
|
||||
private Long aiFill;
|
||||
|
||||
/**
|
||||
* 进度计划详情
|
||||
*/
|
||||
|
@ -0,0 +1,31 @@
|
||||
package org.dromara.progress.domain.vo.progressplandetail;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/5/28 10:20
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PgsProgressPlanDetailFinishedVo {
|
||||
|
||||
/**
|
||||
* 设施id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设施名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 设施完成类型
|
||||
*/
|
||||
private String finishType;
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.progress.domain.vo.progressplandetail;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -23,6 +24,7 @@ public class PgsProgressPlanDetailNumVo {
|
||||
/**
|
||||
* 计划时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date date;
|
||||
|
||||
/**
|
||||
|
@ -7,13 +7,13 @@ import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/5/27 16:08
|
||||
* @date 2025/5/28 11:01
|
||||
*/
|
||||
@Data
|
||||
public class PgsProgressPlanDetailFacilityVo implements Serializable {
|
||||
public class PgsProgressPlanDetailUnFinishVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -4292009770864819304L;
|
||||
private static final long serialVersionUID = 2970680763220471140L;
|
||||
|
||||
/**
|
||||
* 设施id
|
||||
@ -26,8 +26,8 @@ public class PgsProgressPlanDetailFacilityVo implements Serializable {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 设施完成类型
|
||||
* 设施状态
|
||||
*/
|
||||
private String finishType;
|
||||
private String status;
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreateReq;
|
||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq;
|
||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq;
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryLastTimeVo;
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryVo;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -35,6 +36,14 @@ public interface IPgsProgressCategoryService extends IService<PgsProgressCategor
|
||||
*/
|
||||
List<PgsProgressCategoryVo> queryList(PgsProgressCategoryQueryReq req);
|
||||
|
||||
/**
|
||||
* 查询设施剩余数量
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设施剩余数量
|
||||
*/
|
||||
PgsProgressCategoryLastTimeVo queryLastTimeById(Long id);
|
||||
|
||||
/**
|
||||
* 新增进度类别
|
||||
*
|
||||
|
@ -1,16 +1,15 @@
|
||||
package org.dromara.progress.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.progress.domain.PgsProgressPlanDetail;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailQueryReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailUpdateReq;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFacilityVo;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailPercentageCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailRemoveReq;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNumVo;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailVo;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailUnFinishVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -23,54 +22,38 @@ import java.util.List;
|
||||
public interface IPgsProgressPlanDetailService extends IService<PgsProgressPlanDetail> {
|
||||
|
||||
/**
|
||||
* 查询进度计划详情
|
||||
* 插入进度计划详情设施
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 进度计划详情
|
||||
* @param req 插入进度计划详情设施参数
|
||||
* @return 是否插入成功
|
||||
*/
|
||||
PgsProgressPlanDetailVo queryById(Long id);
|
||||
Boolean insertFinishedDetail(PgsProgressPlanDetailFinishedCreateReq req);
|
||||
|
||||
/**
|
||||
* 分页查询进度计划详情列表
|
||||
* 插入进度计划详情设施
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 进度计划详情分页列表
|
||||
* @param req 插入进度计划详情设施参数
|
||||
* @return 是否插入成功
|
||||
*/
|
||||
TableDataInfo<PgsProgressPlanDetailVo> queryPageList(PgsProgressPlanDetailQueryReq req, PageQuery pageQuery);
|
||||
Boolean insertPercentageDetail(PgsProgressPlanDetailPercentageCreateReq req);
|
||||
|
||||
/**
|
||||
* 查询符合条件的进度计划详情列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 进度计划详情列表
|
||||
*/
|
||||
List<PgsProgressPlanDetailVo> queryList(PgsProgressPlanDetailQueryReq req);
|
||||
|
||||
/**
|
||||
* 分页查询进度计划详情设施列表
|
||||
* 分页查询进度计划详情已完成设施列表
|
||||
*
|
||||
* @param id 主键
|
||||
* @param pageQuery 分页参数
|
||||
* @return 进度计划详情设施分页列表
|
||||
*/
|
||||
TableDataInfo<PgsProgressPlanDetailFacilityVo> queryFacilityById(Long id, PageQuery pageQuery);
|
||||
TableDataInfo<PgsProgressPlanDetailFinishedVo> queryFinishedById(Long id, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 修改进度计划详情
|
||||
* 分页查询进度计划详情未完成设施列表
|
||||
*
|
||||
* @param req 进度计划详情
|
||||
* @return 是否修改成功
|
||||
* @param id 主键
|
||||
* @param pageQuery 分页参数
|
||||
* @return 进度计划详情设施分页列表
|
||||
*/
|
||||
Boolean updateByBo(PgsProgressPlanDetailUpdateReq req);
|
||||
|
||||
/**
|
||||
* 获取进度计划详情视图对象
|
||||
*
|
||||
* @param progressPlanDetail 进度计划详情对象
|
||||
* @return 进度计划详情视图对象
|
||||
*/
|
||||
PgsProgressPlanDetailVo getVo(PgsProgressPlanDetail progressPlanDetail);
|
||||
TableDataInfo<PgsProgressPlanDetailUnFinishVo> queryUnFinishById(Long id, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 获取进度计划详情视图对象列表
|
||||
@ -81,19 +64,11 @@ public interface IPgsProgressPlanDetailService extends IService<PgsProgressPlanD
|
||||
List<PgsProgressPlanDetailNumVo> getNumVoList(List<PgsProgressPlanDetail> progressPlanDetailList);
|
||||
|
||||
/**
|
||||
* 获取进度计划详情查询条件封装
|
||||
* 删除进度计划详情
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 查询条件封装
|
||||
* @param req 删除进度计划详情参数
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
LambdaQueryWrapper<PgsProgressPlanDetail> buildQueryWrapper(PgsProgressPlanDetailQueryReq req);
|
||||
|
||||
/**
|
||||
* 获取进度计划详情分页对象视图
|
||||
*
|
||||
* @param progressPlanDetailPage 进度计划详情分页对象
|
||||
* @return 进度计划详情分页对象视图
|
||||
*/
|
||||
Page<PgsProgressPlanDetailVo> getVoPage(Page<PgsProgressPlanDetail> progressPlanDetailPage);
|
||||
Boolean removeDetail(PgsProgressPlanDetailRemoveReq req);
|
||||
|
||||
}
|
||||
|
@ -5,12 +5,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.domain.PgsProgressPlan;
|
||||
import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanQueryReq;
|
||||
import org.dromara.progress.domain.vo.progressplan.PgsProgressPlanVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -55,13 +55,12 @@ public interface IPgsProgressPlanService extends IService<PgsProgressPlan> {
|
||||
Long insertByBo(PgsProgressPlanCreateReq req);
|
||||
|
||||
/**
|
||||
* 校验并批量删除进度计划信息
|
||||
* 删除进度计划信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @param id 待删除的主键
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
Boolean deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 获取进度计划视图对象
|
||||
@ -91,8 +90,8 @@ public interface IPgsProgressPlanService extends IService<PgsProgressPlan> {
|
||||
* 校验计划数量是否合法
|
||||
*
|
||||
* @param planNumber 计划数量
|
||||
* @param progressCategoryId 进度类别id
|
||||
* @param progressCategory 进度类别
|
||||
*/
|
||||
void validPlanNumber(Long planNumber, Long progressCategoryId);
|
||||
void validPlanNumber(Long planNumber, PgsProgressCategory progressCategory);
|
||||
|
||||
}
|
||||
|
@ -14,16 +14,21 @@ import org.dromara.facility.service.IFacPercentageFacilityService;
|
||||
import org.dromara.progress.constant.PgsProgressCategoryConstant;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.domain.PgsProgressCategoryTemplate;
|
||||
import org.dromara.progress.domain.PgsProgressPlan;
|
||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreateReq;
|
||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq;
|
||||
import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq;
|
||||
import org.dromara.progress.domain.enums.PgsFinishStatusEnum;
|
||||
import org.dromara.progress.domain.enums.PgsProgressUnitTypeEnum;
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryLastTimeVo;
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryVo;
|
||||
import org.dromara.progress.mapper.PgsProgressCategoryMapper;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryTemplateService;
|
||||
import org.dromara.progress.service.IPgsProgressPlanService;
|
||||
import org.dromara.utils.BigDecimalUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -47,6 +52,10 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
@Resource
|
||||
private IFacPercentageFacilityService percentageFacilityService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private IPgsProgressPlanService progressPlanService;
|
||||
|
||||
/**
|
||||
* 查询进度类别
|
||||
*
|
||||
@ -74,6 +83,34 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
return this.getVoList(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设施剩余数量
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设施剩余数量
|
||||
*/
|
||||
@Override
|
||||
public PgsProgressCategoryLastTimeVo queryLastTimeById(Long id) {
|
||||
PgsProgressCategory progressCategory = this.getById(id);
|
||||
if (progressCategory == null) {
|
||||
throw new ServiceException("进度类别信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
PgsProgressCategoryLastTimeVo lastTimeVo = new PgsProgressCategoryLastTimeVo();
|
||||
BigDecimal total = progressCategory.getTotal();
|
||||
BigDecimal completed = progressCategory.getCompleted();
|
||||
BigDecimal planTotal = total.subtract(completed);
|
||||
lastTimeVo.setLeftNum(planTotal);
|
||||
PgsProgressPlan progressPlan = progressPlanService.lambdaQuery()
|
||||
.eq(PgsProgressPlan::getProgressCategoryId, id)
|
||||
.orderByDesc(PgsProgressPlan::getEndDate)
|
||||
.last("limit 1")
|
||||
.one();
|
||||
if (progressPlan != null) {
|
||||
lastTimeVo.setEndDate(progressPlan.getEndDate());
|
||||
}
|
||||
return lastTimeVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增进度类别
|
||||
*
|
||||
@ -228,6 +265,8 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
// 如果是父节点,计算其子节点的总和
|
||||
if (progressCategory.getPid() == 0) {
|
||||
List<PgsProgressCategory> children = parentIdToChildrenMap.getOrDefault(progressCategory.getId(), Collections.emptyList());
|
||||
// 获取父节点状态
|
||||
String pidStatus = getPidStatus(children);
|
||||
// 累加子节点数据
|
||||
BigDecimal total = children.stream().map(PgsProgressCategory::getTotal).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal completed = children.stream().map(PgsProgressCategory::getCompleted).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
@ -236,6 +275,7 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
vo.setTotal(total);
|
||||
vo.setCompleted(completed);
|
||||
vo.setPlanTotal(planTotal);
|
||||
vo.setStatus(pidStatus);
|
||||
}
|
||||
// 计算百分比(避免除以 0)
|
||||
vo.setCompletedPercentage(BigDecimalUtil.toPercentage(vo.getCompleted(), vo.getTotal()));
|
||||
@ -315,4 +355,35 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据子节点完成状态获取父节点完成状态
|
||||
*
|
||||
* @param children 子节点列表
|
||||
* @return 父节点完成状态
|
||||
*/
|
||||
public String getPidStatus(List<PgsProgressCategory> children) {
|
||||
if (CollUtil.isEmpty(children)) {
|
||||
return PgsFinishStatusEnum.UNFINISH.getValue(); // 为空视为未开始
|
||||
}
|
||||
boolean allFinished = true;
|
||||
boolean hasInProgress = false;
|
||||
for (PgsProgressCategory category : children) {
|
||||
String status = category.getStatus();
|
||||
if (!PgsFinishStatusEnum.FINISH.getValue().equals(status)) {
|
||||
allFinished = false;
|
||||
if (PgsFinishStatusEnum.INPROGRESS.getValue().equals(status)) {
|
||||
hasInProgress = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allFinished) {
|
||||
return PgsFinishStatusEnum.FINISH.getValue(); // 全部完成
|
||||
} else if (hasInProgress) {
|
||||
return PgsFinishStatusEnum.INPROGRESS.getValue(); // 有进行中
|
||||
} else {
|
||||
return PgsFinishStatusEnum.UNFINISH.getValue(); // 全部未开始
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,18 +1,24 @@
|
||||
package org.dromara.progress.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.facility.domain.FacBoxTransformer;
|
||||
import org.dromara.facility.domain.FacInverter;
|
||||
import org.dromara.facility.domain.FacPhotovoltaicPanel;
|
||||
import org.dromara.facility.domain.enums.FacFinishStatusEnum;
|
||||
import org.dromara.facility.domain.enums.FacFinishTypeEnum;
|
||||
import org.dromara.facility.service.IFacBoxTransformerService;
|
||||
import org.dromara.facility.service.IFacInverterService;
|
||||
import org.dromara.facility.service.IFacPhotovoltaicPanelService;
|
||||
@ -20,21 +26,29 @@ import org.dromara.progress.constant.PgsProgressCategoryConstant;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.domain.PgsProgressPlan;
|
||||
import org.dromara.progress.domain.PgsProgressPlanDetail;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailQueryReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailUpdateReq;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFacilityVo;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailPercentageCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailRemoveReq;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNumVo;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailVo;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailUnFinishVo;
|
||||
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.project.service.IBusProjectService;
|
||||
import org.dromara.utils.PageConvertUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* 进度计划详情Service业务层处理
|
||||
@ -62,44 +76,172 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
||||
@Resource
|
||||
private IPgsProgressCategoryService progressCategoryService;
|
||||
|
||||
@Resource
|
||||
private IBusProjectService projectService;
|
||||
|
||||
/**
|
||||
* 查询进度计划详情
|
||||
* 插入进度计划详情设施
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 进度计划详情
|
||||
* @param req 插入进度计划详情设施参数
|
||||
* @return 是否插入成功
|
||||
*/
|
||||
@Override
|
||||
public PgsProgressPlanDetailVo queryById(Long id) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertFinishedDetail(PgsProgressPlanDetailFinishedCreateReq req) {
|
||||
List<Long> finishedDetailIdList = req.getFinishedDetailIdList();
|
||||
if (CollUtil.isEmpty(finishedDetailIdList)) {
|
||||
return true;
|
||||
}
|
||||
Long id = req.getId();
|
||||
PgsProgressPlanDetail progressPlanDetail = this.getById(id);
|
||||
if (progressPlanDetail == null) {
|
||||
throw new ServiceException("进度计划详情信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return this.getVo(progressPlanDetail);
|
||||
Long projectId = req.getProjectId();
|
||||
if (projectId == null || projectService.getById(projectId) == null) {
|
||||
throw new ServiceException("项目信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
if (progressPlanDetail.getProjectId().equals(projectId)) {
|
||||
throw new ServiceException("进度计划详情信息不属于当前项目,请重新选择", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
Long progressCategoryId = progressPlanDetail.getProgressCategoryId();
|
||||
PgsProgressCategory progressCategory = progressCategoryService.getById(progressCategoryId);
|
||||
if (progressCategory == null) {
|
||||
throw new ServiceException("进度计划类别信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
String workType = progressCategory.getWorkType();
|
||||
List<PgsProgressPlanDetailFinishedVo> finishedDetailList = JSONUtil.toList(progressPlanDetail.getFinishedDetail(), PgsProgressPlanDetailFinishedVo.class);
|
||||
if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
||||
handleFacilityFinish(
|
||||
projectId,
|
||||
progressCategoryId,
|
||||
finishedDetailIdList,
|
||||
progressPlanDetail.getDate(),
|
||||
photovoltaicPanelService,
|
||||
FacPhotovoltaicPanel::getId,
|
||||
FacPhotovoltaicPanel::getName,
|
||||
FacPhotovoltaicPanel::getFinishType,
|
||||
FacPhotovoltaicPanel::getFinishDate,
|
||||
FacPhotovoltaicPanel::getProjectId,
|
||||
FacPhotovoltaicPanel::getProgressCategoryId,
|
||||
FacPhotovoltaicPanel::getId,
|
||||
FacPhotovoltaicPanel::getStatus,
|
||||
finishedDetailList
|
||||
);
|
||||
} else if (PgsProgressCategoryConstant.INVERTER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
||||
handleFacilityFinish(
|
||||
projectId,
|
||||
progressCategoryId,
|
||||
finishedDetailIdList,
|
||||
progressPlanDetail.getDate(),
|
||||
inverterService,
|
||||
FacInverter::getId,
|
||||
FacInverter::getName,
|
||||
FacInverter::getFinishType,
|
||||
FacInverter::getFinishDate,
|
||||
FacInverter::getProjectId,
|
||||
FacInverter::getProgressCategoryId,
|
||||
FacInverter::getId,
|
||||
FacInverter::getStatus,
|
||||
finishedDetailList
|
||||
);
|
||||
} else if (PgsProgressCategoryConstant.BOX_TRANSFORMER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
||||
handleFacilityFinish(
|
||||
projectId,
|
||||
progressCategoryId,
|
||||
finishedDetailIdList,
|
||||
progressPlanDetail.getDate(),
|
||||
boxTransformerService,
|
||||
FacBoxTransformer::getId,
|
||||
FacBoxTransformer::getName,
|
||||
FacBoxTransformer::getFinishType,
|
||||
FacBoxTransformer::getFinishDate,
|
||||
FacBoxTransformer::getProjectId,
|
||||
FacBoxTransformer::getProgressCategoryId,
|
||||
FacBoxTransformer::getId,
|
||||
FacBoxTransformer::getStatus,
|
||||
finishedDetailList
|
||||
);
|
||||
}
|
||||
PgsProgressPlanDetail detail = new PgsProgressPlanDetail();
|
||||
detail.setId(id);
|
||||
detail.setFinishedDetail(JSONUtil.toJsonStr(finishedDetailList));
|
||||
detail.setFinishedNumber(progressPlanDetail.getFinishedNumber() + finishedDetailList.size());
|
||||
boolean update = this.updateById(detail);
|
||||
if (!update) {
|
||||
throw new ServiceException("更新进度计划详情异常", HttpStatus.ERROR);
|
||||
}
|
||||
boolean result = progressPlanService.lambdaUpdate()
|
||||
.eq(PgsProgressPlan::getId, progressPlanDetail.getProgressPlanId())
|
||||
.setSql("finished_number = finished_number + " + finishedDetailList.size())
|
||||
.update();
|
||||
if (!result) {
|
||||
throw new ServiceException("更新进度计划异常", HttpStatus.ERROR);
|
||||
}
|
||||
boolean updateCategory = progressCategoryService.lambdaUpdate()
|
||||
.eq(PgsProgressCategory::getId, progressCategoryId)
|
||||
.setSql("completed = completed + " + finishedDetailList.size())
|
||||
.update();
|
||||
if (!updateCategory) {
|
||||
throw new ServiceException("更新进度计划类别异常", HttpStatus.ERROR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询进度计划详情列表
|
||||
* 插入进度计划详情设施
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 进度计划详情分页列表
|
||||
* @param req 插入进度计划详情设施参数
|
||||
* @return 是否插入成功
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<PgsProgressPlanDetailVo> queryPageList(PgsProgressPlanDetailQueryReq req, PageQuery pageQuery) {
|
||||
Page<PgsProgressPlanDetail> result = this.page(pageQuery.build(), this.buildQueryWrapper(req));
|
||||
return TableDataInfo.build(this.getVoPage(result));
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertPercentageDetail(PgsProgressPlanDetailPercentageCreateReq req) {
|
||||
Long finishedNumber = req.getFinishedNumber();
|
||||
if (finishedNumber == null) {
|
||||
throw new ServiceException("完成百分比不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的进度计划详情列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 进度计划详情列表
|
||||
*/
|
||||
@Override
|
||||
public List<PgsProgressPlanDetailVo> queryList(PgsProgressPlanDetailQueryReq req) {
|
||||
List<PgsProgressPlanDetail> list = this.list(this.buildQueryWrapper(req));
|
||||
return list.stream().map(this::getVo).toList();
|
||||
if (finishedNumber < 0) {
|
||||
throw new ServiceException("完成百分比不能小于0", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (finishedNumber > 100) {
|
||||
throw new ServiceException("完成百分比不能大于100", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
Long id = req.getId();
|
||||
PgsProgressPlanDetail progressPlanDetail = this.getById(id);
|
||||
if (progressPlanDetail == null) {
|
||||
throw new ServiceException("进度计划详情信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
Long progressPlanId = progressPlanDetail.getProgressPlanId();
|
||||
PgsProgressPlan progressPlan = progressPlanService.getById(progressPlanId);
|
||||
if (progressPlan == null) {
|
||||
throw new ServiceException("进度计划信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
Long number = progressPlanDetail.getFinishedNumber();
|
||||
Long finishedNumberTotal = progressPlan.getFinishedNumber();
|
||||
if (finishedNumberTotal + finishedNumber > progressPlan.getPlanNumber()) {
|
||||
throw new ServiceException("完成百分比不能大于计划进度", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
progressPlanDetail.setFinishedNumber(finishedNumber);
|
||||
// 更新
|
||||
boolean update = this.updateById(progressPlanDetail);
|
||||
if (!update) {
|
||||
throw new ServiceException("更新进度计划详情异常", HttpStatus.ERROR);
|
||||
}
|
||||
progressPlan.setFinishedNumber(finishedNumberTotal - progressPlan.getFinishedNumber() + finishedNumber);
|
||||
boolean result = progressPlanService.updateById(progressPlan);
|
||||
if (!result) {
|
||||
throw new ServiceException("更新进度计划异常", HttpStatus.ERROR);
|
||||
}
|
||||
boolean updateCategory = progressCategoryService.lambdaUpdate()
|
||||
.eq(PgsProgressCategory::getId, progressPlan.getProgressCategoryId())
|
||||
.setSql("completed = completed - " + number)
|
||||
.setSql("completed = completed + " + finishedNumber)
|
||||
.update();
|
||||
if (!updateCategory) {
|
||||
throw new ServiceException("更新进度分类异常", HttpStatus.ERROR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,108 +252,86 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
||||
* @return 进度计划详情设施分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<PgsProgressPlanDetailFacilityVo> queryFacilityById(Long id, PageQuery pageQuery) {
|
||||
public TableDataInfo<PgsProgressPlanDetailFinishedVo> queryFinishedById(Long id, PageQuery pageQuery) {
|
||||
PgsProgressPlanDetail progressPlanDetail = this.getById(id);
|
||||
if (progressPlanDetail == null) {
|
||||
throw new ServiceException("进度计划详情信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
PgsProgressPlan progressPlan = progressPlanService.getById(progressPlanDetail.getProgressPlanId());
|
||||
if (progressPlan == null) {
|
||||
throw new ServiceException("进度计划信息不存在", HttpStatus.NOT_FOUND);
|
||||
String finishedDetail = progressPlanDetail.getFinishedDetail();
|
||||
List<PgsProgressPlanDetailFinishedVo> list = JSONUtil.toList(finishedDetail, PgsProgressPlanDetailFinishedVo.class);
|
||||
return TableDataInfo.build(this.paginateList(list, pageQuery));
|
||||
}
|
||||
Long progressCategoryId = progressPlan.getProgressCategoryId();
|
||||
Long projectId = progressPlan.getProjectId();
|
||||
Long matrixId = progressPlan.getMatrixId();
|
||||
|
||||
/**
|
||||
* 分页查询进度计划详情未完成设施列表
|
||||
*
|
||||
* @param id 主键
|
||||
* @param pageQuery 分页参数
|
||||
* @return 进度计划详情设施分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<PgsProgressPlanDetailUnFinishVo> queryUnFinishById(Long id, PageQuery pageQuery) {
|
||||
PgsProgressPlanDetail progressPlanDetail = this.getById(id);
|
||||
if (progressPlanDetail == null) {
|
||||
throw new ServiceException("进度计划详情信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
Long progressCategoryId = progressPlanDetail.getProgressCategoryId();
|
||||
PgsProgressCategory progressCategory = progressCategoryService.getById(progressCategoryId);
|
||||
if (progressCategory == null) {
|
||||
throw new ServiceException("进度计划类别信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
String workType = progressCategory.getWorkType();
|
||||
Page<PgsProgressPlanDetailFacilityVo> resultPage = pageQuery.build();
|
||||
if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
||||
LambdaQueryWrapper<FacPhotovoltaicPanel> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(FacPhotovoltaicPanel::getProjectId, projectId);
|
||||
lqw.eq(FacPhotovoltaicPanel::getMatrixId, matrixId);
|
||||
lqw.select(FacPhotovoltaicPanel::getId, FacPhotovoltaicPanel::getName, FacPhotovoltaicPanel::getStatus);
|
||||
lqw.eq(FacPhotovoltaicPanel::getProjectId, progressPlanDetail.getProjectId());
|
||||
lqw.eq(FacPhotovoltaicPanel::getProgressCategoryId, progressCategoryId);
|
||||
lqw.eq(FacPhotovoltaicPanel::getFinishDate, progressPlanDetail.getDate());
|
||||
lqw.eq(FacPhotovoltaicPanel::getFinishType, FacFinishStatusEnum.FINISH.getValue());
|
||||
Page<FacPhotovoltaicPanel> result = photovoltaicPanelService.page(pageQuery.build(), lqw);
|
||||
List<FacPhotovoltaicPanel> records = result.getRecords();
|
||||
List<PgsProgressPlanDetailFacilityVo> facilityVoList = records.stream().map(photovoltaicPanel -> {
|
||||
PgsProgressPlanDetailFacilityVo facilityVo = new PgsProgressPlanDetailFacilityVo();
|
||||
facilityVo.setId(photovoltaicPanel.getId());
|
||||
facilityVo.setName(photovoltaicPanel.getName());
|
||||
facilityVo.setFinishType(photovoltaicPanel.getFinishType());
|
||||
return facilityVo;
|
||||
}).toList();
|
||||
resultPage.setRecords(facilityVoList);
|
||||
lqw.in(FacPhotovoltaicPanel::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
||||
Page<FacPhotovoltaicPanel> page = photovoltaicPanelService.page(pageQuery.build(), lqw);
|
||||
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
||||
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
||||
vo.setId(entity.getId());
|
||||
vo.setName(entity.getName());
|
||||
vo.setStatus(entity.getStatus());
|
||||
vo.setName(progressCategory.getName());
|
||||
return vo;
|
||||
});
|
||||
return TableDataInfo.build(voPage);
|
||||
} else if (PgsProgressCategoryConstant.INVERTER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
||||
LambdaQueryWrapper<FacInverter> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(FacInverter::getProjectId, projectId);
|
||||
lqw.eq(FacInverter::getMatrixId, matrixId);
|
||||
lqw.select(FacInverter::getId, FacInverter::getName, FacInverter::getStatus);
|
||||
lqw.eq(FacInverter::getProjectId, progressPlanDetail.getProjectId());
|
||||
lqw.eq(FacInverter::getProgressCategoryId, progressCategoryId);
|
||||
lqw.eq(FacInverter::getFinishDate, progressPlanDetail.getDate());
|
||||
lqw.eq(FacInverter::getFinishType, FacFinishStatusEnum.FINISH.getValue());
|
||||
Page<FacInverter> result = inverterService.page(pageQuery.build(), lqw);
|
||||
List<FacInverter> records = result.getRecords();
|
||||
List<PgsProgressPlanDetailFacilityVo> facilityVoList = records.stream().map(inverter -> {
|
||||
PgsProgressPlanDetailFacilityVo facilityVo = new PgsProgressPlanDetailFacilityVo();
|
||||
facilityVo.setId(inverter.getId());
|
||||
facilityVo.setName(inverter.getName());
|
||||
facilityVo.setFinishType(inverter.getFinishType());
|
||||
return facilityVo;
|
||||
}).toList();
|
||||
resultPage.setRecords(facilityVoList);
|
||||
lqw.in(FacInverter::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
||||
Page<FacInverter> page = inverterService.page(pageQuery.build(), lqw);
|
||||
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
||||
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
||||
vo.setId(entity.getId());
|
||||
vo.setName(entity.getName());
|
||||
vo.setStatus(entity.getStatus());
|
||||
vo.setName(progressCategory.getName());
|
||||
return vo;
|
||||
});
|
||||
return TableDataInfo.build(voPage);
|
||||
} else if (PgsProgressCategoryConstant.BOX_TRANSFORMER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
||||
LambdaQueryWrapper<FacBoxTransformer> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(FacBoxTransformer::getProjectId, projectId);
|
||||
lqw.eq(FacBoxTransformer::getMatrixId, matrixId);
|
||||
lqw.select(FacBoxTransformer::getId, FacBoxTransformer::getName, FacBoxTransformer::getStatus);
|
||||
lqw.eq(FacBoxTransformer::getProjectId, progressPlanDetail.getProjectId());
|
||||
lqw.eq(FacBoxTransformer::getProgressCategoryId, progressCategoryId);
|
||||
lqw.eq(FacBoxTransformer::getFinishDate, progressPlanDetail.getDate());
|
||||
lqw.eq(FacBoxTransformer::getFinishType, FacFinishStatusEnum.FINISH.getValue());
|
||||
Page<FacBoxTransformer> result = boxTransformerService.page(pageQuery.build(), lqw);
|
||||
List<FacBoxTransformer> records = result.getRecords();
|
||||
List<PgsProgressPlanDetailFacilityVo> facilityVoList = records.stream().map(boxTransformer -> {
|
||||
PgsProgressPlanDetailFacilityVo facilityVo = new PgsProgressPlanDetailFacilityVo();
|
||||
facilityVo.setId(boxTransformer.getId());
|
||||
facilityVo.setName(boxTransformer.getName());
|
||||
facilityVo.setFinishType(boxTransformer.getFinishType());
|
||||
return facilityVo;
|
||||
}).toList();
|
||||
resultPage.setRecords(facilityVoList);
|
||||
lqw.in(FacBoxTransformer::getStatus, FacFinishStatusEnum.UNFINISH.getValue(), FacFinishStatusEnum.INPROGRESS.getValue());
|
||||
Page<FacBoxTransformer> page = boxTransformerService.page(pageQuery.build(), lqw);
|
||||
Page<PgsProgressPlanDetailUnFinishVo> voPage = PageConvertUtil.convert(page, entity -> {
|
||||
PgsProgressPlanDetailUnFinishVo vo = new PgsProgressPlanDetailUnFinishVo();
|
||||
vo.setId(entity.getId());
|
||||
vo.setName(entity.getName());
|
||||
vo.setStatus(entity.getStatus());
|
||||
vo.setName(progressCategory.getName());
|
||||
return vo;
|
||||
});
|
||||
return TableDataInfo.build(voPage);
|
||||
} else {
|
||||
throw new ServiceException("未知进度计划类别工作类型", HttpStatus.BAD_REQUEST);
|
||||
throw new ServiceException("未定义的进度计划类别", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
return TableDataInfo.build(resultPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改进度计划详情
|
||||
*
|
||||
* @param req 进度计划详情
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(PgsProgressPlanDetailUpdateReq req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(PgsProgressPlanDetail entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取进度计划详情视图对象
|
||||
*
|
||||
* @param progressPlanDetail 进度计划详情对象
|
||||
* @return 进度计划详情视图对象
|
||||
*/
|
||||
@Override
|
||||
public PgsProgressPlanDetailVo getVo(PgsProgressPlanDetail progressPlanDetail) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -230,34 +350,180 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取进度计划详情查询条件封装
|
||||
* 删除进度计划详情
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 查询条件封装
|
||||
* @param req 删除进度计划详情参数
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryWrapper<PgsProgressPlanDetail> buildQueryWrapper(PgsProgressPlanDetailQueryReq req) {
|
||||
LambdaQueryWrapper<PgsProgressPlanDetail> lqw = new LambdaQueryWrapper<>();
|
||||
if (req == null) {
|
||||
return lqw;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean removeDetail(PgsProgressPlanDetailRemoveReq req) {
|
||||
Long id = req.getId();
|
||||
List<Long> detailIdList = req.getDetailIdList();
|
||||
if (CollUtil.isEmpty(detailIdList)) {
|
||||
return true;
|
||||
}
|
||||
Long projectId = req.getProjectId();
|
||||
Long progressPlanId = req.getProgressPlanId();
|
||||
Date date = req.getDate();
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), PgsProgressPlanDetail::getProjectId, projectId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(progressPlanId), PgsProgressPlanDetail::getProgressPlanId, progressPlanId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(date), PgsProgressPlanDetail::getDate, date);
|
||||
return lqw;
|
||||
PgsProgressPlanDetail progressPlanDetail = this.getById(id);
|
||||
if (progressPlanDetail == null) {
|
||||
throw new ServiceException("进度计划详情数据不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
String finishedDetail = progressPlanDetail.getFinishedDetail();
|
||||
int removeTotal = detailIdList.size();
|
||||
List<PgsProgressPlanDetailFinishedVo> finishedVoList = JSONUtil.toList(finishedDetail, PgsProgressPlanDetailFinishedVo.class);
|
||||
PgsProgressCategory progressCategory = progressCategoryService.getById(progressPlanDetail.getProgressCategoryId());
|
||||
String workType = progressCategory.getWorkType();
|
||||
if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
||||
List<FacPhotovoltaicPanel> list = photovoltaicPanelService.lambdaQuery()
|
||||
.in(FacPhotovoltaicPanel::getId, detailIdList)
|
||||
.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);
|
||||
}
|
||||
} else if (PgsProgressCategoryConstant.INVERTER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
||||
List<FacInverter> list = inverterService.lambdaQuery()
|
||||
.in(FacInverter::getId, detailIdList)
|
||||
.list();
|
||||
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
||||
throw new ServiceException("设施数据丢失", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
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.BOX_TRANSFORMER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) {
|
||||
List<FacBoxTransformer> list = boxTransformerService.lambdaQuery()
|
||||
.in(FacBoxTransformer::getId, detailIdList)
|
||||
.list();
|
||||
if (CollUtil.isEmpty(list) || list.size() != removeTotal) {
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
throw new ServiceException("未定义的进度计划类别", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
AtomicInteger finishType2Count = new AtomicInteger(0);
|
||||
// 过滤出不需要删除的,生成新列表
|
||||
List<PgsProgressPlanDetailFinishedVo> newList = finishedVoList.stream()
|
||||
.filter(vo -> {
|
||||
boolean toRemove = detailIdList.contains(vo.getId());
|
||||
if (toRemove && FacFinishTypeEnum.AI.getValue().equals(vo.getFinishType())) {
|
||||
finishType2Count.incrementAndGet();
|
||||
}
|
||||
return !toRemove;
|
||||
})
|
||||
.toList();
|
||||
progressPlanDetail.setFinishedDetail(JSONUtil.toJsonStr(newList));
|
||||
progressPlanDetail.setFinishedNumber((long) newList.size());
|
||||
long aiFill = progressPlanDetail.getAiFill() - (long) finishType2Count.get();
|
||||
progressPlanDetail.setAiFill(Math.max(aiFill, 0L));
|
||||
boolean updatePlanDetail = this.updateById(progressPlanDetail);
|
||||
if (!updatePlanDetail) {
|
||||
throw new ServiceException("修改进度计划详情失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
boolean updatePlan = progressPlanService.lambdaUpdate()
|
||||
.eq(PgsProgressPlan::getId, progressPlanDetail.getProgressPlanId())
|
||||
.setSql("finished_number = finished_number - " + removeTotal)
|
||||
.update();
|
||||
if (!updatePlan) {
|
||||
throw new ServiceException("修改进度计划失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
progressCategory.setCompleted(progressCategory.getCompleted().subtract(BigDecimal.valueOf(removeTotal)));
|
||||
boolean updateCategory = progressCategoryService.updateById(progressCategory);
|
||||
if (!updateCategory) {
|
||||
throw new ServiceException("修改进度类别失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取进度计划详情分页对象视图
|
||||
* 分页
|
||||
*
|
||||
* @param progressPlanDetailPage 进度计划详情分页对象
|
||||
* @return 进度计划详情分页对象视图
|
||||
* @param fullList 列表
|
||||
* @param pageQuery 分页参数
|
||||
* @return 分页列表
|
||||
*/
|
||||
@Override
|
||||
public Page<PgsProgressPlanDetailVo> getVoPage(Page<PgsProgressPlanDetail> progressPlanDetailPage) {
|
||||
return null;
|
||||
public <T> Page<T> paginateList(List<T> fullList, PageQuery pageQuery) {
|
||||
int pageNum = ObjectUtil.defaultIfNull(pageQuery.getPageNum(), PageQuery.DEFAULT_PAGE_NUM);
|
||||
int pageSize = ObjectUtil.defaultIfNull(pageQuery.getPageSize(), PageQuery.DEFAULT_PAGE_SIZE);
|
||||
// 保底
|
||||
if (pageNum < 1) pageNum = 1;
|
||||
if (pageSize < 1) pageSize = PageQuery.DEFAULT_PAGE_SIZE;
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, fullList.size());
|
||||
// 防止越界
|
||||
if (fromIndex > fullList.size()) {
|
||||
return new Page<T>(pageNum, pageSize, fullList.size()).setRecords(Collections.emptyList());
|
||||
}
|
||||
List<T> pageList = fullList.subList(fromIndex, toIndex);
|
||||
return new Page<T>(pageNum, pageSize, fullList.size()).setRecords(pageList);
|
||||
}
|
||||
|
||||
public <T> void handleFacilityFinish(
|
||||
Long projectId,
|
||||
Long progressCategoryId,
|
||||
List<Long> finishedDetailIdList,
|
||||
Date finishDate,
|
||||
IService<T> service,
|
||||
SFunction<T, Long> getIdFunc,
|
||||
SFunction<T, String> getNameFunc,
|
||||
SFunction<T, String> getFinishTypeFunc,
|
||||
SFunction<T, LocalDate> getFinishDateFunc,
|
||||
SFunction<T, Long> getProjectIdFunc,
|
||||
SFunction<T, Long> getProgressCategoryIdFunc,
|
||||
SFunction<T, Long> getIdColumnFunc,
|
||||
SFunction<T, String> getStatusFunc,
|
||||
List<PgsProgressPlanDetailFinishedVo> finishedDetailList
|
||||
) {
|
||||
List<T> entityList = service.lambdaQuery()
|
||||
.eq(getProjectIdFunc, projectId)
|
||||
.eq(getProgressCategoryIdFunc, progressCategoryId)
|
||||
.in(getIdColumnFunc, finishedDetailIdList)
|
||||
.list();
|
||||
if (entityList.size() != finishedDetailIdList.size()) {
|
||||
throw new ServiceException("上传设施信息异常", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
boolean update = service.lambdaUpdate()
|
||||
.eq(getProjectIdFunc, projectId)
|
||||
.eq(getProgressCategoryIdFunc, progressCategoryId)
|
||||
.in(getIdColumnFunc, finishedDetailIdList)
|
||||
.set(getStatusFunc, FacFinishStatusEnum.FINISH.getValue())
|
||||
.set(getFinishTypeFunc, FacFinishTypeEnum.HAND.getValue())
|
||||
.set(getFinishDateFunc, finishDate)
|
||||
.update();
|
||||
if (!update) {
|
||||
throw new ServiceException("更新设施信息异常", HttpStatus.ERROR);
|
||||
}
|
||||
List<PgsProgressPlanDetailFinishedVo> list = entityList.stream().map(entity -> {
|
||||
PgsProgressPlanDetailFinishedVo vo = new PgsProgressPlanDetailFinishedVo();
|
||||
vo.setId(getIdFunc.apply(entity));
|
||||
vo.setName(getNameFunc.apply(entity));
|
||||
vo.setFinishType(getFinishTypeFunc.apply(entity));
|
||||
return vo;
|
||||
}).toList();
|
||||
finishedDetailList.addAll(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import org.dromara.progress.domain.PgsProgressPlanDetail;
|
||||
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.PgsFinishStatusEnum;
|
||||
import org.dromara.progress.domain.vo.progressplan.PgsProgressPlanVo;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNumVo;
|
||||
import org.dromara.progress.mapper.PgsProgressPlanMapper;
|
||||
@ -31,7 +32,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -109,6 +113,12 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
PgsProgressPlan progressPlan = new PgsProgressPlan();
|
||||
BeanUtils.copyProperties(req, progressPlan);
|
||||
// 数据校验
|
||||
Date startDate = req.getStartDate();
|
||||
Date endDate = req.getEndDate();
|
||||
// 结束日期不能早于开始日期
|
||||
if (endDate.before(startDate)) {
|
||||
throw new ServiceException("结束日期不能早于开始日期");
|
||||
}
|
||||
Long projectId = progressPlan.getProjectId();
|
||||
if (projectService.getById(projectId) == null) {
|
||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||
@ -119,7 +129,9 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
throw new ServiceException("对应方阵不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
Long progressCategoryId = progressPlan.getProgressCategoryId();
|
||||
this.validPlanNumber(req.getPlanNumber(), progressCategoryId);
|
||||
PgsProgressCategory progressCategory = progressCategoryService.getById(progressCategoryId);
|
||||
this.validPlanNumber(req.getPlanNumber(), progressCategory);
|
||||
progressPlan.setProgressCategoryName(progressCategory.getName());
|
||||
progressPlan.setMatrixName(matrix.getMatrixName());
|
||||
// 操作数据库
|
||||
boolean save = this.save(progressPlan);
|
||||
@ -135,6 +147,7 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
BeanUtils.copyProperties(detail, progressPlanDetail);
|
||||
progressPlanDetail.setProgressPlanId(id);
|
||||
progressPlanDetail.setProjectId(progressPlan.getProjectId());
|
||||
progressPlanDetail.setProgressCategoryId(progressPlan.getProgressCategoryId());
|
||||
return progressPlanDetail;
|
||||
}).toList();
|
||||
boolean result = progressPlanDetailService.saveBatch(detailList1);
|
||||
@ -146,6 +159,7 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
boolean update = progressCategoryService.lambdaUpdate()
|
||||
.eq(PgsProgressCategory::getId, progressCategoryId)
|
||||
.set(PgsProgressCategory::getPlanTotal, progressPlan.getPlanNumber())
|
||||
.set(PgsProgressCategory::getStatus, PgsFinishStatusEnum.INPROGRESS.getValue())
|
||||
.update();
|
||||
if (!update) {
|
||||
throw new ServiceException("更新进度分类计划总数量失败,数据库操作失败", HttpStatus.ERROR);
|
||||
@ -154,38 +168,45 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(PgsProgressPlan entity) {
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
Long projectId = entity.getProjectId();
|
||||
if (projectService.getById(projectId) == null) {
|
||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
Long matrixId = entity.getMatrixId();
|
||||
if (matrixService.getById(matrixId) == null) {
|
||||
throw new ServiceException("对应方阵不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除进度计划信息
|
||||
* 删除进度计划信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @param id 待删除的主键
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
public Boolean deleteById(Long id) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
List<PgsProgressPlan> progressPlanList = this.listByIds(ids);
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
List<Long> projectId = progressPlanList.stream().map(PgsProgressPlan::getProjectId).toList();
|
||||
projectService.validAuth(projectId, userId);
|
||||
PgsProgressPlan progressPlan = this.getById(id);
|
||||
if (progressPlan == null) {
|
||||
throw new ServiceException("进度计划信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return this.removeBatchByIds(ids);
|
||||
Long projectId = progressPlan.getProjectId();
|
||||
projectService.validAuth(projectId, userId);
|
||||
if (progressPlan.getPlanNumber() != null && progressPlan.getPlanNumber() != 0) {
|
||||
throw new ServiceException("已存在完成的设施,无法删除", HttpStatus.CONFLICT);
|
||||
}
|
||||
// 删除数据
|
||||
boolean result = this.removeById(id);
|
||||
if (!result) {
|
||||
throw new ServiceException("删除进度计划失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
// 关联删除分类中记录的计划值
|
||||
boolean update = progressCategoryService.lambdaUpdate()
|
||||
.eq(PgsProgressCategory::getId, progressPlan.getProgressCategoryId())
|
||||
.setSql("plan_total = plan_total - " + progressPlan.getPlanNumber())
|
||||
.update();
|
||||
if (!update) {
|
||||
throw new ServiceException("更新进度分类计划总数量失败,数据库操作失败", HttpStatus.ERROR);
|
||||
}
|
||||
// 关联删除计划详情数据
|
||||
LambdaQueryWrapper<PgsProgressPlanDetail> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(PgsProgressPlanDetail::getProgressPlanId, id);
|
||||
boolean remove = progressPlanDetailService.remove(lqw);
|
||||
if (!remove) {
|
||||
throw new ServiceException("删除进度计划详情失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -268,10 +289,15 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
// 获取详情列表
|
||||
Long id = progressPlan.getId();
|
||||
List<PgsProgressPlanDetailNumVo> numDetailList = new ArrayList<>();
|
||||
long aiFill = 0L;
|
||||
if (detailMap.containsKey(id)) {
|
||||
numDetailList = progressPlanDetailService.getNumVoList(detailMap.get(id));
|
||||
for (PgsProgressPlanDetailNumVo vo : numDetailList) {
|
||||
aiFill += vo.getAiFill() != null ? vo.getAiFill() : 0L;
|
||||
}
|
||||
}
|
||||
progressPlanVo.setDetailList(numDetailList);
|
||||
progressPlanVo.setAiFill(aiFill);
|
||||
return progressPlanVo;
|
||||
}).toList();
|
||||
progressPlanVoPage.setRecords(progressPlanVoList);
|
||||
@ -282,11 +308,10 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
|
||||
* 校验计划数量是否合法
|
||||
*
|
||||
* @param planNumber 计划数量
|
||||
* @param progressCategoryId 进度类别id
|
||||
* @param progressCategory 进度类别
|
||||
*/
|
||||
@Override
|
||||
public void validPlanNumber(Long planNumber, Long progressCategoryId) {
|
||||
PgsProgressCategory progressCategory = progressCategoryService.getById(progressCategoryId);
|
||||
public void validPlanNumber(Long planNumber, PgsProgressCategory progressCategory) {
|
||||
if (progressCategory == null) {
|
||||
throw new ServiceException("进度类别不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import org.dromara.project.domain.vo.projectfile.BusProjectFileVo;
|
||||
import org.dromara.project.mapper.BusProjectFileMapper;
|
||||
import org.dromara.project.service.IBusProjectFileService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.utils.Dxf2JsonUtils;
|
||||
import org.dromara.utils.Dxf2JsonUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -293,7 +293,7 @@ public class BusProjectFileServiceImpl extends ServiceImpl<BusProjectFileMapper,
|
||||
scheduledExecutorService.execute(() -> {
|
||||
try {
|
||||
// 构造命令行参数
|
||||
Dxf2JsonUtils.dxf2json(exePath, inputDXFPath, outputJSONPath, sourceEPSG, targetEPSG);
|
||||
Dxf2JsonUtil.dxf2json(exePath, inputDXFPath, outputJSONPath, sourceEPSG, targetEPSG);
|
||||
String jsonFilePath = bashPath + File.separator + uuid + "." + DesignMapFileConstant.JSONFileSuffix;
|
||||
String jsonFileName = FileUtil.getPrefix(fileName) + "." + DesignMapFileConstant.JSONFileSuffix;
|
||||
// 修改数据库信息
|
||||
|
@ -35,7 +35,7 @@ import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.dromara.utils.DocumentUtils;
|
||||
import org.dromara.utils.DocumentUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -378,7 +378,7 @@ public class QltQualityConstructionLogServiceImpl extends ServiceImpl<QltQuality
|
||||
// 设置响应头,返回ZIP文件
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
|
||||
try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) {
|
||||
DocumentUtils.zipDirectory(targetDir, targetDir, zos);
|
||||
DocumentUtil.zipDirectory(targetDir, targetDir, zos);
|
||||
zos.flush();
|
||||
} catch (Exception e) {
|
||||
throw new OssException("生成ZIP文件失败,错误信息: " + e.getMessage());
|
||||
@ -451,7 +451,7 @@ public class QltQualityConstructionLogServiceImpl extends ServiceImpl<QltQuality
|
||||
String fileDownload = storage.fileDownload(ossVo.getUrl(), ossVo.getOriginalName(), baseFile);
|
||||
if (lowerVal.endsWith(".png") || lowerVal.endsWith(".jpg") || lowerVal.endsWith(".jpeg") || lowerVal.endsWith(".gif")) {
|
||||
try {
|
||||
DocumentUtils.insertImageDynamic(run, fileDownload, document, 300);
|
||||
DocumentUtil.insertImageDynamic(run, fileDownload, document, 300);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("插入图片失败");
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ import org.dromara.system.service.ISysDictDataService;
|
||||
import org.dromara.system.service.ISysDictTypeService;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.dromara.utils.DocumentUtils;
|
||||
import org.dromara.utils.DocumentUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -490,7 +490,7 @@ public class QltQualityInspectionServiceImpl extends ServiceImpl<QltQualityInspe
|
||||
// 设置响应头,返回ZIP文件
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
|
||||
try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) {
|
||||
DocumentUtils.zipDirectory(targetDir, targetDir, zos);
|
||||
DocumentUtil.zipDirectory(targetDir, targetDir, zos);
|
||||
zos.flush();
|
||||
} catch (Exception e) {
|
||||
throw new OssException("生成ZIP文件失败,错误信息: " + e.getMessage());
|
||||
@ -574,7 +574,7 @@ public class QltQualityInspectionServiceImpl extends ServiceImpl<QltQualityInspe
|
||||
String fileDownload = storage.fileDownload(ossVo.getUrl(), ossVo.getOriginalName(), baseFile);
|
||||
if (lowerVal.endsWith(".png") || lowerVal.endsWith(".jpg") || lowerVal.endsWith(".jpeg") || lowerVal.endsWith(".gif")) {
|
||||
try {
|
||||
DocumentUtils.insertImageDynamic(run, fileDownload, document, 300);
|
||||
DocumentUtil.insertImageDynamic(run, fileDownload, document, 300);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("插入图片失败");
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysDictDataService;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.dromara.utils.DocumentUtils;
|
||||
import org.dromara.utils.DocumentUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -449,7 +449,7 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
// 设置响应头,返回ZIP文件
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
|
||||
try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) {
|
||||
DocumentUtils.zipDirectory(targetDir, targetDir, zos);
|
||||
DocumentUtil.zipDirectory(targetDir, targetDir, zos);
|
||||
zos.flush();
|
||||
} catch (Exception e) {
|
||||
throw new OssException("生成ZIP文件失败,错误信息: " + e.getMessage());
|
||||
@ -535,7 +535,7 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
String fileDownload = storage.fileDownload(ossVo.getUrl(), ossVo.getOriginalName(), baseFile);
|
||||
if (lowerVal.endsWith(".png") || lowerVal.endsWith(".jpg") || lowerVal.endsWith(".jpeg") || lowerVal.endsWith(".gif")) {
|
||||
try {
|
||||
DocumentUtils.insertImageDynamic(run, fileDownload, document, 300);
|
||||
DocumentUtil.insertImageDynamic(run, fileDownload, document, 300);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("插入图片失败");
|
||||
}
|
||||
|
@ -16,12 +16,11 @@ public class BigDecimalUtil {
|
||||
* @param divisor 除数
|
||||
* @return 百分比(保留2位小数)如 12.34%
|
||||
*/
|
||||
public static String toPercentage(BigDecimal dividend, BigDecimal divisor) {
|
||||
public static BigDecimal toPercentage(BigDecimal dividend, BigDecimal divisor) {
|
||||
if (dividend == null || divisor == null || divisor.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return "0";
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
BigDecimal percentage = dividend.divide(divisor, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
||||
return percentage.toPlainString();
|
||||
return dividend.divide(divisor, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import java.util.zip.ZipOutputStream;
|
||||
* @author lcj
|
||||
* @date 2025/4/17 14:53
|
||||
*/
|
||||
public class DocumentUtils {
|
||||
public class DocumentUtil {
|
||||
|
||||
/**
|
||||
* 在给定的 run 里插入图片,并按原始大小(或缩放后大小)设置宽高。
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||
* @date 2025/4/23 10:42
|
||||
*/
|
||||
@Slf4j
|
||||
public class Dxf2JsonUtils {
|
||||
public class Dxf2JsonUtil {
|
||||
|
||||
/**
|
||||
* dxf转json
|
@ -15,7 +15,7 @@ import java.util.stream.Collectors;
|
||||
* @author lcj
|
||||
* @date 2025/4/24 11:48
|
||||
*/
|
||||
public class JSTUtils {
|
||||
public class JSTUtil {
|
||||
|
||||
private static final GeometryFactory geometryFactory = new GeometryFactory();
|
||||
|
@ -0,0 +1,34 @@
|
||||
package org.dromara.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @author lcj
|
||||
* @date 2025/5/28 11:25
|
||||
*/
|
||||
public class PageConvertUtil {
|
||||
|
||||
/**
|
||||
* 将 Page<T> 转换为 Page<V>
|
||||
*
|
||||
* @param source 原始分页数据
|
||||
* @param mapper 实体 -> VO 的转换函数
|
||||
* @return Page<V>
|
||||
*/
|
||||
public static <T, V> Page<V> convert(Page<T> source, Function<T, V> mapper) {
|
||||
Page<V> target = new Page<>(source.getCurrent(), source.getSize(), source.getTotal());
|
||||
if (CollUtil.isEmpty(source.getRecords())) {
|
||||
target.setRecords(Collections.emptyList());
|
||||
} else {
|
||||
List<V> voList = source.getRecords().stream().map(mapper).toList();
|
||||
target.setRecords(voList);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
}
|
@ -1048,10 +1048,12 @@ CREATE TABLE `pgs_progress_plan_detail`
|
||||
`id` bigint not null auto_increment comment '主键id',
|
||||
`project_id` bigint not null comment '项目id',
|
||||
`progress_plan_id` bigint not null comment '进度计划id',
|
||||
`progress_category_id` bigint null comment '进度类型id',
|
||||
`date` date null comment '计划时间',
|
||||
`plan_number` decimal(10) null comment '计划数量/百分比',
|
||||
`finished_number` decimal(10) null comment '完成数量/百分比',
|
||||
`ai_fill` decimal(10) null comment 'AI填入数量',
|
||||
`finished_detail` text null comment '完成设施详情',
|
||||
`create_by` varchar(64) null comment '创建者',
|
||||
`update_by` varchar(64) null comment '更新者',
|
||||
`create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||
@ -1060,5 +1062,6 @@ CREATE TABLE `pgs_progress_plan_detail`
|
||||
`is_delete` tinyint(4) default 0 not null comment '是否删除(0正常 1删除)',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_project_id` (`project_id` ASC) USING BTREE comment '项目id',
|
||||
INDEX `idx_progress_plan_id` (`progress_plan_id` ASC) USING BTREE comment '进度计划id'
|
||||
INDEX `idx_progress_plan_id` (`progress_plan_id` ASC) USING BTREE comment '进度计划id',
|
||||
INDEX `idx_date` (`date` ASC) USING BTREE comment '计划时间'
|
||||
) comment ='进度计划详情' COLLATE = utf8mb4_unicode_ci;
|
||||
|
Reference in New Issue
Block a user