| | |
| | | package com.example.erp.service.sd; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | OrderDetails.get(i).setOrderId(orderId); |
| | | OrderDetails.get(i).setPerimeter(OrderDetails.get(i).getWidth()*OrderDetails.get(i).getHeight()*2/1000); |
| | | OrderDetails.get(i).setWeight(1.0); |
| | | Map<String,Double> otherColumns = JSON.parseObject(OrderDetails.get(i).getOtherColumns(), new TypeReference<Map<String, Double>>(){}); |
| | | int finalI = i; |
| | | if(otherColumns!=null){ |
| | | otherColumns.forEach((key, value) ->{ |
| | | orderOtherMoneyList.forEach(orderOtherMoney ->{ |
| | | if(orderOtherMoney.getColumn().equals(key)){ |
| | | orderOtherMoney.setQuantity (orderOtherMoney.getQuantity()==null?0:orderOtherMoney.getQuantity()); |
| | | orderOtherMoney.setQuantity(((value==null?0:value)*OrderDetails.get(finalI).getQuantity())); |
| | | } |
| | | }); |
| | | |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //往明细表插数据 |
| | | orderDetailMapper.insertBatch(OrderDetails); |
| | | //修改订单主表面积与周长以及重量 |
| | | orderMapper.updateOrderParameter(orderId); |
| | | //往小片表传入产品数据 |
| | | orderGlassDetailMapper.insertOrderGlassDetail(orderId); |
| | | //往订单其他金额副表传入数据 |
| | |
| | | } |
| | | orderOtherMoneyMapper.insert(orderOtherMoney); |
| | | }); |
| | | //修改订单主表面积与周长以及重量 |
| | | orderMapper.updateOrderParameter(orderId); |
| | | |
| | | //查询订单小片表获取工艺传入小片工艺表 |
| | | //List<OrderGlassDetail> orderGlassDetails = orderGlassDetailMapper.selectOrderGlassDetail(orderId); |
| | |
| | | public Map<String,Object> getOrderById(String id) { |
| | | Order order = orderMapper.selectOne(new QueryWrapper<Order>().eq("order_id",id)); |
| | | List<OrderDetail> orderDetails = orderDetailMapper.selectList(new QueryWrapper<OrderDetail>().eq("order_id",id)); |
| | | List<OrderOtherMoney> orderOtherMoneyList = orderOtherMoneyMapper.findById(id); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("order",order); |
| | | map.put("orderDetails",orderDetails); |
| | | map.put("orderOtherMoneyList",orderOtherMoneyList); |
| | | return map; |
| | | } |
| | | //订单审核 |