From e38612bd0c14b89f393a18ebcee0bc5028f8889d Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: 星期二, 09 十二月 2025 16:44:32 +0800
Subject: [PATCH] 修改功能

---
 multi-system/src/main/java/com/gkhy/exam/system/service/impl/StandardizedTemplateServiceImpl.java |   93 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 70 insertions(+), 23 deletions(-)

diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/StandardizedTemplateServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/StandardizedTemplateServiceImpl.java
index 6a64366..ce58277 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/StandardizedTemplateServiceImpl.java
+++ b/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,20 +47,31 @@
 
     @Autowired
     private CustomerService customerService;
+
+    @Autowired
+    private ProductServiceMapper productServiceMapper;
+
+    @Autowired
+    private ProclaimService proclaimService;
+
+
     @Override
-    public CommonPage selectStandardizedTemplateList(Integer companyId, Integer templateType) {
+    public CommonPage selectStandardizedTemplateList(StandardizedTemplate standardizedTemplate) {
         boolean admin = SecurityUtils.adminUser();
-        if (!admin){
-            if (companyId==null){
+        Integer companyId = standardizedTemplate.getCompanyId();
+        Integer templateType = standardizedTemplate.getTemplateType();
+        if (!admin) {
+            if (companyId == null) {
                 companyId = SecurityUtils.getCompanyId().intValue();
             }
         }
         PageUtils.startPage();
-        List<StandardizedTemplate> standardizedTemplates =new ArrayList<>();
-        if (templateType==2 || templateType==10){
-            standardizedTemplates = standardizedTemplateMapper.selectStandardizedTemplateListV2(companyId, templateType, null);
-        }else {
-            standardizedTemplates = standardizedTemplateMapper.selectStandardizedTemplateList(companyId, templateType);
+        List<StandardizedTemplate> standardizedTemplates = new ArrayList<>();
+        //templateType==2 || templateType==10 ||
+        if (templateType == 3) {
+            standardizedTemplates = standardizedTemplateMapper.selectStandardizedTemplateListV2(standardizedTemplate);
+        } else {
+            standardizedTemplates = standardizedTemplateMapper.selectStandardizedTemplateList(standardizedTemplate);
         }
 
         return CommonPage.restPage(standardizedTemplates);
@@ -69,6 +79,7 @@
 
     @Override
     public CommonResult insertStandardizedTemplate(StandardizedTemplate standardizedTemplate) {
+        checkPer();
         LoginUserDetails loginUser = SecurityUtils.getLoginUser();
 
         SysCompany sysCompany = sysCompanyService.selectCompanyById(standardizedTemplate.getCompanyId().longValue());
@@ -77,7 +88,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());
@@ -85,7 +96,7 @@
             customerService.insertCustomer(customer);
         }
 
-        if (insert>0){
+        if (insert > 0) {
             return CommonResult.success();
         }
         return CommonResult.failed();
@@ -93,13 +104,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();
@@ -107,6 +119,7 @@
 
     @Override
     public CommonResult deletedStandardizedTemplate(Integer standardizedTemplateId) {
+        checkPer();
         StandardizedTemplate standardizedTemplate = new StandardizedTemplate();
         LoginUserDetails loginUser = SecurityUtils.getLoginUser();
         standardizedTemplate.setUpdateBy(loginUser.getUsername());
@@ -114,20 +127,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);
             }
         }
@@ -146,7 +166,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();
@@ -160,7 +180,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();
@@ -183,17 +203,25 @@
     public CommonResult getStandardizedQualityByCompanyId(Integer companyId) {
         Map<String, Object> map = new HashMap<>();
         //程序文件
-        List<StandardizedTemplate> companyIndustryTemplates = standardizedTemplateMapper.selectStandardizedTemplateList(companyId, 4);
+        StandardizedTemplate programFile = new StandardizedTemplate();
+        programFile.setTemplateType(4);
+        programFile.setCompanyId(companyId);
+        programFile.setSort(1);
+        List<StandardizedTemplate> companyIndustryTemplates = standardizedTemplateMapper.selectStandardizedTemplateList(programFile);
         //职能分配
         List<SysFunctionalDistribution> sysFunctionalDistributions = sysFunctionalDistributionMapper.selectListVo(companyId.longValue());
         //部门
         SysDept sysDept = new SysDept();
         sysDept.setCompanyId(companyId.longValue());
-        sysDept.setResponsType("1");
+//        sysDept.setResponsType("1");
         List<TreeSelect> treeSelects = iSysDeptService.selectDeptTreeList(sysDept);
 
         //公司概况
         List<CompanySummary> companySummaries = companySummaryMapper.selectCompanySummaryList(companyId);
+
+        List<Proclaim> proclaims = proclaimService.selectProclaimByCompanyId(companyId);
+
+        map.put("proclaim",proclaims);
 
         //质量方针
         List<CompanyQualityPolicy> companyQualityPolicies = companyQualityPolicyMapper.selectCompanyQualityPolicyList(companyId);
@@ -207,6 +235,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);
     }
 }

--
Gitblit v1.9.2