安全、质量、进度、施工人员;对象存储添加文件大小
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
package org.dromara.contractor.controller.app;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.common.core.domain.R;
|
||||
|
||||
@ -2,14 +2,15 @@ package org.dromara.contractor.controller.app;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileQueryReq;
|
||||
import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileSaveReq;
|
||||
import org.dromara.contractor.domain.vo.constructionuserfile.SubConstructionUserFileVo;
|
||||
import org.dromara.contractor.service.ISubConstructionUserFileService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -35,4 +36,13 @@ public class SubConstructionUserFileAppController extends BaseController {
|
||||
return R.ok(constructionUserFileService.queryList(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存施工人员文件存储详情信息
|
||||
*/
|
||||
@Log(title = "施工人员文件存储", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/save")
|
||||
public R<Boolean> save(@RequestBody SubConstructionUserFileSaveReq req) {
|
||||
return R.ok(constructionUserFileService.saveFileList(req));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -47,6 +47,7 @@ public class SubConstructionUserVo implements Serializable {
|
||||
* 人脸照 url
|
||||
*/
|
||||
@ExcelProperty(value = "人脸照 url")
|
||||
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "facePic")
|
||||
private String facePicUrl;
|
||||
|
||||
/**
|
||||
|
||||
@ -10,6 +10,7 @@ import org.dromara.contractor.domain.SubConstructionUserFile;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
@ -51,6 +52,26 @@ public class SubConstructionUserFileVo implements Serializable {
|
||||
@ExcelProperty(value = "文件路径")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 文件访问地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
private String fileSize;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
@ -31,10 +31,13 @@ import org.dromara.project.domain.BusConstructionBlacklist;
|
||||
import org.dromara.project.domain.BusProject;
|
||||
import org.dromara.project.service.IBusConstructionBlacklistService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.safety.domain.WgzQuestionSavePdf;
|
||||
import org.dromara.safety.service.IWgzQuestionSavePdfService;
|
||||
import org.dromara.system.domain.vo.SysDictDataVo;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.service.ISysDictTypeService;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -43,10 +46,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
@ -78,6 +78,9 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
||||
@Resource
|
||||
private ISysOssService ossService;
|
||||
|
||||
@Resource
|
||||
private IWgzQuestionSavePdfService wgzQuestionSavePdfService;
|
||||
|
||||
/**
|
||||
* 查询施工人员文件存储
|
||||
*
|
||||
@ -98,7 +101,73 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
||||
@Override
|
||||
public List<SubConstructionUserFileVo> queryList(SubConstructionUserFileQueryReq req) {
|
||||
LambdaQueryWrapper<SubConstructionUserFile> lqw = buildQueryWrapper(req);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
List<SubConstructionUserFileVo> list = baseMapper.selectVoList(lqw);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return List.of();
|
||||
}
|
||||
// 获取oss文件信息
|
||||
List<Long> files = list.stream().map(SubConstructionUserFileVo::getPath)
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(s -> Arrays.stream(s.split(",")))
|
||||
.map(String::trim)
|
||||
.filter(s -> !s.isEmpty())
|
||||
.map(Long::parseLong)
|
||||
.toList();
|
||||
List<SysOssVo> ossVoList = ossService.listByIds(files);
|
||||
Map<Long, SysOssVo> ossVoMap = ossVoList.stream()
|
||||
.collect(Collectors.toMap(SysOssVo::getOssId, Function.identity()));
|
||||
|
||||
List<SubConstructionUserFileVo> listVo = new ArrayList<>();
|
||||
for (SubConstructionUserFileVo file : list) {
|
||||
if (Objects.equals(file.getFileType(), "11")) {
|
||||
// 安全考试
|
||||
WgzQuestionSavePdf wgzQuestionSavePdf = wgzQuestionSavePdfService.queryByUserId(file.getUserId());
|
||||
if (wgzQuestionSavePdf != null) {
|
||||
List<SysOssVo> ossVos = ossService.listByIds(Arrays.stream(wgzQuestionSavePdf
|
||||
.getPath()
|
||||
.split(","))
|
||||
.map(Long::parseLong)
|
||||
.toList());
|
||||
for (SysOssVo ossVo : ossVos) {
|
||||
SubConstructionUserFileVo vo = new SubConstructionUserFileVo();
|
||||
BeanUtils.copyProperties(file, vo);
|
||||
vo.setUrl(ossVo.getUrl());
|
||||
vo.setFileName(ossVo.getOriginalName());
|
||||
vo.setFileSize(ossService.formatFileSize(ossVo.getFileSize()));
|
||||
listVo.add(vo);
|
||||
}
|
||||
}
|
||||
} else if (Objects.equals(file.getFileType(), "12")) {
|
||||
// 特种工作证
|
||||
SubConstructionUser constructionUser = constructionUserService.getBySysUserId(file.getUserId());
|
||||
List<SysOssVo> ossVos = ossService.listByIds(Arrays.stream(constructionUser
|
||||
.getSpecialWorkPic()
|
||||
.split(","))
|
||||
.map(Long::parseLong).toList());
|
||||
for (SysOssVo ossVo : ossVos) {
|
||||
SubConstructionUserFileVo vo = new SubConstructionUserFileVo();
|
||||
BeanUtils.copyProperties(file, vo);
|
||||
vo.setUrl(ossVo.getUrl());
|
||||
vo.setFileName(ossVo.getOriginalName());
|
||||
vo.setFileSize(ossService.formatFileSize(ossVo.getFileSize()));
|
||||
listVo.add(vo);
|
||||
}
|
||||
} else {
|
||||
List<Long> ossIds = Arrays.stream(file.getPath().split(",")).map(Long::parseLong).toList();
|
||||
for (Long ossId : ossIds) {
|
||||
SubConstructionUserFileVo vo = new SubConstructionUserFileVo();
|
||||
if (ossVoMap.containsKey(ossId)) {
|
||||
BeanUtils.copyProperties(file, vo);
|
||||
SysOssVo ossVo = ossVoMap.get(ossId);
|
||||
vo.setUrl(ossVo.getUrl());
|
||||
vo.setFileName(ossVo.getOriginalName());
|
||||
vo.setFileSize(ossService.formatFileSize(ossVo.getFileSize()));
|
||||
}
|
||||
listVo.add(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return listVo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -683,11 +683,6 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
constructionUserVo.setContractorName(contractor.getName());
|
||||
}
|
||||
}
|
||||
// 关联查询用户头像url
|
||||
String facePic = constructionUser.getFacePic();
|
||||
if (StringUtils.isNotBlank(facePic)) {
|
||||
constructionUserVo.setFacePicUrl(ossService.getById(Long.parseLong(facePic)).getUrl());
|
||||
}
|
||||
// 关联查询薪水标准
|
||||
String typeOfWork = constructionUser.getTypeOfWork();
|
||||
String wageMeasureUnit = constructionUser.getWageMeasureUnit();
|
||||
@ -770,13 +765,15 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
.or().isNull(SubConstructionUser::getTeamId));
|
||||
}
|
||||
// 查询当前项目下的黑名单人员
|
||||
List<Long> blackUserIdList;
|
||||
if (projectId != null) {
|
||||
List<Long> blackUserIdList = constructionBlacklistService.queryIdListByProjectId(projectId);
|
||||
// 查询结果移除黑名单人员
|
||||
blackUserIdList = constructionBlacklistService.queryIdListByProjectId(projectId);
|
||||
} else {
|
||||
blackUserIdList = constructionBlacklistService.queryIdListByProjectId(null);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(blackUserIdList)) {
|
||||
lqw.notIn(SubConstructionUser::getSysUserId, blackUserIdList);
|
||||
}
|
||||
}
|
||||
lqw.ne(StringUtils.isNotBlank(notUserRole), SubConstructionUser::getUserRole, notUserRole);
|
||||
if (StringUtils.isNotBlank(entryDate)) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@ -1036,8 +1033,6 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取施工人员身份证信息
|
||||
*
|
||||
@ -1305,6 +1300,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
SubConstructionUserAppVo subConstructionUserAppVo = new SubConstructionUserAppVo();
|
||||
BeanUtils.copyProperties(constructionUser, subConstructionUserAppVo);
|
||||
SysUserVo sysUserVo = userService.selectUserById(subConstructionUserAppVo.getSysUserId());
|
||||
if (sysUserVo != null) {
|
||||
if (sysUserVo.getAvatar() != null)
|
||||
subConstructionUserAppVo.setAvatar(ossService.getById(sysUserVo.getAvatar()).getUrl());
|
||||
//计算日期
|
||||
@ -1317,7 +1313,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
);
|
||||
subConstructionUserAppVo.setDays(days);
|
||||
subConstructionUserAppVo.setSex(sysUserVo.getSex());
|
||||
|
||||
}
|
||||
list.add(subConstructionUserAppVo);
|
||||
}
|
||||
|
||||
|
||||
@ -7,8 +7,6 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
@ -21,7 +19,6 @@ import org.dromara.progress.domain.dto.constructionscheduleplan.PgsConstructionS
|
||||
import org.dromara.progress.domain.dto.constructionscheduleplan.PgsConstructionSchedulePlanUpdateReq;
|
||||
import org.dromara.progress.domain.vo.constructionscheduleplan.PgsConstructionSchedulePlanVo;
|
||||
import org.dromara.progress.service.IPgsConstructionSchedulePlanService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -83,11 +80,7 @@ public class PgsConstructionSchedulePlanController extends BaseController {
|
||||
public R<Void> readExcel(@RequestParam("file") MultipartFile file, Long projectId) {
|
||||
List<PgsConstructionSchedulePlanExcelDto> list = pgsConstructionSchedulePlanService.readExcel(file, projectId);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<PgsConstructionSchedulePlan> planList = list.stream().map(dto -> {
|
||||
PgsConstructionSchedulePlan plan = new PgsConstructionSchedulePlan();
|
||||
BeanUtils.copyProperties(dto, plan);
|
||||
return plan;
|
||||
}).toList();
|
||||
List<PgsConstructionSchedulePlan> planList = pgsConstructionSchedulePlanService.convertToEntities(list);
|
||||
return toAjax(pgsConstructionSchedulePlanService.saveBatch(planList));
|
||||
}
|
||||
return toAjax(true);
|
||||
@ -112,7 +105,7 @@ public class PgsConstructionSchedulePlanController extends BaseController {
|
||||
@Log(title = "施工进度计划", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<PgsConstructionSchedulePlanVo> add(@Validated(AddGroup.class) @RequestBody PgsConstructionSchedulePlanCreateReq req) {
|
||||
public R<PgsConstructionSchedulePlanVo> add(@Validated @RequestBody PgsConstructionSchedulePlanCreateReq req) {
|
||||
return R.ok(pgsConstructionSchedulePlanService.insertByBo(req));
|
||||
}
|
||||
|
||||
@ -123,7 +116,7 @@ public class PgsConstructionSchedulePlanController extends BaseController {
|
||||
@Log(title = "施工进度计划", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody PgsConstructionSchedulePlanUpdateReq req) {
|
||||
public R<Void> edit(@Validated @RequestBody PgsConstructionSchedulePlanUpdateReq req) {
|
||||
return toAjax(pgsConstructionSchedulePlanService.updateByBo(req));
|
||||
}
|
||||
|
||||
|
||||
@ -8,13 +8,17 @@ import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
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.*;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailQueryReq;
|
||||
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.domain.vo.progressplandetail.PgsProgressPlanDetailVo;
|
||||
import org.dromara.progress.service.IPgsProgressPlanDetailService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 进度计划详情
|
||||
@ -60,14 +64,12 @@ public class PgsProgressPlanDetailController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增进度计划详情(数量设施)
|
||||
* 新增进度计划详情(AI 填报)
|
||||
*/
|
||||
/* @SaCheckPermission("progress:progressPlanDetail:insertNumber")
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/insert/number")
|
||||
public R<Void> insertNumberDetail(@Validated @RequestBody PgsProgressPlanDetailNumberCreateReq req) {
|
||||
return toAjax(pgsProgressPlanDetailService.insertNumberDetail(req));
|
||||
}*/
|
||||
@PostMapping("/insert/numberAI")
|
||||
public R<Void> insertNumberDetailByAI(@RequestPart("file") MultipartFile file) {
|
||||
return toAjax(pgsProgressPlanDetailService.insertNumberDetailByAI(file));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取进度计划详情已完成设施详细信息
|
||||
|
||||
@ -13,16 +13,16 @@ import java.time.LocalDate;
|
||||
@AllArgsConstructor
|
||||
public class PgsConstructionSchedulePlanExcelDto {
|
||||
|
||||
/**
|
||||
* 编号(1, 1.1, 1.1.1)
|
||||
*/
|
||||
private String number;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 父ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
|
||||
@ -36,6 +36,16 @@ public class PgsConstructionSchedulePlanUpdateReq implements Serializable {
|
||||
*/
|
||||
private String projectStructureName;
|
||||
|
||||
/**
|
||||
* 预计开始时间
|
||||
*/
|
||||
private LocalDate planStartDate;
|
||||
|
||||
/**
|
||||
* 预计结束时间
|
||||
*/
|
||||
private LocalDate planEndDate;
|
||||
|
||||
/**
|
||||
* 实际开始时间
|
||||
*/
|
||||
|
||||
@ -101,4 +101,12 @@ public interface IPgsConstructionSchedulePlanService extends IService<PgsConstru
|
||||
* @return 读取的数据列表
|
||||
*/
|
||||
List<PgsConstructionSchedulePlanExcelDto> readExcel(MultipartFile file, Long projectId);
|
||||
|
||||
/**
|
||||
* 将Excel数据转换为实体列表
|
||||
*
|
||||
* @param excelList Excel数据列表
|
||||
* @return 实体列表
|
||||
*/
|
||||
List<PgsConstructionSchedulePlan> convertToEntities(List<PgsConstructionSchedulePlanExcelDto> excelList);
|
||||
}
|
||||
|
||||
@ -6,14 +6,15 @@ 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.PgsProgressPlanDetailFinishedCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq;
|
||||
import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailQueryReq;
|
||||
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.PgsProgressPlanDetailUnFinishVo;
|
||||
import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
@ -51,14 +52,6 @@ public interface IPgsProgressPlanDetailService extends IService<PgsProgressPlanD
|
||||
*/
|
||||
Boolean insertPercentageNumberDetail(PgsProgressPlanDetailCreateReq req);
|
||||
|
||||
/**
|
||||
* 插入进度计划详情设施
|
||||
*
|
||||
* @param req 插入进度计划详情设施参数
|
||||
* @return 是否插入成功
|
||||
*/
|
||||
// Boolean insertNumberDetail(PgsProgressPlanDetailNumberCreateReq req);
|
||||
|
||||
/**
|
||||
* 分页查询进度计划详情已完成设施列表
|
||||
*
|
||||
@ -138,4 +131,12 @@ public interface IPgsProgressPlanDetailService extends IService<PgsProgressPlanD
|
||||
* @return 计划详情设施数量
|
||||
*/
|
||||
List<PgsProgressPlanDetailNumVo> queryNumberList(PgsProgressPlanDetailQueryReq req);
|
||||
|
||||
/**
|
||||
* 使用AI识别计划详情设施数量
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean insertNumberDetailByAI(MultipartFile file);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package org.dromara.progress.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@ -173,7 +174,7 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl<PgsConst
|
||||
return constructionSchedulePlanList.stream().map(this::getVo).toList();
|
||||
}
|
||||
|
||||
// region
|
||||
// region 导出 excel
|
||||
|
||||
/**
|
||||
* 导出Excel
|
||||
@ -228,8 +229,8 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl<PgsConst
|
||||
}
|
||||
// 主 Sheet 设置表头
|
||||
Row sheetRow = mainSheet.createRow(0);
|
||||
String[] headers = {"节点名称", "对应项目结构", "对应项目结构编码", "预计开始时间(格式:2025-09-06)",
|
||||
"预计结束时间", "实际开始时间", "实际结束时间", "状态", "状态编码", "备注"};
|
||||
String[] headers = {"编号(格式:1,1-1,1-1-1。用于进行父子结构关联)", "节点名称", "对应项目结构", "对应项目结构编码",
|
||||
"预计开始时间(格式:2025-09-06)", "预计结束时间", "实际开始时间", "实际结束时间", "状态", "状态编码", "备注"};
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
Cell cell = sheetRow.createCell(i);
|
||||
cell.setCellValue(headers[i]);
|
||||
@ -237,26 +238,26 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl<PgsConst
|
||||
// 6. 设置专业下拉列表(第二列)
|
||||
setMajorDropdown(mainSheet, projectStructureMap.size());
|
||||
setStatusDropdown(mainSheet, statusMap.size());
|
||||
String formulaTemplate = "IFERROR(INDEX(DropdownData!$B$1:$B$" + projectStructureMap.size() + ", MATCH(B{rowNum}, DropdownData!$A$1:$A$" + projectStructureMap.size() + ", 0)),\"\")";
|
||||
String formulaTemplate1 = "IFERROR(INDEX(DropdownData!$F$1:$F$" + statusMap.size() + ", MATCH(H{rowNum}, DropdownData!$E$1:$E$" + statusMap.size() + ", 0)),\"\")";
|
||||
String formulaTemplate = "IFERROR(INDEX(DropdownData!$B$1:$B$" + projectStructureMap.size() + ", MATCH(C{rowNum}, DropdownData!$A$1:$A$" + projectStructureMap.size() + ", 0)),\"\")";
|
||||
String formulaTemplate1 = "IFERROR(INDEX(DropdownData!$F$1:$F$" + statusMap.size() + ", MATCH(I{rowNum}, DropdownData!$E$1:$E$" + statusMap.size() + ", 0)),\"\")";
|
||||
for (int i = 1; i <= 1000; i++) { // 从第2行到101行
|
||||
Row row = mainSheet.createRow(i);
|
||||
int currentRowNum = i + 1; // Excel行号从1开始
|
||||
String formula = formulaTemplate.replace("{rowNum}", String.valueOf(currentRowNum));
|
||||
|
||||
Cell cell = row.createCell(1);
|
||||
Cell cell = row.createCell(2);
|
||||
cell.setCellStyle(editableStyle); //专业不锁定
|
||||
|
||||
Cell idCell = row.createCell(2);
|
||||
Cell idCell = row.createCell(3);
|
||||
idCell.setCellFormula(formula);
|
||||
idCell.setCellStyle(protectedStyle); // 应用隐藏公式样式
|
||||
|
||||
String formula1 = formulaTemplate1.replace("{rowNum}", String.valueOf(currentRowNum));
|
||||
|
||||
Cell cell1 = row.createCell(7);
|
||||
Cell cell1 = row.createCell(8);
|
||||
cell1.setCellStyle(editableStyle); //专业不锁定
|
||||
|
||||
Cell idCell1 = row.createCell(8);
|
||||
Cell idCell1 = row.createCell(9);
|
||||
idCell1.setCellFormula(formula1);
|
||||
idCell1.setCellStyle(protectedStyle); // 应用隐藏公式样式
|
||||
|
||||
@ -271,8 +272,8 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl<PgsConst
|
||||
Cell cell = row.createCell(0);
|
||||
cell.setCellStyle(editableStyle);
|
||||
|
||||
Cell cell3 = row.createCell(3);
|
||||
cell3.setCellStyle(editableStyle);
|
||||
Cell cell1 = row.createCell(1);
|
||||
cell1.setCellStyle(editableStyle);
|
||||
|
||||
Cell cell4 = row.createCell(4);
|
||||
cell4.setCellStyle(editableStyle);
|
||||
@ -283,8 +284,11 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl<PgsConst
|
||||
Cell cell6 = row.createCell(6);
|
||||
cell6.setCellStyle(editableStyle);
|
||||
|
||||
Cell cell9 = row.createCell(9);
|
||||
cell9.setCellStyle(editableStyle);
|
||||
Cell cell7 = row.createCell(7);
|
||||
cell7.setCellStyle(editableStyle);
|
||||
|
||||
Cell cell10 = row.createCell(10);
|
||||
cell10.setCellStyle(editableStyle);
|
||||
|
||||
}
|
||||
|
||||
@ -307,6 +311,7 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl<PgsConst
|
||||
mainSheet.setColumnWidth(7, 20 * 200);
|
||||
mainSheet.setColumnWidth(8, 20 * 100);
|
||||
mainSheet.setColumnWidth(9, 20 * 200);
|
||||
mainSheet.setColumnWidth(10, 20 * 200);
|
||||
|
||||
// 直接写入响应输出流
|
||||
try {
|
||||
@ -352,7 +357,7 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl<PgsConst
|
||||
|
||||
DataValidationConstraint constraint = helper.createFormulaListConstraint(majorRange);
|
||||
// 作用范围:第2行到100行,第二列
|
||||
CellRangeAddressList addressList = new CellRangeAddressList(1, 1000, 1, 1);
|
||||
CellRangeAddressList addressList = new CellRangeAddressList(1, 1000, 2, 2);
|
||||
|
||||
DataValidation validation = helper.createValidation(constraint, addressList);
|
||||
validation.setShowErrorBox(true);
|
||||
@ -371,7 +376,7 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl<PgsConst
|
||||
|
||||
DataValidationConstraint constraint = helper.createFormulaListConstraint(majorRange);
|
||||
// 作用范围:第2行到100行,第二列
|
||||
CellRangeAddressList addressList = new CellRangeAddressList(1, 1000, 7, 7);
|
||||
CellRangeAddressList addressList = new CellRangeAddressList(1, 1000, 8, 8);
|
||||
|
||||
DataValidation validation = helper.createValidation(constraint, addressList);
|
||||
validation.setShowErrorBox(true);
|
||||
@ -402,19 +407,19 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl<PgsConst
|
||||
for (int rowIndex = 1; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
|
||||
Row row = sheet.getRow(rowIndex);
|
||||
if (hasValidData(row)) {
|
||||
|
||||
String nodeName = getCellValue(row.getCell(0));
|
||||
String projectStructureName = getCellValue(row.getCell(1));
|
||||
Long projectStructure = Long.valueOf(getCellValue(row.getCell(2)));
|
||||
LocalDate planStartDate = getLocalDateValue(row.getCell(3));
|
||||
LocalDate planEndDate = getLocalDateValue(row.getCell(4));
|
||||
LocalDate practicalStartDate = getLocalDateValue(row.getCell(5));
|
||||
LocalDate practicalEndDate = getLocalDateValue(row.getCell(6));
|
||||
String status = getCellValue(row.getCell(8));
|
||||
String remark = getCellValue(row.getCell(9));
|
||||
String number = getCellValue(row.getCell(0));
|
||||
String nodeName = getCellValue(row.getCell(1));
|
||||
String projectStructureName = getCellValue(row.getCell(2));
|
||||
Long projectStructure = Long.valueOf(getCellValue(row.getCell(3)));
|
||||
LocalDate planStartDate = getLocalDateValue(row.getCell(4));
|
||||
LocalDate planEndDate = getLocalDateValue(row.getCell(5));
|
||||
LocalDate practicalStartDate = getLocalDateValue(row.getCell(6));
|
||||
LocalDate practicalEndDate = getLocalDateValue(row.getCell(7));
|
||||
String status = getCellValue(row.getCell(9));
|
||||
String remark = getCellValue(row.getCell(10));
|
||||
|
||||
PgsConstructionSchedulePlanExcelDto excelData = new PgsConstructionSchedulePlanExcelDto(
|
||||
projectId, 0L, nodeName, projectStructure, projectStructureName,
|
||||
number, projectId, nodeName, projectStructure, projectStructureName,
|
||||
planStartDate, planEndDate, practicalStartDate, practicalEndDate, status, remark
|
||||
);
|
||||
dataList.add(excelData);
|
||||
@ -428,6 +433,61 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl<PgsConst
|
||||
return dataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Excel数据转换为实体列表
|
||||
*
|
||||
* @param excelList Excel数据列表
|
||||
* @return 实体列表
|
||||
*/
|
||||
@Override
|
||||
public List<PgsConstructionSchedulePlan> convertToEntities(List<PgsConstructionSchedulePlanExcelDto> excelList) {
|
||||
List<PgsConstructionSchedulePlan> result = new ArrayList<>();
|
||||
Map<String, Long> numberIdMap = new HashMap<>();
|
||||
|
||||
for (PgsConstructionSchedulePlanExcelDto dto : excelList) {
|
||||
PgsConstructionSchedulePlan entity = new PgsConstructionSchedulePlan();
|
||||
|
||||
LocalDate planStartDate = dto.getPlanStartDate();
|
||||
LocalDate planEndDate = dto.getPlanEndDate();
|
||||
if (planStartDate == null || planEndDate == null || planStartDate.isAfter(planEndDate)) {
|
||||
throw new ServiceException("计划开始时间和计划结束时间不能为空,且计划开始时间不能大于计划结束时间", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
// 生成主键
|
||||
Long id = IdWorker.getId();
|
||||
entity.setId(id);
|
||||
|
||||
entity.setProjectId(dto.getProjectId());
|
||||
entity.setNodeName(dto.getNodeName());
|
||||
entity.setProjectStructure(dto.getProjectStructure());
|
||||
entity.setProjectStructureName(dto.getProjectStructureName());
|
||||
entity.setPlanStartDate(planStartDate);
|
||||
entity.setPlanEndDate(planEndDate);
|
||||
entity.setPracticalStartDate(dto.getPracticalStartDate());
|
||||
entity.setPracticalEndDate(dto.getPracticalEndDate());
|
||||
entity.setStatus(dto.getStatus());
|
||||
entity.setRemark(dto.getRemark());
|
||||
// 确定父ID
|
||||
String number = dto.getNumber();
|
||||
if (number != null && number.contains("-")) {
|
||||
String parentNumber = number.substring(0, number.lastIndexOf("-"));
|
||||
Long parentId = numberIdMap.get(parentNumber);
|
||||
if (parentId == null) {
|
||||
throw new ServiceException("未找到父编号:" + parentNumber, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
entity.setParentId(parentId);
|
||||
} else {
|
||||
entity.setParentId(0L); // 顶级节点
|
||||
}
|
||||
|
||||
// 保存当前编号对应的id
|
||||
numberIdMap.put(number, entity.getId());
|
||||
result.add(entity);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static boolean hasValidData(Row row) {
|
||||
// 遍历行中的所有单元格
|
||||
for (int cellIndex = 0; cellIndex < row.getLastCellNum(); cellIndex++) {
|
||||
|
||||
@ -143,8 +143,11 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
public List<PgsProgressCategoryVo> queryListByParent(PgsProgressCategoryQueryByParentReq req) {
|
||||
Long parentId = req.getParentId();
|
||||
String name = req.getName();
|
||||
if (parentId == null) {
|
||||
return List.of();
|
||||
}
|
||||
QueryWrapper<PgsProgressCategory> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.apply(parentId != null, "FIND_IN_SET({0}, ancestors)", parentId);
|
||||
queryWrapper.apply("FIND_IN_SET({0}, ancestors)", parentId);
|
||||
queryWrapper.like(StringUtils.isNotBlank(name), "name", name);
|
||||
return this.getVoList(this.list(queryWrapper));
|
||||
}
|
||||
@ -524,6 +527,21 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl<PgsProgressCateg
|
||||
throw new ServiceException("超过最大层级", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
progressCategory.setAncestors(ancestors + StringUtils.SEPARATOR + progressCategory.getParentId());
|
||||
// 修改关联结构
|
||||
String parentRelevancyStructure = parent.getRelevancyStructure();
|
||||
String oldRelevancyStructure = oldProgressCategory.getRelevancyStructure();
|
||||
progressCategory.setRelevancyStructure(parentRelevancyStructure);
|
||||
if (!oldRelevancyStructure.equals(parentRelevancyStructure)) {
|
||||
if (oldRelevancyStructure.equals(PgsRelevancyStructureEnum.MATRIX.getValue())
|
||||
&& parentRelevancyStructure.equals(PgsRelevancyStructureEnum.SUB_PROJECT.getValue())) {
|
||||
progressCategory.setMatrixId(0L);
|
||||
progressCategory.setMatrixName(null);
|
||||
} else if (oldRelevancyStructure.equals(PgsRelevancyStructureEnum.SUB_PROJECT.getValue())
|
||||
&& parentRelevancyStructure.equals(PgsRelevancyStructureEnum.MATRIX.getValue())) {
|
||||
progressCategory.setMatrixId(parent.getMatrixId());
|
||||
progressCategory.setMatrixName(parent.getMatrixName());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 写入数据库
|
||||
boolean result = this.updateById(progressCategory);
|
||||
|
||||
@ -46,6 +46,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
@ -397,75 +398,6 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入进度计划详情设施
|
||||
*
|
||||
* @param req 插入进度计划详情设施参数
|
||||
* @return 是否插入成功
|
||||
*/
|
||||
/*@Override
|
||||
public Boolean insertNumberDetail(PgsProgressPlanDetailNumberCreateReq req) {
|
||||
// 校验
|
||||
BigDecimal finishedNumber = req.getFinishedNumber();
|
||||
// 判断是否小于 0
|
||||
if (finishedNumber.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException("完成数量不能小于0", 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 progressCategoryId = progressPlanDetail.getProgressCategoryId();
|
||||
PgsProgressCategory progressCategory = progressCategoryService.getById(progressCategoryId);
|
||||
if (progressCategory == null) {
|
||||
throw new ServiceException("进度计划类别信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
// 校验:总完成数不能超过总计划数
|
||||
BigDecimal number = progressPlanDetail.getFinishedNumber(); // 旧的完成数
|
||||
BigDecimal oldFinishedNumberTotal = progressPlan.getFinishedNumber();
|
||||
BigDecimal newFinishedNumberTotal = oldFinishedNumberTotal.subtract(number).add(finishedNumber);
|
||||
if (newFinishedNumberTotal.compareTo(progressPlan.getPlanNumber()) > 0) {
|
||||
throw new ServiceException("总完成数量不能超过计划数量", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 更新 detail
|
||||
progressPlanDetail.setFinishedNumber(finishedNumber);
|
||||
boolean update = this.updateById(progressPlanDetail);
|
||||
if (!update) {
|
||||
throw new ServiceException("更新进度计划详情异常", HttpStatus.ERROR);
|
||||
}
|
||||
// 更新 plan
|
||||
progressPlan.setFinishedNumber(newFinishedNumberTotal);
|
||||
boolean result = progressPlanService.updateById(progressPlan);
|
||||
if (!result) {
|
||||
throw new ServiceException("更新进度计划异常", HttpStatus.ERROR);
|
||||
}
|
||||
// 更新 category
|
||||
BigDecimal completed = progressCategory.getCompleted();
|
||||
BigDecimal completedTotal = completed.subtract(number).add(finishedNumber);
|
||||
progressCategory.setCompleted(completedTotal);
|
||||
// 如果完成数量 >= 总数量,标记为完成
|
||||
if (completedTotal.compareTo(progressCategory.getTotal()) >= 0) {
|
||||
progressCategory.setStatus(PgsFinishStatusEnum.FINISH.getValue());
|
||||
}
|
||||
// 判断当前是否已完成计划数量
|
||||
BigDecimal nowFinishedNumber = progressPlan.getFinishedNumber();
|
||||
if (oldFinishedNumberTotal.compareTo(progressPlan.getPlanNumber()) < 0
|
||||
&& nowFinishedNumber.compareTo(progressPlan.getPlanNumber()) >= 0) {
|
||||
progressCategory.setPlanTotal(progressCategory.getPlanTotal().subtract(progressPlan.getPlanNumber()));
|
||||
}
|
||||
boolean updateCategory = progressCategoryService.updateById(progressCategory);
|
||||
if (!updateCategory) {
|
||||
throw new ServiceException("更新进度分类异常", HttpStatus.ERROR);
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 分页查询进度计划详情设施列表
|
||||
*
|
||||
@ -954,6 +886,17 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
|
||||
return getNumVoList(progressPlanDetailList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用AI识别计划详情设施数量
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertNumberDetailByAI(MultipartFile file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
|
||||
@ -7,12 +7,10 @@ import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.project.domain.dto.constructionuserexit.BusConstructionUserExitCreateReq;
|
||||
import org.dromara.project.domain.dto.constructionuserexit.BusConstructionUserExitUpdateReq;
|
||||
import org.dromara.project.service.IBusConstructionUserExitService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 施工人员入场退场记录信息 app 接口
|
||||
@ -38,4 +36,14 @@ public class BusConstructionUserExitAppController extends BaseController {
|
||||
return toAjax(constructionUserExitService.addRecord(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改施工人员退场记录信息
|
||||
*/
|
||||
@Log(title = "施工人员入场退场记录信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> updateExitRecord(@Validated @RequestBody BusConstructionUserExitUpdateReq req) {
|
||||
return toAjax(constructionUserExitService.updateRecord(req));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,10 +18,10 @@ public class BusConstructionUserExitUpdateReq implements Serializable {
|
||||
private static final long serialVersionUID = 6818895534694076391L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
* 用户id
|
||||
*/
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 工资发放凭证
|
||||
|
||||
@ -13,6 +13,7 @@ import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.utils.IdCardEncryptorUtil;
|
||||
import org.dromara.contractor.domain.SubConstructionUser;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
import org.dromara.project.domain.BusConstructionUserExit;
|
||||
@ -55,6 +56,9 @@ public class BusConstructionUserExitServiceImpl extends ServiceImpl<BusConstruct
|
||||
@Resource
|
||||
private ISubConstructionUserService constructionUserService;
|
||||
|
||||
@Resource
|
||||
private IdCardEncryptorUtil idCardEncryptorUtil;
|
||||
|
||||
/**
|
||||
* 查询施工人员入场退场记录信息
|
||||
*
|
||||
@ -200,11 +204,15 @@ public class BusConstructionUserExitServiceImpl extends ServiceImpl<BusConstruct
|
||||
SubConstructionUser constructionUser = constructionUserService.getBySysUserId(userId);
|
||||
BusConstructionUserExit constructionUserExit = new BusConstructionUserExit();
|
||||
constructionUserExit.setProjectId(constructionUser.getProjectId());
|
||||
constructionUserExit.setUserId(constructionUser.getId());
|
||||
constructionUserExit.setUserId(constructionUser.getSysUserId());
|
||||
constructionUserExit.setSalaryVoucherFile(salaryVoucherFile);
|
||||
constructionUserExit.setSalaryConfirmationFile(salaryConfirmationFile);
|
||||
constructionUserExit.setTeamId(constructionUser.getTeamId());
|
||||
constructionUserExit.setSfzNumber(constructionUser.getSfzNumber());
|
||||
String sfzNumber = constructionUser.getSfzNumber();
|
||||
if (StringUtils.isNotBlank(sfzNumber)) {
|
||||
sfzNumber = idCardEncryptorUtil.decrypt(sfzNumber);
|
||||
constructionUserExit.setSfzNumber(sfzNumber);
|
||||
}
|
||||
constructionUserExit.setEntryDate(constructionUser.getEntryDate());
|
||||
constructionUserExit.setLeaveDate(new Date());
|
||||
constructionUserExit.setRemark(req.getRemark());
|
||||
@ -238,13 +246,17 @@ public class BusConstructionUserExitServiceImpl extends ServiceImpl<BusConstruct
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateRecord(BusConstructionUserExitUpdateReq req) {
|
||||
Long id = req.getId();
|
||||
BusConstructionUserExit constructionUserExit = this.getById(id);
|
||||
Long userId = req.getUserId();
|
||||
BusConstructionUserExit constructionUserExit = this.lambdaQuery()
|
||||
.eq(BusConstructionUserExit::getUserId, userId)
|
||||
.orderByDesc(BusConstructionUserExit::getId)
|
||||
.last("limit 1")
|
||||
.one();
|
||||
if (constructionUserExit == null) {
|
||||
throw new ServiceException("施工人员入场退场记录不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
BusConstructionUserExit update = new BusConstructionUserExit();
|
||||
update.setId(id);
|
||||
update.setId(constructionUserExit.getId());
|
||||
update.setSalaryVoucherFile(req.getSalaryVoucherFile());
|
||||
update.setSalaryConfirmationFile(req.getSalaryConfirmationFile());
|
||||
update.setRemark(req.getRemark());
|
||||
@ -253,10 +265,10 @@ public class BusConstructionUserExitServiceImpl extends ServiceImpl<BusConstruct
|
||||
throw new ServiceException("施工人员入场退场记录修改失败", HttpStatus.ERROR);
|
||||
}
|
||||
// 同步修改用户表信息
|
||||
SubConstructionUser user = new SubConstructionUser();
|
||||
user.setId(constructionUserExit.getUserId());
|
||||
user.setExitStatus("2");
|
||||
boolean resultUser = constructionUserService.updateById(user);
|
||||
LambdaUpdateWrapper<SubConstructionUser> luw = new LambdaUpdateWrapper<>();
|
||||
luw.eq(SubConstructionUser::getSysUserId, constructionUserExit.getUserId())
|
||||
.set(SubConstructionUser::getExitStatus, "2");
|
||||
boolean resultUser = constructionUserService.update(luw);
|
||||
if (!resultUser) {
|
||||
throw new ServiceException("施工人员入场退场记录修改失败", HttpStatus.ERROR);
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
||||
SubConstructionUser constructionUser = constructionUserService.getBySysUserId(memberId);
|
||||
BusConstructionUserExit constructionUserExit = new BusConstructionUserExit();
|
||||
constructionUserExit.setProjectId(constructionUser.getProjectId());
|
||||
constructionUserExit.setUserId(constructionUser.getId());
|
||||
constructionUserExit.setUserId(constructionUser.getSysUserId());
|
||||
constructionUserExit.setSalaryVoucherFile(salaryVoucherFile);
|
||||
constructionUserExit.setSalaryConfirmationFile(salaryConfirmationFile);
|
||||
constructionUserExit.setTeamId(constructionUser.getTeamId());
|
||||
|
||||
@ -101,7 +101,7 @@ public class HseViolationRecord extends BaseEntity {
|
||||
private String review;
|
||||
|
||||
/**
|
||||
* 复查状态(1通过 2未通过)
|
||||
* 复查状态(0未复查 1通过 2未通过)
|
||||
*/
|
||||
private String reviewType;
|
||||
|
||||
@ -116,7 +116,7 @@ public class HseViolationRecord extends BaseEntity {
|
||||
private String processType;
|
||||
|
||||
/**
|
||||
* 工单状态(1通知 2整改 3复查)
|
||||
* 工单状态(0待处理 1通知 2整改 3复查)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
@ -41,4 +41,9 @@ public class HseViolationRecordQueryReq implements Serializable {
|
||||
*/
|
||||
private Long rectificationId;
|
||||
|
||||
/**
|
||||
* 整改人id
|
||||
*/
|
||||
private Long correctorId;
|
||||
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum HseSafetyInspectionReviewTypeEnum {
|
||||
|
||||
NOT_REVIEW("未审核", "0"),
|
||||
PASS("通过", "1"),
|
||||
UNPASS("未通过", "2");
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum HseSafetyInspectionStatusEnum {
|
||||
|
||||
PENDING("待处理", "0"),
|
||||
INFORM("通知", "1"),
|
||||
RECTIFICATION("整改", "2"),
|
||||
REVIEW("复查", "3");
|
||||
|
||||
@ -106,13 +106,24 @@ public class HseViolationRecordVo implements Serializable {
|
||||
*/
|
||||
private Date rectificationTime;
|
||||
|
||||
/**
|
||||
* 整改附件
|
||||
*/
|
||||
private String rectificationFile;
|
||||
|
||||
/**
|
||||
* 整改附件url
|
||||
*/
|
||||
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "rectificationFile")
|
||||
private String rectificationFileUrl;
|
||||
|
||||
/**
|
||||
* 复查情况
|
||||
*/
|
||||
private String review;
|
||||
|
||||
/**
|
||||
* 复查状态(1通过 2未通过)
|
||||
* 复查状态(0未复查 1通过 2未通过)
|
||||
*/
|
||||
private String reviewType;
|
||||
|
||||
@ -127,7 +138,7 @@ public class HseViolationRecordVo implements Serializable {
|
||||
private String processType;
|
||||
|
||||
/**
|
||||
* 工单状态(1通知 2整改 3复查)
|
||||
* 工单状态(0待处理 1通知 2整改 3复查)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
@ -27,7 +27,9 @@ import org.dromara.common.utils.DocumentUtil;
|
||||
import org.dromara.contractor.domain.SubContractor;
|
||||
import org.dromara.contractor.service.ISubContractorService;
|
||||
import org.dromara.project.domain.BusProjectTeam;
|
||||
import org.dromara.project.domain.BusProjectTeamMember;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.project.service.IBusProjectTeamMemberService;
|
||||
import org.dromara.project.service.IBusProjectTeamService;
|
||||
import org.dromara.safety.constant.HseSafetyConstant;
|
||||
import org.dromara.safety.domain.HseSafetyInspection;
|
||||
@ -42,7 +44,6 @@ import org.dromara.safety.mapper.HseSafetyInspectionMapper;
|
||||
import org.dromara.safety.service.IHseSafetyInspectionService;
|
||||
import org.dromara.safety.service.IHseTeamMeetingService;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
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;
|
||||
@ -60,7 +61,6 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
@ -98,6 +98,9 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
@Resource
|
||||
private ChatServerHandler chatServerHandler;
|
||||
|
||||
@Resource
|
||||
private IBusProjectTeamMemberService projectTeamMemberService;
|
||||
|
||||
/**
|
||||
* 查询安全巡检工单
|
||||
*
|
||||
@ -122,7 +125,18 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<HseSafetyInspectionVo> queryPageList(HseSafetyInspectionQueryReq req, PageQuery pageQuery) {
|
||||
Page<HseSafetyInspection> result = this.page(pageQuery.build(), buildQueryWrapper(req));
|
||||
LambdaQueryWrapper<HseSafetyInspection> lqw = this.buildQueryWrapper(req);
|
||||
Long userId = LoginHelper.getUserId();
|
||||
if (userId != null) {
|
||||
BusProjectTeamMember one = projectTeamMemberService.lambdaQuery()
|
||||
.eq(BusProjectTeamMember::getMemberId, userId)
|
||||
.eq(BusProjectTeamMember::getPostId, "0")
|
||||
.one();
|
||||
if (one != null) {
|
||||
lqw.eq(HseSafetyInspection::getCorrectorId, userId);
|
||||
}
|
||||
}
|
||||
Page<HseSafetyInspection> result = this.page(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(this.getVoPage(result));
|
||||
}
|
||||
|
||||
@ -359,13 +373,6 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
if (CollUtil.isEmpty(safetyInspectionList)) {
|
||||
return safetyInspectionVoPage;
|
||||
}
|
||||
// 获取整改人、创建用户信息
|
||||
List<Long> userIdList = Stream.concat(
|
||||
safetyInspectionList.stream().map(HseSafetyInspection::getCorrectorId),
|
||||
safetyInspectionList.stream().map(HseSafetyInspection::getCreateBy)
|
||||
).distinct().toList();
|
||||
List<SysUserVo> userVoList = userService.selectUserByIds(userIdList, null);
|
||||
Map<Long, String> userMap = userVoList.stream().collect(Collectors.toMap(SysUserVo::getUserId, SysUserVo::getNickName));
|
||||
// 对象列表 => 封装对象列表
|
||||
List<HseSafetyInspectionVo> safetyInspectionVoList = safetyInspectionList.stream().map(inspection -> {
|
||||
HseSafetyInspectionVo qualityInspectionVo = new HseSafetyInspectionVo();
|
||||
@ -463,10 +470,9 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
Long correctorId = safetyInspection.getCorrectorId();
|
||||
// 只有指定用户可以整改
|
||||
Long userId = LoginHelper.getUserId();
|
||||
// todo 仅测试
|
||||
/* if (!correctorId.equals(userId)) {
|
||||
if (!correctorId.equals(userId)) {
|
||||
throw new ServiceException("当前用户不是指定整改人", HttpStatus.BAD_REQUEST);
|
||||
}*/
|
||||
}
|
||||
HseSafetyInspection updateInspection = new HseSafetyInspection();
|
||||
BeanUtils.copyProperties(req, updateInspection);
|
||||
if (safetyInspection.getCreateBy() != null && safetyInspection.getIsReply().equals("1")) {
|
||||
|
||||
@ -19,11 +19,14 @@ import org.dromara.common.sse.config.SseProperties;
|
||||
import org.dromara.common.sse.dto.SeeMessageContentDto;
|
||||
import org.dromara.common.sse.dto.SseMessageDto;
|
||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||
import org.dromara.project.domain.BusProjectTeamMember;
|
||||
import org.dromara.project.service.IBusProjectTeamMemberService;
|
||||
import org.dromara.safety.domain.HseRecognizeRecord;
|
||||
import org.dromara.safety.domain.HseViolationLevel;
|
||||
import org.dromara.safety.domain.HseViolationLevelPost;
|
||||
import org.dromara.safety.domain.HseViolationRecord;
|
||||
import org.dromara.safety.domain.dto.violationrecord.*;
|
||||
import org.dromara.safety.domain.enums.HseSafetyInspectionReviewTypeEnum;
|
||||
import org.dromara.safety.domain.enums.HseSafetyInspectionStatusEnum;
|
||||
import org.dromara.safety.domain.vo.violationrecord.HseViolationRecordVo;
|
||||
import org.dromara.safety.mapper.HseViolationRecordMapper;
|
||||
@ -68,6 +71,9 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
|
||||
@Resource
|
||||
private IHseViolationLevelPostService violationLevelPostService;
|
||||
|
||||
@Resource
|
||||
private IBusProjectTeamMemberService projectTeamMemberService;
|
||||
|
||||
@Resource
|
||||
private SseProperties sseProperties;
|
||||
|
||||
@ -98,7 +104,18 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<HseViolationRecordVo> queryPageList(HseViolationRecordQueryReq req, PageQuery pageQuery) {
|
||||
Page<HseViolationRecord> violationRecordPage = this.page(pageQuery.build(), this.buildQueryWrapper(req));
|
||||
LambdaQueryWrapper<HseViolationRecord> lqw = this.buildQueryWrapper(req);
|
||||
Long userId = LoginHelper.getUserId();
|
||||
if (userId != null) {
|
||||
BusProjectTeamMember one = projectTeamMemberService.lambdaQuery()
|
||||
.eq(BusProjectTeamMember::getMemberId, userId)
|
||||
.eq(BusProjectTeamMember::getPostId, "0")
|
||||
.one();
|
||||
if (one != null) {
|
||||
lqw.eq(HseViolationRecord::getCorrectorId, userId);
|
||||
}
|
||||
}
|
||||
Page<HseViolationRecord> violationRecordPage = this.page(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(this.getVoPage(violationRecordPage));
|
||||
}
|
||||
|
||||
@ -249,6 +266,8 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
|
||||
chatServerHandler.sendSystemMessageToUser(req.getCorrectorId(),
|
||||
"您有一份新的 AI 违章工单,请及时处理!工单号为:" + violationRecord.getId(), "2");
|
||||
}
|
||||
violationRecord.setStatus(HseSafetyInspectionStatusEnum.INFORM.getValue());
|
||||
violationRecord.setReviewType(HseSafetyInspectionReviewTypeEnum.NOT_REVIEW.getValue());
|
||||
boolean result = this.updateById(violationRecord);
|
||||
if (!result) {
|
||||
throw new ServiceException("更新处理人操作失败", HttpStatus.ERROR);
|
||||
@ -317,8 +336,10 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
|
||||
Long projectId = req.getProjectId();
|
||||
String violationType = req.getViolationType();
|
||||
LocalDate violationTime = req.getViolationTime();
|
||||
Long correctorId = req.getCorrectorId();
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), HseViolationRecord::getProjectId, projectId);
|
||||
lqw.eq(StringUtils.isNotBlank(violationType), HseViolationRecord::getViolationType, violationType);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(correctorId), HseViolationRecord::getCorrectorId, correctorId);
|
||||
if (violationTime != null) {
|
||||
// 构造当天的起始和结束时间
|
||||
LocalDateTime startOfDay = violationTime.atStartOfDay();
|
||||
@ -404,6 +425,7 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
|
||||
updateRecord.setId(id);
|
||||
updateRecord.setRectificationTime(new Date());
|
||||
updateRecord.setStatus(HseSafetyInspectionStatusEnum.RECTIFICATION.getValue());
|
||||
updateRecord.setReviewType(HseSafetyInspectionReviewTypeEnum.NOT_REVIEW.getValue());
|
||||
// 操作数据库
|
||||
return this.updateById(updateRecord);
|
||||
}
|
||||
|
||||
@ -2,9 +2,9 @@ package org.dromara.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
|
||||
/**
|
||||
* OSS对象存储对象
|
||||
@ -37,6 +37,11 @@ public class SysOss extends TenantEntity {
|
||||
*/
|
||||
private String fileSuffix;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
private Long fileSize;
|
||||
|
||||
/**
|
||||
* URL地址
|
||||
*/
|
||||
|
||||
@ -42,6 +42,11 @@ public class SysOssVo implements Serializable {
|
||||
*/
|
||||
private String fileSuffix;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
private Long fileSize;
|
||||
|
||||
/**
|
||||
* URL地址
|
||||
*/
|
||||
|
||||
@ -146,4 +146,12 @@ public interface ISysOssService {
|
||||
*/
|
||||
String minioFileName(String prefix, MultipartFile file);
|
||||
|
||||
/**
|
||||
* 格式化文件大小
|
||||
*
|
||||
* @param size 文件大小
|
||||
* @return 文件大小
|
||||
*/
|
||||
String formatFileSize(Long size);
|
||||
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ import org.dromara.common.oss.core.OssClient;
|
||||
import org.dromara.common.oss.entity.UploadResult;
|
||||
import org.dromara.common.oss.enumd.AccessPolicyType;
|
||||
import org.dromara.common.oss.factory.OssFactory;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.system.domain.SysOss;
|
||||
import org.dromara.system.domain.bo.SysOssBo;
|
||||
import org.dromara.system.domain.vo.SysOssUploadVo;
|
||||
@ -45,7 +44,6 @@ import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -206,7 +204,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
// 保存文件信息
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult);
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), file.getSize(), uploadResult);
|
||||
}
|
||||
|
||||
|
||||
@ -229,7 +227,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
// 保存文件信息
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult);
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), file.getSize(), uploadResult);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -340,7 +338,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
// 保存文件信息
|
||||
return buildResultEntity(originalFileName, suffix, storage.getConfigKey(), uploadResult);
|
||||
return buildResultEntity(originalFileName, suffix, storage.getConfigKey(), length, uploadResult);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -387,18 +385,20 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length());
|
||||
OssClient storage = OssFactory.instance();
|
||||
UploadResult uploadResult = storage.uploadSuffix(file, suffix);
|
||||
long size = file.length(); // 单位:字节
|
||||
// 保存文件信息
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult);
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), size, uploadResult);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private SysOssVo buildResultEntity(String originalfileName, String suffix, String configKey, UploadResult uploadResult) {
|
||||
private SysOssVo buildResultEntity(String originalfileName, String suffix, String configKey, Long fileSize, UploadResult uploadResult) {
|
||||
SysOss oss = new SysOss();
|
||||
oss.setUrl(uploadResult.getUrl());
|
||||
oss.setFileSuffix(suffix);
|
||||
oss.setFileName(uploadResult.getFilename());
|
||||
oss.setOriginalName(originalfileName);
|
||||
oss.setService(configKey);
|
||||
oss.setFileSize(fileSize);
|
||||
|
||||
//罗成负责删掉
|
||||
oss.setCreateBy(1L);
|
||||
@ -461,4 +461,26 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
OssClient storage = OssFactory.instance();
|
||||
return storage.getPath(prefix, suffix);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化文件大小
|
||||
*
|
||||
* @param size 文件大小
|
||||
* @return 文件大小
|
||||
*/
|
||||
@Override
|
||||
public String formatFileSize(Long size) {
|
||||
if (size == null || size <= 0) {
|
||||
return "0 B";
|
||||
}
|
||||
if (size < 1024) {
|
||||
return size + " B";
|
||||
} else if (size < 1024 * 1024) {
|
||||
return String.format("%.2f KB", size / 1024.0);
|
||||
} else if (size < 1024 * 1024 * 1024) {
|
||||
return String.format("%.2f MB", size / 1024.0 / 1024.0);
|
||||
} else {
|
||||
return String.format("%.2f GB", size / 1024.0 / 1024.0 / 1024.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user