发表于: 2017-09-12 22:14:13
2 1035
今天做的事:
今天把之前说的逻辑整合到任务代码中了
public interface StudentService {
public List<Student> getExcellent();
public int getStudying();
public int getWorking();
public int insert(Student student);
public boolean sendEmail(String email);
public boolean putPicture(String picture);
public boolean sendMessage(Integer tel,Integer verify);
}
实现类就不贴了,就是之前的demo代码,然后做了些改动,将某些地方变为变量
@RequestMapping(value = "/a/success",method = RequestMethod.GET)
public String getSuccess(){
return "success";
}
@RequestMapping(value = "/a/Stu",method = RequestMethod.GET)
public String addStu(Map<String,Object> map){
map.put("student",new Student());
return "insertStu";
}
@RequestMapping(value = "/a/Stu",method = RequestMethod.POST)
public String insertStu(Student student,Integer checking){
int verify = (int)(Math.random()*1000);
try {
boolean flag1 = sS.sendMessage(student.getTel(), verify);
boolean flag2 = (checking == verify) ? true : false;
boolean flag3 = sS.sendEmail(student.getEmail());
boolean flag4 = sS.putPicture(student.getImage());
if (flag1 == true && flag2 == true && flag3 == true && flag4 == true) {
int i =sS.insert(student);
if(i > 0) {
return "redirect:/a/success";
}
}
}catch (Exception e){
e.printStackTrace();
}
return "redirect:/a/error";
}
还没测试逻辑是否有问题,页面如何写也在考虑,因为涉及一个短信验证的问题,明天测试一下能否成功。
还有上传图片这个也有一定问题,因为上传到的是七牛云的对象存储中,那我如何从中取出,并通过我的数据库中的字段调用是个问题,还有上传文件的选择,应该以什么模式,我们常用的选择图片会弹出一个窗口,然后选择图片,不知道这个是怎么实现的,会不会比较难实现,明天也需要看一下。
然后Controller也写好了,正打算写页面,突然噩耗传来。。。
然后我就交了工单,开始处理服务器的问题,最后发现里面的一些文件被删了,还有比特币勒索,真的就搞笑了

评论