heheng
2025-12-03 c95d04de9c717a491135aa76c9107c88dc9c7e6c
修改权限
已修改1个文件
61 ■■■■■ 文件已修改
multi-system/src/main/java/com/gkhy/exam/system/service/impl/StandardizedTemplateServiceImpl.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/service/impl/StandardizedTemplateServiceImpl.java
@@ -50,22 +50,23 @@
    @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);
        }
@@ -74,6 +75,7 @@
    @Override
    public CommonResult insertStandardizedTemplate(StandardizedTemplate standardizedTemplate) {
        checkPer();
        LoginUserDetails loginUser = SecurityUtils.getLoginUser();
        SysCompany sysCompany = sysCompanyService.selectCompanyById(standardizedTemplate.getCompanyId().longValue());
@@ -82,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());
@@ -90,7 +92,7 @@
            customerService.insertCustomer(customer);
        }
        if (insert>0){
        if (insert > 0) {
            return CommonResult.success();
        }
        return CommonResult.failed();
@@ -98,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();
@@ -112,6 +115,7 @@
    @Override
    public CommonResult deletedStandardizedTemplate(Integer standardizedTemplateId) {
        checkPer();
        StandardizedTemplate standardizedTemplate = new StandardizedTemplate();
        LoginUserDetails loginUser = SecurityUtils.getLoginUser();
        standardizedTemplate.setUpdateBy(loginUser.getUsername());
@@ -119,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);
            }
        }
@@ -151,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();
@@ -165,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();
@@ -221,20 +232,20 @@
        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());
        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<>());
                }
            map.put("productServiceDatas", fileUrlsData);
        } else {
            map.put("productServiceDatas", new ArrayList<>());
        }
        return CommonResult.success(map);
    }
}