| | |
| | | import com.example.erp.exception.ServiceException; |
| | | import com.example.erp.mapper.sd.*; |
| | | import com.example.erp.service.userInfo.SysErrorService; |
| | | import com.sun.org.apache.regexp.internal.RE; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | |
| | | Order order = JSONObject.parseObject(JSONObject.toJSONString(orderJson.get("title")), Order.class); |
| | | List<OrderDetail> OrderDetails = JSONArray.parseArray(JSONObject.toJSONString(orderJson.get("detail")), OrderDetail.class); |
| | | List<OrderOtherMoney> orderOtherMoneyList = JSONArray.parseArray(JSONObject.toJSONString(orderJson.get("otherMoney")), OrderOtherMoney.class); |
| | | |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | |
| | | //删除其他金额明细表 |
| | | orderOtherMoneyMapper.delete(new LambdaQueryWrapper<OrderOtherMoney>().eq(OrderOtherMoney::getOrderId, order.getOrderId())); |
| | | |
| | | |
| | | //删除订单工艺表 |
| | | // orderProcessDetailMapper.delete(new LambdaQueryWrapper<OrderProcessDetail>().eq(OrderProcessDetail::getOrderId, order.getOrderId())); |
| | | insertOtherDetail(order.getOrderId(),OrderDetails,orderOtherMoneyList); |
| | |
| | | |
| | | //插入其他副表数据,被其他方法引用 |
| | | public void insertOtherDetail(String orderId,List<OrderDetail> OrderDetails,List<OrderOtherMoney> orderOtherMoneyList) { |
| | | |
| | | //先把其他金额副表的金额与数量置0 |
| | | orderOtherMoneyList.forEach(orderOtherMoney -> { |
| | | orderOtherMoney.setQuantity(0.0); |
| | |
| | | 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>>(){}); |
| | | Map<String,Object> otherColumns = JSON.parseObject(OrderDetails.get(i).getOtherColumns(), new TypeReference<Map<String, Object>>(){}); |
| | | int finalI = i; |
| | | |
| | | |
| | | if(otherColumns!=null){ |
| | | otherColumns.forEach((key, value) ->{ |
| | | if(value!=null) { |
| | | if(value!=null && key.contains("M")) { |
| | | orderOtherMoneyList.forEach(orderOtherMoney -> { |
| | | if (orderOtherMoney.getColumn().equals(key)) { |
| | | orderOtherMoney.setQuantity(orderOtherMoney.getQuantity()+(value * OrderDetails.get(finalI).getQuantity())); |
| | | orderOtherMoney.setQuantity(orderOtherMoney.getQuantity()+(Double.parseDouble((String) value) * OrderDetails.get(finalI).getQuantity())); |
| | | } |
| | | }); |
| | | } |
| | |
| | | public List<OrderDTO> exportOrderProductSummary(List<LocalDate> dates) { |
| | | return orderDetailMapper.exportOrderProductSummary(dates); |
| | | } |
| | | |
| | | public Map<String,String> getOrderProductDetailTag(String orderId) { |
| | | return orderDetailMapper.getOrderProductDetailTag(orderId); |
| | | } |
| | | |
| | | public List<OrderDetail> getOrderDetailById(String id) { |
| | | return orderDetailMapper.selectList(new QueryWrapper<OrderDetail>().eq("order_id",id)); |
| | | } |
| | | |
| | | public List<OrderGlassDetail> getOrderCraftDetailById(String id) { |
| | | return orderGlassDetailMapper.selectOrderGlassDetailByOrderId(id); |
| | | } |
| | | } |