Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2025-10-13 18:44:18 +08:00
31 changed files with 588 additions and 104 deletions

View File

@ -83,6 +83,7 @@ public class RedisSubscribeManager {
Object object = RedisUtils.getCacheObject("xmjdap:ws");
log.info("开始执行Redis订阅更新定时任务...");
if (object == null) {
cancelAllSubscribes();
return;
}
long oldTime = Long.parseLong(String.valueOf(object));

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
@ -114,7 +115,15 @@ public class DroProjectDroneServiceImpl extends ServiceImpl<DroProjectDroneMappe
* 保存前的数据校验
*/
private void validEntityBeforeSave(DroProjectDrone entity) {
//TODO 做一些数据校验,如唯一约束
// 判断无人机是否已被其他项目使用
Long count = this.lambdaQuery()
.eq(DroProjectDrone::getDroneSn, entity.getDroneSn())
.ne(entity.getProjectId() != null, DroProjectDrone::getProjectId, entity.getProjectId())
.ne(entity.getId() != null, DroProjectDrone::getId, entity.getId())
.count();
if (count > 0) {
throw new ServiceException("无人机已存在于其他项目");
}
}
/**

View File

@ -13,8 +13,7 @@ import org.dromara.contractor.domain.SubConstructionUser;
import org.dromara.contractor.domain.dto.constructionuser.SubConstructionUserQueryReq;
import org.dromara.contractor.service.ISubConstructionUserService;
import org.dromara.gps.domain.bo.GpsEquipmentBo;
import org.dromara.gps.domain.vo.ConstructionUser;
import org.dromara.gps.domain.vo.GpsProjectVo;
import org.dromara.gps.domain.vo.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
@ -26,7 +25,6 @@ import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.gps.domain.vo.DeviceVo;
import org.dromara.gps.domain.bo.DeviceBo;
import org.dromara.gps.service.IDeviceService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -114,6 +112,15 @@ public class DeviceController extends BaseController {
return toAjax(deviceService.deleteWithValidByIds(List.of(ids), true));
}
/**
* 查询GPS设备用户列表
*/
@SaCheckPermission("gps:device:getUserList")
@GetMapping("/getUserList")
public R<List<AnqmUserVo>> getUserList(DeviceBo bo) {
return R.ok(deviceService.getUserList(bo));
}
/**
* 项目列表

View File

@ -15,7 +15,7 @@ import java.io.Serial;
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("device")
@TableName("anqm_device")
public class Device extends BaseEntity {
@Serial

View File

@ -15,7 +15,7 @@ import java.io.Serial;
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("location")
@TableName("anqm_location")
public class Location extends BaseEntity {
@Serial

View File

@ -97,5 +97,7 @@ public class DeviceBo extends BaseEntity {
*/
private String batteryOff;
private Integer type;
}

View File

@ -0,0 +1,51 @@
package org.dromara.gps.domain.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* GPS人机关联视图对象 gps_manmachine
*
* @author Lion Li
* @date 2025-08-28
*/
@Data
//@ExcelIgnoreUnannotated
//@AutoMapper(target = GpsManmachine.class)
public class AnqmUserVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*类型1、历史0、当前
*/
// @ExcelProperty(value = "")
private Integer type;
/**
*
*/
// @ExcelProperty(value = "")
private Long userId;
/**
* 用户名
*/
private String userName;
/**
*
*/
// @ExcelProperty(value = "")
private Long projectId;
/**
* 用户名
*/
private String projectName;
private String devNum;
}

View File

@ -34,6 +34,13 @@ public class DeviceVo implements Serializable {
@ExcelProperty(value = "id")
private Long id;
/**
* 用户id
*/
private Long userId;
private String userName;
/**
* 设备编号
*/
@ -58,6 +65,8 @@ public class DeviceVo implements Serializable {
@ExcelProperty(value = "项目id")
private Long projectId;
private String projectName;
/**
* 设备采集温度
*/
@ -112,5 +121,7 @@ public class DeviceVo implements Serializable {
@ExcelProperty(value = "电池关机时间")
private String batteryOff;
private Integer type;
}

View File

@ -1,9 +1,15 @@
package org.dromara.gps.mapper;
import jakarta.validation.constraints.NotBlank;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.dromara.gps.domain.Device;
import org.dromara.gps.domain.vo.AnqmUserVo;
import org.dromara.gps.domain.vo.DeviceVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import java.util.List;
/**
* 安全帽设备Mapper接口
*
@ -12,4 +18,17 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
*/
public interface DeviceMapper extends BaseMapperPlus<Device, DeviceVo> {
@Select("SELECT\n" +
" gm.user_id AS userId,\n" +
" su.user_name AS userName, \n" +
" gm.project_id AS projectId,\n" +
" bp.project_name AS projectName \n" +
"FROM\n" +
" anqm_location gm\n" +
" LEFT JOIN sys_user su ON gm.user_id = su.user_id \n" +
"LEFT JOIN bus_project bp ON gm.project_id = bp.id \n" +
"WHERE\n" +
" gm.dev_num = #{devNum}" +
" GROUP BY gm.user_id,gm.project_id")
List<AnqmUserVo> getUserList(@Param("devNum") String devNum);
}

View File

@ -23,7 +23,7 @@ public interface LocationMapper extends BaseMapperPlus<Location, LocationVo> {
"ROW_NUMBER() OVER(" +
"PARTITION BY user_id " +
"ORDER BY create_time DESC, id DESC) AS rn " +
"FROM location WHERE project_id = #{projectId})" +
"FROM anqm_location WHERE project_id = #{projectId})" +
"SELECT user_id AS userId," +
"latitude AS latitude, " +
"longitude AS longitude " +
@ -37,7 +37,7 @@ public interface LocationMapper extends BaseMapperPlus<Location, LocationVo> {
" *,\n" +
" ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY create_time DESC) AS rn\n" +
" FROM\n" +
" location \n " +
" anqm_location \n " +
"WHERE \n" +
"project_id = #{projectId}\n " +
// "AND create_time BETWEEN #{startTime} AND #{endTime} \n" +

View File

@ -1,6 +1,7 @@
package org.dromara.gps.service;
import org.dromara.gps.domain.bo.GpsEquipmentBo;
import org.dromara.gps.domain.vo.AnqmUserVo;
import org.dromara.gps.domain.vo.DeviceVo;
import org.dromara.gps.domain.bo.DeviceBo;
import org.dromara.gps.domain.Device;
@ -9,6 +10,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.gps.domain.vo.GpsProjectVo;
import org.dromara.gps.domain.vo.GpsUserVo;
import java.time.LocalDateTime;
import java.util.Collection;
@ -79,4 +81,6 @@ public interface IDeviceService extends IService<Device>{
Boolean unbindManmachine(DeviceBo bo);
List<DeviceVo> getUserListByProjectId(Long projectId, LocalDateTime startOfDay, LocalDateTime now);
List<AnqmUserVo> getUserList(DeviceBo bo);
}

View File

@ -15,25 +15,24 @@ import lombok.RequiredArgsConstructor;
import org.dromara.gps.domain.AnqmManmachine;
import org.dromara.gps.domain.GpsEquipment;
import org.dromara.gps.domain.GpsManmachine;
import org.dromara.gps.domain.vo.GpsProjectVo;
import org.dromara.gps.domain.bo.GpsEquipmentBo;
import org.dromara.gps.domain.vo.*;
import org.dromara.gps.mapper.AnqmManmachineMapper;
import org.dromara.gps.service.ILocationService;
import org.dromara.project.domain.vo.project.BusProjectVo;
import org.dromara.project.service.IBusProjectService;
import org.dromara.system.domain.vo.SysUserVo;
import org.dromara.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.dromara.gps.domain.bo.DeviceBo;
import org.dromara.gps.domain.vo.DeviceVo;
import org.dromara.gps.domain.Device;
import org.dromara.gps.mapper.DeviceMapper;
import org.dromara.gps.service.IDeviceService;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.*;
/**
* 安全帽设备Service业务层处理
@ -56,6 +55,9 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
@Autowired
private ILocationService locationService;
@Autowired
private ISysUserService userService;
/**
* 查询安全帽设备
*
@ -78,6 +80,40 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
public TableDataInfo<DeviceVo> queryPageList(DeviceBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<Device> lqw = buildQueryWrapper(bo);
Page<DeviceVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
if (bo.getType() == 1){
List<DeviceVo> list = result.getRecords().stream()
.filter(gpsEquipment -> gpsEquipment.getProjectId() != null)
.toList();
list.forEach(item -> {
if (item.getUserId() != null){
item.setType(1);
SysUserVo sysUserVo = userService.queryById(item.getUserId());
if (sysUserVo != null) {
item.setUserName(sysUserVo.getNickName());
}
}else{
item.setType(2);
}
BusProjectVo busProjectVo = projectService.selectById(item.getProjectId());
if (busProjectVo != null) {
item.setProjectName(busProjectVo.getProjectName());
}
});
result.setRecords(list);
}else if (bo.getType() == 2){
List<DeviceVo> list = result.getRecords().stream()
.filter(gpsEquipment -> gpsEquipment.getProjectId() == null).toList();
list.forEach(item ->{
if (item.getProjectId() != null) {
BusProjectVo busProjectVo = projectService.selectById(item.getProjectId());
if (busProjectVo != null) {
item.setProjectName(busProjectVo.getProjectName());
}
}
item.setType(2);
});
result.setRecords(list);
}
return TableDataInfo.build(result);
}
@ -222,4 +258,23 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
public List<DeviceVo> getUserListByProjectId(Long projectId, LocalDateTime startOfDay, LocalDateTime now) {
return locationService.getUserListByProjectId(projectId,startOfDay,now);
}
@Override
public List<AnqmUserVo> getUserList(DeviceBo bo) {
List<AnqmUserVo> gpsUserVos = baseMapper.getUserList(bo.getDevNum());
if (gpsUserVos == null || gpsUserVos.isEmpty()) {
return null;
}
List<AnqmUserVo> list = gpsUserVos.stream().filter(Objects::nonNull).toList();
AnqmManmachine gpsManmachine = anqmManmachineMapper.selectOne(new LambdaQueryWrapper<AnqmManmachine>().eq(AnqmManmachine::getClientId, bo.getDevNum()));
for (AnqmUserVo item : list) {
item.setDevNum(bo.getDevNum());
if (gpsManmachine != null && gpsManmachine.getUserId().equals(item.getUserId())) {
item.setType(0);
}else {
item.setType(1);
}
}
return list;
}
}

View File

@ -16,6 +16,7 @@ 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.out.domain.bo.OutConstructionValueBo;
import org.dromara.out.domain.bo.OutConstructionValueFacilityReq;
import org.dromara.out.domain.vo.OutConstructionAllValueVo;
import org.dromara.out.domain.vo.OutConstructionValueVo;
import org.dromara.out.service.IOutConstructionValueService;
@ -113,4 +114,24 @@ public class OutConstructionValueController extends BaseController {
@PathVariable Long[] ids) {
return toAjax(outConstructionValueService.deleteWithValidByIds(List.of(ids), true));
}
/**
* 新增进度计划详情
*/
@SaCheckPermission("out:constructionValue:edit")
@RepeatSubmit()
@PostMapping("/insert/facility")
public R<Void> insertFinishedDetail(@Validated @RequestBody OutConstructionValueFacilityReq req) {
return toAjax(outConstructionValueService.insertFacilityDetail(req));
}
/**
* 删除进度计划详情
*/
@SaCheckPermission("out:constructionValue:edit")
@RepeatSubmit()
@DeleteMapping("/remove/facility")
public R<Void> removeDetail(@Validated OutConstructionValueFacilityReq req) {
return toAjax(outConstructionValueService.removeFacilityDetail(req));
}
}

View File

@ -0,0 +1,42 @@
package org.dromara.out.domain.bo;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;
/**
* @author lilemy
* @date 2025-10-12 17:51
*/
@Data
public class OutConstructionValueFacilityReq implements Serializable {
@Serial
private static final long serialVersionUID = -5491058421687762904L;
/**
* 主键ID
*/
@NotNull(message = "主键ID不能为空")
private Long id;
/**
* 上报日期
*/
private LocalDate reportDate;
/**
* 详情主键id
*/
@NotNull(message = "详情主键id不能为空")
private Long detailId;
/**
* 详情id列表
*/
private List<Long> detailIdList;
}

View File

@ -166,4 +166,9 @@ public class OutConstructionValueVo implements Serializable {
* 对甲产值
*/
private BigDecimal ownerValue;
/**
* 工作类型
*/
private String workType;
}

View File

@ -5,6 +5,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.out.domain.OutConstructionValue;
import org.dromara.out.domain.bo.OutConstructionValueBo;
import org.dromara.out.domain.bo.OutConstructionValueFacilityReq;
import org.dromara.out.domain.vo.OutConstructionAllValueVo;
import org.dromara.out.domain.vo.OutConstructionValueVo;
@ -86,4 +87,20 @@ public interface IOutConstructionValueService extends IService<OutConstructionVa
* @return 施工所有产值
*/
OutConstructionAllValueVo getAllValue(OutConstructionValueBo bo);
/**
* 新增设施设施详情
*
* @param req 新增设施设施详情
* @return 新增设施设施详情
*/
Boolean insertFacilityDetail(OutConstructionValueFacilityReq req);
/**
* 删除设施设施详情
*
* @param req 删除设施设施详情
* @return 删除设施设施详情
*/
Boolean removeFacilityDetail(OutConstructionValueFacilityReq req);
}

View File

@ -18,13 +18,17 @@ import org.dromara.facility.service.IFacMatrixService;
import org.dromara.out.domain.OutConstructionValue;
import org.dromara.out.domain.OutConstructionValueRange;
import org.dromara.out.domain.bo.OutConstructionValueBo;
import org.dromara.out.domain.bo.OutConstructionValueFacilityReq;
import org.dromara.out.domain.vo.OutConstructionAllValueVo;
import org.dromara.out.domain.vo.OutConstructionValueVo;
import org.dromara.out.mapper.OutConstructionValueMapper;
import org.dromara.out.service.IOutConstructionValueRangeService;
import org.dromara.out.service.IOutConstructionValueService;
import org.dromara.progress.domain.PgsProgressCategory;
import org.dromara.progress.domain.PgsProgressPlanDetail;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateReq;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq;
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailRemoveReq;
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryVo;
import org.dromara.progress.service.IPgsProgressCategoryService;
import org.dromara.progress.service.IPgsProgressPlanDetailService;
@ -188,7 +192,7 @@ public class OutConstructionValueServiceImpl extends ServiceImpl<OutConstruction
}
OutConstructionValue update = MapstructUtils.convert(bo, OutConstructionValue.class);
validEntityBeforeSave(update);
PgsProgressCategory progressCategory = pgsProgressCategoryService.getById(bo.getProgressCategoryId());
PgsProgressCategory progressCategory = pgsProgressCategoryService.getById(old.getProgressCategoryId());
// 同步确认数量
BigDecimal confirmNum = BigDecimal.valueOf(bo.getConfirmNum());
if (StringUtils.isBlank(progressCategory.getWorkType())) {
@ -274,6 +278,48 @@ public class OutConstructionValueServiceImpl extends ServiceImpl<OutConstruction
return vo;
}
/**
* 新增设施设施详情
*
* @param req 新增设施设施详情
* @return 新增设施设施详情
*/
@Override
public Boolean insertFacilityDetail(OutConstructionValueFacilityReq req) {
PgsProgressPlanDetailFinishedCreateReq dto = new PgsProgressPlanDetailFinishedCreateReq();
dto.setId(req.getDetailId());
dto.setFinishedDetailIdList(req.getDetailIdList());
pgsProgressPlanDetailService.insertFinishedDetail(dto, false);
PgsProgressPlanDetail detail = pgsProgressPlanDetailService.getById(req.getDetailId());
OutConstructionValueBo bo = new OutConstructionValueBo();
bo.setId(req.getId());
bo.setConfirmNum(detail.getFinishedNumber().intValue());
bo.setReportDate(req.getReportDate());
this.updateByBo(bo);
return true;
}
/**
* 删除设施设施详情
*
* @param req 删除设施设施详情
* @return 删除设施设施详情
*/
@Override
public Boolean removeFacilityDetail(OutConstructionValueFacilityReq req) {
PgsProgressPlanDetailRemoveReq dto = new PgsProgressPlanDetailRemoveReq();
dto.setId(req.getDetailId());
dto.setDetailIdList(req.getDetailIdList());
pgsProgressPlanDetailService.removeDetail(dto, false);
PgsProgressPlanDetail detail = pgsProgressPlanDetailService.getById(req.getDetailId());
OutConstructionValueBo bo = new OutConstructionValueBo();
bo.setId(req.getId());
bo.setConfirmNum(detail.getFinishedNumber().intValue());
bo.setReportDate(req.getReportDate());
this.updateByBo(bo);
return true;
}
/**
* 补充数据
*/
@ -288,7 +334,7 @@ public class OutConstructionValueServiceImpl extends ServiceImpl<OutConstruction
//查询分部工程以及分项工程
PgsProgressCategoryVo pgsProgressCategoryVo = pgsProgressCategoryService.queryById(vo.getProgressCategoryId());
vo.setProgressCategoryName(pgsProgressCategoryVo.getName());
vo.setWorkType(pgsProgressCategoryVo.getWorkType());
PgsProgressCategoryVo pgsProgressCategoryVo1 = pgsProgressCategoryService.queryById(pgsProgressCategoryVo.getParentId());
vo.setCategoryId(pgsProgressCategoryVo1.getId());
vo.setCategoryName(pgsProgressCategoryVo1.getName());

View File

@ -345,6 +345,18 @@ public class PgsProgressCategoryController extends BaseController {
return R.ok(pgsProgressCategoryService.queryLastTimeById(id));
}
/**
* 获取进度类别甘特图结构
*
* @param projectId 项目主键
*/
@SaCheckPermission("progress:progressCategory:query")
@GetMapping("/gantt/{projectId}")
public R<List<PgsProgressCategoryGanttVo>> listGantt(@NotNull(message = "主键不能为空")
@PathVariable Long projectId) {
return R.ok(pgsProgressCategoryService.listGanttByProject(projectId));
}
/**
* 新增分项工程单价
*/

View File

@ -46,7 +46,7 @@ public class PgsProgressPlanDetailController extends BaseController {
@RepeatSubmit()
@PostMapping("/insert/detail")
public R<Void> insertFinishedDetail(@Validated @RequestBody PgsProgressPlanDetailFinishedCreateReq req) {
return toAjax(pgsProgressPlanDetailService.insertFinishedDetail(req));
return toAjax(pgsProgressPlanDetailService.insertFinishedDetail(req, true));
}
/**
@ -100,7 +100,7 @@ public class PgsProgressPlanDetailController extends BaseController {
@RepeatSubmit()
@DeleteMapping("/remove/detail")
public R<Void> removeDetail(@Validated PgsProgressPlanDetailRemoveReq req) {
return toAjax(pgsProgressPlanDetailService.removeDetail(req));
return toAjax(pgsProgressPlanDetailService.removeDetail(req, true));
}
}

View File

@ -48,7 +48,7 @@ public class PgsProgressPlanDetailAppController extends BaseController {
@RepeatSubmit()
@PostMapping("/insert/detail")
public R<Void> insertFinishedDetail(@Validated @RequestBody PgsProgressPlanDetailFinishedCreateReq req) {
return toAjax(progressPlanDetailService.insertFinishedDetail(req));
return toAjax(progressPlanDetailService.insertFinishedDetail(req, true));
}
/**
@ -90,7 +90,7 @@ public class PgsProgressPlanDetailAppController extends BaseController {
@RepeatSubmit()
@DeleteMapping("/remove/detail")
public R<Void> removeDetail(@Validated PgsProgressPlanDetailRemoveReq req) {
return toAjax(progressPlanDetailService.removeDetail(req));
return toAjax(progressPlanDetailService.removeDetail(req, true));
}
}

View File

@ -0,0 +1,49 @@
package org.dromara.progress.domain.vo.progresscategory;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* @author lilemy
* @date 2025-10-12 15:15
*/
@Data
public class PgsProgressCategoryGanttVo implements Serializable {
@Serial
private static final long serialVersionUID = 1759675635511567284L;
/**
* id
*/
private Long id;
/**
* 父级id
*/
private Long parentId;
/**
* 名称
*/
private String text;
/**
* 开始时间
*/
private LocalDate startDate;
/**
* 结束时间
*/
private LocalDate endDate;
/**
* 进度
*/
private BigDecimal progress;
}

View File

@ -165,6 +165,15 @@ public interface IPgsProgressCategoryService extends IService<PgsProgressCategor
*/
List<PgsProgressCategory> getLeafNodesByTopId(Long topId);
/**
* 获取最底层的叶子节点
*
* @param topId 顶级节点id
* @param allCategory 所有节点
* @return 最底层的叶子节点
*/
List<PgsProgressCategory> getLeafNodesByTopId(Long topId, List<PgsProgressCategory> allCategory);
/**
* 获取最底层的叶子节点支持多个顶级id
*
@ -212,4 +221,12 @@ public interface IPgsProgressCategoryService extends IService<PgsProgressCategor
* @return 是否新增成功
*/
Boolean insertBatchFacility(PgsProgressCategoryCreateBatchFacilityReq req);
/**
* 获取进度类别甘特图结构
*
* @param projectId 项目id
* @return 进度类别甘特图结构
*/
List<PgsProgressCategoryGanttVo> listGanttByProject(Long projectId);
}

View File

@ -38,7 +38,7 @@ public interface IPgsProgressPlanDetailService extends IService<PgsProgressPlanD
* @param req 插入进度计划详情设施参数
* @return 是否插入成功
*/
Boolean insertFinishedDetail(PgsProgressPlanDetailFinishedCreateReq req);
Boolean insertFinishedDetail(PgsProgressPlanDetailFinishedCreateReq req, Boolean isCheckout);
/**
* 插入进度计划详情设施
@ -80,7 +80,7 @@ public interface IPgsProgressPlanDetailService extends IService<PgsProgressPlanD
* @param req 删除进度计划详情参数
* @return 是否删除成功
*/
Boolean removeDetail(PgsProgressPlanDetailRemoveReq req);
Boolean removeDetail(PgsProgressPlanDetailRemoveReq req, Boolean isCheckout);
/**
* 获取进度计划详情视图对象

View File

@ -1400,6 +1400,43 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
.toList();
}
/**
* 获取最底层的叶子节点
*
* @param topId 顶级节点id
* @param allCategory 所有节点
* @return 最底层的叶子节点
*/
@Override
public List<PgsProgressCategory> getLeafNodesByTopId(Long topId, List<PgsProgressCategory> allCategory) {
if (allCategory == null || allCategory.isEmpty()) {
return Collections.emptyList();
}
// 1. 找出所有属于该顶级节点的子孙节点Ancestors 字段包含 ,topId,
List<PgsProgressCategory> allChildren = allCategory.stream()
.filter(item -> {
String ancestors = item.getAncestors();
return ancestors != null && ancestors.contains("," + topId + ",");
})
.toList();
if (allChildren.isEmpty()) {
return Collections.emptyList();
}
// 2. 找出所有的 parentId即有孩子的节点
Set<Long> parentIds = allChildren.stream()
.map(PgsProgressCategory::getParentId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
// 3. 过滤出没有作为别人 parentId 出现的节点 → 叶子节点
return allChildren.stream()
.filter(item -> !parentIds.contains(item.getId()))
.toList();
}
/**
* 获取最底层的叶子节点支持多个顶级id
*
@ -1823,4 +1860,69 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
return true;
}
/**
* 获取进度类别甘特图结构
*
* @param projectId 项目id
* @return 进度类别甘特图结构
*/
@Override
public List<PgsProgressCategoryGanttVo> listGanttByProject(Long projectId) {
List<PgsProgressCategoryGanttVo> ganttList = new ArrayList<>();
// 获取项目
BusProject project = projectService.getById(projectId);
if (project == null) {
throw new ServiceException("项目不存在", HttpStatus.NOT_FOUND);
}
// 获取当前项目的所有子项目
List<BusProject> projectList = projectService.lambdaQuery()
.eq(BusProject::getPId, projectId)
.list();
projectList.add(project);
if (CollUtil.isEmpty(projectList)) {
return ganttList;
}
List<Long> projectIds = projectList.stream().map(BusProject::getId).toList();
// 获取当前项目所有进度类别
List<PgsProgressCategory> progressCategoryList = this.lambdaQuery()
.in(PgsProgressCategory::getProjectId, projectIds)
.eq(PgsProgressCategory::getMatrixId, 0)
.list();
if (CollUtil.isEmpty(progressCategoryList)) {
return ganttList;
}
// 封装进度类别数据
List<PgsProgressCategoryGanttVo> list = progressCategoryList.stream().map(p -> {
// 获取所有子节点
List<PgsProgressCategory> children = this.getLeafNodesByTopId(p.getId(), progressCategoryList);
PgsProgressCategoryGanttVo vo = new PgsProgressCategoryGanttVo();
vo.setId(p.getId());
vo.setParentId(p.getParentId());
vo.setText(p.getName());
vo.setStartDate(null);
vo.setEndDate(null);
vo.setProgress(this.getCompletedPercentage(children)
.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP));
return vo;
}).toList();
ganttList.addAll(list);
// 获取当前项目所有计划
List<PgsProgressPlan> planList = progressPlanService.lambdaQuery()
.eq(PgsProgressPlan::getProjectId, projectId)
.list();
List<PgsProgressCategoryGanttVo> list1 = planList.stream().map(p -> {
PgsProgressCategoryGanttVo vo = new PgsProgressCategoryGanttVo();
vo.setId(p.getId());
vo.setParentId(p.getProgressCategoryId());
vo.setText(p.getProgressCategoryName() + "-" + "计划");
vo.setStartDate(p.getStartDate());
vo.setEndDate(p.getEndDate());
vo.setProgress(BigDecimalUtil.toPercentage(p.getFinishedNumber(), p.getPlanNumber())
.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP));
return vo;
}).toList();
ganttList.addAll(list1);
return ganttList;
}
}

View File

@ -156,7 +156,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertFinishedDetail(PgsProgressPlanDetailFinishedCreateReq req) {
public Boolean insertFinishedDetail(PgsProgressPlanDetailFinishedCreateReq req, Boolean isCheckout) {
List<Long> finishedDetailIdList = req.getFinishedDetailIdList();
if (CollUtil.isEmpty(finishedDetailIdList)) {
return true;
@ -168,7 +168,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
throw new ServiceException("进度计划详情信息不存在", HttpStatus.NOT_FOUND);
}
// 判断当前详情是否已提交
if (!progressPlanDetail.getStatus().equals("1")) {
if (isCheckout && !progressPlanDetail.getStatus().equals("1")) {
throw new ServiceException("当前详情已提交至施工产值,无法进行修改", HttpStatus.BAD_REQUEST);
}
Long progressPlanId = progressPlanDetail.getProgressPlanId();
@ -627,7 +627,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean removeDetail(PgsProgressPlanDetailRemoveReq req) {
public Boolean removeDetail(PgsProgressPlanDetailRemoveReq req, Boolean isCheckout) {
Long id = req.getId();
List<Long> detailIdList = req.getDetailIdList();
if (CollUtil.isEmpty(detailIdList)) {
@ -637,6 +637,10 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
if (progressPlanDetail == null) {
throw new ServiceException("进度计划详情数据不存在", HttpStatus.NOT_FOUND);
}
// 判断当前详情是否已提交
if (isCheckout && !progressPlanDetail.getStatus().equals("1")) {
throw new ServiceException("当前详情已提交至施工产值,无法进行修改", HttpStatus.BAD_REQUEST);
}
String finishedDetail = progressPlanDetail.getFinishedDetail();
int removeTotal = detailIdList.size();
List<PgsProgressPlanDetailFinishedVo> finishedVoList = JSONUtil.toList(finishedDetail, PgsProgressPlanDetailFinishedVo.class);
@ -977,6 +981,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
value.setArtificialNum(finishedNumber.subtract(aiFill).intValue());
value.setUavNum(aiFill.intValue());
value.setPlanNum(planDetail.getPlanNumber().intValue());
value.setConfirmNum(finishedNumber.intValue());
value.setReportDate(planDetail.getDate());
value.setPlanDate(planDetail.getDate());
// 计算产值
@ -1054,6 +1059,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
value.setArtificialNum(finishedNumber.subtract(aiFill).intValue());
value.setUavNum(aiFill.intValue());
value.setPlanNum(planDetail.getPlanNumber().intValue());
value.setConfirmNum(finishedNumber.intValue());
value.setReportDate(planDetail.getDate());
value.setPlanDate(planDetail.getDate());
// 计算产值

View File

@ -69,4 +69,9 @@ public class BusLeaveAddReq implements Serializable {
* 申请人类型0-施工人员 1-管理人员 2-分包人员)
*/
private String userType;
private Long gangerId;
private String gangerName;
}

View File

@ -25,13 +25,12 @@ public class BusReissueCardManagerReviewReq implements Serializable {
/**
* 管理员意见1未读 2同意 3拒绝
*/
@NotNull(message = "管理员意见不能为空")
private String managerOpinion;
private String gangerOpinion;
/**
* 管理员说明
* 班组长说明
*/
private String managerExplain;
private String gangerExplain;
/**
* 备注

View File

@ -60,6 +60,8 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static org.dromara.common.core.constant.TenantConstants.SUPER_ADMIN_ID;
/**
* 施工人员补卡申请Service业务层处理
*
@ -185,60 +187,46 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper,
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean managerReview(BusReissueCardManagerReviewReq req) {
// Long id = req.getId();
// String managerOpinion = req.getManagerOpinion();
// // 判断该补卡记录是否存在
// BusReissueCard oldReissueCard = this.getById(id);
// if (oldReissueCard == null) {
// throw new ServiceException("施工人员补卡申请不存在", HttpStatus.NOT_FOUND);
// }
// // 如果已经审核过,则返回
// if (!BusOpinionStatusEnum.UNREAD.getValue().equals(managerOpinion)) {
// throw new ServiceException("该请假已审核,请勿重复操作", HttpStatus.BAD_REQUEST);
// }
// // 判断班组长是否审核通过
// String gangerOpinion = oldReissueCard.getGangerOpinion();
// if (!BusOpinionStatusEnum.PASS.getValue().equals(gangerOpinion)) {
// throw new ServiceException("请等待班组长审核通过后再进行操作", HttpStatus.BAD_REQUEST);
// }
// // todo 判断当前用户是否为项目管理员
// // 填充默认值,更新数据
// BusReissueCard reissueCard = new BusReissueCard();
// reissueCard.setId(id);
// reissueCard.setManagerOpinion(managerOpinion);
// reissueCard.setManagerExplain(req.getManagerExplain());
// reissueCard.setManagerTime(new Date());
// reissueCard.setRemark(req.getRemark());
// boolean result = this.updateById(reissueCard);
// if (!result) {
// throw new ServiceException("更新管理员审核操作失败", HttpStatus.ERROR);
// }
// // 更新考勤表记录
// BusAttendance oldAttendance = attendanceService.getById(oldReissueCard.getAttendanceId());
// if (oldAttendance == null) {
// throw new ServiceException("考勤记录不存在", HttpStatus.NOT_FOUND);
// }
// BusAttendance attendance = new BusAttendance();
// BusProject project = projectService.getById(oldReissueCard.getProjectId());
// // 根据补卡类型更新考勤时间
// String[] clockTime = project.getPunchRange().split(",");
// String reissueCardType = oldReissueCard.getReissueCardType();
// if (BusAttendanceCommuterEnum.CLOCKIN.getValue().equals(reissueCardType)) {
// // 拼接时间,获取项目的上班打卡时间
// Date date = DateUtils.combineDateAndTime(oldAttendance.getClockDate(), clockTime[0] + ":00");
// attendance.setClockTime(date);
// } else if (BusAttendanceCommuterEnum.CLOCKOUT.getValue().equals(reissueCardType)) {
// // 拼接时间,获取项目的下班打卡时间
// Date date = DateUtils.combineDateAndTime(oldAttendance.getClockDate(), clockTime[1] + ":00");
// attendance.setClockTime(date);
// }
// attendance.setId(oldReissueCard.getAttendanceId());
// attendance.setClockStatus(BusAttendanceClockStatusEnum.REISSUE.getValue());
// boolean updateAttendance = attendanceService.updateById(attendance);
// if (!updateAttendance) {
// throw new ServiceException("更新考勤记录失败", HttpStatus.ERROR);
// }
return true;
BusReissueCard bean = getById(req.getId());
if (bean == null) {
throw new ServiceException("未找到该申请");
}
Long attendanceId = bean.getAttendanceId();
BeanUtil.copyProperties(req, bean);
boolean b = updateById(bean);
if("2".equals(bean.getGangerOpinion())){
BusAttendance byId = attendanceService.getById(attendanceId);
String clockStatus = byId.getClockStatus();
byId.setClockStatus(BusAttendanceClockStatusEnum.REISSUE.getValue());
attendanceService.updateById(byId);
//缺卡补充当天的工资表
if(BusAttendanceClockStatusEnum.UNCLOCK.getValue().equals(clockStatus)){
userSalaryDetailService.insertByAttendance(byId.getUserId(),byId.getClockDate());
}
CompletableFuture.runAsync(() -> {
try {
chatServerHandler.sendSystemMessageToUser(bean.getUserId(),"补卡申请已通过","1");
} catch (Exception e) {
log.error("异步发送系统消息失败用户ID: {}, 消息: {}", bean.getUserId(), "补卡申请已通过", e);
}
});
}
if("3".equals(bean.getGangerOpinion())){
BusAttendance byId = attendanceService.getById(attendanceId);
byId.setHandle("0");
attendanceService.updateById(byId);
CompletableFuture.runAsync(() -> {
try {
chatServerHandler.sendSystemMessageToUser(bean.getUserId(),"补卡申请未通过","1");
} catch (Exception e) {
log.error("异步发送系统消息失败用户ID: {}, 消息: {}", bean.getUserId(), "补卡申请未通过", e);
}
});
}
return b;
}
/**
@ -312,13 +300,15 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper,
// 精确查询
lqw.eq(ObjectUtils.isNotEmpty(id), BusReissueCard::getId, id);
lqw.eq(ObjectUtils.isNotEmpty(userId), BusReissueCard::getUserId, userId);
lqw.eq(ObjectUtils.isNotEmpty(gangerId), BusReissueCard::getGangerId, gangerId);
lqw.eq(ObjectUtils.isNotEmpty(gangerId) && !Objects.equals(gangerId, SUPER_ADMIN_ID), BusReissueCard::getGangerId, gangerId);
lqw.eq(StringUtils.isNotBlank(gangerOpinion), BusReissueCard::getGangerOpinion, gangerOpinion);
lqw.eq(StringUtils.isNotBlank(managerOpinion), BusReissueCard::getManagerOpinion, managerOpinion);
lqw.eq(ObjectUtils.isNotEmpty(projectId), BusReissueCard::getProjectId, projectId);
lqw.eq(ObjectUtils.isNotEmpty(teamId), BusReissueCard::getTeamId, teamId);
lqw.eq(StringUtils.isNotBlank(reissueCardType), BusReissueCard::getReissueCardType, reissueCardType);
lqw.eq(ObjectUtils.isNotEmpty(attendanceId), BusReissueCard::getAttendanceId, attendanceId);
lqw.orderByDesc(BusReissueCard::getCreateTime);
return lqw;
}

View File

@ -31,7 +31,6 @@ import org.dromara.quality.domain.dto.qualityinspection.QltQualityInspectionGisR
import org.dromara.quality.domain.dto.qualityinspection.QltQualityInspectionQueryReq;
import org.dromara.quality.domain.dto.qualityinspection.QltQualityInspectionUpdateReq;
import org.dromara.quality.domain.enums.QltQualityInspectionStatusEnum;
import org.dromara.quality.domain.enums.QltQualityInspectionVerificationTypeEnum;
import org.dromara.quality.domain.vo.qualityinspection.QltQualityInspectionGis;
import org.dromara.quality.domain.vo.qualityinspection.QltQualityInspectionListGisVo;
import org.dromara.quality.domain.vo.qualityinspection.QltQualityInspectionVo;
@ -170,17 +169,17 @@ public class QltQualityInspectionServiceImpl extends ServiceImpl<QltQualityInspe
// 获取整改情况
long passCount = 0L;
for (QltQualityInspection qualityInspection : qualityInspectionList) {
if ("1".equals(qualityInspection.getIsReply())
&& QltQualityInspectionStatusEnum.VERIFICATION.getValue().equals(qualityInspection.getInspectionStatus())
&& QltQualityInspectionVerificationTypeEnum.PASS.getValue().equals(qualityInspection.getVerificationType())) {
passCount++;
} else if ("2".equals(qualityInspection.getIsReply())
&& QltQualityInspectionStatusEnum.RECTIFICATION.getValue().equals(qualityInspection.getInspectionStatus())) {
passCount++;
if ("1".equals(qualityInspection.getIsReply())) {
if (!qualityInspection.getInspectionStatus().equals(QltQualityInspectionStatusEnum.INFORM.getValue())) {
passCount++;
}
}
}
gisVo.setList(gisList);
gisVo.setCount((long) qualityInspectionList.size());
gisVo.setCount((long) qualityInspectionList.stream()
.filter(q -> "2".equals(q.getIsReply()))
.toList()
.size());
gisVo.setCorrectSituation(String.format("%.2f", passCount * 100.0 / qualityInspectionList.size()));
return gisVo;
}

View File

@ -30,12 +30,10 @@ import org.dromara.project.domain.BusProjectTeam;
import org.dromara.project.service.IBusProjectService;
import org.dromara.project.service.IBusProjectTeamMemberService;
import org.dromara.project.service.IBusProjectTeamService;
import org.dromara.quality.domain.enums.QltQualityInspectionStatusEnum;
import org.dromara.safety.constant.HseSafetyConstant;
import org.dromara.safety.domain.HseSafetyInspection;
import org.dromara.safety.domain.HseTeamMeeting;
import org.dromara.safety.domain.dto.safetyinspection.*;
import org.dromara.safety.domain.enums.HseSafetyInspectionReviewTypeEnum;
import org.dromara.safety.domain.enums.HseSafetyInspectionStatusEnum;
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionListGisVo;
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionVo;
@ -225,18 +223,16 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
.list();
long passCount = 0L;
for (HseSafetyInspection safetyInspection : safetyInspectionList) {
if ("1".equals(safetyInspection.getIsReply())
&& HseSafetyInspectionStatusEnum.REVIEW.getValue().equals(safetyInspection.getStatus())
&& HseSafetyInspectionReviewTypeEnum.PASS.getValue().equals(safetyInspection.getReviewType())) {
passCount++;
} else if ("2".equals(safetyInspection.getIsReply())
&& QltQualityInspectionStatusEnum.RECTIFICATION.getValue().equals(safetyInspection.getStatus())
) {
passCount++;
if ("1".equals(safetyInspection.getIsReply())) {
if (!safetyInspection.getStatus().equals(HseSafetyInspectionStatusEnum.INFORM.getValue())) {
passCount++;
}
}
}
gisVo.setTeamMeetingCount((long) teamMeetings.size());
gisVo.setSafetyInspectionCount((long) safetyInspectionList.size());
gisVo.setSafetyInspectionCount((long) safetyInspectionList.stream()
.filter(q -> "2".equals(q.getIsReply()))
.toList().size());
gisVo.setCorrectSituationCount(passCount);
gisVo.setCorrectSituation(String.format("%.2f", passCount * 100.0 / safetyInspectionList.size()));
return gisVo;

View File

@ -0,0 +1,19 @@
package org.dromara.xzd.enums;
public enum XzdClassEnum {
CS_CONTRACT_INFORMATION("xzd_cs_contract_information");
private final String className;
public String getClassName() {
return className;
}
XzdClassEnum(String className) {
this.className = className;
}
}