发表于: 2017-08-17 22:54:30

2 1031


今天完成的事情:

1.师姐帮我找了前端,用我复盘的接口,今天调了一天的接口,长时间没动,发现里面还有一些小bug,修改了一下。

2.由于前端的对公司进行删除,要先进行判断,判断是否有上线的职位,以及产品,有的话要先下架,在进行删除操作。这也要看前端的方案是如何设计,要和前端沟通。

@RequestMapping(value = "/a/u/company/{id}", method = RequestMethod.DELETE)
public String deleteCompanyJson(HttpServletRequest requestHttpServletResponse response,
                                Model model@PathVariable Long idthrows Exception {

    log.info("delete company : id= " id);
    //通过公司cid删除公司产品,最后删公司
    //params获取produceids
    List<Longproduceids null;
    try {
        Map<String,Objectparams new HashMap<>();
        params.put("@query","id");
        params.put("c_id",id);
        params.put("@table","produce");
        produceids produceService.getIdsByDynamicCondition(Produce.classparams0,Integer.MAX_VALUE);
        log.info("===========>produceids"+produceids);
    }catch (Throwable t) {
        t.printStackTrace();
        log.error(t.getMessage());
        log.error("get produceids error ");
        model.addAttribute("code", -6002);
        model.addAttribute("massage""error");
    }
    //删除produceids
    produceService.deleteList(Produce.class,produceids);


    //删除公司在招职位
    List<Longpositionids null;
    try {
        Map<String,Objectparams new HashMap<>();
        params.put("@query","id");
        params.put("c_id",id);
        params.put("@table","position");
        positionids positionService.getIdsByDynamicCondition(Position.classparams0Integer.MAX_VALUE);
        log.info("=========>positionids"+positionids);
    }catch (Throwable t) {
        t.printStackTrace();
        log.error(t.getMessage());
        log.error("get positionids error ");
        model.addAttribute("code", -6002);
        model.addAttribute("massage""error");
    }
    //删除公司所有在招职位
    positionService.deleteList(Position.classpositionids);


    //删除公司对应标签
    List<Longlabelids null;
    try {
        Map<String,Objectparams new HashMap<>();
        params.put("@query","id");
        params.put("c_id",id);
        params.put("@table","label");
        labelids labelService.getIdsByDynamicCondition(Label.classparams0Integer.MAX_VALUE);
        log.info("===============>labelids="+labelids);
    }catch (Throwable t) {
        t.printStackTrace();
        log.error(t.getMessage());
        log.error("get labelids error ");
        model.addAttribute("code", -6002);
        model.addAttribute("message""error");
    }
    //删除公司对应的标签
    labelService.deleteList(Label.class,labelids);

    //删除公司信息
    try {
        companyService.delete(id);
        log.info("=====>delete company success");
    } catch (Throwable t) {
        t.printStackTrace();
        log.error(t.getMessage());
        log.error("delete company error by id "+id);
        model.addAttribute("code", -6002);
        model.addAttribute("message""error");
    }

    model.addAttribute("code"0);
    model.addAttribute("massage""success");

    return "/data/json/code";
}
明天完成的事情:
将后台的接口测试,调完,更新一波接口文档。
遇到的问题:
长时间没有看自己写的代码,发现自己的代码都陌生了。
总结:
今天差不多都在调试接口。状态也不是很好,没有做什么实质性的东西。




返回列表 返回列表
评论

    分享到