multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/ProductServiceController.java
对比新文件 @@ -0,0 +1,60 @@ package com.gkhy.exam.admin.controller.web; import com.gkhy.exam.common.annotation.RepeatSubmit; import com.gkhy.exam.common.api.CommonResult; import com.gkhy.exam.system.domain.ProductService; import com.gkhy.exam.system.service.ProductServiceService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** * <p> * 产品服务实现过程 前端控制器 * </p> * * @author hh * @since 2025-12-02 16:59:08 */ @Api(tags = "产品服务实现过程") @RestController @RequestMapping("/system/productService") public class ProductServiceController { @Autowired private ProductServiceService productServiceService; @ApiOperation(value = "产品服务实现过程列表(分页)") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"), @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"), @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "int", required = false, value = "公司id"), @ApiImplicitParam(paramType = "query", name = "year", dataType = "String", required = false, value = "年份"), }) @GetMapping("/selectProductServiceList") public CommonResult selectProductServiceList(ProductService service){ return CommonResult.success(productServiceService.selectProductServiceList(service)); } @RepeatSubmit @ApiOperation(value = "新增编辑产品服务实现过程") @PostMapping("/saveProductService") public CommonResult saveProductService(@RequestBody @Validated ProductService service){ return productServiceService.saveProductService(service); } @ApiOperation(value = "删除产品服务实现过程") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", name = "id", dataType = "int", required = true, value = "id"), }) @GetMapping("/delProductService") public CommonResult delProductService(@RequestParam Long id){ return productServiceService.delProductService(id); } } multi-system/src/main/java/com/gkhy/exam/system/controller/MaterialController.java
文件已删除 multi-system/src/main/java/com/gkhy/exam/system/domain/InternalAuditCheckCatalogue.java
@@ -32,6 +32,18 @@ @TableField("catalogue_id") private Integer catalogueId; @ApiModelProperty("审核要点") @TableField("point_key") private String pointKey; @ApiModelProperty("审核发现") @TableField("find") private String find; @ApiModelProperty("审核结果") @TableField("result") private Integer result; @TableField(exist = false) private String number; @@ -40,22 +52,5 @@ @TableField("del_flag") private Integer delFlag; @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; InternalAuditCheckCatalogue that = (InternalAuditCheckCatalogue) o; return Objects.equals(catalogueId, that.catalogueId); } @Override public int hashCode() { return Objects.hash(catalogueId); } @TableField(exist = false) private List<InternalAuditCheckContent> checkContents; } multi-system/src/main/java/com/gkhy/exam/system/domain/ProductService.java
对比新文件 @@ -0,0 +1,60 @@ package com.gkhy.exam.system.domain; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.time.LocalDateTime; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; import javax.validation.constraints.NotNull; /** * <p> * 产品服务实现过程 * </p> * * @author hh * @since 2025-12-02 16:59:08 */ @Getter @Setter @TableName("product_service") @ApiModel(value = "ProductService对象", description = "产品服务实现过程") public class ProductService implements Serializable { private static final long serialVersionUID = 1L; @TableId("id") private Long id; @ApiModelProperty("企业id") @TableField("company_id") @NotNull(message = "companyId不能为空") private Integer companyId; @TableField("file_url") @NotNull(message = "图片不能为空") @ApiModelProperty("文件路径") private String fileUrl; @TableField("del_flag") private Integer delFlag; @TableField("create_by") private String createBy; @TableField("create_time") private LocalDateTime createTime; @TableField("update_by") private String updateBy; @TableField("update_time") private LocalDateTime updateTime; } multi-system/src/main/java/com/gkhy/exam/system/mapper/InternalAuditCheckCatalogueMapper.java
@@ -15,4 +15,9 @@ int insertBatch(@Param("catalogues") List<InternalAuditCheckCatalogue> catalogues); int updatebyCheckId(@Param("id") Integer id); void updateCheckCatalogues(List<InternalAuditCheckCatalogue> checkCatalogues); int saveBatch(List<InternalAuditCheckCatalogue> checkCatalogues); } multi-system/src/main/java/com/gkhy/exam/system/mapper/ProductServiceMapper.java
对比新文件 @@ -0,0 +1,22 @@ package com.gkhy.exam.system.mapper; import com.gkhy.exam.system.domain.ProductService; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import java.util.List; /** * <p> * 产品服务实现过程 Mapper 接口 * </p> * * @author hh * @since 2025-12-02 16:59:08 */ @Mapper public interface ProductServiceMapper extends BaseMapper<ProductService> { List<ProductService> selectProductServiceList(ProductService productService); } multi-system/src/main/java/com/gkhy/exam/system/service/ProductServiceService.java
对比新文件 @@ -0,0 +1,25 @@ package com.gkhy.exam.system.service; import com.gkhy.exam.common.api.CommonPage; import com.gkhy.exam.common.api.CommonResult; import com.gkhy.exam.system.domain.ProductService; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 产品服务实现过程 服务类 * </p> * * @author hh * @since 2025-12-02 16:59:08 */ public interface ProductServiceService extends IService<ProductService> { CommonPage selectProductServiceList(ProductService productService); CommonResult saveProductService(ProductService productService); CommonResult delProductService(Long id); } multi-system/src/main/java/com/gkhy/exam/system/service/impl/InternalAuditCarryServiceImpl.java
@@ -122,17 +122,8 @@ internalAuditCheck.setEndTime(checkDate.atTime(endTime)); } // 5. 部门ID转换安全处理:避免非数字字符串导致NumberFormatException Integer deptId1 = internalAuditCarryDept.getDeptId(); Long deptId; try { deptId = Long.valueOf(deptId1); } catch (NumberFormatException e) { continue; } // 6. 查询结果空防护:避免deptDetialVo为null导致后续getSysDeptResponsibilitys()报错 DeptDetialVo deptDetialVo = sysDeptService.selectDeptById(deptId); // 查询结果空防护:避免deptDetialVo为null导致后续getSysDeptResponsibilitys()报错 DeptDetialVo deptDetialVo = sysDeptService.selectDeptById(Long.valueOf(internalAuditCarryDept.getDeptId())); if (deptDetialVo == null) { continue; } @@ -149,25 +140,14 @@ InternalAuditCheckCatalogue internalAuditCheckCatalogue = new InternalAuditCheckCatalogue(); // 8. clauseId安全转换:避免null导致Math.toIntExact()报错 Long clauseId = sysDeptResponsibility.getClauseId(); if (clauseId != null) { internalAuditCheckCatalogue.setCatalogueId(Math.toIntExact(clauseId)); } else { continue; } // 9. 条款查询结果空防护:避免sysClauseManagement为null导致getPoints()报错 SysClauseManagement sysClauseManagement = sysClauseManagementMapper.selectById(clauseId); if (sysClauseManagement == null) { continue; } // 简化集合创建(原逻辑不变,仅优化初始化) List<InternalAuditCheckContent> internalAuditCheckContents = new ArrayList<>(); InternalAuditCheckContent internalAuditCheckContent = new InternalAuditCheckContent(); internalAuditCheckContent.setPointKey(sysClauseManagement.getPoints()); internalAuditCheckContents.add(internalAuditCheckContent); internalAuditCheckCatalogue.setCheckContents(internalAuditCheckContents); internalAuditCheckCatalogue.setCatalogueId(Math.toIntExact(clauseId)); internalAuditCheckCatalogue.setPointKey(sysClauseManagement.getPoints()); internalAuditCheckCatalogues.add(internalAuditCheckCatalogue); } } @@ -196,63 +176,36 @@ } private CommonResult updateInternalAuditCheck(InternalAuditCarry carry) { // 2. 空指针防护:避免deptList为null导致循环NPE List<InternalAuditCarryDept> deptList = carry.getDeptList(); if (CollectionUtils.isEmpty(deptList)) { log.warn("保存/更新内部审计检查:部门列表为空,companyId={}, year={}"); return CommonResult.success(); } for (InternalAuditCarryDept internalAuditCarryDept : deptList) { // 3. 跳过空的部门项,避免后续NPE if (internalAuditCarryDept == null) { log.warn("保存/更新内部审计检查:部门项为null,跳过"); continue; } InternalAuditCheck internalAuditCheck = new InternalAuditCheck(); // 基础字段赋值(保留原逻辑不变) internalAuditCheck.setCompanyId(carry.getCompanyId()); internalAuditCheck.setYear(carry.getYear()); internalAuditCheck.setDeptId(internalAuditCarryDept.getDeptId()); internalAuditCheck.setPersonId(internalAuditCarryDept.getCheckId()); internalAuditCheck.setCheckTime(internalAuditCarryDept.getDate()); // 4. 时间字段安全赋值:避免date/startTime/endTime为null导致atTime()报错 LocalDate checkDate = internalAuditCarryDept.getDate(); LocalTime startTime = internalAuditCarryDept.getStartTime(); LocalTime endTime = internalAuditCarryDept.getEndTime(); if (checkDate != null && startTime != null) { internalAuditCheck.setStartTime(checkDate.atTime(startTime)); } else { log.warn("保存/更新内部审计检查:开始时间构造失败(日期/时段为空),deptId={}"); } if (checkDate != null && endTime != null) { internalAuditCheck.setEndTime(checkDate.atTime(endTime)); } else { log.warn("保存/更新内部审计检查:结束时间构造失败(日期/时段为空),deptId={}"); } // 5. 部门ID转换安全处理:避免非数字字符串导致NumberFormatException Integer deptIdStr = internalAuditCarryDept.getDeptId(); Long deptId; try { deptId = Long.valueOf(deptIdStr); } catch (NumberFormatException e) { continue; } // 6. 查询部门详情空防护:避免deptDetialVo为null导致后续NPE DeptDetialVo deptDetialVo = sysDeptService.selectDeptById(deptId); DeptDetialVo deptDetialVo = sysDeptService.selectDeptById(Long.valueOf(internalAuditCarryDept.getDeptId())); if (deptDetialVo == null) { log.warn("保存/更新内部审计检查:未查询到部门详情,deptId={}"); continue; } List<SysDeptResponsibility> sysDeptResponsibilitys = deptDetialVo.getSysDeptResponsibilitys(); List<InternalAuditCheckCatalogue> internalAuditCheckCatalogues = new ArrayList<>(); // 7. 构建查询条件(保留原逻辑,仅优化日志) Map<String, Object> queryMap = new HashMap<>(); queryMap.put("dept_id", internalAuditCheck.getDeptId()); @@ -260,92 +213,40 @@ queryMap.put("company_id", internalAuditCheck.getCompanyId()); queryMap.put("del_flag", 0); List<InternalAuditCheck> internalAuditChecks = internalAuditCheckService.selectByMap(queryMap); log.debug("保存/更新内部审计检查:查询已有记录,条件={},查询结果数={}"); // 9. 循环构建新检查项(增加多层空防护) List<InternalAuditCheckCatalogue> checkCatalogues = new ArrayList<>(); if (!CollectionUtils.isEmpty(internalAuditChecks)){ batchLoadCheckDetails(internalAuditChecks); checkCatalogues = internalAuditChecks.get(0).getCheckCatalogues(); } // 循环构建新检查项 if (!CollectionUtils.isEmpty(sysDeptResponsibilitys)) { for (SysDeptResponsibility sysDeptResponsibility : sysDeptResponsibilitys) { if (sysDeptResponsibility == null) { log.warn("保存/更新内部审计检查:部门责任项为null,跳过"); continue; } // 防护:clauseId为空跳过,避免Math.toIntExact()报错 Long clauseId = sysDeptResponsibility.getClauseId(); if (clauseId == null) { log.warn("保存/更新内部审计检查:条款ID为空,跳过该责任项"); continue; } InternalAuditCheckCatalogue catalogue = new InternalAuditCheckCatalogue(); catalogue.setCatalogueId(Math.toIntExact(clauseId)); // 防护:条款查询为空跳过,避免getPoints()报错 SysClauseManagement clauseManagement = sysClauseManagementMapper.selectById(clauseId); catalogue.setCatalogueId(Math.toIntExact(sysDeptResponsibility.getClauseId())); SysClauseManagement clauseManagement = sysClauseManagementMapper.selectById(sysDeptResponsibility.getClauseId()); if (clauseManagement == null) { continue; } // 构建检查内容(保留原逻辑) List<InternalAuditCheckContent> checkContents = new ArrayList<>(); InternalAuditCheckContent content = new InternalAuditCheckContent(); content.setPointKey(clauseManagement.getPoints()); checkContents.add(content); catalogue.setCheckContents(checkContents); catalogue.setPointKey(clauseManagement.getPoints()); if (!CollectionUtils.isEmpty(checkCatalogues)){ for (InternalAuditCheckCatalogue checkCatalogue : checkCatalogues) { if (checkCatalogue.getCatalogueId().equals(catalogue.getCatalogueId())){ catalogue.setFind(checkCatalogue.getFind()); // catalogue.setPointKey(checkCatalogue.getPointKey()); catalogue.setResult(checkCatalogue.getResult()); } } } internalAuditCheckCatalogues.add(catalogue); } } else { log.debug("保存/更新内部审计检查:部门无责任项,deptId={}"); } // 8. 批量加载详情 + 合并已有检查项(关键防护:避免internalAuditChecks为空导致get(0)索引越界) if (!CollectionUtils.isEmpty(internalAuditChecks)) { batchLoadCheckDetails(internalAuditChecks); InternalAuditCheck firstCheck = internalAuditChecks.get(0); List<InternalAuditCheckCatalogue> existingCatalogues = firstCheck.getCheckCatalogues(); // 仅当旧数据非空、且新数据已存在时,才筛选合并旧数据 if (!CollectionUtils.isEmpty(existingCatalogues) && !internalAuditCheckCatalogues.isEmpty()) { // 提取新数据的所有catalogue_id(用Set实现O(1)快速匹配) Set<Integer> newCatalogueIds = internalAuditCheckCatalogues.stream() .map(InternalAuditCheckCatalogue::getCatalogueId) .collect(Collectors.toSet()); // 筛选旧数据:仅保留与新数据catalogue_id匹配的记录(避免无用旧数据) List<InternalAuditCheckCatalogue> matchedOldCatalogues = existingCatalogues.stream() .filter(oldCata -> newCatalogueIds.contains(oldCata.getCatalogueId())) .collect(Collectors.toList()); // 合并筛选后的旧数据(新数据已在列表中,旧数据仅加匹配项) internalAuditCheckCatalogues.addAll(matchedOldCatalogues); } else if (CollectionUtils.isEmpty(internalAuditCheckCatalogues)) { log.warn("保存/更新内部审计检查:无新构建的检查项,不合并旧数据,deptId={}, year={}"); } else { log.warn("保存/更新内部审计检查:已有记录无检查项,deptId={}, year={}"); } } // 去重优化:按catalogue_id可靠去重(核心修改:替代distinct(),避免依赖equals/hashCode) List<InternalAuditCheckCatalogue> uniqueCatalogues = internalAuditCheckCatalogues.stream() .collect(Collectors.toMap( InternalAuditCheckCatalogue::getCatalogueId, // 唯一键:catalogue_id(确保去重逻辑) Function.identity(), // 值:检查项对象 (oldVal, newVal) -> newVal // 冲突策略:保留新数据(如需保留旧数据,改为oldVal) )) .values() .stream() .collect(Collectors.toList()); // 最终设置(新数据全部保留,旧数据仅保留匹配项) internalAuditCheck.setCheckCatalogues(uniqueCatalogues); internalAuditCheck.setCheckCatalogues(uniqueCatalogues); internalAuditCheck.setCheckCatalogues(internalAuditCheckCatalogues); // 新增/更新判断(保留原逻辑,增加日志) if (CollectionUtils.isEmpty(internalAuditChecks)) { internalAuditCheckService.insertInternalAuditCheck(internalAuditCheck); } else { InternalAuditCheck existingCheck = internalAuditChecks.get(0); @@ -353,10 +254,8 @@ internalAuditCheckService.updateByYearAndDeptId(internalAuditCheck); } } return CommonResult.success(); } private void batchLoadCheckDetails(List<InternalAuditCheck> checks) { @@ -365,25 +264,14 @@ .map(InternalAuditCheck::getId) .collect(Collectors.toList()); if (CollectionUtils.isEmpty(checkIds)){ return; } //批量查询所有目录 List<InternalAuditCheckCatalogue> allCatalogues = checkCatalogueMapper.selectByCheckIds(checkIds); if (CollectionUtils.isEmpty(allCatalogues)) { return; } //收集所有目录ID List<Integer> catalogueIds = allCatalogues.stream() .map(InternalAuditCheckCatalogue::getId) .collect(Collectors.toList()); //批量查询所有内容 List<InternalAuditCheckContent> allContents = checkContentMapper.selectByCatalogueIds(catalogueIds); //按目录ID分组内容 Map<Integer, List<InternalAuditCheckContent>> contentMap = allContents.stream() .collect(Collectors.groupingBy(InternalAuditCheckContent::getCheckCatalogueId)); //按检查ID分组目录 Map<Integer, List<InternalAuditCheckCatalogue>> catalogueMap = allCatalogues.stream() .collect(Collectors.groupingBy(InternalAuditCheckCatalogue::getCheckId)); @@ -392,10 +280,6 @@ for (InternalAuditCheck check : checks) { List<InternalAuditCheckCatalogue> catalogues = catalogueMap.get(check.getId()); if (!CollectionUtils.isEmpty(catalogues)) { for (InternalAuditCheckCatalogue catalogue : catalogues) { List<InternalAuditCheckContent> contents = contentMap.get(catalogue.getId()); catalogue.setCheckContents(contents != null ? contents : new ArrayList<>()); } check.setCheckCatalogues(catalogues); } } multi-system/src/main/java/com/gkhy/exam/system/service/impl/InternalAuditCheckServiceImpl.java
@@ -79,13 +79,6 @@ .map(InternalAuditCheckCatalogue::getId) .collect(Collectors.toList()); //批量查询所有内容 List<InternalAuditCheckContent> allContents = checkContentMapper.selectByCatalogueIds(catalogueIds); //按目录ID分组内容 Map<Integer, List<InternalAuditCheckContent>> contentMap = allContents.stream() .collect(Collectors.groupingBy(InternalAuditCheckContent::getCheckCatalogueId)); //按检查ID分组目录 Map<Integer, List<InternalAuditCheckCatalogue>> catalogueMap = allCatalogues.stream() .collect(Collectors.groupingBy(InternalAuditCheckCatalogue::getCheckId)); @@ -94,10 +87,6 @@ for (InternalAuditCheck check : checks) { List<InternalAuditCheckCatalogue> catalogues = catalogueMap.get(check.getId()); if (!CollectionUtils.isEmpty(catalogues)) { for (InternalAuditCheckCatalogue catalogue : catalogues) { List<InternalAuditCheckContent> contents = contentMap.get(catalogue.getId()); catalogue.setCheckContents(contents != null ? contents : new ArrayList<>()); } check.setCheckCatalogues(catalogues); } } @@ -117,7 +106,6 @@ return CommonResult.failed("当前部门存在,请勿重复添加"); } internalAuditCheck.setCreateBy(SecurityUtils.getUsername()); internalAuditCheck.setCreateTime(LocalDateTime.now()); int insert = internalAuditCheckMapper.insert(internalAuditCheck); @@ -130,44 +118,18 @@ return CommonResult.success(); } //批量处理目录和内容 batchInsertCataloguesAndContents(internalAuditCheck.getId(), checkCatalogues); return CommonResult.success(); } private void batchInsertCataloguesAndContents(Integer checkId, List<InternalAuditCheckCatalogue> catalogues) { // 1. 设置目录的检查ID并批量插入 for (InternalAuditCheckCatalogue catalogue : catalogues) { catalogue.setCheckId(checkId); for (InternalAuditCheckCatalogue catalogue : checkCatalogues) { catalogue.setCheckId(internalAuditCheck.getId()); } // 批量插入目录 int catalogueInsertCount = checkCatalogueMapper.insertBatch(catalogues); if (catalogueInsertCount != catalogues.size()) { int catalogueInsertCount = checkCatalogueMapper.insertBatch(checkCatalogues); if (catalogueInsertCount != checkCatalogues.size()) { throw new RuntimeException("插入目录记录数量不匹配"); } return CommonResult.success(); // 2. 收集所有内容并设置目录ID List<InternalAuditCheckContent> allContents = new ArrayList<>(); for (int i = 0; i < catalogues.size(); i++) { InternalAuditCheckCatalogue catalogue = catalogues.get(i); List<InternalAuditCheckContent> contents = catalogue.getCheckContents(); if (!CollectionUtils.isEmpty(contents)) { for (InternalAuditCheckContent content : contents) { content.setCheckCatalogueId(catalogue.getId()); } allContents.addAll(contents); } } // 3. 批量插入内容 if (!CollectionUtils.isEmpty(allContents)) { int contentInsertCount = checkContentMapper.insertBatchs(allContents); if (contentInsertCount != allContents.size()) { throw new RuntimeException("插入内容记录数量不匹配"); } } } @Override @@ -176,14 +138,17 @@ internalAuditCheck.setUpdateTime(LocalDateTime.now()); int update = internalAuditCheckMapper.updateById(internalAuditCheck); if (update>0){ checkCatalogueMapper.updatebyCheckId(internalAuditCheck.getId()); List<InternalAuditCheckCatalogue> checkCatalogues = internalAuditCheck.getCheckCatalogues(); if (CollectionUtils.isEmpty(checkCatalogues)) { return CommonResult.success(); } for (InternalAuditCheckCatalogue catalogue : checkCatalogues) { catalogue.setCheckId(internalAuditCheck.getId()); } batchInsertCataloguesAndContents(internalAuditCheck.getId(), checkCatalogues); // 批量插入目录 checkCatalogueMapper.updateCheckCatalogues(checkCatalogues); return CommonResult.success(); } return CommonResult.failed(); @@ -210,7 +175,16 @@ if (update>0){ checkCatalogueMapper.updatebyCheckId(internalAuditCheck.getId()); List<InternalAuditCheckCatalogue> checkCatalogues = internalAuditCheck.getCheckCatalogues(); batchInsertCataloguesAndContents(internalAuditCheck.getId(), checkCatalogues); for (InternalAuditCheckCatalogue catalogue : checkCatalogues) { catalogue.setCheckId(internalAuditCheck.getId()); } // 批量插入目录 int catalogueInsertCount = checkCatalogueMapper.saveBatch(checkCatalogues); if (catalogueInsertCount != checkCatalogues.size()) { throw new RuntimeException("插入目录记录数量不匹配"); } } return CommonResult.success(); } multi-system/src/main/java/com/gkhy/exam/system/service/impl/ProductServiceServiceImpl.java
对比新文件 @@ -0,0 +1,68 @@ package com.gkhy.exam.system.service.impl; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.gkhy.exam.common.api.CommonPage; import com.gkhy.exam.common.api.CommonResult; import com.gkhy.exam.common.constant.UserConstant; import com.gkhy.exam.common.utils.PageUtils; import com.gkhy.exam.common.utils.SecurityUtils; import com.gkhy.exam.system.domain.InternalKnowledge; import com.gkhy.exam.system.domain.ProductService; import com.gkhy.exam.system.mapper.ProductServiceMapper; import com.gkhy.exam.system.service.ProductServiceService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.List; /** * <p> * 产品服务实现过程 服务实现类 * </p> * * @author hh * @since 2025-12-02 16:59:08 */ @Service public class ProductServiceServiceImpl extends ServiceImpl<ProductServiceMapper, ProductService> implements ProductServiceService { @Autowired private ProductServiceMapper productServiceMapper; @Override public CommonPage selectProductServiceList(ProductService productService) { PageUtils.startPage(); List<ProductService> productServices = productServiceMapper.selectProductServiceList(productService); return CommonPage.restPage(productServices); } @Override public CommonResult saveProductService(ProductService productService) { String[] split = productService.getFileUrl().split(","); if (split.length > 3){ return CommonResult.failed("最多上传3张图片"); } if (productService.getId() == null){ productService.setCreateTime(LocalDateTime.now()); productService.setCreateBy(SecurityUtils.getUsername()); productServiceMapper.insert(productService); }else { productService.setUpdateTime(LocalDateTime.now()); productService.setUpdateBy(SecurityUtils.getUsername()); productServiceMapper.updateById(productService); } return CommonResult.success(); } @Override public CommonResult delProductService(Long id) { productServiceMapper.update(new ProductService(), new LambdaUpdateWrapper<ProductService>().eq(ProductService::getId, id) .set(ProductService::getDelFlag, UserConstant.DISENABLE) .set(ProductService::getUpdateTime, LocalDateTime.now()) .set(ProductService::getUpdateBy, SecurityUtils.getUsername())); return CommonResult.success(); } } multi-system/src/main/java/com/gkhy/exam/system/service/impl/StandardizedTemplateServiceImpl.java
@@ -1,5 +1,6 @@ package com.gkhy.exam.system.service.impl; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -19,10 +20,8 @@ import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.*; import java.util.stream.Collectors; @Service public class StandardizedTemplateServiceImpl extends ServiceImpl<StandardizedTemplateMapper, StandardizedTemplate> implements StandardizedTemplateService { @@ -48,22 +47,26 @@ @Autowired private CustomerService customerService; @Autowired private ProductServiceMapper productServiceMapper; @Override public CommonPage selectStandardizedTemplateList(StandardizedTemplate standardizedTemplate) { boolean admin = SecurityUtils.adminUser(); Integer companyId = standardizedTemplate.getCompanyId(); Integer templateType = standardizedTemplate.getTemplateType(); if (!admin){ if (companyId==null){ if (!admin) { if (companyId == null) { companyId = SecurityUtils.getCompanyId().intValue(); } } PageUtils.startPage(); List<StandardizedTemplate> standardizedTemplates =new ArrayList<>(); List<StandardizedTemplate> standardizedTemplates = new ArrayList<>(); //templateType==2 || templateType==10 || if ( templateType == 3){ if (templateType == 3) { standardizedTemplates = standardizedTemplateMapper.selectStandardizedTemplateListV2(standardizedTemplate); }else { } else { standardizedTemplates = standardizedTemplateMapper.selectStandardizedTemplateList(standardizedTemplate); } @@ -72,6 +75,7 @@ @Override public CommonResult insertStandardizedTemplate(StandardizedTemplate standardizedTemplate) { checkPer(); LoginUserDetails loginUser = SecurityUtils.getLoginUser(); SysCompany sysCompany = sysCompanyService.selectCompanyById(standardizedTemplate.getCompanyId().longValue()); @@ -80,7 +84,7 @@ standardizedTemplate.setCreateTime(LocalDateTime.now()); int insert = standardizedTemplateMapper.insert(standardizedTemplate); if (standardizedTemplate.getTemplateType().equals(4)&&standardizedTemplate.getTemplateName().contains("满意度")){ if (standardizedTemplate.getTemplateType().equals(4) && standardizedTemplate.getTemplateName().contains("满意度")) { Customer customer = new Customer(); customer.setCompanyId(standardizedTemplate.getCompanyId()); customer.setFileName(standardizedTemplate.getTemplateName()); @@ -88,7 +92,7 @@ customerService.insertCustomer(customer); } if (insert>0){ if (insert > 0) { return CommonResult.success(); } return CommonResult.failed(); @@ -96,13 +100,14 @@ @Override public CommonResult updateStandardizedTemplate(StandardizedTemplate standardizedTemplate) { checkPer(); LoginUserDetails loginUser = SecurityUtils.getLoginUser(); SysCompany sysCompany = sysCompanyService.selectCompanyById(standardizedTemplate.getCompanyId().longValue()); standardizedTemplate.setCompanyName(sysCompany.getName()); standardizedTemplate.setUpdateBy(loginUser.getUsername()); standardizedTemplate.setUpdateTime(LocalDateTime.now()); int update = standardizedTemplateMapper.updateStandardizedTemplateById(standardizedTemplate); if (update>0){ if (update > 0) { return CommonResult.success(); } return CommonResult.failed(); @@ -110,6 +115,7 @@ @Override public CommonResult deletedStandardizedTemplate(Integer standardizedTemplateId) { checkPer(); StandardizedTemplate standardizedTemplate = new StandardizedTemplate(); LoginUserDetails loginUser = SecurityUtils.getLoginUser(); standardizedTemplate.setUpdateBy(loginUser.getUsername()); @@ -117,20 +123,27 @@ standardizedTemplate.setDelFlag(1); standardizedTemplate.setId(standardizedTemplateId); int i = standardizedTemplateMapper.updateById(standardizedTemplate); if (i>0){ if (i > 0) { return CommonResult.success(); } return CommonResult.failed(); } private void checkPer(){ boolean admin = SecurityUtils.adminUser(); if (!admin) { throw new ApiException("非管理员不可操作"); } } @Override public CommonResult selectStandardizedQuality(Integer companyId) { boolean admin = SecurityUtils.adminUser(); LambdaQueryWrapper<StandardizedQuality> lambdaQueryWrapper = Wrappers.<StandardizedQuality>lambdaQuery(); if (!admin){ if (!admin) { lambdaQueryWrapper.eq(StandardizedQuality::getCompanyId, companyId); }else { if (companyId != null){ } else { if (companyId != null) { lambdaQueryWrapper.eq(StandardizedQuality::getCompanyId, companyId); } } @@ -149,7 +162,7 @@ standardizedQuality.setCreateBy(loginUser.getUsername()); standardizedQuality.setCreateTime(LocalDateTime.now()); int insert = standardizedQualityMapper.insert(standardizedQuality); if (insert>0){ if (insert > 0) { return CommonResult.success(); } return CommonResult.failed(); @@ -163,7 +176,7 @@ standardizedQuality.setUpdateBy(loginUser.getUsername()); standardizedQuality.setUpdateTime(LocalDateTime.now()); int update = standardizedQualityMapper.updateStandardizedQualityById(standardizedQuality); if (update>0){ if (update > 0) { return CommonResult.success(); } return CommonResult.failed(); @@ -214,6 +227,25 @@ map.put("sysFunctionalDistributions", sysFunctionalDistributions); //程序文件 map.put("companyIndustryTemplates", companyIndustryTemplates); //产品和服务实现过程 LambdaQueryWrapper<ProductService> lambdaQueryWrapper = Wrappers.<ProductService>lambdaQuery() .eq(ProductService::getCompanyId, companyId) .eq(ProductService::getDelFlag, 0); List<ProductService> productServices = productServiceMapper.selectList(lambdaQueryWrapper); if (ObjectUtil.isNotEmpty(productServices)) { List<String> fileUrls = productServices.stream().map(ProductService::getFileUrl).collect(Collectors.toList()); List<String> fileUrlsData = fileUrls.stream().map(fileUrl -> { List<String> collect = Arrays.stream(fileUrl.split(",")).collect(Collectors.toList()); return collect; }).flatMap(Collection::stream).collect(Collectors.toList()); // for (String fileUrl : fileUrls) { // List<String> collect = Arrays.stream(fileUrl.split(",")).collect(Collectors.toList()); // } map.put("productServiceDatas", fileUrlsData); } else { map.put("productServiceDatas", new ArrayList<>()); } return CommonResult.success(map); } } multi-system/src/main/resources/mapper/system/InternalAuditCheckCatalogueMapper.xml
@@ -5,17 +5,46 @@ <insert id="insertBatch" useGeneratedKeys="true" keyProperty="id"> INSERT INTO internal_audit_check_catalogue ( check_id, catalogue_Id catalogue_Id, point_key ) VALUES <foreach collection="catalogues" item="item" separator=","> ( #{item.checkId}, #{item.catalogueId} #{item.catalogueId}, #{item.pointKey} ) </foreach> </insert> <insert id="saveBatch"> INSERT INTO internal_audit_check_catalogue ( check_id, catalogue_Id, point_key, find ) VALUES <foreach collection="list" item="item" separator=","> ( #{item.checkId}, #{item.catalogueId}, #{item.pointKey}, #{item.find} ) </foreach> </insert> <update id="updatebyCheckId"> update internal_audit_check_catalogue set del_flag =1 where check_id = #{id} </update> <update id="updateCheckCatalogues"> <foreach collection="list" item="item" separator=";"> UPDATE internal_audit_check_catalogue <set> <if test="item.pointKey != null">`point_key` = #{item.pointKey},</if> <if test="item.find != null">`find` = #{item.find},</if> <if test="item.result != null">`result` = #{item.result},</if> </set> WHERE `id` = #{item.id} </foreach> </update> <select id="selectByCheckIds" resultType="com.gkhy.exam.system.domain.InternalAuditCheckCatalogue"> @@ -23,6 +52,9 @@ iacc.`id`, iacc.`check_id`, iacc.`catalogue_id`, iacc.`point_key`, iacc.`find`, iacc.`result`, c.`clause_num` as number, c.`name` as mess, iacc.`del_flag` multi-system/src/main/resources/mapper/system/InternalAuditCheckMapper.xml
@@ -26,7 +26,7 @@ FROM `internal_audit_check` iac LEFT JOIN sys_dept sd ON iac.dept_id = sd.dept_id LEFT JOIN sys_user es on iac.person_id = es.id LEFT JOIN ex_student es on iac.person_id = es.id WHERE iac.del_flag = 0 <if test="companyId!=null"> multi-system/src/main/resources/mapper/system/ProductServiceMapper.xml
对比新文件 @@ -0,0 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gkhy.exam.system.mapper.ProductServiceMapper"> <select id="selectProductServiceList" resultType="com.gkhy.exam.system.domain.ProductService" parameterType="com.gkhy.exam.system.domain.ProductService"> select * from product_service where del_flag = 0 <if test="companyId != null"> and company_id = #{companyId} </if> order by create_time desc </select> </mapper>