|
|
@ -32,8 +32,12 @@ import com.epmet.dataaggre.dao.epmettduck.PrUserProjectDao; |
|
|
|
import com.epmet.dataaggre.dto.epmettduck.PrUserProjectDTO; |
|
|
|
import com.epmet.dataaggre.dto.epmettduck.ProjectItemTypeEnum; |
|
|
|
import com.epmet.dataaggre.dto.epmettduck.result.AnalysisReportResDTO; |
|
|
|
import com.epmet.dataaggre.dto.epmettduck.result.OptionDTO; |
|
|
|
import com.epmet.dataaggre.dto.epmettduck.result.ProjectProfileResultDTO; |
|
|
|
import com.epmet.dataaggre.dto.epmettduck.struct.CheckboxExpandStruct; |
|
|
|
import com.epmet.dataaggre.dto.epmettduck.struct.RadioExpandStruct; |
|
|
|
import com.epmet.dataaggre.dto.epmettduck.struct.RateExpandStruct; |
|
|
|
import com.epmet.dataaggre.dto.epmettduck.struct.SelectExpandStruct; |
|
|
|
import com.epmet.dataaggre.entity.epmettduck.PrUserProjectEntity; |
|
|
|
import com.epmet.dataaggre.entity.epmettduck.PrUserProjectResultEntity; |
|
|
|
import com.epmet.dataaggre.service.epmettduck.PrUserProjectService; |
|
|
@ -165,6 +169,7 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, |
|
|
|
||ProjectItemTypeEnum.DATE_RANGE.getValue().equals(currentType)){ |
|
|
|
|
|
|
|
for(PrUserProjectResultEntity res:resultList){ |
|
|
|
|
|
|
|
JSONObject originalData = JSON.parseObject(res.getOriginalData()); |
|
|
|
//手机号、邮箱、身份证、单行文本: INPUT
|
|
|
|
//多行文本
|
|
|
@ -181,8 +186,8 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, |
|
|
|
}else{ |
|
|
|
log.warn("没有当前的key:,可能用户没填写吧"+key); |
|
|
|
} |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
//省市联动: PROVINCE_CITY
|
|
|
|
//时间范围选择
|
|
|
|
//日期范围选择
|
|
|
@ -195,7 +200,9 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, |
|
|
|
validTotal+=1; |
|
|
|
} |
|
|
|
} |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
//地理位置:INPUT_MAP
|
|
|
|
if(ProjectItemTypeEnum.INPUT_MAP.getValue().equals(currentType)){ |
|
|
|
if(originalData.containsKey(key)){ |
|
|
@ -205,6 +212,8 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, |
|
|
|
validTotal += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
//不加也行,后面也没有代码块了
|
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -212,12 +221,114 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, |
|
|
|
item.setDetail(detail); |
|
|
|
continue; |
|
|
|
} |
|
|
|
// 3、下拉选择、级联选择、单选框组、多选框组显示不同选项选择次数、所占比例
|
|
|
|
//3.1、下拉选择
|
|
|
|
if (ProjectItemTypeEnum.SELECT.getValue().equals(currentType)) { |
|
|
|
SelectExpandStruct selectExpandStruct = JSON.parseObject(item.getExpand(), SelectExpandStruct.class); |
|
|
|
List<OptionDTO> options = new ArrayList<>(); |
|
|
|
if (null != selectExpandStruct) { |
|
|
|
options = ConvertUtils.sourceToTarget(selectExpandStruct.getOptions(), OptionDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
//3、下拉选择、级联选择、单选框组、多选框组显示不同选项选择次数、所占比例
|
|
|
|
if(ProjectItemTypeEnum.SELECT.getValue().equals(currentType)){ |
|
|
|
//共选择了多少次,每道题相加
|
|
|
|
int totalCount = 0; |
|
|
|
for (OptionDTO optionDTO : options) { |
|
|
|
//currentCount:每道题,被选了多少次?
|
|
|
|
int currentCount = 0; |
|
|
|
for (PrUserProjectResultEntity res : resultList) { |
|
|
|
JSONObject originalData = JSON.parseObject(res.getOriginalData()); |
|
|
|
if (selectExpandStruct.getMultiple()) { |
|
|
|
//多选
|
|
|
|
if(originalData.containsKey(key)){ |
|
|
|
List<Integer> answers = (List<Integer>) originalData.get(key); |
|
|
|
if (!CollectionUtils.isEmpty(answers) && answers.contains(optionDTO.getValue())) { |
|
|
|
currentCount += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
//单选
|
|
|
|
if(originalData.containsKey(key)){ |
|
|
|
Integer answer = (Integer) originalData.get(key); |
|
|
|
if (null != answer && optionDTO.getValue() == answer) { |
|
|
|
currentCount += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
optionDTO.setCurrentCount(currentCount); |
|
|
|
totalCount += currentCount; |
|
|
|
} |
|
|
|
detail.put("totalCount", totalCount); |
|
|
|
detail.put("options", options); |
|
|
|
item.setDetail(detail); |
|
|
|
continue; |
|
|
|
} |
|
|
|
// 3.2 单选
|
|
|
|
if (ProjectItemTypeEnum.RADIO.getValue().equals(currentType)) { |
|
|
|
RadioExpandStruct radioExpandStruct = JSON.parseObject(item.getExpand(), RadioExpandStruct.class); |
|
|
|
List<OptionDTO> options = new ArrayList<>(); |
|
|
|
if (null != radioExpandStruct) { |
|
|
|
options = ConvertUtils.sourceToTarget(radioExpandStruct.getOptions(), OptionDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
//共选择了多少次,每道题相加
|
|
|
|
int totalCount = 0; |
|
|
|
for (OptionDTO optionDTO : options) { |
|
|
|
//currentCount:每道题,被选了多少次?
|
|
|
|
int currentCount = 0; |
|
|
|
for (PrUserProjectResultEntity res : resultList) { |
|
|
|
JSONObject originalData = JSON.parseObject(res.getOriginalData()); |
|
|
|
//单选
|
|
|
|
if(originalData.containsKey(key)){ |
|
|
|
Integer answer = (Integer) originalData.get(key); |
|
|
|
if (null != answer && optionDTO.getValue() == answer) { |
|
|
|
currentCount += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
optionDTO.setCurrentCount(currentCount); |
|
|
|
totalCount += currentCount; |
|
|
|
} |
|
|
|
detail.put("totalCount", totalCount); |
|
|
|
detail.put("options", options); |
|
|
|
item.setDetail(detail); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
// 3.3多选
|
|
|
|
if (ProjectItemTypeEnum.CHECKBOX.getValue().equals(currentType)) { |
|
|
|
CheckboxExpandStruct checkboxExpandStruct = JSON.parseObject(item.getExpand(), CheckboxExpandStruct.class); |
|
|
|
List<OptionDTO> options = new ArrayList<>(); |
|
|
|
if (null != checkboxExpandStruct) { |
|
|
|
options = ConvertUtils.sourceToTarget(checkboxExpandStruct.getOptions(), OptionDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
//共选择了多少次,每道题相加
|
|
|
|
int totalCount = 0; |
|
|
|
for (OptionDTO optionDTO : options) { |
|
|
|
//currentCount:每道题,被选了多少次?
|
|
|
|
int currentCount = 0; |
|
|
|
for (PrUserProjectResultEntity res : resultList) { |
|
|
|
JSONObject originalData = JSON.parseObject(res.getOriginalData()); |
|
|
|
//多选
|
|
|
|
if(originalData.containsKey(key)){ |
|
|
|
List<Integer> answers = (List<Integer>) originalData.get(key); |
|
|
|
if (!CollectionUtils.isEmpty(answers) && answers.contains(optionDTO.getValue())) { |
|
|
|
currentCount += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
optionDTO.setCurrentCount(currentCount); |
|
|
|
totalCount += currentCount; |
|
|
|
} |
|
|
|
detail.put("totalCount", totalCount); |
|
|
|
detail.put("options", options); |
|
|
|
item.setDetail(detail); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(ProjectItemTypeEnum.CASCADER.getValue().equals(currentType)){ |
|
|
|
|
|
|
|
continue; |
|
|
|