| | |
| | | log.setContent(orderMap.toString()); |
| | | log.setFunction("saveOrderTitle保存表头:"+order.getOrderId()); |
| | | |
| | | Order order1 = orderMapper.selectOrderId(order.getOrderId()); |
| | | order.setCalculateType(order1.getCalculateType()); |
| | | |
| | | LambdaUpdateWrapper<Order> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Order::getOrderId, order.getOrderId()); |
| | | order.setCreateTime(null); |
| | |
| | | OrderDetails.get(i).setOrderNumber(i+1); |
| | | OrderDetails.get(i).setOrderId(orderId); |
| | | OrderDetails.get(i).setPerimeter(Double.valueOf(String.format("%.3f",(OrderDetails.get(i).getWidth()+OrderDetails.get(i).getHeight())*2/1000*OrderDetails.get(i).getQuantity()))); |
| | | OrderDetails.get(i).setMonolithicPerimeter(Double.valueOf(String.format("%.3f",(OrderDetails.get(i).getWidth()+OrderDetails.get(i).getHeight())*2/1000))); |
| | | Product product = productMapper.selectById(OrderDetails.get(i).getProductId()); |
| | | |
| | | OrderDetails.get(i).setWeight(Double.valueOf(String.format("%.2f",product.getThickness()*OrderDetails.get(i).getWidth()*OrderDetails.get(i).getHeight()/1000000*2.5))); |
| | |
| | | Order order = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("order")), Order.class); |
| | | List<OrderDetail> OrderDetails = JSONArray.parseArray(JSONObject.toJSONString(jsonObject.get("detail")), OrderDetail.class); |
| | | List<OrderOtherMoney> orderOtherMoneyList = JSONArray.parseArray(JSONObject.toJSONString(jsonObject.get("otherMoney")), OrderOtherMoney.class); |
| | | double money = 0; |
| | | for (OrderDetail orderDetail : OrderDetails) { |
| | | orderDetail = updateOrderMoneyComputed(orderDetail,order.getCalculateType()); |
| | | BigDecimal getGrossAmount= BigDecimal.valueOf(orderDetail.getGrossAmount()); |
| | | money+=getGrossAmount.doubleValue(); |
| | | |
| | | if(orderOtherMoneyList != null ){ |
| | | orderOtherMoneyList = orderOtherMoneyList.stream().filter(o -> o.getColumn().indexOf("M")==0).collect(Collectors.toList()); |
| | | } |
| | | if(orderOtherMoneyList!=null){ |
| | | orderOtherMoneyList.forEach(orderOtherMoney -> { |
| | | orderOtherMoney.setQuantity(0.0); |
| | | }); |
| | | } |
| | | |
| | | Log log = new Log(); |
| | | log.setOperator(order.getCreator()); |
| | | log.setOperatorId(order.getCreatorId()); |
| | | log.setContent(jsonObject.toString()); |
| | | log.setFunction("updateOrderMoney金额重置:"+order.getOrderId()); |
| | | |
| | | orderOtherMoneyList.forEach(orderOtherMoney -> { |
| | | if(orderOtherMoney.getQuantity()!=null && orderOtherMoney.getPrice()!=null){ |
| | | orderOtherMoney.setMoney((orderOtherMoney.getQuantity()*orderOtherMoney.getPrice())); |
| | | //删除其他金额明细表 |
| | | orderOtherMoneyMapper.delete(new LambdaQueryWrapper<OrderOtherMoney>().eq(OrderOtherMoney::getOrderId, order.getOrderId())); |
| | | List<OrderOtherMoney> orderOtherMoneyLists=orderOtherMoneyList; |
| | | |
| | | double money = 0; |
| | | for (OrderDetail orderDetail : OrderDetails) { |
| | | orderDetail = updateOrderMoneyComputed(orderDetail,order.getCalculateType()); |
| | | BigDecimal getGrossAmount= BigDecimal.valueOf(orderDetail.getGrossAmount()); |
| | | money+=getGrossAmount.doubleValue(); |
| | | |
| | | Map<String,Object> otherColumns = JSON.parseObject(orderDetail.getOtherColumns(), new TypeReference<Map<String, Object>>(){}); |
| | | if(otherColumns!=null){ |
| | | otherColumns.values().removeIf(value -> value == null || value.equals("")); |
| | | orderDetail.setOtherColumns(JSON.toJSONString(otherColumns)); |
| | | |
| | | OrderDetail finalOrderDetail = orderDetail; |
| | | otherColumns.forEach((key, value) ->{ |
| | | |
| | | if(value!=null && !value.equals("") && key.contains("M")) { |
| | | orderOtherMoneyLists.forEach(orderOtherMoney -> { |
| | | if (orderOtherMoney.getColumn().equals(key)) { |
| | | orderOtherMoney.setQuantity( |
| | | orderOtherMoney.getQuantity()+(Double.parseDouble((String) value) * finalOrderDetail.getQuantity())); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | }else{ |
| | | orderDetail.setOtherColumns("{}"); |
| | | } |
| | | orderOtherMoneyMapper.update(orderOtherMoney,new QueryWrapper<OrderOtherMoney>() |
| | | .eq("order_id",orderOtherMoney.getOrderId()) |
| | | .eq("`column`",orderOtherMoney.getColumn())); |
| | | }); |
| | | |
| | | } |
| | | |
| | | if(orderOtherMoneyLists!=null){ |
| | | orderOtherMoneyLists.forEach(orderOtherMoney ->{ |
| | | orderOtherMoney.setId(null); |
| | | orderOtherMoney.setOrderId(order.getOrderId()); |
| | | if(orderOtherMoney.getQuantity()!=null && orderOtherMoney.getPrice()!=null){ |
| | | orderOtherMoney.setMoney((orderOtherMoney.getQuantity()*orderOtherMoney.getPrice())); |
| | | }else { |
| | | orderOtherMoney.setMoney(0.0); |
| | | } |
| | | orderOtherMoneyMapper.insert(orderOtherMoney); |
| | | }); |
| | | } |
| | | |
| | | order.setMoney(money+orderOtherMoneyMapper.selectGrossAmount(order.getOrderId())); |
| | | order.setOtherMoney(orderOtherMoneyMapper.selectGrossAmount(order.getOrderId())); |
| | | orderMapper.updateMoney(order); |