尚品汇-订单接口实现(四十)

news2024/12/25 9:08:24

目录:

(1)搭建service-order-client模块

(2)微服务之间用户信息传递

(3)在web-all模块中添加接口

(4)下订单 

(1)搭建service-order-client模块

搭建过程同service-cart-client

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>com.atguigu.gmall</groupId>
      <artifactId>service-client</artifactId>
      <version>1.0</version>
   </parent>

   <version>1.0</version>
   <artifactId>service-order-client</artifactId>
   <packaging>jar</packaging>
   <name>service-order-client</name>
   <description>service-order-client</description>

</project>

在service-order-client暴露接口

package com.atguigu.gmall.order.client;


@FeignClient(value = "service-order", fallback = OrderDegradeFeignClient.class)
public interface OrderFeignClient {
    @GetMapping("/api/order/auth/trade")
    Result<Map<String, Object>> trade();
}
package com.atguigu.gmall.order.client.impl;


@Component
public class OrderDegradeFeignClient implements OrderFeignClient {

    @Override
    public Result<Map<String, Object>> trade() {
        return Result.fail();
    }
}

(2)微服务之间用户信息传递

如上图:因为微服务之间并没有传递头文件,所以我们可以定义一个拦截器,每次微服务调用之前都先检查下头文件,将请求的头文件中的用户信息再放入到header中,再调用其他微服务即可。
 

web-util中添加拦截器

package com.atguigu.gmall.common.interceptor;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

@Component
public class FeignInterceptor implements RequestInterceptor {

    public void apply(RequestTemplate requestTemplate){
            //  微服务远程调用使用feign ,feign 传递数据的时候,没有。
            ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
            HttpServletRequest request = attributes.getRequest();
            //  添加header 数据
            requestTemplate.header("userTempId", request.getHeader("userTempId"));
            requestTemplate.header("userId", request.getHeader("userId"));

    }

}

配置网关

- id: web-order
 
uri: lb://web-all
 
predicates:
  - Host=order.gmall.com

- id: service-order
 
uri: lb://service-order
 
predicates:
  - Path=/*/order/**

(3)在web-all模块中添加接口

<dependency>
         <groupId>com.atguigu.gmall</groupId>
         <artifactId>service-order-client</artifactId>
         <version>1.0</version>
      </dependency>

在web-all中添加控制器

package com.atguigu.gmall.all.controller;


@Controller
public class OrderController {

    @Autowired
    private OrderFeignClient orderFeignClient;

    /**
     * 确认订单
     * @param model
     * @return
     */
    @GetMapping("trade.html")
    public String trade(Model model) {
        Result<Map<String, Object>> result = orderFeignClient.trade();

        //addAllAttributes会把里面的map拆分成一个个键值对传过去
        model.addAllAttributes(result.getData());
        return "order/trade";
    }
}

跳转到结算页:

(4)下订单 

下单功能分析:

  1. 保存单据前要做记录:验库存,验价格
  2. 保存单据: orderInfo orderDetail。
  3. 保存以后把购物车中的商品删除。{演示不删!}
  4. 重定向到支付页面。

实体类:OrderInfo

package com.atguigu.gmall.model.order;

import com.atguigu.gmall.model.activity.ActivityRule;
import com.atguigu.gmall.model.activity.CouponInfo;
import com.atguigu.gmall.model.base.BaseEntity;
import com.atguigu.gmall.model.enums.ActivityType;
import com.atguigu.gmall.model.enums.CouponType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.CollectionUtils;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
@ApiModel(description = "订单信息")
@TableName("order_info")
public class OrderInfo extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "收货人")
    @TableField("consignee")
    private String consignee;

    @ApiModelProperty(value = "收件人电话")
    @TableField("consignee_tel")
    private String consigneeTel;

    @ApiModelProperty(value = "总金额")
    @TableField("total_amount")
    private BigDecimal totalAmount;

    @ApiModelProperty(value = "订单状态")
    @TableField("order_status")
    private String orderStatus;

    @ApiModelProperty(value = "用户id")
    @TableField("user_id")
    private Long userId;

    @ApiModelProperty(value = "付款方式")
    @TableField("payment_way")
    private String paymentWay;

    @ApiModelProperty(value = "送货地址")
    @TableField("delivery_address")
    private String deliveryAddress;

    @ApiModelProperty(value = "订单备注")
    @TableField("order_comment")
    private String orderComment;

    @ApiModelProperty(value = "订单交易编号(第三方支付用)")
    @TableField("out_trade_no")
    private String outTradeNo;

    @ApiModelProperty(value = "订单描述(第三方支付用)")
    @TableField("trade_body")
    private String tradeBody;

    @ApiModelProperty(value = "创建时间")
    @TableField("create_time")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @ApiModelProperty(value = "失效时间")
    @TableField("expire_time")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    private Date expireTime;

    @ApiModelProperty(value = "进度状态")
    @TableField("process_status")
    private String processStatus;

    @ApiModelProperty(value = "物流单编号")
    @TableField("tracking_no")
    private String trackingNo;

    @ApiModelProperty(value = "父订单编号")
    @TableField("parent_order_id")
    private Long parentOrderId;

    @ApiModelProperty(value = "图片路径")
    @TableField("img_url")
    private String imgUrl;

    @TableField(exist = false)
    private List<OrderDetail> orderDetailList;

    @TableField(exist = false)
    private String wareId;

    @ApiModelProperty(value = "地区")
    @TableField("province_id")
    private Long provinceId;

    @ApiModelProperty(value = "促销金额")
    @TableField("activity_reduce_amount")
    private BigDecimal activityReduceAmount;

    @ApiModelProperty(value = "优惠券")
    @TableField("coupon_amount")
    private BigDecimal couponAmount;

    @ApiModelProperty(value = "原价金额")
    @TableField("original_total_amount")
    private BigDecimal originalTotalAmount;

    @ApiModelProperty(value = "可退款日期(签收后30天)")
    @TableField("refundable_time")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    private Date refundableTime;

    @ApiModelProperty(value = "运费")
    @TableField("feight_fee")
    private BigDecimal feightFee;

    @ApiModelProperty(value = "操作时间")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @TableField("operate_time")
    private Date operateTime;

    //  计算活动或者优惠劵的金额
    @TableField(exist = false)
    private List<OrderDetailVo> orderDetailVoList;

    @TableField(exist = false)
    private String orderStatusName;

    @TableField(exist = false)
    private CouponInfo couponInfo;

    // 计算总价格
    public void sumTotalAmount(){
        BigDecimal totalAmount = new BigDecimal("0");
        BigDecimal originalTotalAmount = new BigDecimal("0");
        BigDecimal couponAmount = new BigDecimal("0");
        //  减去优惠劵
        if(null != couponInfo) {
            couponAmount = couponAmount.add(couponInfo.getReduceAmount());
            totalAmount = totalAmount.subtract(couponInfo.getReduceAmount());
        }
        //  减去活动
        if(null != this.getActivityReduceAmount()) {
            totalAmount = totalAmount.subtract(this.getActivityReduceAmount());
        }
        //  计算最后
        for (OrderDetail orderDetail : orderDetailList) {
            BigDecimal skuTotalAmount = orderDetail.getOrderPrice().multiply(new BigDecimal(orderDetail.getSkuNum()));
            originalTotalAmount = originalTotalAmount.add(skuTotalAmount);
            totalAmount = totalAmount.add(skuTotalAmount);
        }
        this.setTotalAmount(totalAmount);
        this.setOriginalTotalAmount(originalTotalAmount);
        this.setCouponAmount(couponAmount);
    }

    /**
     * 获取促销优惠总金额
     * @param orderInfo
     * @return
     */
    public BigDecimal getActivityReduceAmount(OrderInfo orderInfo) {
        //促销优惠金额
        BigDecimal activityReduceAmount = new BigDecimal("0");
        List<OrderDetailVo> orderDetailVoList = orderInfo.getOrderDetailVoList();
        if(!CollectionUtils.isEmpty(orderDetailVoList)) {
            for(OrderDetailVo orderDetailVo : orderDetailVoList) {
                ActivityRule activityRule = orderDetailVo.getActivityRule();
                if(null != activityRule) {
                    activityReduceAmount = activityReduceAmount.add(activityRule.getReduceAmount());
                }
            }
        }
        return activityReduceAmount;
    }
    /**
     * 计算购物项分摊的优惠减少金额
     * 打折:按折扣分担
     * 现金:按比例分摊
     * @param orderInfo
     * @return
     */
    public Map<String, BigDecimal> computeOrderDetailPayAmount(OrderInfo orderInfo) {
        Map<String, BigDecimal> skuIdToReduceAmountMap = new HashMap<>();
        //  获取到订单明细
        List<OrderDetailVo> orderDetailVoList = orderInfo.getOrderDetailVoList();
        if (!CollectionUtils.isEmpty(orderDetailVoList)) {
            for (OrderDetailVo orderDetailVo : orderDetailVoList) {
                //  获取到活动的规则
                ActivityRule activityRule = orderDetailVo.getActivityRule();
                List<OrderDetail> orderDetailList = orderDetailVo.getOrderDetailList();
                if (null != activityRule) {
                    //  key = activity:skuId
                    //优惠金额, 按比例分摊
                    BigDecimal reduceAmount = activityRule.getReduceAmount();
                    if (orderDetailList.size() == 1) {
                        //  记录活动的减少的金额
                        skuIdToReduceAmountMap.put("activity:" + orderDetailList.get(0).getSkuId(), reduceAmount);
                    } else {
                        // 总金额
                        BigDecimal originalTotalAmount = new BigDecimal(0);
                        for (OrderDetail orderDetail : orderDetailList) {
                            BigDecimal skuTotalAmount = orderDetail.getOrderPrice().multiply(new BigDecimal(orderDetail.getSkuNum()));
                            originalTotalAmount = originalTotalAmount.add(skuTotalAmount);
                        }
                        //  记录除最后一项是所有分摊金额, 最后一项 = 总的 - skuPartReduceAmount
                        //  三项  100 一项 33.33 二项 33.33 第三项 100-66.66 = 33.34
                        BigDecimal skuPartReduceAmount = new BigDecimal(0);
                        //  促销活动对应的是满减!
                        if (activityRule.getActivityType().equals(ActivityType.FULL_REDUCTION.name())) {
                            for (int i = 0, len = orderDetailList.size(); i < len; i++) {
                                OrderDetail orderDetail = orderDetailList.get(i);
                                //  最后一项前面一项应该如何做
                                if (i < len - 1) {
                                    BigDecimal skuTotalAmount = orderDetail.getOrderPrice().multiply(new BigDecimal(orderDetail.getSkuNum()));
                                    //sku分摊金额  skuTotalAmount/originalTotalAmount * 优惠的金额
                                    BigDecimal skuReduceAmount = skuTotalAmount.divide(originalTotalAmount, 2, RoundingMode.HALF_UP).multiply(reduceAmount);
                                    skuIdToReduceAmountMap.put("activity:" + orderDetail.getSkuId(), skuReduceAmount);

                                    skuPartReduceAmount = skuPartReduceAmount.add(skuReduceAmount);
                                } else {
                                    //  最后一项
                                    BigDecimal skuReduceAmount = reduceAmount.subtract(skuPartReduceAmount);
                                    skuIdToReduceAmountMap.put("activity:" + orderDetail.getSkuId(), skuReduceAmount);
                                }
                            }
                        } else {
                            //  满量打折
                            for (int i = 0, len = orderDetailList.size(); i < len; i++) {
                                OrderDetail orderDetail = orderDetailList.get(i);
                                if (i < len - 1) {
                                    BigDecimal skuTotalAmount = orderDetail.getOrderPrice().multiply(new BigDecimal(orderDetail.getSkuNum()));
                                    //sku分摊金额
                                    BigDecimal skuDiscountTotalAmount = skuTotalAmount.multiply(activityRule.getBenefitDiscount().divide(new BigDecimal("10")));
                                    BigDecimal skuReduceAmount = skuTotalAmount.subtract(skuDiscountTotalAmount);
                                    skuIdToReduceAmountMap.put("activity:" + orderDetail.getSkuId(), skuReduceAmount);

                                    skuPartReduceAmount = skuPartReduceAmount.add(skuReduceAmount);
                                } else {
                                    BigDecimal skuReduceAmount = reduceAmount.subtract(skuPartReduceAmount);
                                    skuIdToReduceAmountMap.put("activity:" + orderDetail.getSkuId(), skuReduceAmount);
                                }
                            }
                        }
                    }
                }
            }
        }
        //  计算优惠券
        CouponInfo couponInfo = orderInfo.getCouponInfo();
        if (null != couponInfo) {
            //sku对应的订单明细
            Map<Long, OrderDetail> skuIdToOrderDetailMap = new HashMap<>();
            for (OrderDetail orderDetail : orderInfo.getOrderDetailList()) {
                skuIdToOrderDetailMap.put(orderDetail.getSkuId(), orderDetail);
            }
            // 优惠券对应的skuId列表
            List<Long> skuIdList = couponInfo.getSkuIdList();
            // 优惠券优惠总金额
            BigDecimal reduceAmount = couponInfo.getReduceAmount();
            if (skuIdList.size() == 1) {
                // sku总的优惠金额 = 优惠券 key = "coupon:skuId"
                skuIdToReduceAmountMap.put("coupon:" + skuIdToOrderDetailMap.get(skuIdList.get(0)).getSkuId(), reduceAmount);
            } else {
                //总金额
                BigDecimal originalTotalAmount = new BigDecimal(0);
                for (Long skuId : skuIdList) {
                    OrderDetail orderDetail = skuIdToOrderDetailMap.get(skuId);
                    BigDecimal skuTotalAmount = orderDetail.getOrderPrice().multiply(new BigDecimal(orderDetail.getSkuNum()));
                    originalTotalAmount = originalTotalAmount.add(skuTotalAmount);
                }
                // 记录除最后一项是所有分摊金额, 最后一项 = 总的 - skuPartReduceAmount
                BigDecimal skuPartReduceAmount = new BigDecimal(0);
                // 购物券类型 1 现金券 2 折扣券 3 满减券 4 满件打折券
                if (couponInfo.getCouponType().equals(CouponType.CASH.name()) || couponInfo.getCouponType().equals(CouponType.FULL_REDUCTION.name())) {
                    for (int i = 0, len = skuIdList.size(); i < len; i++) {
                        OrderDetail orderDetail = skuIdToOrderDetailMap.get(skuIdList.get(i));
                        if (i < len - 1) {
                            BigDecimal skuTotalAmount = orderDetail.getOrderPrice().multiply(new BigDecimal(orderDetail.getSkuNum()));
                            //sku分摊金额
                            BigDecimal skuReduceAmount = skuTotalAmount.divide(originalTotalAmount, 2, RoundingMode.HALF_UP).multiply(reduceAmount);
                            skuIdToReduceAmountMap.put("coupon:" + orderDetail.getSkuId(), skuReduceAmount);

                            skuPartReduceAmount = skuPartReduceAmount.add(skuReduceAmount);
                        } else {
                            BigDecimal skuReduceAmount = reduceAmount.subtract(skuPartReduceAmount);
                            skuIdToReduceAmountMap.put("coupon:" + orderDetail.getSkuId(), skuReduceAmount);
                        }
                    }
                } else {
                    //  对应的2,4
                    for (int i = 0, len = skuIdList.size(); i < len; i++) {
                        OrderDetail orderDetail = skuIdToOrderDetailMap.get(skuIdList.get(i));
                        if (i < len - 1) {
                            BigDecimal skuTotalAmount = orderDetail.getOrderPrice().multiply(new BigDecimal(orderDetail.getSkuNum()));
                            BigDecimal skuDiscountTotalAmount = skuTotalAmount.multiply(couponInfo.getBenefitDiscount().divide(new BigDecimal("10")));
                            BigDecimal skuReduceAmount = skuTotalAmount.subtract(skuDiscountTotalAmount);
                            //sku分摊金额
                            skuIdToReduceAmountMap.put("coupon:" + orderDetail.getSkuId(), skuReduceAmount);

                            skuPartReduceAmount = skuPartReduceAmount.add(skuReduceAmount);
                        } else {
                            BigDecimal skuReduceAmount = reduceAmount.subtract(skuPartReduceAmount);
                            skuIdToReduceAmountMap.put("coupon:" + orderDetail.getSkuId(), skuReduceAmount);
                        }
                    }
                }
            }
        }
        return skuIdToReduceAmountMap;
    }
}

添加mapper

package com.atguigu.gmall.order.mapper;


@Mapper
public interface OrderInfoMapper extends BaseMapper<OrderInfo> {

}
package com.atguigu.gmall.order.mapper;


@Mapper
public interface OrderDetailMapper extends BaseMapper<OrderDetail> {
}

添加接口OrderService :

package com.atguigu.gmall.order.service;

public interface OrderService extends IService<OrderInfo> {

    /**
     * 保存订单
     * @param orderInfo
     * @return
     */
    Long saveOrderInfo(OrderInfo orderInfo);
}

实现类:

package com.atguigu.gmall.order.service.impl;


@Service
public class OrderServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo> implements OrderService {

    @Autowired
    private OrderInfoMapper orderInfoMapper;

    @Autowired
    private OrderDetailMapper orderDetailMapper;

@Override
@Transactional
public Long saveOrderInfo(OrderInfo orderInfo) {
    //调用里面的方法获取总金额
    orderInfo.sumTotalAmount();
    //订单状态
    orderInfo.setOrderStatus(OrderStatus.UNPAID.name());

    //付款方式  在线支付写死了
     orderInfo.setPaymentWay(PaymentWay.ONLINE.name());
    
    String outTradeNo = "ATGUIGU" + System.currentTimeMillis() + "" + new Random().nextInt(1000);
    //订单交易号
    orderInfo.setOutTradeNo(outTradeNo);
    //创建时间,不写也没事数据库自动添加
    orderInfo.setCreateTime(new Date());
    // 失效时间,定义为1天
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.DATE, 1);
    orderInfo.setExpireTime(calendar.getTime());

   //进度状态
    orderInfo.setProcessStatus(ProcessStatus.UNPAID.name());
       
    //订单描述   
     // 获取订单明细
       List<OrderDetail> orderDetailList = orderInfo.getOrderDetailList();
    StringBuffer tradeBody = new StringBuffer();
    for (OrderDetail orderDetail : orderDetailList) {
        tradeBody.append(orderDetail.getSkuName()+" ");
    }
    //如果订单描述长度大于100进行截取
    if (tradeBody.toString().length()>100){
        orderInfo.setTradeBody(tradeBody.toString().substring(0,100));
    }else {
        orderInfo.setTradeBody(tradeBody.toString());
    }

    //保存订单
    orderInfoMapper.insert(orderInfo);

    for (OrderDetail orderDetail : orderDetailList) {
        //设置订单id
        orderDetail.setOrderId(orderInfo.getId());
        //保存订单明细
        orderDetailMapper.insert(orderDetail);  
    }
    return orderInfo.getId();
  }
}

 

继续编写控制器:在OrderApiController:

@Autowired
private OrderService orderService;
/**
     * 提交订单
     * @param orderInfo
     * @param request
     * @return
     */
    @PostMapping("auth/submitOrder")
    public Result submitOrder(@RequestBody OrderInfo orderInfo, HttpServletRequest request) {
        // 获取到用户Id
        String userId = AuthContextHolder.getUserId(request);
        orderInfo.setUserId(Long.parseLong(userId));

        // 验证通过,保存订单!
        Long orderId = orderService.saveOrderInfo(orderInfo);
        return Result.ok(orderId);
    }

订单表多了一条数据: 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2085626.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

DDD设计方法-1-初识DDD

前情提要&#xff1a;一共包含 如下六篇文章&#xff08;篇幅精简&#xff0c;快速入门&#xff09; 1、初识DDD 2、聚合、实体、值对象 3、仓储&#xff0c;封装持久化数据 4、端口和适配器 5、领域事件 6、领域服务&#xff0c;实现约定 DDD设计理念-快速入门 DDD&#xff0…

雨水回用一体化设备

雨水回用一体化设备集提升、回用&#xff08;变频恒压供水&#xff09;、排泥系统&#xff1b;絮凝、消毒&#xff08;加药、紫外线&#xff09;、曝气系统&#xff1b;过滤&#xff08;初、精&#xff09;系统&#xff08;全自动自清洗过滤器/石英砂过滤器/多介质过滤器/精密碟…

没错,一分钟告诉你TCP和UDP之间的区别!

TCP (Transmission Control Protocol&#xff09;和UDP (User Datagram Protocol&#xff09;是两种常用的传输层协议&#xff0c;用于在计算机网络中传输数据。 TCP是一种面向连接的协议&#xff0c;提供可靠的数据传输。它通过建立连接、数据分段、流量控制、拥塞控制和错误校…

【论文阅读】skill code 和 one-shot manipulate

文章目录 1. Interpretable Robotic Manipulation from Language针对痛点和贡献摘要和结论引言模型框架实验思考不足之处 2. One-Shot Imitation Learning with Invariance Matching for Robotic Manipulation针对痛点和贡献摘要和结论引言模型框架实验 1. Interpretable Robot…

深入理解快排【C语言版】

目录 一、快排介绍及其思想 二、hoare版本 三、前后指针版 四、挖坑法 五、优化版本 5.1 三数取中 5.2 小区间优化 六 、非递归实现快排 七、三路划分 八、introsort 小结 一、快排介绍及其思想 快速排序是C.R.A.Hoare于1962年提出的一种划分交换排序。它采用了一…

掌握CompletableFuture,提升你的代码效率!

文章目录 1 CompletableFuture与线程池之间有什么关系&#xff1f;2 如何优化CompletableFuture的性能&#xff1f;3 实际项目中&#xff0c;以并行执行多个HTTP请求为例&#xff0c;你会如何优雅使用CompletableFuture 解决问题&#xff1f; 1 CompletableFuture与线程池之间有…

计算机毕业设计选题推荐-在线音乐网站-音乐专辑商城-Java/Python项目实战

✨作者主页&#xff1a;IT研究室✨ 个人简介&#xff1a;曾从事计算机专业培训教学&#xff0c;擅长Java、Python、微信小程序、Golang、安卓Android等项目实战。接项目定制开发、代码讲解、答辩教学、文档编写、降重等。 ☑文末获取源码☑ 精彩专栏推荐⬇⬇⬇ Java项目 Python…

埃隆·马斯克超级计算新里程碑:Cortex AI超级集群震撼亮相!

本周&#xff0c;科技界的超级明星埃隆马斯克再次引领潮流&#xff0c;他在超级计算领域的征途上迈出了令人瞩目的步伐。通过一段视频&#xff0c;他首次公开了最新命名的“Cortex”人工智能超级集群&#xff0c;这一壮举不仅标志着特斯拉“Giga Texas”工厂的又一次重大扩张&a…

LeetCode_sql_day17(1843.可疑银行账户)

描述&#xff1a; 表&#xff1a;Accounts ---------------------- | Column Name | Type | ---------------------- | account_id | int | | max_income | int | ---------------------- account_id 是这张表具有唯一值的列。 每行包含一个银行账户每月最大收入的…

提供开发资料 Hi3516CV610-00B/10B/20B/00S/20S/00G/20G 七个型号配置差异

根据功能不同&#xff0c; Hi3516CV610 分为七个不同型号版本: HI3516CV610-00B HI3516CV610-00B HI3516CV610-10B HI3516CV610-20B HI3516CV610-00S HI3516CV610-20S HI3516CV610-00G HI3516CV610-20G

【书生2.1】书生大模型全链路开源体系

0 引言 书生浦语官网 开源一周年总结及回顾 1 回顾 1.1 社区生态 2 总结 书生浦语大模型的开源开放体系&#xff0c;包括技术发展、性能提升、模型架构、开源生态等。 要点: &#x1f31f; 开源开放体系涵盖数据收集、标注、训练、微调、评测、部署等全链路。 &#x1f68…

【案例64】无法从套接字读取更多的数据

问题现象 系统突然间登录报如下错误&#xff1a;SELECT * FROM sm_user WHERE user_code_q? 无法从套接字读取更多的数据 问题分析 查看nc-log.log发现大量相关报错 $$callid1723104097968-1063 $$thread[http-bio-xxx-xxx-exec-xxx] $$hostxxx$$userid#UAP# $$tsxxx-08-08…

C++竞赛初阶L1-14-第六单元-数组(31~33课)542: T456472 数组逆序重存放

题目内容 将一个数组中的值按逆序重新存放。例如&#xff0c;原来的顺序为 8,6,5,4,1。要求改为 1,4,5,6,8。 输入格式 输入为两行&#xff1a;第一行数组中元素的个数 n&#xff08;1<n≤100)&#xff0c;第二行是 n 个整数&#xff0c;每两个整数之间用空格分隔。 输出…

Windows安装PostgreSQL数据库,保姆级教程

PostgreSQL 是客户端/服务器关系数据库管理系统 (RDMS)。PostgreSQL是一个功能非常强大的、源代码开放的客户/服务器关系型数据库管理系统&#xff08;RDBMS&#xff09;。PostgreSQL 也有自己的查询语言&#xff0c;称为 pgsql。 此外&#xff0c;PostgreSQL 还支持过程语言&a…

Cesium模型封装-Point

一、初始化地图 <template><div class"cesium_map"><div id"cesiumContainer"></div></div> </template><script setup> import { reactive, ref, onMounted } from "vue"; import { Point } from &…

基于yolov8的安全帽反光衣护目镜检测系统python源码+onnx模型+评估指标曲线+精美GUI界面

【算法介绍】 基于YOLOv8的安全帽、反光衣及护目镜检测系统是一款集成了前沿深度学习与计算机视觉技术的智能监控系统。该系统利用YOLOv8这一尖端的目标检测模型&#xff0c;结合云计算与自动化图像处理技术&#xff0c;实现对工地、化工厂、煤矿等高风险作业区域工作人员安全…

Java—方法引用

目录 初识方法引用 方法引用的分类 引用静态方法 引用成员方法 引用构造方法 其它调用方式 类名引用成员方法 引用数组的构造方法 总结 初识方法引用 方法引用就是拿现有的方法来当做函数式接口中抽象方法的方法体。 方法引用注意事项 1. 引用处必须是函数式接口&a…

初识JAVA(上)

&#x1f381;&#x1f381;创作不易&#xff0c;关注作者不迷路&#x1f380;&#x1f380; 初识JAVA 前言一、初识JAVA1.1.Java是什么1.2.Java语言的重要性1.3 Java语言发展简史1.4 Java语言特性 二、初识Java的main方法1 main方法示例 三、注释基本规则 四、数据类型1.常量2…

入门Java第一步—>IDEA的下载与安装与JDK的环境配置(day01)

1.JDK的下载与安装 jdk的安装链接分为不同操作系统如下,点击链接跳转下载页面&#xff1a; windows操作系统JDK下载链接(按住键盘ctrl键单击链接即可)&#xff1a; 链接7天有效&#xff0c;有需要的评论区找我哈 通过网盘分享的文件&#xff1a;jdk-8u271-windows-x64.exe 链…

建筑企业数字信息化转型的建议

在现代建筑企业的管理中&#xff0c;信息化转型已成为提升效率和竞争力的关键。然而&#xff0c;在选择信息化系统时&#xff0c;企业需要慎重考虑&#xff0c;以确保系统真正适合企业的现状和未来发展。 &#x1f50d; 要选合适的&#xff0c;而非“成熟”的 信息化系统的核心…