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 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; } }