| | |
| | | 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; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | 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 { |
| | |
| | | |
| | | @Autowired |
| | | private CustomerService customerService; |
| | | |
| | | @Autowired |
| | | private ProductServiceMapper productServiceMapper; |
| | | @Override |
| | | public CommonPage selectStandardizedTemplateList(Integer companyId, Integer templateType) { |
| | | public CommonPage selectStandardizedTemplateList(StandardizedTemplate standardizedTemplate) { |
| | | boolean admin = SecurityUtils.adminUser(); |
| | | Integer companyId = standardizedTemplate.getCompanyId(); |
| | | Integer templateType = standardizedTemplate.getTemplateType(); |
| | | if (!admin){ |
| | | if (companyId==null){ |
| | | companyId = SecurityUtils.getCompanyId().intValue(); |
| | | } |
| | | } |
| | | PageUtils.startPage(); |
| | | List<StandardizedTemplate> companyIndustryTemplates = standardizedTemplateMapper.selectStandardizedTemplateList(companyId, templateType); |
| | | return CommonPage.restPage(companyIndustryTemplates); |
| | | 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); |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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()); |
| | | //部门 |
| | |
| | | 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); |
| | | } |
| | | } |