|
|
@ -376,21 +376,22 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, |
|
|
|
Map<String, Integer> resMap = new HashMap<>(); |
|
|
|
for (PrUserProjectResultEntity res : resultList) { |
|
|
|
JSONObject originalData = JSON.parseObject(res.getOriginalData()); |
|
|
|
List<CascaderDTO> dtoList = JSON.parseArray(originalData.get(key).toString(), CascaderDTO.class); |
|
|
|
if(CollectionUtils.isEmpty(dtoList)){ |
|
|
|
log.info(String.format("当前userId:%s,没有填写本题itemId:%s",res.getUserId(),key)); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if(originalData.containsKey(key)){ |
|
|
|
List<CascaderDTO> dtoList = JSON.parseArray(originalData.get(key).toString(), CascaderDTO.class); |
|
|
|
if(CollectionUtils.isEmpty(dtoList)){ |
|
|
|
log.info(String.format("当前userId:%s,没有填写本题itemId:%s",res.getUserId(),key)); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
for (CascaderDTO cascaderDTO : dtoList) { |
|
|
|
if (null != cascaderDTO && !CollectionUtils.isEmpty(cascaderDTO.getLabels())) { |
|
|
|
totalCount += 1; |
|
|
|
String pathName = StringUtils.join(cascaderDTO.getLabels(), StringUtils.isNotBlank(cascaderExpandStruct.getSeparator()) ? cascaderExpandStruct.getSeparator() : StrConstant.HYPHEN); |
|
|
|
Integer count = resMap.get(pathName); |
|
|
|
resMap.put(pathName, count == null ? 1 : count + 1); |
|
|
|
for (CascaderDTO cascaderDTO : dtoList) { |
|
|
|
if (null != cascaderDTO && !CollectionUtils.isEmpty(cascaderDTO.getLabels())) { |
|
|
|
totalCount += 1; |
|
|
|
String pathName = StringUtils.join(cascaderDTO.getLabels(), StringUtils.isNotBlank(cascaderExpandStruct.getSeparator()) ? cascaderExpandStruct.getSeparator() : StrConstant.HYPHEN); |
|
|
|
Integer count = resMap.get(pathName); |
|
|
|
resMap.put(pathName, count == null ? 1 : count + 1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
detail.put("totalCount", totalCount); |
|
|
|
detail.put("profile", resMap); |
|
|
@ -497,7 +498,7 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PrUserProjectEntity headerInfo(TDuckHeaderInfoFormDTO formDTO) { |
|
|
|
PrUserProjectEntity prUserProjectEntity = baseDao.selectHeaderInfoByKey(formDTO.getProjectKey()); |
|
|
|
PrUserProjectEntity prUserProjectEntity = baseDao.selectOne(new QueryWrapper<PrUserProjectEntity>().lambda().eq(PrUserProjectEntity::getKey, formDTO.getProjectKey())); |
|
|
|
return prUserProjectEntity; |
|
|
|
} |
|
|
|
|
|
|
@ -543,8 +544,126 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, |
|
|
|
* @date 2021/9/22 1:37 下午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageData<List<String>> queryItemResDetail(ItemResDetailFormDTO formDTO) { |
|
|
|
//todo
|
|
|
|
return null; |
|
|
|
public List<String> queryItemResDetail(ItemResDetailFormDTO formDTO) { |
|
|
|
List<PrUserProjectResultEntity> resultList=baseDao.selectResults(formDTO.getProjectKey()); |
|
|
|
if(CollectionUtils.isEmpty(resultList)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
List<String> stringList=new ArrayList<>(); |
|
|
|
String key="field".concat(formDTO.getFormItemId()); |
|
|
|
for(PrUserProjectResultEntity res:resultList){ |
|
|
|
JSONObject originalData = JSON.parseObject(res.getOriginalData()); |
|
|
|
if(ProjectItemTypeEnum.INPUT.getValue().equals(formDTO.getType()) |
|
|
|
||ProjectItemTypeEnum.TEXTAREA.getValue().equals(formDTO.getType()) |
|
|
|
||ProjectItemTypeEnum.TIME.getValue().equals(formDTO.getType()) |
|
|
|
||ProjectItemTypeEnum.DATE.getValue().equals(formDTO.getType())){ |
|
|
|
if(originalData.containsKey(key)){ |
|
|
|
stringList.add((String) originalData.get(key)); |
|
|
|
continue; |
|
|
|
} |
|
|
|
}else if(ProjectItemTypeEnum.TIME_RANGE.getValue().equals(formDTO.getType()) |
|
|
|
||ProjectItemTypeEnum.DATE_RANGE.getValue().equals(formDTO.getType())){ |
|
|
|
if(originalData.containsKey(key)){ |
|
|
|
List<String> originalList= (List<String>) originalData.get(key); |
|
|
|
if(!CollectionUtils.isEmpty(originalList)){ |
|
|
|
String rangeStr=StringUtils.join(originalList,StrConstant.COMMA); |
|
|
|
stringList.add(rangeStr); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return stringList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 联系人组件 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.dataaggre.dto.epmettduck.result.ItemResDetailConcatResultDTO |
|
|
|
* @author yinzuomei |
|
|
|
* @date 2021/9/22 2:57 下午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public ItemResDetailConcatResultDTO queryItemResDetailConcat(ItemResDetailFormDTO formDTO) { |
|
|
|
// 联系人题目
|
|
|
|
List<AnalysisReportResDTO> itemList=baseDao.selectCocatItems(formDTO.getProjectKey()); |
|
|
|
if(CollectionUtils.isEmpty(itemList)){ |
|
|
|
return new ItemResDetailConcatResultDTO(); |
|
|
|
} |
|
|
|
//答案
|
|
|
|
List<PrUserProjectResultEntity> resultList=baseDao.selectResults(formDTO.getProjectKey()); |
|
|
|
if(CollectionUtils.isEmpty(resultList)){ |
|
|
|
return new ItemResDetailConcatResultDTO(); |
|
|
|
} |
|
|
|
|
|
|
|
ItemResDetailConcatResultDTO resultDTO=new ItemResDetailConcatResultDTO(); |
|
|
|
|
|
|
|
List<ConcatTableHeaderDTO> tableHeaderList=new ArrayList<>(); |
|
|
|
for(AnalysisReportResDTO item:itemList){ |
|
|
|
ConcatTableHeaderDTO headerDTO=new ConcatTableHeaderDTO(); |
|
|
|
headerDTO.setFormItemId(item.getFormItemId()); |
|
|
|
headerDTO.setLabel(item.getLabel()); |
|
|
|
headerDTO.setType(item.getType()); |
|
|
|
tableHeaderList.add(headerDTO); |
|
|
|
} |
|
|
|
|
|
|
|
List<List<String>> dataList=new ArrayList<>(); |
|
|
|
for(PrUserProjectResultEntity res:resultList){ |
|
|
|
List<String> userAnswer=new ArrayList<>(); |
|
|
|
JSONObject originalData = JSON.parseObject(res.getOriginalData()); |
|
|
|
|
|
|
|
for(ConcatTableHeaderDTO header:tableHeaderList){ |
|
|
|
String key="field".concat(header.getFormItemId()); |
|
|
|
|
|
|
|
//手机号、邮箱、身份证、单行文本: INPUT
|
|
|
|
if(ProjectItemTypeEnum.INPUT.getValue().equals(header.getType())){ |
|
|
|
if(originalData.containsKey(key)){ |
|
|
|
if(StringUtils.isNotBlank(originalData.get(key).toString())){ |
|
|
|
userAnswer.add((String) originalData.get(key)); |
|
|
|
}else{ |
|
|
|
userAnswer.add(StrConstant.EPMETY_STR); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
log.warn("没有当前的key:,可能用户没填写吧"+key); |
|
|
|
userAnswer.add(StrConstant.HYPHEN); |
|
|
|
} |
|
|
|
} |
|
|
|
//省市联动: PROVINCE_CITY
|
|
|
|
if(ProjectItemTypeEnum.PROVINCE_CITY.getValue().equals(header.getType())){ |
|
|
|
if(originalData.containsKey(key)){ |
|
|
|
List<String> provinceCityList= (List<String>) originalData.get(key); |
|
|
|
if(!CollectionUtils.isEmpty(provinceCityList)){ |
|
|
|
userAnswer.add(StringUtils.join(provinceCityList,StrConstant.HYPHEN)); |
|
|
|
}else{ |
|
|
|
userAnswer.add(StrConstant.EPMETY_STR); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
log.warn("没有当前的key:,可能用户没填写吧"+key); |
|
|
|
userAnswer.add(StrConstant.HYPHEN); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//地理位置:INPUT_MAP
|
|
|
|
if(ProjectItemTypeEnum.INPUT_MAP.getValue().equals(header.getType())){ |
|
|
|
if(originalData.containsKey(key)){ |
|
|
|
List<String> inputMap= (List<String>) originalData.get(key); |
|
|
|
log.info("地理位置:"+JSON.toJSONString(inputMap,true)); |
|
|
|
if (!CollectionUtils.isEmpty(inputMap) && inputMap.size() == 3) { |
|
|
|
userAnswer.add(inputMap.get(2)); |
|
|
|
}else{ |
|
|
|
userAnswer.add(StrConstant.EPMETY_STR); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
log.warn("没有当前的key:,可能用户没填写吧"+key); |
|
|
|
userAnswer.add(StrConstant.HYPHEN); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
dataList.add(userAnswer); |
|
|
|
} |
|
|
|
resultDTO.setTableHeaderList(tableHeaderList); |
|
|
|
resultDTO.setDataList(dataList); |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
} |