瀏覽代碼

Merge remote-tracking branch 'origin/20210716' into 20210716

lihui001 3 年之前
父節點
當前提交
3ad6d2f0c1

+ 2 - 0
message/src/main/resources/sentry.properties

@@ -0,0 +1,2 @@
+dsn=http://dfd3e7b071c9472f8f2a4bdf0c326410@10.0.0.159:8080/1
+servername=host1

+ 67 - 0
message/src/test/java/com/zcxk/JmhTest.java

@@ -0,0 +1,67 @@
+package com.huaxu;
+
+/*
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.results.format.ResultFormatType;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+*/
+
+import java.util.concurrent.TimeUnit;
+
+/*@BenchmarkMode(Mode.Throughput)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+@State(Scope.Thread)
+@Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Fork(1)
+@Threads(2)*/
+public class JmhTest {
+  /*  @Benchmark
+    public long shift() {
+
+        long t = 455565655225562L;
+
+        long a = 0;
+
+        for (int i = 0; i < 1000; i++) {
+
+            a = t >> 30;
+
+        }
+
+        return a;
+
+    }
+
+
+    @Benchmark
+    public long div() {
+
+        long t = 455565655225562L;
+
+        long a = 0;
+
+        for (int i = 0; i < 1000; i++) {
+
+            a = t / 1024 / 1024 / 1024;
+
+        }
+
+        return a;
+
+    }
+
+
+    public static void main(String[] args) throws Exception {
+
+        Options opts = new OptionsBuilder()
+
+                .include(JmhTest.class.getSimpleName())
+
+                .resultFormat(ResultFormatType.CSV)
+                .build();
+        new Runner(opts).run();
+    }*/
+}

+ 97 - 0
message/src/test/java/com/zcxk/TestSentry.java

@@ -0,0 +1,97 @@
+package com.huaxu;
+
+/*
+import io.sentry.Sentry;
+import io.sentry.SentryClient;
+import io.sentry.SentryClientFactory;
+import io.sentry.context.Context;
+import io.sentry.event.BreadcrumbBuilder;
+import io.sentry.event.UserBuilder;
+*/
+
+public class TestSentry {
+  /*  private static SentryClient sentry;
+
+    public static void main(String[] args) {
+        //String dsn = "http://2384bbf9e2134af9b765dc8c10a2c08a@192.168.174.133:8080/1";
+        //Sentry.init(dsn);
+
+        *//*
+         It is possible to go around the static ``Sentry`` API, which means
+         you are responsible for making the SentryClient instance available
+         to your code.
+         *//*
+        sentry = SentryClientFactory.sentryClient();
+
+        TestSentry myClass = new TestSentry();
+        //myClass.logWithStaticAPI();
+        myClass.logWithInstanceAPI();
+    }
+    void unsafeMethod() {
+        throw new UnsupportedOperationException("You shouldn't call this!");
+    }
+
+    *//**
+     * Examples using the (recommended) static API.
+     *//*
+    void logWithStaticAPI() {
+        // Note that all fields set on the context are optional. Context data is copied onto
+        // all future events in the current context (until the context is cleared).
+
+
+        // Record a breadcrumb in the current context. By default the last 100 breadcrumbs are kept.
+
+     *//*   Sentry.getContext().recordBreadcrumb(
+                new BreadcrumbBuilder().setMessage("User made an action").build()
+        );
+
+        // Set the user in the current context.
+        Sentry.getContext().setUser(
+                new UserBuilder().setEmail("hello@sentry.io").build()
+        );
+
+        // Add extra data to future events in this context.
+        Sentry.getContext().addExtra("extra", "thing");
+
+        // Add an additional tag to future events in this context.
+        Sentry.getContext().addTag("tagName", "tagValue");*//*
+
+        *//*
+         This sends a simple event to Sentry using the statically stored instance
+         that was created in the ``main`` method.
+         *//*
+       // Sentry.capture("This is a test");
+
+        try {
+            unsafeMethod();
+        } catch (Exception e) {
+            // This sends an exception event to Sentry using the statically stored instance
+            // that was created in the ``main`` method.
+            Sentry.capture(e);
+        }
+    }
+
+    *//**
+     * Examples that use the SentryClient instance directly.
+     *//*
+    void logWithInstanceAPI() {
+        // Retrieve the current context.
+        Context context = sentry.getContext();
+
+        // Record a breadcrumb in the current context. By default the last 100 breadcrumbs are kept.
+        context.recordBreadcrumb(new BreadcrumbBuilder().setMessage("User made an action").build());
+
+        // Set the user in the current context.
+        context.setUser(new UserBuilder().setEmail("hello@sentry.io").build());
+
+        // This sends a simple event to Sentry.
+        sentry.sendMessage("This is a test");
+
+        try {
+            unsafeMethod();
+        } catch (Exception e) {
+            // This sends an exception event to Sentry.
+            sentry.sendException(e);
+        }
+    }*/
+}

+ 79 - 0
message/src/test/java/com/zcxk/bintree.java

@@ -0,0 +1,79 @@
+package com.huaxu;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class bintree {
+    public bintree left;
+    public bintree right;
+    public bintree root;
+    //    数据域
+    private Object data;
+    //    存节点
+    public List<bintree> datas;
+
+    public bintree(bintree left, bintree right, Object data){
+        this.left=left;
+        this.right=right;
+        this.data=data;
+    }
+    //    将初始的左右孩子值为空
+    public bintree(Object data){
+        this(null,null,data);
+    }
+
+    public bintree() {
+
+    }
+
+    public void creat(Object[] objs){
+        datas=new ArrayList<bintree>();
+        //        将一个数组的值依次转换为Node节点
+        for(Object o:objs){
+            datas.add(new bintree(o));
+        }
+//        第一个数为根节点
+        root=datas.get(0);
+//        建立二叉树
+        for (int i = 0; i <objs.length/2; i++) {
+//            左孩子
+            datas.get(i).left=datas.get(i*2+1);
+//            右孩子
+            if(i*2+2<datas.size()){//避免偶数的时候 下标越界
+                datas.get(i).right=datas.get(i*2+2);
+            }
+        }
+    }
+    //先序遍历
+    public void preorder(bintree root){
+        if(root!=null){
+            System.out.println(root.data);
+            preorder(root.left);
+            preorder(root.right);
+        }
+    }
+    //中序遍历
+    public void inorder(bintree root){
+        if(root!=null){
+            inorder(root.left);
+            System.out.println(root.data);
+            inorder(root.right);
+        }
+    }
+    //    后序遍历
+    public void afterorder(bintree root){
+        if(root!=null){
+            System.out.println(root.data);
+            afterorder(root.left);
+            afterorder(root.right);
+        }
+    }
+    public static void main(String[] args) {
+        bintree bintree=new bintree();
+        Object []a={2,4,5,7,1,6,12,32,51,22};
+        bintree.creat(a);
+        bintree.preorder(bintree.root);
+    }
+
+
+}

+ 1 - 1
operation_manager/src/main/java/com/zcxk/process/entity/UserActionDesc.java

@@ -6,7 +6,7 @@ import lombok.Data;
 
 import java.time.LocalDateTime;
 
-@ApiModel(value = "com.bz.smart_city.entity.UserActionDesc")
+@ApiModel(value = "com.zcxk.rmcp.pay.entity.UserActionDesc")
 @Data
 public class UserActionDesc {
 

+ 2 - 2
operation_manager/src/main/resources/activiti.cfg.xml

@@ -6,10 +6,10 @@
 
     <bean id="processEngineConfiguration"
           class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
-        <property name="jdbcUrl" value="jdbc:mysql://114.135.61.188:33306/operation_manager?characterEncoding=utf8"></property>
+        <property name="jdbcUrl" value="jdbc:mysql://10.0.0.63:3306/operation_manager?characterEncoding=utf8"></property>
         <property name="jdbcDriver" value="com.mysql.jdbc.Driver"></property>
         <property name="jdbcUsername" value="root"></property>
-        <property name="jdbcPassword" value="100Zone@123"></property>
+        <property name="jdbcPassword" value="100zone"></property>
         <property name="databaseSchemaUpdate" value="true"></property>
     </bean>
 </beans>

+ 3 - 2
user_center/src/main/java/com/zcxk/service/UserService.java

@@ -4,7 +4,7 @@ package com.zcxk.service;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.zcxk.common.ToolUtil;
-import com.bz.zoneiot.core.utils.util.RedisUtils;
+
 import com.zcxk.dao.OrgMapper;
 import com.zcxk.dao.UserMapper;
 import com.zcxk.dto.MaintainerCountDto;
@@ -15,6 +15,7 @@ import com.zcxk.entity.UserRoleEntity;
 import com.zcxk.entity.UserTagEntity;
 import com.zcxk.model.LoginUser;
 import com.zcxk.util.ByteArrayUtils;
+import com.zcxk.util.RedisUtil;
 import com.zcxk.util.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -51,7 +52,7 @@ public class UserService extends ServiceImpl<UserMapper,UserEntity> {
 	@Resource
 	private OrgMapper orgMapper;
 	@Autowired
-	private RedisUtils redisUtils;
+	private RedisUtil redisUtils;
 	@Value("${add_iot_user_url}")
 	private String addIotUserUrl;
 

+ 3 - 2
user_center/src/main/java/com/zcxk/service/impl/OrgServiceImpl.java

@@ -1,7 +1,7 @@
 package com.zcxk.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.bz.zoneiot.core.utils.util.RedisUtils;
+
 import com.zcxk.dao.OrgMapper;
 import com.zcxk.dto.OrgBaseTreeInfoDto;
 import com.zcxk.dto.OrgTree;
@@ -10,6 +10,7 @@ import com.zcxk.model.LoginUser;
 import com.zcxk.model.ProgramItem;
 import com.zcxk.service.OrgService;
 import com.zcxk.util.ByteArrayUtils;
+import com.zcxk.util.RedisUtil;
 import com.zcxk.util.UserUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,7 +34,7 @@ public class OrgServiceImpl implements OrgService {
     private OrgMapper orgMapper;
 
     @Autowired
-    private RedisUtils redisUtils;
+    private RedisUtil redisUtils;
 
 
     /**

+ 3 - 2
user_center/src/main/java/com/zcxk/service/impl/RoleServiceImpl.java

@@ -1,7 +1,7 @@
 package com.zcxk.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.bz.zoneiot.core.utils.util.RedisUtils;
+
 import com.zcxk.dao.MenuMapper;
 import com.zcxk.dao.RoleMapper;
 import com.zcxk.dao.RoleMenuMapper;
@@ -12,6 +12,7 @@ import com.zcxk.entity.*;
 import com.zcxk.model.LoginUser;
 import com.zcxk.service.RoleService;
 import com.zcxk.util.ByteArrayUtils;
+import com.zcxk.util.RedisUtil;
 import com.zcxk.util.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -36,7 +37,7 @@ public class RoleServiceImpl implements RoleService {
     @Autowired
     private RoleMenuMapper roleMenuMapper;
     @Autowired
-    private RedisUtils redisUtils;
+    private RedisUtil redisUtils;
     @Autowired
     private MenuMapper menuMapper;
 

+ 1 - 2
user_center/src/main/resources/application-dev.properties

@@ -39,8 +39,7 @@ spring.redis.lettuce.shutdown-timeout=100
 security.oauth2.client.client-id=smart-city-v2
 security.oauth2.client.client-secret=smart-city-v2-123
 security.oauth2.resource.id=smartcity-deivice-service
-#security.oauth2.resource.user-info-uri=http://10.0.0.62:8321/user/principal
-security.oauth2.resource.user-info-uri=http://127.0.0.1:8321/user/principal
+security.oauth2.resource.user-info-uri=http://10.0.0.62:8321/user/principal
 security.oauth2.resource.prefer-token-info=false
 
 

+ 3 - 0
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/entity/Product.java

@@ -18,6 +18,9 @@ public class Product implements Serializable {
     @ApiModelProperty(value="")
     private Integer id;
 
+    @ApiModelProperty(value="物联网产品id")
+    private Integer iotProductId;
+
     @ApiModelProperty(value="产品分类id")
     private Integer productCategoryId;
 

+ 2 - 1
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/ProductMapper.xml

@@ -5,6 +5,7 @@
     <!--@mbg.generated-->
     <!--@Table rmcp_product-->
     <id column="id" property="id" />
+    <result column="iot_product_id" property="iotProductId" />
     <result column="product_category_id" property="productCategoryId" />
     <result column="manufacturer_id" property="manufacturerId" />
     <result column="product_name" property="productName" />
@@ -21,7 +22,7 @@
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, product_category_id, manufacturer_id, product_name, product_model, product_desc, 
+    id, iot_product_id, product_category_id, manufacturer_id, product_name, product_model, product_desc,
     `status`, create_date, create_by, update_date, update_by, is_support_valve, valve_measuring_code, 
     reading_measuring_code
   </sql>

+ 2 - 1
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/DeviceServiceImpl.java

@@ -185,8 +185,9 @@ public class DeviceServiceImpl implements DeviceService{
     }
 
     private DeviceDTO covertDeviceDTO(DeviceInputDto dto,Product product, Long customerId) {
+
         DeviceDTO deviceDTO = new DeviceDTO();
-        deviceDTO.setProductId(Long.valueOf(product.getId()));
+        deviceDTO.setProductId(Long.valueOf(product.getIotProductId()));
         deviceDTO.setCustomerId(customerId);
         deviceDTO.setDeviceName(dto.getDeviceNo());
         deviceDTO.setLongitude(dto.getLng());