我有一个包含以下数据的csv文件:
Id,Name,Type,date
1,name1,employee,25/04/2017
2,name2,contrator,26/04/2017
3,name3,employee,25/04/2017
4,name4,contrator,26/04/2017
5,name5,employee,24/04/2017
6,name6,employee,27/04/2017
7,name7,employee,25/04/2017
8,name8,contrator,24/04/2017
9,name9,employee,24/04/2017
10,name10,contrator,26/04/2017
11,name11,employee,27/04/2017
12,name12,contrator,27/04/2017
如果它有两行具有相同的Id号。应通过检查最新日期删除其中一行。应删除具有较早日期的行。 例如,上面的输入有两行ID为6的数据。应该删除日期为24/04/2017的行。输出应该是这样的
@RequestMapping(value = "/registration", method = RequestMethod.POST)
public ModelAndView createNewUser(@Valid User user, BindingResult bindingResult) {
ModelAndView modelAndView = new ModelAndView();
try{
userService.saveUser(user);
modelAndView.addObject("successMessage", "User has been registered successfully");
modelAndView.addObject("user", user);
modelAndView.setViewName("registration");
}catch(DataIntegrityViolationException e){
bindingResult
.rejectValue("email", "error.user",
"There is already a user registered with the email provided");
}
return modelAndView;
}
我需要使用Dataweave实现这一目标。请给我一个解决方案或建议