|
|
@@ -490,8 +490,38 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
// .sorted(Comparator.comparing(AnswerVO::getValue, Comparator.nullsFirst(List::indexOf)).reversed()).collect(Collectors.toList())
|
|
|
// .stream()
|
|
|
// .sorted((a,b)-> Boolean.compare(b.getFlag(),a.getFlag())).collect(Collectors.toList());
|
|
|
- List<AnswerVO> collect = vo.getAnswers().stream()
|
|
|
- .sorted(Comparator.comparing(AnswerVO::getSort)).collect(Collectors.toList());
|
|
|
+
|
|
|
+// List<AnswerVO> collect = vo.getAnswers().stream()
|
|
|
+// .sorted(Comparator.comparing(AnswerVO::getSort)).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// vo.setAnswers(collect);
|
|
|
+
|
|
|
+ List<AnswerVO> answerList = vo.getAnswers();
|
|
|
+
|
|
|
+ // 1. 收集已有的非空 sort 值
|
|
|
+ Set<Integer> usedSorts = answerList.stream()
|
|
|
+ .map(AnswerVO::getSort)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ // 2. 为 null 的元素分配不冲突的默认值(从1开始递增)
|
|
|
+ int nextDefault = 1;
|
|
|
+ for (AnswerVO answer : answerList) {
|
|
|
+ if (answer.getSort() == null) {
|
|
|
+ // 找到下一个未使用的最小整数
|
|
|
+ while (usedSorts.contains(nextDefault)) {
|
|
|
+ nextDefault++;
|
|
|
+ }
|
|
|
+ answer.setSort(nextDefault);
|
|
|
+ usedSorts.add(nextDefault); // 标记为已使用
|
|
|
+ nextDefault++; // 继续下一个起始值(可选,也可以不加,但为了效率建议加)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3. 按 sort 升序排序
|
|
|
+ List<AnswerVO> collect = answerList.stream()
|
|
|
+ .sorted(Comparator.comparing(AnswerVO::getSort))
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
vo.setAnswers(collect);
|
|
|
}
|
|
|
@@ -1322,9 +1352,10 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
@Override
|
|
|
public R bindUser(CollectionBindUserParam param) {
|
|
|
//TODO 是否判断销售后续再做
|
|
|
- if (param.getCompanyUserId() != null) {
|
|
|
- return R.error("销售人员无法绑定");
|
|
|
- }
|
|
|
+ log.error("-----------------销售id:{}",param.getCompanyUserId());
|
|
|
+// if (param.getCompanyUserId() != null) {
|
|
|
+// return R.error("销售人员无法绑定");
|
|
|
+// }
|
|
|
if (param.getUserId() == null) {
|
|
|
return R.error("用户参数错误");
|
|
|
}
|
|
|
@@ -1475,6 +1506,17 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
fsUserInformationCollectionMapper.updateFsUserInformationCollection(sourceInfo);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<FsUserInformationCollectionOverviewVo> fullyCollectionInfoList(FsUserInformationCollectionOverviewDTO queryDto) {
|
|
|
+ queryDto.setCompleteStatus(1);//已完善信息标识
|
|
|
+ PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize());
|
|
|
+ List<FsUserInformationCollectionOverviewVo> resultList=fsUserInformationCollectionMapper.selectUserInformationCollectionOverviewByPage(queryDto);
|
|
|
+ if (CollectionUtils.isEmpty(resultList)){
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 校验必填备注:对于 open=true 且被勾选的选项,必须填写备注文本
|
|
|
*
|
|
|
@@ -1511,13 +1553,11 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
|
|
|
Map<Integer, Boolean> optionOpenMap = openConfigMap.get(title);
|
|
|
if (optionOpenMap == null) {
|
|
|
- log.error("模板中未找到该问题:{}", title);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
List<Integer> selectedValues = answer.getValue();
|
|
|
if (CollectionUtils.isEmpty(selectedValues)) {
|
|
|
- log.error("该问题未选择任何选项:{}", title);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
@@ -1527,9 +1567,6 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
for (AnswerVO.Remarks remark : answer.getRemarksList()) {
|
|
|
if (StringUtils.isNotBlank(remark.getText())) {
|
|
|
remarkMap.put(remark.getValue(), remark.getText().trim());
|
|
|
- log.error("添加备注映射:{} -> {}", remark.getValue(), remark.getText());
|
|
|
- } else {
|
|
|
- log.error("备注文本为空白,跳过添加:{} -> '{}'", remark.getValue(), remark.getText());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1538,10 +1575,8 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
for (Integer val : selectedValues) {
|
|
|
if (Boolean.TRUE.equals(optionOpenMap.get(val))) {
|
|
|
String text = remarkMap.get(val);
|
|
|
- log.error("检查选项 {} (open=true),备注文本:'{}'", val, text);
|
|
|
|
|
|
if (StringUtils.isBlank(text)) {
|
|
|
- log.warn("必填备注缺失:title={}, optionValue={}", title, val);
|
|
|
return false;
|
|
|
}
|
|
|
}
|