Browse Source

1. 近期记录内容

kindring 2 years ago
parent
commit
d16ef7fb9c

+ 0 - 0
C与C++/STUN协议.md


+ 31 - 0
C与C++/webrtc/stun协议.md

@@ -0,0 +1,31 @@
+# stun 协议 01
+## 协议介绍
+1. 作用NAT穿越
+2. 客户端服务器方式交互
+> 客户端请求服务器,服务器返回数据给客户端
+
+3. 参考文档 
+   1. RFC3489/STUN 
+   > simple Traversal of UDP THrough NAT
+   2. RFC5389 (新)
+
+
+## stun 协议组成
+### STUN header
+字节数: 20
+#### 1. header 定义表
+| 位数 | 定义 | 取值 | 长度(byt) | 备注 |
+| --- | --- | --- | --- | --- |
+| 1-2 | stun message type | -- | 2 | type |
+| 3-4 | stun message Length | -- | 2 | length |
+| 5-8 | magic cookie | -- | 4 | 包含在 事务id,请求与响应相同 |
+| 9-20 | transaction ID | -- | 12 | 事务id,请求与响应相同 |
+
+#### message type 字段解析
+前两位为00
+2位用于分类 c0 和 c1
+12位定义消息类型
+
+### body Attribute
+字节数: 不限
+

+ 1 - 0
docker/docker 环境配置.md

@@ -0,0 +1 @@
+# docker 环境配置

BIN
js/001 结果 以01连接区分大陆 .png


BIN
js/001 需求 以01连接区分大陆 .png


+ 6 - 0
linux/ubuntu smb安装.md

@@ -0,0 +1,6 @@
+# linux 安装配置smb
+## 安装smb
+### 1. 安装
+```shell
+sudo apt-get install samba samba-common
+```

+ 32 - 0
高端java/PlatformGoodsExtMapper.java

@@ -0,0 +1,32 @@
+package com.foonsu.efenxiao.platform.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.foonsu.efenxiao.platform.entity.PlatformGoods;
+import com.foonsu.efenxiao.platform.vo.PlatformGoodsReq;
+import com.foonsu.efenxiao.platform.vo.PlatformGoodsVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ *  平台商品扩展 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-03-29
+ */
+public interface PlatformGoodsExtMapper extends BaseMapper<PlatformGoodsVO> {
+
+	/**
+	 * 自定义分页 (商品列表包含代发商品)
+	 *
+	 * @param page
+	 * @param req
+	 * @return
+	 */
+	List<PlatformGoodsVO> selectPlatformGoodsPageData( @Param("req") PlatformGoodsReq req);
+
+	Integer countPlatformGoodsPage(@Param("req") PlatformGoodsReq req);
+
+	List<Long> selectPlatformGoodsPageBizId(@Param("req") PlatformGoodsReq req);
+}

+ 275 - 0
高端java/PlatformGoodsExtMapper.xml

@@ -0,0 +1,275 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.foonsu.efenxiao.platform.mapper.PlatformGoodsExtMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="goodsResultMap" type="com.foonsu.efenxiao.platform.vo.PlatformGoodsVO"
+        extends="com.foonsu.efenxiao.platform.mapper.PlatformGoodsMapper.platformGoodsResultMap">
+        <result column="shop_name" property="shopName"/>
+        <result column="goods_pic_path" property="picPath"/>
+        <collection property="goodsSkuList" ofType="com.foonsu.efenxiao.platform.vo.PlatformGoodsSkuVO">
+            <id column="goodsSkuId" property="id"/>
+            <result column="goodsSkuBizId" property="bizId"/>
+            <result column="productId" property="productId"/>
+            <result column="sku_id" property="skuId"/>
+            <result column="sku_name" property="skuName"/>
+            <result column="sku_out_id" property="skuOutId"/>
+            <result column="sku_price" property="skuPrice"/>
+            <result column="sku_weight" property="skuWeight"/>
+            <result column="sku_short_name" property="skuShortName"/>
+            <result column="shopBizId" property="shopBizId"/>
+            <result column="shopTenantId" property="shopTenantId"/>
+            <result column="skuOnSale" property="onSale"/>
+            <result column="sku_pic_path" property="picPath"/>
+            <result column="color_spec" property="colorSpec"/>
+            <result column="size_spec" property="sizeSpec"/>
+        </collection>
+        <collection property="distributeList" ofType="com.foonsu.efenxiao.platform.vo.PlatformGoodsDistributeVO">
+            <id column="goodsDistributeId" property="id"/>
+            <result column="goodsDistributeBizId" property="bizId"/>
+            <result column="seller_tenant_id" property="sellerTenantId"/>
+            <result column="factory_tenant_id" property="factoryTenantId"/>
+            <result column="factory_tenant_account" property="factoryTenantAccount"/>
+            <result column="dGoodsBizId" property="goodsBizId"/>
+            <result column="dSkuBizId" property="skuBizId"/>
+            <result column="allocation_status" property="allocationStatus"/>
+        </collection>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        pg.id,
+        pg.biz_id,
+        pg.product_id,
+        pg.product_name,
+        pg.product_out_id,
+        pg.price,
+        pg.weight,
+        pg.short_name,
+        pg.shop_biz_id,
+        pg.shop_tenant_id,
+        pg.shop_platform,
+        pg.on_sale,
+        pg.create_time,
+        pg.pic_path goods_pic_path
+	</sql>
+
+    <sql id="Base_sku_Column_List">
+        pgs.id goodsSkuId,
+        pgs.biz_id goodsSkuBizId,
+        pgs.product_id productId,
+        pgs.sku_id,
+        pgs.sku_name,
+        pgs.sku_out_id,
+        pgs.sku_price,
+        pgs.sku_weight,
+        pgs.sku_short_name,
+        pgs.shop_biz_id shopBizId,
+        pgs.shop_tenant_id shopTenantId,
+        pgs.on_sale skuOnSale,
+        pgs.pic_path sku_pic_path,
+        pgs.color_spec,
+        pgs.size_spec
+	</sql>
+
+  <!--  <sql id="Base_distribute_Column_List">
+        pgd.id goodsDistributeId,
+        pgd.biz_id goodsDistributeBizId,
+        pgd.seller_tenant_id,
+        pgd.factory_tenant_id,
+        pgd.goods_biz_id dGoodsBizId,
+        pgd.sku_biz_id dSkuBizId,
+        pgd.allocation_status,
+        pgd.factory_tenant_account
+	</sql>-->
+
+    <select id="countPlatformGoodsPage" resultType="int">
+        select count(distinct biz_id)   from(
+        select  pg.biz_id from i_platform_goods pg
+        inner join i_platform_goods_sku pgs on pg.product_id = pgs.product_id and pg.shop_biz_id = pgs.shop_biz_id
+        inner join i_shop s on s.biz_id = pg.shop_biz_id
+        inner join i_platform_goods_distribute pgd on pgd.sku_biz_id = pgs.biz_id and pgd.relation_type = '2' and pgd.factory_tenant_id =  #{req.tenantId}
+        left join i_platform_goods_distribute pgd1 on pgd1.sku_biz_id = pgs.biz_id and pgd1.relation_type = '2' and pgd1.seller_tenant_id =  #{req.tenantId}
+        where pgs.id is not null
+        <include refid="search_condition" />
+
+        union
+        select pg.biz_id from i_platform_goods pg
+        left join i_platform_goods_sku pgs on pg.product_id = pgs.product_id and pg.shop_biz_id = pgs.shop_biz_id
+        inner join i_shop s on s.biz_id = pg.shop_biz_id
+        inner join i_platform_goods_distribute pgd on pgd.goods_biz_id = pg.biz_id and pgd.relation_type = '1' and (pgd.factory_tenant_id =  #{req.tenantId} )
+        left join i_platform_goods_distribute pgd1 on pgd1.goods_biz_id = pg.biz_id and pgd1.relation_type = '1' and (pgd1.seller_tenant_id =  #{req.tenantId} )
+        where pgs.id is null
+        <include refid="search_condition" />
+        ) temp
+    </select>
+
+
+    <select id="selectPlatformGoodsPageBizId" resultType="int">
+        select distinct biz_id  from(
+        select  pg.biz_id from i_platform_goods pg
+        inner join i_platform_goods_sku pgs on pg.product_id = pgs.product_id and pg.shop_biz_id = pgs.shop_biz_id
+        inner join i_shop s on s.biz_id = pg.shop_biz_id
+        inner join i_platform_goods_distribute pgd on pgd.sku_biz_id = pgs.biz_id and pgd.relation_type = '2' and pgd.factory_tenant_id =  #{req.tenantId}
+        left join i_platform_goods_distribute pgd1 on pgd1.sku_biz_id = pgs.biz_id and pgd1.relation_type = '2' and pgd1.seller_tenant_id =  #{req.tenantId}
+        where pgs.id is not null
+        <include refid="search_condition" />
+
+        union
+        select pg.biz_id from i_platform_goods pg
+        left join i_platform_goods_sku pgs on pg.product_id = pgs.product_id and pg.shop_biz_id = pgs.shop_biz_id
+        inner join i_shop s on s.biz_id = pg.shop_biz_id
+        inner join i_platform_goods_distribute pgd on pgd.goods_biz_id = pg.biz_id and pgd.relation_type = '1' and (pgd.factory_tenant_id =  #{req.tenantId} )
+        left join i_platform_goods_distribute pgd1 on pgd1.goods_biz_id = pg.biz_id and pgd1.relation_type = '1' and (pgd1.seller_tenant_id =  #{req.tenantId} )
+
+        where pgs.id is null
+        <include refid="search_condition" />
+        ) temp
+        <include refid="sort_condition" />
+    </select>
+
+
+    <select id="selectPlatformGoodsPageData" resultMap="goodsResultMap">
+        select <include refid="Base_Column_List" />, <include refid="Base_sku_Column_List" />, s.shop_name
+        from i_platform_goods pg
+        left join i_platform_goods_sku pgs on pg.product_id = pgs.product_id and pg.shop_biz_id = pgs.shop_biz_id
+        inner join i_shop s on s.biz_id = pg.shop_biz_id
+        where pg.biz_id in <foreach collection="req.productBizIds" item="item" open="(" close=")" separator=",">#{item}</foreach>
+    </select>
+
+    <sql id="search_condition">
+
+        <if test="req.shopPlatforms != null">
+            and pg.shop_platform in <foreach collection="req.shopPlatforms" open="(" close=")" separator="," item="item">#{item}</foreach>
+        </if>
+        <if test="req.shopBizId != null">
+            and pg.shop_biz_id = #{req.shopBizId}
+        </if>
+        <if test="req.factoryTenantId != null">
+            and pgd1.factory_tenant_id = #{req.factoryTenantId}
+        </if>
+        <if test="req.sellerTenantId != null">
+            and pgd.seller_tenant_id = #{req.sellerTenantId}
+        </if>
+        <if test="req.factoryTenantId != null and (req.fillInStater != null || req.compareStater != null)">
+            and (
+                <if test="req.fillInStater == 0">
+                     pgd1.distribute_price is not null
+                </if>
+                <if test="req.fillInStater == 1">
+                     pgd1.distribute_price is null
+                </if>
+                <if test="req.compareStater == 0">
+                    <if test="req.fillInStater != null">
+                        and
+                    </if>
+                    pgd1.distribute_price &gt;= #{req.distributePrice}
+                </if>
+                <if test="req.compareStater == 1">
+                    <if test="req.fillInStater != null">
+                        and
+                    </if>
+                    pgd1.distribute_price &lt;= #{req.distributePrice}
+                </if>
+            )
+        </if>
+        <if test="req.sellerTenantId != null and (req.fillInStater != null || req.compareStater != null)">
+            and (
+                <if test="req.fillInStater == 0">
+                    pgd.distribute_price is not null
+                </if>
+                <if test="req.fillInStater == 1">
+                    pgd.distribute_price is null
+                </if>
+                <if test="req.compareStater == 0">
+                    <if test="req.fillInStater != null">
+                        and
+                    </if>
+                    pgd.distribute_price &gt;= #{req.distributePrice}
+                </if>
+                <if test="req.compareStater == 1">
+                    <if test="req.fillInStater != null">
+                        and
+                    </if>
+                    pgd.distribute_price &lt;= #{req.distributePrice}
+                </if>
+            )
+        </if>
+        <if test="req.onSale != null">
+            and pg.on_sale = #{req.onSale}
+        </if>
+        <if test="req.productName != null">
+            <if test="req.isGoodsInclude == 1">
+                and pg.product_name like concat('%',#{req.productName},'%')
+            </if>
+            <if test="req.isGoodsInclude == 0">
+                and pg.product_name not like concat('%',#{req.productName},'%')
+            </if>
+        </if>
+        <if test="req.shortName != null and req.shortName != ''">
+            and pg.short_name = #{req.shortName}
+        </if>
+        <if test="req.shortNameFlag != null and req.shortNameFlag == 1">
+            and pg.short_name is not null and pg.short_name != ''
+        </if>
+        <if test="req.weightFlag != null and req.weightFlag == 1">
+            and (pg.weight is not null and pg.weight > 0)
+        </if>
+        <if test="req.weightFlag != null and req.weightFlag == 0">
+            and (pg.weight is null or pg.weight = '' or pg.weight = 0)
+        </if>
+        <if test="req.skuShortName != null and req.skuShortName != ''">
+            and pgs.sku_short_name = #{req.skuShortName}
+        </if>
+        <if test="req.skuShortNameFlag != null and req.skuShortNameFlag == 1">
+            and pgs.sku_short_name is not null and pgs.sku_short_name != ''
+        </if>
+        <if test="req.skuWeightFlag != null and req.skuWeightFlag == 1">
+            and (pgs.sku_weight is not null and pgs.sku_weight > 0)
+        </if>
+        <if test="req.skuWeightFlag != null and req.skuWeightFlag == 0">
+            and (pgs.sku_weight is null or pgs.sku_weight = '' or pgs.sku_weight = 0)
+        </if>
+        <if test="req.productOutIdList != null">
+            and pg.product_out_id in
+            <foreach collection="req.productOutIdList" item="productOutId" open="("
+                     close=")" separator=",">
+                #{productOutId}
+            </foreach>
+        </if>
+        <if test="req.skuName != null and req.skuName != ''">
+            <if test="req.isSkuInclude == 1">
+                and pgs.sku_name like concat('%',#{req.skuName},'%')
+            </if>
+            <if test="req.isSkuInclude == 0">
+                and pgs.sku_name not like concat('%',#{req.skuName},'%')
+            </if>
+        </if>
+        <if test="req.productId != null and req.productId != ''">
+            and pg.product_id = #{req.productId}
+        </if>
+        <if test="req.skuId != null and req.skuId != ''">
+            and pgs.sku_id = #{req.skuId}
+        </if>
+
+        <if test="req.allocationStatus != null and req.allocationStatus != ''">
+            and pgd.allocation_status = #{req.allocationStatus}
+        </if>
+
+        <if test="req.productBizIds != null">
+            and pg.biz_id in <foreach collection="req.productBizIds" item="item" open="(" close=")" separator=",">#{item}</foreach>
+        </if>
+
+    </sql>
+
+    <sql id="sort_condition">
+        <if test="req.sort == '0'">
+            order BY  temp.create_time asc
+        </if>
+        <if test="req.sort == '1'">
+            order BY  temp.create_time desc
+        </if>
+        limit #{req.pageStart},#{req.pageSize}
+    </sql>
+
+
+</mapper>

+ 83 - 0
高端java/PlatformGoodsSkuServiceImpl.java

@@ -0,0 +1,83 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.foonsu.efenxiao.platform.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.foonsu.efenxiao.platform.entity.PlatformGoods;
+import com.foonsu.efenxiao.platform.entity.PlatformGoodsDistribute;
+import com.foonsu.efenxiao.platform.entity.PlatformGoodsSku;
+import com.foonsu.efenxiao.platform.vo.PlatformGoodsSkuVO;
+import com.foonsu.efenxiao.platform.mapper.PlatformGoodsSkuMapper;
+import com.foonsu.efenxiao.platform.service.IPlatformGoodsSkuService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2022-03-17
+ */
+@Service
+public class PlatformGoodsSkuServiceImpl extends ServiceImpl<PlatformGoodsSkuMapper, PlatformGoodsSku> implements IPlatformGoodsSkuService {
+
+	@Autowired
+	private PlatformGoodsDistributeServiceImpl platformGoodsDistributeService;
+
+	@Override
+	public IPage<PlatformGoodsSkuVO> selectPlatformGoodsSkuPage(IPage<PlatformGoodsSkuVO> page, PlatformGoodsSkuVO platformGoodsSku) {
+		return page.setRecords(baseMapper.selectPlatformGoodsSkuPage(page, platformGoodsSku));
+	}
+
+	@Override
+	public PlatformGoodsSku queryByProductIdSkuId(Long shopBizId, String productId, String skuId) {
+		LambdaQueryWrapper<PlatformGoodsSku> queryWrapper = Wrappers.<PlatformGoodsSku>query().lambda().eq(PlatformGoodsSku::getShopBizId, shopBizId)
+			.eq(PlatformGoodsSku::getProductId, productId).eq(PlatformGoodsSku::getSkuId, skuId);
+
+		List<PlatformGoodsSku> skus = baseMapper.selectList(queryWrapper);
+
+		return skus.size()>0?skus.get(0):null;
+	}
+
+	@Override
+	@Transactional
+	public void addPlatformGoodsSku(PlatformGoodsSku sku, PlatformGoodsDistribute platformGoodsDistribute) {
+		this.save(sku);
+		platformGoodsDistributeService.save(platformGoodsDistribute);
+	}
+
+	@Override
+	public List<PlatformGoodsSku> queryByProductIdsSkuIds(Long shopId, List<String> productIds, List<String> skuIds) {
+		if(skuIds.size() == 0){
+			return new ArrayList<>();
+		}
+		LambdaQueryWrapper<PlatformGoodsSku> queryWrapper = Wrappers.<PlatformGoodsSku>query().lambda().eq(PlatformGoodsSku::getShopBizId, shopId)
+				.in(PlatformGoodsSku::getProductId, productIds).in(PlatformGoodsSku::getSkuId, skuIds);
+
+		List<PlatformGoodsSku> skus = baseMapper.selectList(queryWrapper);
+
+		return skus;
+	}
+}