代码规范

(1) 如果提交的话,加上commons 别不加

 

(1)如果有try catch finally;

 

如果有返回值的话,不要放在finally中;

private boolean checkDriverCanDel(Long driverId) {
        boolean canDel = true;
        try {
            List<TransportPowerDTO> transportPowerDTOS = transportPowerClient.getAvailableTransportPowerByDriverId(driverId);
            if (!CollectionUtils.isEmpty(transportPowerDTOS)) {
                for (TransportPowerDTO e : transportPowerDTOS) {
                    if (TransportPowerStatusEnum.ENABLE.equals(e.getStatus())) {
                        log.info("checkDriverCanDel driverId={} 找到有效运力 ", driverId);
                        canDel = false;
                        break;
                    }
                }
            }
        } catch (BusinessException e) {
            log.error("checkDriverCanDel={} ", e.getShowMessage(), e);

        } catch (TException e) {
            log.error("checkDriverCanDel error ", e);
        }
        log.info("checkDriverCanDel={}", canDel);
        return canDel;


    }

 

posted @ 2019-11-07 15:30  aspirant  阅读(241)  评论(0编辑  收藏  举报