jinlin
2024-01-12 f491d30b0a69148bd0991b3d5b1c4cf9f8216949
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.zt.life.modules.mainPart.utils;
 
import com.zt.core.sys.dto.DictDto;
import com.zt.core.sys.dto.DictItemDto;
import com.zt.core.sys.dto.DictLeafDto;
import com.zt.life.modules.project.service.SoftwareTestOrderService;
import com.zt.modules.sys.service.SysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
 
@Service
public class GetShowDictList {
    @Autowired
    private SysDictTypeService sysDictTypeService;
 
    public String getShowDictList(Object paramValues, String DictTYpe, Boolean enter) {
        String result = "";
        if (paramValues != null) {
            List<DictDto> userDicts = sysDictTypeService.getUserDicts();
            DictDto testType1Dict = userDicts.stream()
                    .filter(c -> c.getDictType().equals(DictTYpe))
                    .collect(Collectors.toList()).get(0);
 
            String values = "," + paramValues.toString() + ",";
            int i = 0;
            for (DictItemDto dictItemDto : ((DictLeafDto) testType1Dict).getDataList()) {
                String value = dictItemDto.getDictValue();
                String desc = (values.contains("," + value + ",") ? "☑" : "□") + dictItemDto.getDictLabel();
                i++;
                if (enter && i < ((DictLeafDto) testType1Dict).getDataList().size()) {
                    desc = desc + "\r\n";
                }
                result = result + desc;
            }
        }
        return result;
    }
 
 
}