|
@@ -1310,6 +1310,41 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
return R.error("绑定失败");
|
|
return R.error("绑定失败");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public int modifyUserCollectedQuestions(FsUserInformationCollectionParam param) {
|
|
|
|
|
+ FsUserInformationCollection informationCollection = fsUserInformationCollectionMapper.selectFsUserInformationCollectionById(param.getId());
|
|
|
|
|
+ if (informationCollection== null){
|
|
|
|
|
+ throw new CustomException("用户采集信息不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ int result=0;
|
|
|
|
|
+ //根据前端传递的填写结果判断是否更新标识符
|
|
|
|
|
+ if (informationCollection.getFillFlag()==0 &&!CollectionUtils.isEmpty(param.getAnswers())) {
|
|
|
|
|
+ param.getAnswers().forEach(answer -> {
|
|
|
|
|
+ if (answer.getFlag() == null) {
|
|
|
|
|
+ answer.setFlag(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ // 只要有一个 answer 的 value 有值,就设置为已填
|
|
|
|
|
+ boolean hasValue = param.getAnswers().stream()
|
|
|
|
|
+ .anyMatch(answer -> !CollectionUtils.isEmpty(answer.getValue()));
|
|
|
|
|
+ if (hasValue) {
|
|
|
|
|
+ informationCollection.setJsonInfo(JSON.toJSONString(param.getAnswers()));
|
|
|
|
|
+ //设置填写标识
|
|
|
|
|
+ informationCollection.setFillFlag(1);
|
|
|
|
|
+ fsUserInformationCollectionMapper.updateFsUserInformationCollection(informationCollection);
|
|
|
|
|
+
|
|
|
|
|
+ FsUserInformationCollectionSchedule schedule = scheduleMapper.selectCollectionScheduleRunningByCollectionId(informationCollection.getId());
|
|
|
|
|
+ //设置填写时间
|
|
|
|
|
+ schedule.setFillTime(DateUtils.getNowDate());
|
|
|
|
|
+ result=scheduleMapper.updateFsUserInformationCollectionSchedule(schedule);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ throw new CustomException("请提交采集信息后再操作");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private List<AnswerVO> getAnswerVOs(List<AnswerVO> target,List<AnswerVO> source) {
|
|
private List<AnswerVO> getAnswerVOs(List<AnswerVO> target,List<AnswerVO> source) {
|
|
|
target.addAll(source);
|
|
target.addAll(source);
|
|
|
return target.stream()
|
|
return target.stream()
|