日期:2014-05-19  浏览次数:20633 次

spring嵌套无效,大家帮忙看看
总业务方法(saveOrderUtil),直接被controller调用,saveOrderUtil在调用第一个业务(interceptororder)对订单状态进行修改,在第二个业务方法中(orerpoint)中写了一个错误的sql(select from orders where)异常后没有回滚
Java code

@Override
    @Transactional(rollbackFor=Exception.class,propagation=Propagation.REQUIRED)
    public void saveOrderUtil(Orders orders, Member member,boolean ismembermoney, double membermoney,boolean type) throws Exception {
        if(IConstants.IsNotEmpty(orders) && IConstants.IsNotEmpty(member)){
            //拦截订单
            interceptorOrder(orders, member);
            //送积分
            orderPoint(orders.getOrders_code(),member);
            //送优惠券
            orderEtick(String.valueOf(orders.getOrders_ticketid()), member);
            if(ismembermoney){
                //余额支付
                memberBuy(member, membermoney);
            }
            if(type){
                //非货到付款修改订单状支付态为已付款
                dao.updateBySql("update orders set orders_statustype=1 where orders_code='"+orders.getOrders_code()+"'");
            }
            //订单解锁
            dao.updateBySql("update orders set lock_status=0 where orders_code='"+orders.getOrders_code()+"'");
        }
        
    }

/* (non-Javadoc)
     * @see com.cfuture.ysj.web.service.ICommonService#orderPoint(java.lang.String, com.cfuture.ysj.web.vo.users.Member)
     */
    @Override
    @Transactional(rollbackFor=Exception.class,propagation=Propagation.REQUIRED)
    public void orderPoint(String orders_code, Member member) throws Exception {
        ArrayList<String> kunCunSqls = new ArrayList<String>();
        //是否购物送积分
        int point=orderService.getpointratiopoint(member);
        if(point>0){
            //订单信息
            Orders orders=dao.queryBySql(Orders.class,"select  from orders where orders_code='"+orders_code+"'",null);
            point+=orders.getOrders_point();
            if(orders.getOrders_point()>0){
                //修改用户积分
                dao.updateBySql("update member set member_consumepoint="+point+" where member_id="+member.getMember_id()+"");
                String res=WebServicesCall.initServices("addpoint",new Object[]{"ecmemberid","point","note"},new Object[]{member.getMember_id(),point,"订单商品积分"});
                if(null==res||(null!=res&&"-1".equals(res.split(IConstants.REMOTE_SPLIT)[0]))){
                    throw new Exception("订单积分异常");
                }
                // 记录积分流水
                saveMemberLevelGride(member,res.split(IConstants.REMOTE_SPLIT)[1],point,IConstants.sdf.format(new Date()),"购物积分");
            }
        }
        //修改商品程控信息
        kunCunSqls.add("update merchandiseprog set createordercount=createordercount+1 where merchandise_code in (select  ordermerchandise_merchandisecode from ordermerchandise where orders_code='"+orders_code+"')");
        //修改库存
        List<OrderMerchandise> orderMerchandises=dao.queryListByCond(OrderMerchandise.class,"select * from ordermerchandise where orders_code='"+orders_code+"'");
        for (OrderMerchandise om : orderMerchandises) {
            kunCunSqls.add("update storestock set stock=stock-"+om.getOrdermerchandise_count()+" where dcNo='"+om.getMer_store()+"' and concat(mer_code,'_',mer_spec1,'_',mer_spec2)='"+om.getOrdermerchandise_sku()+"'");
        }
        dao.patchUpdateOrDelete(kunCunSqls.toArray(new String[]{}));
        
    }

@Override
    @Transactional(rollbackFor=Exception.class,propagation=Propagation.REQUIRED)
    public void orderEtick(String etick_id, Member member) throws Exception {
        //是否开启购物送券
         GlobalProperty gvo=dao.queryBySql(Glo