diff --git a/bonus-admin/src/main/java/com/bonus/web/controller/enterprise/TechnicalController.java b/bonus-admin/src/main/java/com/bonus/web/controller/enterprise/TechnicalController.java new file mode 100644 index 0000000..52cdc71 --- /dev/null +++ b/bonus-admin/src/main/java/com/bonus/web/controller/enterprise/TechnicalController.java @@ -0,0 +1,108 @@ +package com.bonus.web.controller.enterprise; + +import com.bonus.common.annotation.RequiresPermissions; +import com.bonus.common.annotation.SysLog; +import com.bonus.common.core.controller.BaseController; +import com.bonus.common.core.domain.AjaxResult; +import com.bonus.common.core.page.TableDataInfo; +import com.bonus.common.domain.mainDatabase.dto.TechnicalDto; +import com.bonus.common.domain.mainDatabase.vo.EnterpriseVo; +import com.bonus.common.domain.mainDatabase.vo.TechnicalVo; +import com.bonus.common.enums.OperaType; +import com.bonus.web.service.enterprise.TechnicalService; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @className:TechnicalController + * @author:cwchen + * @date:2025-10-28-17:41 + * @version:1.0 + * @description:技术方案库-web层 + */ + +@RestController +@RequestMapping("/mainDatabase/technical") +public class TechnicalController extends BaseController { + + @Resource(name = "TechnicalService") + private TechnicalService technicalService; + + @ApiOperation(value = "技术方案库", notes = "查询类型列表") + @GetMapping("getTypeList") + @SysLog(title = "技术方案库", module = "企业知识库->技术方案库->查询类型列表", businessType = OperaType.QUERY, details = "查询类型列表", logType = 1) + @RequiresPermissions("enterpriseLibrary:technical:list") + public AjaxResult getTypeList(TechnicalDto.TypeDto dto) { + return technicalService.getTypeList(dto); + } + + @ApiOperation(value = "技术方案库", notes = "新增技术方案类别库") + @PostMapping("addTypeData") + @SysLog(title = "技术方案库", module = "企业知识库->技术方案库->新增技术方案类别库", businessType = OperaType.INSERT, details = "新增技术方案类别库", logType = 1) + @RequiresPermissions("enterpriseLibrary:technical:add") + public AjaxResult addTypeData(@RequestBody TechnicalDto.TypeDto dto) { + return technicalService.addTypeData(dto); + } + + @ApiOperation(value = "技术方案库", notes = "修改技术方案类别库") + @PostMapping("editTypeData") + @SysLog(title = "技术方案库", module = "企业知识库->技术方案库->修改技术方案类别库", businessType = OperaType.UPDATE, details = "修改技术方案类别库", logType = 1) + @RequiresPermissions("enterpriseLibrary:technical:edit") + public AjaxResult editTypeData(@RequestBody TechnicalDto.TypeDto dto) { + return technicalService.editTypeData(dto); + } + + @ApiOperation(value = "技术方案库", notes = "删除技术方案类别库") + @PostMapping("delTypeData") + @SysLog(title = "技术方案库", module = "企业知识库->技术方案库->删除技术方案类别库", businessType = OperaType.DELETE, details = "删除技术方案类别库", logType = 1) + @RequiresPermissions("enterpriseLibrary:technical:del") + public AjaxResult delTypeData(@RequestBody TechnicalDto.TypeDto dto) { + return technicalService.delTypeData(dto); + } + + + @ApiOperation(value = "技术方案库", notes = "查询数据列表") + @GetMapping("getDataList") + @SysLog(title = "技术方案库", module = "企业知识库->技术方案库->查询数据列表", businessType = OperaType.QUERY, details = "查询数据列表", logType = 1) + @RequiresPermissions("enterpriseLibrary:technical:list") + public TableDataInfo getDataList(TechnicalDto.TechnicalDataDto dto) { + startPage(); + List list = technicalService.getList(dto); + return getDataTable(list); + } + + @ApiOperation(value = "技术方案库", notes = "新增技术方案库") + @PostMapping("addData") + @SysLog(title = "技术方案库", module = "企业知识库->技术方案库->新增技术方案库", businessType = OperaType.INSERT, details = "新增技术方案库", logType = 1) + @RequiresPermissions("enterpriseLibrary:technical:add") + public AjaxResult addData(@RequestBody TechnicalDto.TechnicalDataDto dto) { + return technicalService.addData(dto); + } + + @ApiOperation(value = "技术方案库", notes = "修改技术方案库") + @PostMapping("editData") + @SysLog(title = "技术方案库", module = "企业知识库->技术方案库->修改技术方案库", businessType = OperaType.UPDATE, details = "修改技术方案库", logType = 1) + @RequiresPermissions("enterpriseLibrary:technical:edit") + public AjaxResult editData(@RequestBody TechnicalDto.TechnicalDataDto dto) { + return technicalService.editData(dto); + } + + @ApiOperation(value = "技术方案库", notes = "删除技术方案库") + @PostMapping("delData") + @SysLog(title = "技术方案库", module = "企业知识库->技术方案库->删除技术方案库", businessType = OperaType.DELETE, details = "删除技术方案库", logType = 1) + @RequiresPermissions("enterpriseLibrary:technical:del") + public AjaxResult delData(@RequestBody TechnicalDto.TechnicalDataDto dto) { + return technicalService.delData(dto); + } + + @ApiOperation(value = "技术方案库", notes = "技术方案库详情") + @GetMapping("detailData") + @SysLog(title = "技术方案库", module = "企业知识库->技术方案库->技术方案库详情", businessType = OperaType.QUERY, details = "删除技术方案库", logType = 1) + @RequiresPermissions("enterpriseLibrary:technical:detail") + public AjaxResult detailData(TechnicalDto.TechnicalDataDto dto) { + return technicalService.detailData(dto); + } +} diff --git a/bonus-admin/src/main/java/com/bonus/web/service/enterprise/PersonnelService.java b/bonus-admin/src/main/java/com/bonus/web/service/enterprise/PersonnelService.java index 448b958..78df371 100644 --- a/bonus-admin/src/main/java/com/bonus/web/service/enterprise/PersonnelService.java +++ b/bonus-admin/src/main/java/com/bonus/web/service/enterprise/PersonnelService.java @@ -317,7 +317,7 @@ public class PersonnelService { // 3.查询人员关联资源文件 List fileVoList = sourceFileService.getFilesByTable(dto.getPersonnelId(),TableConstants.TB_ENTERPRISE_PERSONNEL); // 4.取minio中的文件访问路径 - List resourceFileVos = setFile(fileVoList); + List resourceFileVos = fileUploadService.setFile(fileVoList); detailVo.setResourceFileVoList(resourceFileVos); // 5.查询人员证书 @@ -328,7 +328,7 @@ public class PersonnelService { vo.setCertificate(item); List filesByTable = sourceFileService.getFilesByTable(item.getPersonnelCertificateId(), TableConstants.TB_PERSONNEL_CERTIFICATE); // 取minio中的文件访问路径 - List fileVos = setFile(filesByTable); + List fileVos = fileUploadService.setFile(filesByTable); vo.setFileVoList(fileVos); certificateDetailList.add(vo); } @@ -373,7 +373,7 @@ public class PersonnelService { * @return List * @author cwchen * @date 2025/10/24 13:37 - */ + *//* public List setFile(List fileVoList){ if(CollectionUtils.isNotEmpty(fileVoList)){ for (ResourceFileVo file : fileVoList) { @@ -384,5 +384,5 @@ public class PersonnelService { } } return fileVoList; - } + }*/ } diff --git a/bonus-admin/src/main/java/com/bonus/web/service/enterprise/TechnicalService.java b/bonus-admin/src/main/java/com/bonus/web/service/enterprise/TechnicalService.java new file mode 100644 index 0000000..e557825 --- /dev/null +++ b/bonus-admin/src/main/java/com/bonus/web/service/enterprise/TechnicalService.java @@ -0,0 +1,270 @@ +package com.bonus.web.service.enterprise; + +import com.bonus.common.constant.TableConstants; +import com.bonus.common.core.domain.AjaxResult; +import com.bonus.common.domain.file.po.ResourceFilePo; +import com.bonus.common.domain.file.vo.ResourceFileVo; +import com.bonus.common.domain.file.vo.SysFile; +import com.bonus.common.domain.mainDatabase.dto.TechnicalDto; +import com.bonus.common.domain.mainDatabase.vo.TechnicalVo; +import com.bonus.common.utils.ValidatorsUtils; +import com.bonus.file.service.FileUploadService; +import com.bonus.file.service.SourceFileService; +import com.bonus.mainDataBase.service.IMDTechnicalService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.interceptor.TransactionAspectSupport; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +/** + * @className:TechnicalService + * @author:cwchen + * @date:2025-10-28-17:42 + * @version:1.0 + * @description:技术方案库-业务层 + */ +@Service(value = "TechnicalService") +@Slf4j +public class TechnicalService { + + @Resource(name = "IMDTechnicalService") + private IMDTechnicalService imdTechnicalService; + + @Resource(name = "ValidatorsUtils") + private ValidatorsUtils validatorsUtils; + + @Resource(name = "SourceFileService") + private SourceFileService sourceFileService; + + @Resource(name = "FileUploadService") + private FileUploadService fileUploadService; + + + /** + * 企业知识库->技术方案库->查询类型列表 + * @param dto + * @return AjaxResult + * @author cwchen + * @date 2025/10/28 18:19 + */ + public AjaxResult getTypeList(TechnicalDto.TypeDto dto) { + List list = imdTechnicalService.getTypeList(dto); + return AjaxResult.success(list); + } + + /** + * 企业知识库->技术方案库->新增技术方案类型 + * @param dto + * @return AjaxResult + * @author cwchen + * @date 2025/10/28 18:19 + */ + public AjaxResult addTypeData(TechnicalDto.TypeDto dto) { + // 校验数据是否合法 + String validResult = validatorsUtils.valid(dto, TechnicalDto.TypeDto.ADD.class); + if (StringUtils.isNotBlank(validResult)) { + return AjaxResult.error(validResult); + } + try { + // 1.技术方案库类别是否重复 + int result = imdTechnicalService.isRepeat(dto); + if(result > 0){ + return AjaxResult.error("技术方案库类别已存在"); + } + // 2.添加技术方案库类别数据 + imdTechnicalService.operTypeData(dto, 1); + } catch (Exception e) { + log.error(e.toString(), e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error(); + } + return AjaxResult.success(); + } + + /** + * 企业知识库->技术方案库->修改技术方案类型 + * @param dto + * @return AjaxResult + * @author cwchen + * @date 2025/10/28 18:19 + */ + public AjaxResult editTypeData(TechnicalDto.TypeDto dto) { + // 校验数据是否合法 + String validResult = validatorsUtils.valid(dto, TechnicalDto.TypeDto.UPDATE.class); + if (StringUtils.isNotBlank(validResult)) { + return AjaxResult.error(validResult); + } + try { + // 1.技术方案库类别是否重复 + int result = imdTechnicalService.isRepeat(dto); + if(result > 0){ + return AjaxResult.error("技术方案库类别已存在"); + } + // 2.添加技术方案库类别数据 + imdTechnicalService.operTypeData(dto, 1); + } catch (Exception e) { + log.error(e.toString(), e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error(); + } + return AjaxResult.success(); + } + + /** + * 企业知识库->技术方案库->删除技术方案类型 + * @param dto + * @return AjaxResult + * @author cwchen + * @date 2025/10/28 18:19 + */ + public AjaxResult delTypeData(TechnicalDto.TypeDto dto) { + // 校验数据是否合法 + String validResult = validatorsUtils.valid(dto, TechnicalDto.TypeDto.DELETE.class); + if (StringUtils.isNotBlank(validResult)) { + return AjaxResult.error(validResult); + } + try { + // 1.技术方案库类别是否存在子集 + int result = imdTechnicalService.hasChildData(dto); + if(result > 0){ + return AjaxResult.error("技术方案库类别子集数据,无法删除"); + } + // 2.添加技术方案库类别数据 + imdTechnicalService.operTypeData(dto, 3); + } catch (Exception e) { + log.error(e.toString(), e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error(); + } + return AjaxResult.success(); + } + + + + /** + * 企业知识库->技术方案库->新增技术方案库数据 + * @param dto + * @return List + * @author cwchen + * @date 2025/10/30 10:09 + */ + public AjaxResult addData(TechnicalDto.TechnicalDataDto dto) { + // 校验数据是否合法 + String validResult = validatorsUtils.valid(dto, TechnicalDto.TechnicalDataDto.ADD.class); + if (StringUtils.isNotBlank(validResult)) { + return AjaxResult.error(validResult); + } + try { + List dataDtos = new ArrayList<>(); + + String[] ignoreProperties = {"files"}; // 要忽略的属性名 + for (ResourceFilePo file : dto.getFiles()) { + TechnicalDto.TechnicalDataDto dataDto = new TechnicalDto.TechnicalDataDto(); + BeanUtils.copyProperties(dto, dataDto,ignoreProperties); + String fileName = StringUtils.substringBeforeLast(file.getFileName(), "."); + dataDto.setTechnicalName(fileName); + dataDtos.add(dataDto); + } + // 2.添加技术方案库数据 + imdTechnicalService.operData(dataDtos, 1); + // 3.添加文件 + for (int i = 0; i < dto.getFiles().size(); i++) { + dto.getFiles().get(i).setBusinessId(dataDtos.get(i).getTechnicalSolutionId()); // 业务id + dto.getFiles().get(i).setSourceTable(TableConstants.TB_ENTERPRISE_TECHNICAL_SOLUTION); // 来源表 + } + sourceFileService.saveResourceFile(dto.getFiles()); + } catch (Exception e) { + log.error(e.toString(), e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error(); + } + return AjaxResult.success(); + } + + /** + * 企业知识库->技术方案库->修改技术方案库数据 + * @param dto + * @return List + * @author cwchen + * @date 2025/10/30 10:09 + */ + public AjaxResult editData(TechnicalDto.TechnicalDataDto dto) { + // 校验数据是否合法 + String validResult = validatorsUtils.valid(dto, TechnicalDto.TechnicalDataDto.UPDATE.class); + if (StringUtils.isNotBlank(validResult)) { + return AjaxResult.error(validResult); + } + try { + // 修改技术方案库数据 + imdTechnicalService.operData(Collections.singletonList(dto), 2); + } catch (Exception e) { + log.error(e.toString(), e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error(); + } + return AjaxResult.success(); + } + + /** + * 企业知识库->技术方案库->删除技术方案库数据 + * @param dto + * @return List + * @author cwchen + * @date 2025/10/30 10:09 + */ + public AjaxResult delData(TechnicalDto.TechnicalDataDto dto) { + // 校验数据是否合法 + String validResult = validatorsUtils.valid(dto, TechnicalDto.TechnicalDataDto.DELETE.class); + if (StringUtils.isNotBlank(validResult)) { + return AjaxResult.error(validResult); + } + try { + // 删除技术方案库数据 + imdTechnicalService.operData(Collections.singletonList(dto), 3); + } catch (Exception e) { + log.error(e.toString(), e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error(); + } + return AjaxResult.success(); + } + + /** + * 企业知识库->技术方案库->技术方案库详情数据 + * @param dto + * @return List + * @author cwchen + * @date 2025/10/30 10:09 + */ + public List getList(TechnicalDto.TechnicalDataDto dto) { + List list = imdTechnicalService.getList(dto); + return list; + } + + /** + * 企业知识库->技术方案库->技术方案库详情数据 + * @param dto + * @return AjaxResult + * @author cwchen + * @date 2025/10/30 11:25 + */ + public AjaxResult detailData(TechnicalDto.TechnicalDataDto dto) { + TechnicalVo.Technical vo = new TechnicalVo.Technical(); + // 1.查询关联资源文件 + List fileVoList = sourceFileService.getFilesByTable(dto.getTechnicalSolutionId(),TableConstants.TB_ENTERPRISE_TECHNICAL_SOLUTION); + // 2.取minio中的文件访问路径 + List resourceFileVos = fileUploadService.setFile(fileVoList); + vo.setResourceFileVoList(resourceFileVos); + return AjaxResult.success(vo); + } + + +} diff --git a/bonus-common/src/main/java/com/bonus/common/constant/TableConstants.java b/bonus-common/src/main/java/com/bonus/common/constant/TableConstants.java index ac96b0b..3b9322b 100644 --- a/bonus-common/src/main/java/com/bonus/common/constant/TableConstants.java +++ b/bonus-common/src/main/java/com/bonus/common/constant/TableConstants.java @@ -17,4 +17,7 @@ public class TableConstants { /**人员证书*/ public static final String TB_PERSONNEL_CERTIFICATE = "tb_personnel_certificate"; + + /**技术方案库*/ + public static final String TB_ENTERPRISE_TECHNICAL_SOLUTION = "tb_enterprise_technical_solution"; } diff --git a/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/dto/EnterpriseDto.java b/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/dto/EnterpriseDto.java index 51c87b7..3cc7098 100644 --- a/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/dto/EnterpriseDto.java +++ b/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/dto/EnterpriseDto.java @@ -33,7 +33,7 @@ public class EnterpriseDto { * 企业名称 */ @NotBlank(message = "企业名称不能为空", groups = {ADD.class, UPDATE.class}) - @Length(max = 64, message = "企业名称字符长度不能超过256", groups = {ADD.class, UPDATE.class}) + @Length(max = 64, message = "企业名称字符长度不能超过64", groups = {ADD.class, UPDATE.class}) private String enterpriseName; /** diff --git a/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/dto/TechnicalDto.java b/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/dto/TechnicalDto.java new file mode 100644 index 0000000..2a0f662 --- /dev/null +++ b/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/dto/TechnicalDto.java @@ -0,0 +1,218 @@ +package com.bonus.common.domain.mainDatabase.dto; + +import com.bonus.common.core.domain.model.LoginUser; +import com.bonus.common.domain.file.po.ResourceFilePo; +import com.bonus.common.utils.SecurityUtils; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.Date; +import java.util.List; +import java.util.Optional; + +/** + * @className:TechnicalDto + * @author:cwchen + * @date:2025-10-28-17:50 + * @version:1.0 + * @description:企业技术方案库类别库-dto + */ +@Data +public class TechnicalDto { + + @Data + public static class TypeDto { + + /** + * 技术方案类别id + */ + @NotNull(message = "技术方案类别id不能为空", groups = {UPDATE.class, DELETE.class, QUERY.class}) + private Long technicalSolutionTypeId; + + /** + * 企业id + */ + @NotNull(message = "技术方案类别id不能为空", groups = {ADD.class,UPDATE.class, DELETE.class, QUERY.class}) + private Long enterpriseId; + + /** + * 技术方案名称 + */ + @NotBlank(message = "技术方案名称不能为空", groups = {EnterpriseDto.ADD.class, EnterpriseDto.UPDATE.class}) + @Length(max = 64, message = "技术方案名称字符长度不能超过64", groups = {EnterpriseDto.ADD.class, EnterpriseDto.UPDATE.class}) + private String technicalSolutionName; + + /** + * 创建人 + */ + private Long createUserId = Optional.ofNullable(SecurityUtils.getLoginUser()) + .map(LoginUser::getUserId) + .orElse(null); + + /** + * 创建人姓名 + */ + private String createUserName = Optional.ofNullable(SecurityUtils.getLoginUser()) + .map(LoginUser::getUsername) + .orElse(null); + + /** + * 修改人 + */ + private Long updateUserId = Optional.ofNullable(SecurityUtils.getLoginUser()) + .map(LoginUser::getUserId) + .orElse(null); + + /** + * 修改人姓名 + */ + private String updateUserName = Optional.ofNullable(SecurityUtils.getLoginUser()) + .map(LoginUser::getUsername) + .orElse(null); + + /** + * 查询条件限制 + */ + public interface QUERY { + } + + /** + * 新增条件限制 + */ + public interface ADD { + } + + /** + * 修改条件限制 + */ + public interface UPDATE { + } + + /** + * 删除条件限制 + */ + public interface DELETE { + } + + } + + @Data + public static class TechnicalDataDto { + + /** + * 技术方案id + */ + @NotNull(message = "技术方案id不能为空", groups = {UPDATE.class, DELETE.class, QUERY.class}) + private Long technicalSolutionId; + + /** + * 技术方案类别id + */ + @NotNull(message = "技术方案类别id不能为空", groups = {UPDATE.class, DELETE.class, QUERY.class}) + private Long technicalSolutionTypeId; + + /** + * 技术方案名称 + * */ + private String technicalName; + + /** + * 电压等级(字典表配置) + */ + @NotBlank(message = "电压等级不能为空", groups = {ADD.class, UPDATE.class}) + @Length(max = 64, message = "电压等级字符长度不能超过64", groups = {ADD.class, UPDATE.class}) + private String voltageLevel; + + /** + * 建设性质(字典表配置) + */ + @NotBlank(message = "建设性质不能为空", groups = {ADD.class, UPDATE.class}) + @Length(max = 512, message = "建设性质字符长度不能超过512", groups = {ADD.class, UPDATE.class}) + private String natureConstruction; + + + /** + * 结构形式(字典表配置) + */ + @NotBlank(message = "结构形式不能为空", groups = {ADD.class, UPDATE.class}) + @Length(max = 32, message = "结构形式字符长度不能超过32", groups = {ADD.class, UPDATE.class}) + private String structuralForm; + + /** + * 基础形式 + */ + @NotBlank(message = "基础形式不能为空", groups = {ADD.class, UPDATE.class}) + @Length(max = 32, message = "基础形式字符长度不能超过32", groups = {ADD.class, UPDATE.class}) + private String basicForm; + + /** + * 资源文件 + */ + @NotEmpty(message = "文件不能为空", groups = {ADD.class}) + @Size(min = 1,message = "最少上传一个文件", groups = {ADD.class}) + private List files; + + + /** + * 文件状态 1.解析中 2.可引用 + */ + private String technicalSolutionState = "2"; + + /** + * 创建人 + */ + private Long createUserId = Optional.ofNullable(SecurityUtils.getLoginUser()) + .map(LoginUser::getUserId) + .orElse(null); + + /** + * 创建人姓名 + */ + private String createUserName = Optional.ofNullable(SecurityUtils.getLoginUser()) + .map(LoginUser::getUsername) + .orElse(null); + + /** + * 修改人 + */ + private Long updateUserId = Optional.ofNullable(SecurityUtils.getLoginUser()) + .map(LoginUser::getUserId) + .orElse(null); + + /** + * 修改人姓名 + */ + private String updateUserName = Optional.ofNullable(SecurityUtils.getLoginUser()) + .map(LoginUser::getUsername) + .orElse(null); + + /** + * 查询条件限制 + */ + public interface QUERY { + } + + /** + * 新增条件限制 + */ + public interface ADD { + } + + /** + * 修改条件限制 + */ + public interface UPDATE { + } + + /** + * 删除条件限制 + */ + public interface DELETE { + } + + } +} diff --git a/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/po/TechnicalSolution.java b/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/po/TechnicalSolution.java new file mode 100644 index 0000000..cac09d7 --- /dev/null +++ b/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/po/TechnicalSolution.java @@ -0,0 +1,81 @@ +package com.bonus.common.domain.mainDatabase.po; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * 企业技术方案库 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class TechnicalSolution { + + /** + * 技术方案id + */ + private Long technicalSolutionId; + + /** + * 技术方案类别id + */ + private Long technicalSolutionTypeId; + + /** + * 电压等级(字典表配置) + */ + private String voltageLevel; + + /** + * 建设性质(字典表配置) + */ + private String natureConstruction; + + /** + * 基础形式 + */ + private String basicForm; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 创建人 + */ + private Long createUserId; + + /** + * 创建人姓名 + */ + private String createUserName; + + /** + * 修改时间 + */ + private Date updateTime; + + /** + * 修改人 + */ + private Long updateUserId; + + /** + * 修改人姓名 + */ + private String updateUserName; + + /** + * 删除状态 0.未删除 1.删除 + */ + private String delFlag; + + /** + * 文件状态 + */ + private String technicalSolutionState; +} diff --git a/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/vo/TechnicalVo.java b/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/vo/TechnicalVo.java new file mode 100644 index 0000000..951b480 --- /dev/null +++ b/bonus-common/src/main/java/com/bonus/common/domain/mainDatabase/vo/TechnicalVo.java @@ -0,0 +1,95 @@ +package com.bonus.common.domain.mainDatabase.vo; + +import com.bonus.common.domain.file.vo.ResourceFileVo; +import com.bonus.common.domain.mainDatabase.dto.TechnicalDto; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.hibernate.validator.constraints.Length; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotBlank; +import java.util.Date; +import java.util.List; + +/** + * @className:TechnicalVo + * @author:cwchen + * @date:2025-10-28-17:52 + * @version:1.0 + * @description:技术方案库类别-vo + */ +@Data +public class TechnicalVo { + + @Data + public static class TypeVo { + /** + * 技术方案类别id + */ + private Long technicalSolutionTypeId; + + /** + * 企业id + */ + private Long enterpriseId; + + /** + * 技术方案名称 + */ + private String technicalSolutionName; + } + + @Data + public static class Technical { + /** + * 技术方案id + */ + private Long technicalSolutionId; + + /** + * 技术方案类别id + */ + private Long technicalSolutionTypeId; + + /** + * 技术方案名称 + * */ + private String technicalName; + + /** + * 电压等级(字典表配置) + */ + private String voltageLevel; + + /** + * 结构形式(字典表配置) + */ + private String structuralForm; + + /** + * 建设性质(字典表配置) + */ + private String natureConstruction; + + /** + * 基础形式 + */ + private String basicForm; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 文件状态 1.解析中 2.可引用 + */ + private String technicalSolutionState; + + /**人员相关资源文件*/ + private List resourceFileVoList; + } + +} diff --git a/bonus-file/src/main/java/com/bonus/file/enums/UploadSuffixEnum.java b/bonus-file/src/main/java/com/bonus/file/enums/UploadSuffixEnum.java index 9792ae0..8ca6fde 100644 --- a/bonus-file/src/main/java/com/bonus/file/enums/UploadSuffixEnum.java +++ b/bonus-file/src/main/java/com/bonus/file/enums/UploadSuffixEnum.java @@ -22,7 +22,7 @@ public enum UploadSuffixEnum { */ QUALIFICATION_DATABASE("qualification_database", "qualificationDatabase"), /** - * 业绩库 + * 技术方案库 */ TECHNICAL_SOLUTION_DATABASE("technical_solution_database", "technicalSolutionDatabase"), /** diff --git a/bonus-file/src/main/java/com/bonus/file/service/FileUploadService.java b/bonus-file/src/main/java/com/bonus/file/service/FileUploadService.java index 9e4f4f5..b828046 100644 --- a/bonus-file/src/main/java/com/bonus/file/service/FileUploadService.java +++ b/bonus-file/src/main/java/com/bonus/file/service/FileUploadService.java @@ -1,13 +1,17 @@ package com.bonus.file.service; +import com.bonus.common.domain.file.vo.ResourceFileVo; import com.bonus.common.domain.file.vo.SysFile; import com.bonus.file.config.MinioConfig; import com.bonus.file.util.MinioUtil; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.util.List; +import java.util.Objects; /** * @className:FileUploadService @@ -70,6 +74,13 @@ public class FileUploadService { return null; } + /** + * 获取文件 + * @param filePath + * @return SysFile + * @author cwchen + * @date 2025/10/30 13:11 + */ public SysFile getFile(String filePath) { try{ String fileUrl = minioUtil.getFileUrl(minioConfig.getBucketName(), filePath, 60 * 60 * 12); @@ -83,4 +94,23 @@ public class FileUploadService { return null; } + /** + * 文件访问路径赋值 + * @param fileVoList + * @return List + * @author cwchen + * @date 2025/10/24 13:37 + */ + public List setFile(List fileVoList){ + if(CollectionUtils.isNotEmpty(fileVoList)){ + for (ResourceFileVo file : fileVoList) { + SysFile sysFile = getFile(file.getFilePath()); + if(Objects.nonNull(sysFile)){ + file.setLsFilePath(sysFile.getUrl()); + } + } + } + return fileVoList; + } + } diff --git a/bonus-file/src/main/java/com/bonus/file/util/MinioUtil.java b/bonus-file/src/main/java/com/bonus/file/util/MinioUtil.java index 63519e9..8d225d8 100644 --- a/bonus-file/src/main/java/com/bonus/file/util/MinioUtil.java +++ b/bonus-file/src/main/java/com/bonus/file/util/MinioUtil.java @@ -167,7 +167,6 @@ public class MinioUtil { .object(partName) .stream(stream, stream.available(), -1) .build()); - System.out.println("Uploaded part: " + partName); } } catch (Exception e) { throw new RuntimeException("Error uploading part: " + partName, e); diff --git a/bonus-mainDatabase/src/main/java/com/bonus/mainDataBase/mapper/IMDTechnicalMapper.java b/bonus-mainDatabase/src/main/java/com/bonus/mainDataBase/mapper/IMDTechnicalMapper.java new file mode 100644 index 0000000..583d1a5 --- /dev/null +++ b/bonus-mainDatabase/src/main/java/com/bonus/mainDataBase/mapper/IMDTechnicalMapper.java @@ -0,0 +1,76 @@ +package com.bonus.mainDataBase.mapper; + +import com.bonus.common.domain.mainDatabase.dto.TechnicalDto; +import com.bonus.common.domain.mainDatabase.vo.TechnicalVo; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @className:IMDTechnicalMapper + * @author:cwchen + * @date:2025-10-28-17:44 + * @version:1.0 + * @description:数据方案库-数据层 + */ +@Repository(value = "IMDTechnicalMapper") +public interface IMDTechnicalMapper { + + /** + * 企业知识库->技术方案库->查询类型列表 + * + * @param dto + * @return List + * @author cwchen + * @date 2025/10/28 18:21 + */ + List getTypeList(TechnicalDto.TypeDto dto); + + /** + * 企业知识库->技术方案库->操作技术方案库类别 + * @param dto + * @param type + * @return void + * @author cwchen + * @date 2025/10/29 9:01 + */ + void operTypeData(@Param("params") TechnicalDto.TypeDto dto, @Param("type") int type); + + /** + * 企业知识库->技术方案库->技术方案库类别是否重复 + * @param dto + * @return int + * @author cwchen + * @date 2025/10/30 9:50 + */ + int isRepeat(@Param("params") TechnicalDto.TypeDto dto); + + /** + * 企业知识库->技术方案库->技术方案库类别是否存在子集 + * @param dto + * @return int + * @author cwchen + * @date 2025/10/30 9:59 + */ + int hasChildData(TechnicalDto.TypeDto dto); + + /** + * 企业知识库->技术方案库->查询数据列表 + * @param dto + * @return List + * @author cwchen + * @date 2025/10/30 10:15 + */ + List getList(TechnicalDto.TechnicalDataDto dto); + + /** + * 企业知识库->技术方案库->操作技术方案库数据 + * @param list + * @param type + * @return void + * @author cwchen + * @date 2025/10/30 11:01 + */ + void operData(@Param("list") List list,@Param("type") int type); +} diff --git a/bonus-mainDatabase/src/main/java/com/bonus/mainDataBase/service/IMDTechnicalService.java b/bonus-mainDatabase/src/main/java/com/bonus/mainDataBase/service/IMDTechnicalService.java new file mode 100644 index 0000000..20abd7c --- /dev/null +++ b/bonus-mainDatabase/src/main/java/com/bonus/mainDataBase/service/IMDTechnicalService.java @@ -0,0 +1,72 @@ +package com.bonus.mainDataBase.service; + +import com.bonus.common.domain.mainDatabase.dto.TechnicalDto; +import com.bonus.common.domain.mainDatabase.vo.TechnicalVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @className:IMDTechnicalService + * @author:cwchen + * @date:2025-10-28-17:43 + * @version:1.0 + * @description:技术方案库-具体业务层 + */ +public interface IMDTechnicalService { + /** + * 企业知识库->技术方案库->查询技术方案库类型列表 + * @param dto + * @return List + * @author cwchen + * @date 2025/10/28 18:20 + */ + List getTypeList(TechnicalDto.TypeDto dto); + + /** + * 技术方案库类别是否重复 + * @param dto + * @return int + * @author cwchen + * @date 2025/10/28 18:29 + */ + int isRepeat(TechnicalDto.TypeDto dto); + + /** + * 技术方案库类别是否重复 + * @param dto + * @param type + * @return void + * @author cwchen + * @date 2025/10/28 18:30 + */ + void operTypeData(@Param("params") TechnicalDto.TypeDto dto, @Param("type") int type); + + /** + * 技术方案库类别是否存在子集 + * @param dto + * @return int + * @author cwchen + * @date 2025/10/30 9:59 + */ + int hasChildData(TechnicalDto.TypeDto dto); + + /** + * 企业知识库->技术方案库->查询数据列表 + * @param dto + * @return List + * @author cwchen + * @date 2025/10/30 10:15 + */ + List getList(TechnicalDto.TechnicalDataDto dto); + + /** + * 企业知识库->技术方案库->操作技术方案库数据 + * @param dataDtos + * @param type + * @return void + * @author cwchen + * @date 2025/10/30 11:00 + */ + void operData(List dataDtos, int type); +} diff --git a/bonus-mainDatabase/src/main/java/com/bonus/mainDataBase/service/impl/MDTechnicalService.java b/bonus-mainDatabase/src/main/java/com/bonus/mainDataBase/service/impl/MDTechnicalService.java new file mode 100644 index 0000000..a87c015 --- /dev/null +++ b/bonus-mainDatabase/src/main/java/com/bonus/mainDataBase/service/impl/MDTechnicalService.java @@ -0,0 +1,73 @@ +package com.bonus.mainDataBase.service.impl; + +import com.bonus.common.domain.mainDatabase.dto.TechnicalDto; +import com.bonus.common.domain.mainDatabase.vo.TechnicalVo; +import com.bonus.mainDataBase.mapper.IMDTechnicalMapper; +import com.bonus.mainDataBase.service.IMDTechnicalService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +/** + * @className:MDTechnicalService + * @author:cwchen + * @date:2025-10-28-17:44 + * @version:1.0 + * @description:技术方案库-具体业务逻辑层 + */ +@Slf4j +@Service(value = "IMDTechnicalService") +public class MDTechnicalService implements IMDTechnicalService { + + @Resource(name = "IMDTechnicalMapper") + private IMDTechnicalMapper imdTechnicalMapper; + + @Override + public List getTypeList(TechnicalDto.TypeDto dto) { + try { + return imdTechnicalMapper.getTypeList(dto); + } catch (Exception e) { + return Collections.emptyList(); + } + } + + @Override + public int isRepeat(TechnicalDto.TypeDto dto) { + try { + return imdTechnicalMapper.isRepeat(dto); + } catch (Exception e) { + return 0; + } + } + + @Override + public void operTypeData(TechnicalDto.TypeDto dto, int type) { + imdTechnicalMapper.operTypeData(dto,type); + } + + @Override + public int hasChildData(TechnicalDto.TypeDto dto) { + try { + return imdTechnicalMapper.hasChildData(dto); + } catch (Exception e) { + return 0; + } + } + + @Override + public List getList(TechnicalDto.TechnicalDataDto dto) { + try { + return imdTechnicalMapper.getList(dto); + } catch (Exception e) { + return Collections.emptyList(); + } + } + + @Override + public void operData(List dataDtos, int type) { + imdTechnicalMapper.operData(dataDtos,type); + } +} diff --git a/bonus-mainDatabase/src/main/resources/mapper/TechnicalMapper.xml b/bonus-mainDatabase/src/main/resources/mapper/TechnicalMapper.xml new file mode 100644 index 0000000..1b2cbae --- /dev/null +++ b/bonus-mainDatabase/src/main/resources/mapper/TechnicalMapper.xml @@ -0,0 +1,155 @@ + + + + + + + INSERT INTO tb_enterprise_technical_solution_type + + enterprise_id, + technical_solution_name, + create_user_id, + create_user_name, + update_user_id, + update_user_name + + + #{params.enterpriseId}, + #{params.technicalSolutionName}, + #{params.createUserId}, + #{params.createUserName}, + #{params.updateUserId}, + #{params.updateUserName}, + + + + UPDATE tb_enterprise_technical_solution_type SET technical_solution_name = #{params.technicalSolutionName} + WHERE technical_solution_type_id = #{params.technicalSolutionTypeId}; + + + UPDATE tb_enterprise_technical_solution_type SET del_flag = '1' + WHERE technical_solution_type_id = #{params.technicalSolutionTypeId} + + + + + + + INSERT INTO tb_enterprise_technical_solution + ( + technical_solution_type_id, + technical_name, + voltage_level, + nature_construction, + structural_form, + basic_form, + create_user_id, + create_user_name, + update_user_id, + update_user_name + ) + VALUES + + ( + #{item.technicalSolutionTypeId}, + #{item.technicalName}, + #{item.voltageLevel}, + #{item.natureConstruction}, + #{item.structuralForm}, + #{item.basicForm}, + #{item.createUserId}, + #{item.createUserName}, + #{item.updateUserId}, + #{item.updateUserName} + ) + + + + + + UPDATE tb_enterprise_technical_solution + + technical_solution_type_id = #{item.technicalSolutionTypeId}, + technical_name = #{item.technicalName}, + voltage_level = #{item.voltageLevel}, + nature_construction = #{item.natureConstruction}, + structural_form = #{item.structuralForm}, + basic_form = #{item.basicForm}, + update_user_id = #{item.updateUserId}, + update_user_name = #{item.updateUserName} + + WHERE technical_solution_id = #{item.technicalSolutionId} + + + + + + UPDATE tb_enterprise_technical_solution + + del_flag = '1' + + WHERE technical_solution_id = #{item.technicalSolutionId} + + + + + + + + + + + + +