| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.sql.SQLOutput; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e.toString()); |
| | | sysError.setError(e.toString()+Arrays.toString(e.getStackTrace())); |
| | | sysError.setFunc("saveOrder"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | //判断传入id参数是否为空,未传入id为空插入订单表,传入更新表 |
| | | try{ |
| | | Log log = new Log(); |
| | | log.setOperator(order.getCreator()); |
| | | log.setOperatorId(order.getCreatorId()); |
| | | log.setContent(orderMap.toString()); |
| | | log.setFunction("saveOrderTitle保存表头:"+order.getOrderId()); |
| | | |
| | | LambdaUpdateWrapper<Order> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Order::getOrderId, order.getOrderId()); |
| | | order.setCreateTime(null); |
| | | orderMapper.update(order,updateWrapper); |
| | | //修改订单主表面积与周长以及重量 |
| | | orderMapper.updateOrderParameter(order.getOrderId()); |
| | | logService.saveLog(log); |
| | | |
| | | }catch (Exception e){ |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | |
| | | |
| | | Map<String,Object> otherColumns = JSON.parseObject(OrderDetails.get(i).getOtherColumns(), new TypeReference<Map<String, Object>>(){}); |
| | | int finalI = i; |
| | | |
| | | if(otherColumns!=null){ |
| | | otherColumns.values().removeIf(value -> value == null || value.equals("")); |
| | | OrderDetails.get(i).setOtherColumns(JSON.toJSONString(otherColumns)); |
| | | |
| | | otherColumns.forEach((key, value) ->{ |
| | | if(value!=null && key.contains("M")) { |
| | | |
| | | if(value!=null && !value.equals("") && key.contains("M")) { |
| | | orderOtherMoneyList.forEach(orderOtherMoney -> { |
| | | if (orderOtherMoney.getColumn().equals(key)) { |
| | | orderOtherMoney.setQuantity(orderOtherMoney.getQuantity()+(Double.parseDouble((String) value) * OrderDetails.get(finalI).getQuantity())); |
| | | orderOtherMoney.setQuantity( |
| | | orderOtherMoney.getQuantity()+(Double.parseDouble((String) value) * OrderDetails.get(finalI).getQuantity())); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | }else if(OrderDetails.get(i).getOtherColumns()==null){ |
| | | }else{ |
| | | OrderDetails.get(i).setOtherColumns("{}"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | BigDecimal getGrossAmount= BigDecimal.valueOf(orderDetail.getGrossAmount()); |
| | | money+=getGrossAmount.doubleValue(); |
| | | } |
| | | 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){ |
| | |
| | | order.setOtherMoney(orderOtherMoneyMapper.selectGrossAmount(order.getOrderId())); |
| | | orderMapper.updateMoney(order); |
| | | orderDetailMapper.updateOrderMoney(OrderDetails); |
| | | logService.saveLog(log); |
| | | return false; |
| | | } |
| | | |