发表于: 2018-01-27 23:03:09

2 539


今天完成的事情:

对之前没有跑通的合作机构 与 热门推荐进行测试修改.  代码不够健壮

    @RequestMapping(value = "/a/u/admin/company", method = RequestMethod.PUT)
  public String updateCompanyJson(HttpServletRequest request,
        HttpServletResponse response, ModelMap model,@RequestBody Company company) throws Exception {
     
     log.info("update company : company= " + company.toString());

     String userId = "66666";

                 /* 入参校验*/
     if (null == company.getName()){
        model.addAttribute("code", -1000);
        return "common/fail";
     }

//          /* 入参校验*/
     if (null == company.getLogo()){
        model.addAttribute("code", -1000);
        return "common/fail";
     }

     try {

        Company company1 = companyService.getObjectById(company.getId());
        if (IsNullUtil.isNullOrEmpty(company1)){
           model.addAttribute("code",-3003);
        }

        company1.setName(company.getName());
        company1.setLogo(company.getLogo());
        company1.setStatus(0);
        company1.setUpdateBy(Long.parseLong(userId));
        companyService.update(company1);
        model.addAttribute("code", 0);
        model.addAttribute("company", company);
     } catch (Throwable t) {
         t.printStackTrace();
        log.error(t.getMessage());
        log.error("update company error,id is  " + company.getId());
        model.addAttribute("code", -6003);

     }

     return "common/success";
  }

对排行榜sql语句进行编写

public List<Long> getUserLessiodPeriodRank()throws ServiceException, ServiceDaoException{
String sql = "select user.id FROM user_lesson_period,user WHERE user_lesson_period.user_id = user.id GROUP BY user_lesson_period.user_id order by count(user_lesson_period.user_id) DESC,user.study_day  DESC,user.create_at DESC LIMIT 0,5 ";

log.info("  getUserLessiodPeriodRank sql " +  sql);
  List<Long> idList=new ArrayList<>();
  try {
     Object o = dao.excuteSimpleSql(sql,UserLessonPeriod.class);
     idList = BigIntgerToLong.bigIntgerToLong(o);
  log.info(o);
  }catch (DaoException e) {
     log.error(" getUserId top 5  fail " );
     log.error(e);
     e.printStackTrace();
     throw new ServiceDaoException(e);
  }return  idList;
}


明天计划的事情:

 完成排行榜接口

对代码进行完善


遇到的困难:

400  原因 传入的参数和model接受的不一样  大小写也无法识别.

另外一个问题 不支持put请求,,重启jetty后解决,


任务进度:接口编写

任务开始时间:2017-12-12

预计demo时间:2017-02-09

是否有延期风险:暂无

禅道地址:http://task.ptteng.com/zentao/task-view-17095.html



返回列表 返回列表
评论

    分享到