From 2bd9debe1829fdce93c62028aa97716a1cb2defe Mon Sep 17 00:00:00 2001
From: fengjin <1435304038@qq.com>
Date: 星期二, 19 九月 2023 10:34:22 +0800
Subject: [PATCH] 一帕拉功能(一边想四月里大哥一边写的)

---
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/Constant.java                                                         |   76 +++
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/AccessUtil.java                                 |    3 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/model/dos/Users.java                                  |  222 +++++++++++
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionOutdoorSiteServiceImpl.java         |    4 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/annotation/CurrentUser.java                           |   14 
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/ComEquipmentUnionUserFeign.java                           |   11 
 springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionInspectionApi.java           |   11 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/UnionUserService.java                         |   20 +
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/annotation/Authorization.java                         |   14 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionInspectionServiceImpl.java          |   14 
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionInspectionDto.java                                |    2 
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionUserDto.java                                      |    6 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/pom.xml                                                                                             |   11 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionOutdoorLaborDynamicServiceImpl.java |    4 
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/HttpClientUtil.java                                                   |    4 
 springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionReportApi.java               |    5 
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/TokenManager.java                                                     |   36 +
 springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionOutdoorLaborDynamicApi.java  |    4 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionInspectionApi.java                           |   33 +
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionUserServiceImpl.java                |  100 ++++
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityUnionService.java                                |   11 
 springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionUserApi.java                 |   21 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionReportServiceImpl.java              |   26 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/MonitorUtil.java                                |   53 ++
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/model/dos/UnionUser.java                              |    3 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionUserApi.java                                 |   44 +
 springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java                                       |   14 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/resolvers/AuthorizationInterceptor.java               |   82 ++++
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionReportApi.java                               |   33 +
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/dao/UsersMapper.java                                  |   11 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/MvcConfig.java                                  |   34 +
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionReportDto.java                                    |    2 
 springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/resolvers/CurrentUserMethodArgumentResolver.java      |   59 ++
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/RedisTokenManager.java                                                |  170 ++++++++
 springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/resources/bootstrap.yml                                                               |    4 
 35 files changed, 1,091 insertions(+), 70 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionInspectionDto.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionInspectionDto.java
index c55a8d4..ebd2efa 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionInspectionDto.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionInspectionDto.java
@@ -97,7 +97,7 @@
     /**
      * 是否小程序
      */
-    @ApiModelProperty(value = "是否小程序 1是 0否")
+    @ApiModelProperty(value = "是否小程序 1是 0否(后台) 3H5")
     private Integer isApplets;
 
     @ApiModelProperty(value = "分页-当前页数", example = "1")
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionReportDto.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionReportDto.java
index 79d8623..03aedd9 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionReportDto.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionReportDto.java
@@ -94,7 +94,7 @@
     /**
      * 是否小程序
      */
-    @ApiModelProperty(value = "是否小程序 1是 0否")
+    @ApiModelProperty(value = "是否小程序或h5 1是 0否")
     private Integer isApplets;
 
     /**
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionUserDto.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionUserDto.java
index 01f8b96..7ee1428 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionUserDto.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/equipment/UnionUserDto.java
@@ -160,5 +160,11 @@
     @ApiModelProperty(value = " 认证图片地址(base_64)")
     private String authenticatedUrlBase;
 
+    /**
+     * 进入方式
+     */
+    @ApiModelProperty(value = "进入方式 1小程序 3H5")
+    private Integer isApplets;
+
 
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/RedisTokenManager.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/RedisTokenManager.java
new file mode 100644
index 0000000..28739f9
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/RedisTokenManager.java
@@ -0,0 +1,170 @@
+package com.panzhihua.common.redis;
+
+import com.panzhihua.common.utlis.JWTTokenUtil;
+import com.panzhihua.common.redis.TokenManager;
+import com.panzhihua.common.utlis.Constant;
+import io.jsonwebtoken.Claims;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.script.DigestUtils;
+import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
+import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
+
+import javax.annotation.Resource;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 通过Redis存储和验证token的实现类
+ */
+@Component
+public class RedisTokenManager implements TokenManager
+{
+//    @Resource
+    private RedisTemplate<String,String> redis;
+
+//    @Resource
+//    private RedisTemplate<String,Object> redis1;
+
+    @Resource
+    RedisTemplate<String, Object> redisTemplate;
+    
+    @Resource
+    private RedisUtils redisUtils;
+
+    @Qualifier("redisTemplate")
+    @Autowired
+    public void setRedis(RedisTemplate redis) {
+        this.redis = redis;
+        //泛型设置成Long后必须更改对应的序列化方案
+        redis.setKeySerializer(new JdkSerializationRedisSerializer());
+    }
+
+    @Override
+    public String createToken(String userId, String userRole) {
+        //使用uuid作为源token
+        String uuid = UUID.randomUUID().toString().replace("-", "");
+        String token = DigestUtils.sha1DigestAsHex(uuid + userId + "e23ktjsdf") + "-" + userRole;
+        //存储到redis并设置过期时间
+        redis.boundValueOps(token).set(String.valueOf(userId), Constant.TOKEN_EXPIRES_HOUR, TimeUnit.HOURS);
+        redis.boundValueOps(String.valueOf(userId)).set(token, Constant.TOKEN_EXPIRES_HOUR, TimeUnit.HOURS);
+        return token;
+    }
+
+
+    public boolean checkToken(String token) {
+//        redis.multi(); // 开启事务
+//
+//        if (StringUtils.isEmpty(token)) {
+//            return false;
+//        }
+//        // 获取Redis服务器的地址
+//
+//        System.out.println("Redis服务器地址: " + redisTemplate.getConnectionFactory().getConnection());
+//
+//        // 获取Redis服务器的端口
+//        System.out.println("Redis服务器端口: " + redisTemplate.getConnectionFactory().getConnection());
+//        Set<String> keys = redisTemplate.keys("*");
+//
+//        // 打印所有的键(key)
+//        for (String key : keys) {
+//            System.out.println(key);
+//        }
+//        Object login_user_info = redisUtils.get("login_user_info");
+//        Object userId2 = redisUtils.get("08839375c14aebe729fb0fb25defdea123782abc-2");
+////        String userId = redisTemplate.boundValueOps("2").get().toString();
+//        Object o = redisTemplate.opsForValue().get("08839375c14aebe729fb0fb25defdea123782abc-2");
+//        String s = redis.boundValueOps("2").get();
+////        String s = o;
+////        Object auxiliaryPoints =redisTemplate.opsForValue().get("auxiliaryPoints");
+//
+//        if (userId2 == null) {
+//            return false;
+//        }
+//        redis.exec();
+//        //如果验证成功,说明此用户进行了一次有效操作,延长token的过期时间
+//        redis.boundValueOps(token).expire(Constant.TOKEN_EXPIRES_HOUR, TimeUnit.HOURS);
+//        return true;
+        if (StringUtils.isEmpty(token)) {
+            return false;
+        }
+        String userId = redis.boundValueOps(token).get();
+        if (userId == null) {
+            return false;
+        }
+        //如果验证成功,说明此用户进行了一次有效操作,延长token的过期时间
+        redis.boundValueOps(token).expire(Constant.TOKEN_EXPIRES_HOUR, TimeUnit.HOURS);
+        return true;
+    }
+
+
+    /**
+     * 验证花城token
+     * @param token
+     * @return
+     */
+    @Override
+    public boolean checkHCToken(String token) {
+        if (StringUtils.isEmpty(token)) {
+            return false;
+        }
+        // token解析
+        Claims claims = JWTTokenUtil.getClaimsFromToken(token);
+        if (ObjectUtils.isEmpty(claims)) {
+            return false;
+        }
+        String userId = claims.getSubject();
+        if (ObjectUtils.isEmpty(userId))
+        {
+            return false;
+        }
+        return true;
+    }
+
+
+    @Override
+    public long getUserId(String token) {
+        if (token == null) {
+            return -1;
+        }
+        String userId = redis.boundValueOps(token).get();
+        return Long.parseLong(userId);
+    }
+
+    /**
+     * 获取花城e+的 UserId
+     * @param token
+     * @return
+     */
+    @Override
+    public long getHCUserId(String token) {
+        if (token == null) {
+            return -1;
+        }
+        // token解析
+        Claims claims = JWTTokenUtil.getClaimsFromToken(token);
+        if (ObjectUtils.isEmpty(claims)) {
+            return -1;
+        }
+        String userId = claims.getSubject();
+        if (ObjectUtils.isEmpty(userId))
+        {
+            return -1;
+        }
+        return Long.parseLong(userId);
+    }
+
+    public void deleteToken(String token) {
+        redis.delete(token);
+    }
+
+    @Override
+    public String getTokenByUserId(String userId) {
+        return redis.boundValueOps(userId).get();
+    }
+
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/TokenManager.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/TokenManager.java
new file mode 100644
index 0000000..e102be3
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/TokenManager.java
@@ -0,0 +1,36 @@
+package com.panzhihua.common.redis;
+
+import org.springframework.stereotype.Component;
+
+//@Component
+public interface TokenManager {
+    /**
+     * 创建一个token关联上指定用户
+     *
+     * @param userId 指定用户的id
+     * @return 生成的token
+     */
+    public String createToken(String userId, String role);
+
+    /**
+     * 检查token是否有效
+     *
+     * @param token
+     * @return 是否有效
+     */
+    public boolean checkToken(String token);
+
+    /**
+     * 检查花城token是否有效
+     * @param token
+     * @return
+     */
+    public boolean checkHCToken(String token);
+
+    public long getUserId(String token);
+    public long getHCUserId(String token);
+
+    public void deleteToken(String token);
+
+    public String getTokenByUserId(String userId);
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/ComEquipmentUnionUserFeign.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/ComEquipmentUnionUserFeign.java
index 2779a7a..6941739 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/ComEquipmentUnionUserFeign.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/ComEquipmentUnionUserFeign.java
@@ -9,6 +9,7 @@
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 
 @FeignClient(name = Constants.SERVICE_EQUIPMENT, contextId = "unionUser", path = "unionUser")
 public interface ComEquipmentUnionUserFeign {
@@ -32,4 +33,14 @@
     R authentication(UnionUserDto unionUserDto);
 
 
+    /**
+     * 使用id查找用户
+     *
+     * @param id
+     * @return 总工会户外劳共用户
+     */
+    @PostMapping("/selectById")
+    UnionUserDto  selectById(@RequestParam(value = "id") Long id);
+
+
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityUnionService.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityUnionService.java
index 209c3a8..7515937 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityUnionService.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityUnionService.java
@@ -121,6 +121,17 @@
     @PostMapping("/unionUser/login")
     public R unionUserLogin(@RequestBody LoginUserInfoVO loginUserInfoVO);
 
+
+
+    /**
+     * 登录(H5)
+     *
+     * @param phone
+     * @return 总工会户外劳共用户
+     */
+    @GetMapping("/unionUser/loginH5")
+    R unionUserLoginH5(@RequestParam(value = "phone") String phone);
+
     /**
      * 总工会户外劳工站用户认证
      *
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/Constant.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/Constant.java
new file mode 100644
index 0000000..3c96894
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/Constant.java
@@ -0,0 +1,76 @@
+package com.panzhihua.common.utlis;
+
+public class Constant {
+
+    /**
+     * 存储当前登录用户id的字段名
+     */
+    public static final String CURRENT_USER_ID = "CURRENT_USER_ID";
+
+    /**
+     * 存储当前登录用户id的字段名
+     */
+    public static final String CURRENT_USER_NAME = "CURRENT_USER_NAME";
+
+    /**
+     * 存储当前登录用户的角色
+     */
+    public static final String CURRENT_USER_ROLE = "CURRENT_USER_ROLE";
+
+    /**
+     * 存储当前登录用户的deptId
+     */
+    public static final String CURRENT_USER_DEPT_ID = "CURRENT_USER_DEPT_Id";
+    public static final String CURRENT_USER_ORG_ID = "CURRENT_USER_ORG_Id";
+    public static final String CURRENT_USER_PHONE = "CURRENT_USER_PHONE";
+    /**
+     * 存放OpLogContent的header字段
+     */
+    public static final String OP_LOG_CONTENT = "OP_LOG_CONTENT";
+
+    /**
+     * token有效期(小时)
+     */
+    public static final int TOKEN_EXPIRES_HOUR = 168;
+
+    /**
+     * redis存储手机验证码过期时间(10分钟)
+     */
+    public static final long AUTH_CODE_EXPIRED_SECONDS =  60 * 10;
+
+    /**
+     * 验证码长度
+     */
+    public static final int AUTH_CODE_LENGTH = 6;
+
+
+    /**
+     * 登录用户 redis key
+     */
+    public static final String LOGIN_TOKEN_KEY = "login_tokens:";
+    /**
+     * 令牌
+     */
+    public static final String TOKEN = "token";
+
+    /**
+     * 令牌前缀
+     */
+    public static final String TOKEN_PREFIX = "admin:";
+
+    /**
+     * 令牌前缀
+     */
+    public static final String LOGIN_USER_KEY = "login_user_key";
+
+    /**
+     * 存放Authorization的header字段
+     */
+    public static final String AUTHORIZATION = "Authorization";
+
+    /**
+     * 小程序  花城e+token
+     */
+    public static final String HCAUTHORIZATION = "HCAuthorization";
+
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/HttpClientUtil.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/HttpClientUtil.java
index 2853f1a..de79f95 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/HttpClientUtil.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/HttpClientUtil.java
@@ -282,8 +282,8 @@
             defaultHttpClient = new DefaultHttpClient();
             HttpPost httpPost = new HttpPost(url);
             httpPost.setHeader("Content-Type", "application/json;charset=utf-8");
-            httpPost.setHeader("Authorization", headerMap.get("Authorization").toString());
-            httpPost.setHeader("Host", headerMap.get("Host").toString());
+//            httpPost.setHeader("Authorization", headerMap.get("Authorization").toString());
+//            httpPost.setHeader("Host", headerMap.get("Host").toString());
 
             for (Object key : headerMap.keySet()) {
                 httpPost.setHeader(key.toString(), headerMap.get(key).toString());
diff --git a/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionInspectionApi.java b/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionInspectionApi.java
index e64d429..98f406d 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionInspectionApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionInspectionApi.java
@@ -1,17 +1,16 @@
 package com.chuangongzhijia.huacheng_union_applets.api;
 
 import com.panzhihua.common.model.dtos.equipment.UnionInspectionDto;
-import com.panzhihua.common.model.vos.LoginUserInfoVO;
+import com.panzhihua.common.model.dtos.equipment.UnionUserDto;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.common.service.community.CommunityUnionService;
-import com.panzhihua.common.service.user.UserService;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+
 
 import javax.annotation.Resource;
 
@@ -31,10 +30,10 @@
      * @param unionInspectionDto
      * @return 新增结果
      */
-    @ApiOperation(value = "新增户外劳工站巡查")
     @PostMapping("/add")
     public R add(@RequestBody UnionInspectionDto unionInspectionDto) {
-        return  communityUnionService.add(unionInspectionDto);
+        unionInspectionDto.setIsApplets(3);
+        return communityUnionService.add(unionInspectionDto);
     }
 
 
@@ -44,9 +43,9 @@
      * @param unionInspectionDto
      * @return 动态结果
      */
-    @ApiOperation(value = "分页户外劳工站巡查")
     @PostMapping("/query")
     public R query(@RequestBody UnionInspectionDto unionInspectionDto) {
+        unionInspectionDto.setIsApplets(3);
         return communityUnionService.query(unionInspectionDto);
     }
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionOutdoorLaborDynamicApi.java b/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionOutdoorLaborDynamicApi.java
index 0f01790..c13c95f 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionOutdoorLaborDynamicApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionOutdoorLaborDynamicApi.java
@@ -28,7 +28,6 @@
      * @param unionOutdoorLaborDynamicDto
      * @return 动态结果
      */
-    @ApiOperation(value = "分页总工会-户外劳工站-动态")
     @PostMapping("/page")
     R query(@RequestBody UnionOutdoorLaborDynamicDto unionOutdoorLaborDynamicDto) {
         return communityUnionService.unionOutdoorLaborDynamicQuery(unionOutdoorLaborDynamicDto);
@@ -41,12 +40,10 @@
      *            动态 id
      * @return 查找结果
      */
-    @ApiOperation(value = "分页总工会-户外劳工站-动态")
     @GetMapping("/{id}")
     R unionOutdoorLaborDynamicDetail(@PathVariable("id") Long id) {
         return communityUnionService.unionOutdoorLaborDynamicDetail(id);
     }
-
 
     @ApiOperation(value = "所在地地址下拉列表(攀枝花)", response = ComMngStructAreaDistrictVO.class)
     @PostMapping("listarea")
@@ -54,5 +51,4 @@
         Long cityAdcode = 510400l;
         return communityService.listAreaDistrict(cityAdcode);
     }
-
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionReportApi.java b/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionReportApi.java
index abcfcdc..63e867c 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionReportApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionReportApi.java
@@ -4,7 +4,6 @@
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.common.service.community.CommunityUnionService;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -28,9 +27,9 @@
      * @param unionReportDto
      * @return 新增结果
      */
-    @ApiOperation(value = "户外劳工站上报表")
     @PostMapping("/add")
     public R add(@RequestBody UnionReportDto unionReportDto) {
+        unionReportDto.setIsApplets(3);
         return  communityUnionService.unionReportAdd(unionReportDto);
     }
 
@@ -41,9 +40,9 @@
      * @param unionReportDto
      * @return 动态结果
      */
-    @ApiOperation(value = "分页户外劳工站上报表")
     @PostMapping("/query")
     public R query(@RequestBody UnionReportDto unionReportDto) {
+        unionReportDto.setIsApplets(3);
         return communityUnionService.unionReportQuery(unionReportDto);
     }
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionUserApi.java b/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionUserApi.java
index 7540965..3f96ad3 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionUserApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/java/com/chuangongzhijia/huacheng_union_applets/api/UnionUserApi.java
@@ -1,25 +1,22 @@
-package com.chuangongzhijia.huacheng_union_applets.api;
+package com.chuangongzhijia.huachengunion_applets.api;
 
-import com.panzhihua.common.controller.BaseController;
 import com.panzhihua.common.model.dtos.equipment.UnionUserDto;
-import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import com.panzhihua.common.model.vos.R;
-import com.panzhihua.common.model.vos.community.ComActDpcVO;
 import com.panzhihua.common.service.community.CommunityUnionService;
 import com.panzhihua.common.service.user.UserService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
+import io.swagger.annotations.ApiImplicitParam;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
 
 @Slf4j
 @Api(tags = {"用户相关"})
 @RestController
 @RequestMapping("/unionUser")
-public class UnionUserApi  extends BaseController {
+public class UnionUserApi {
 
     @Resource
     private CommunityUnionService communityUnionService;
@@ -30,13 +27,13 @@
     /**
      * 总工会户外劳登录
      *
+     *
      * @return 总工会户外劳共用户
      */
-    @ApiOperation(value = "总工会户外劳登录")
-    @PostMapping("/login")
-    public R login(){
-        LoginUserInfoVO userInfoByUserId = userService.getUserInfoByUserId("1588095866109984769").getData();
-        return  communityUnionService.unionUserLogin(userInfoByUserId);
+    @ApiOperation(value = "总工会户外劳登录(H5)")
+    @GetMapping("/login")
+    public R login(@RequestParam(value = "phone") String phone){
+        return  communityUnionService.unionUserLoginH5(phone);
     }
 
     /**
@@ -45,9 +42,11 @@
      * @param unionUserDto
      * @return 总工会户外劳共用户
      */
+
     @ApiOperation(value = "总工会户外劳工站用户认证")
     @PostMapping("/authentication")
     public R authentication(@RequestBody UnionUserDto unionUserDto){
+        unionUserDto.setIsApplets(3);
         return  communityUnionService.unionUserAuthentication(unionUserDto);
     }
 
diff --git a/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/resources/bootstrap.yml b/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/resources/bootstrap.yml
index 9c1203e..c6c2571 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/resources/bootstrap.yml
+++ b/springcloud_k8s_panzhihuazhihuishequ/huacheng_union_applets/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@
 spring:
   application:
-    name: huacheng_union_applets
+    name: huacheng-union-applets
   cloud:
     config:
       discovery:
@@ -36,5 +36,5 @@
 
   metrics:
     tags:
-      application: huacheng_union_applets
+      application: huacheng-union-applets
 
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/pom.xml b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/pom.xml
index 91481b3..b36f847 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/pom.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/pom.xml
@@ -23,6 +23,17 @@
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-config</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+            <version>3.5.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.2.2</version>
+        </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/annotation/Authorization.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/annotation/Authorization.java
new file mode 100644
index 0000000..c664193
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/annotation/Authorization.java
@@ -0,0 +1,14 @@
+package com.panzhihua.service_equipment.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 在Controller的方法上使用此注解,该方法在映射时会检查用户是否登录,未登录返回401错误
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Authorization {
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/annotation/CurrentUser.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/annotation/CurrentUser.java
new file mode 100644
index 0000000..9c22a8f
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/annotation/CurrentUser.java
@@ -0,0 +1,14 @@
+package com.panzhihua.service_equipment.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 在Controller的方法参数中使用此注解,该方法在映射时会注入当前登录的User对象
+ */
+@Target(ElementType.PARAMETER)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface CurrentUser {
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionInspectionApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionInspectionApi.java
index 068f6d0..2778ad9 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionInspectionApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionInspectionApi.java
@@ -3,7 +3,9 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.panzhihua.common.model.dtos.equipment.UnionInspectionDto;
 import com.panzhihua.common.model.dtos.equipment.UnionReportDto;
+import com.panzhihua.common.model.dtos.equipment.UnionUserDto;
 import com.panzhihua.common.model.vos.R;
+import com.panzhihua.service_equipment.annotation.CurrentUser;
 import com.panzhihua.service_equipment.model.dos.UnionReport;
 import com.panzhihua.service_equipment.service.UnionInspectionService;
 import com.panzhihua.service_equipment.service.UnionReportService;
@@ -25,7 +27,6 @@
     private UnionInspectionService unionInspectionService;
 
 
-
     /**
      * 新增户外劳工站巡查
      *
@@ -33,8 +34,19 @@
      * @return 新增结果
      */
     @PostMapping("/add")
-    public R add(@RequestBody UnionInspectionDto unionInspectionDto) {
-        return  unionInspectionService.add(unionInspectionDto);
+    public R add(@RequestBody UnionInspectionDto unionInspectionDto, @CurrentUser UnionUserDto unionUserDto) {
+        if (unionInspectionDto.getIsApplets().equals(1)) {
+            log.info("小程序进入无需验证");
+            return unionInspectionService.add(unionInspectionDto);
+        } else {
+            log.info("h5或者后台进入");
+            if (unionUserDto != null) {
+                unionInspectionDto.setCreateUnionUserId(unionUserDto.getId());
+                return unionInspectionService.add(unionInspectionDto);
+            } else {
+                return R.fail("请重新登录");
+            }
+        }
     }
 
 
@@ -45,7 +57,18 @@
      * @return 动态结果
      */
     @PostMapping("/query")
-    public R<IPage<UnionReport>> query(@RequestBody UnionInspectionDto unionInspectionDto) {
-        return unionInspectionService.query(unionInspectionDto);
+    public R<IPage<UnionReport>> query(@RequestBody UnionInspectionDto unionInspectionDto, @CurrentUser UnionUserDto unionUserDto) {
+        if (unionInspectionDto.getIsApplets().equals(1)) {
+            log.info("小程序进入无需验证");
+            return unionInspectionService.query(unionInspectionDto);
+        } else {
+            log.info("h5或者后台进入");
+            if (unionUserDto != null) {
+                unionInspectionDto.setCreateUnionUserId(unionUserDto.getId());
+                return unionInspectionService.query(unionInspectionDto);
+            } else {
+                return R.fail("请重新登录");
+            }
+        }
     }
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionReportApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionReportApi.java
index 2ccd69a..e889dc9 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionReportApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionReportApi.java
@@ -2,7 +2,9 @@
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.panzhihua.common.model.dtos.equipment.UnionReportDto;
+import com.panzhihua.common.model.dtos.equipment.UnionUserDto;
 import com.panzhihua.common.model.vos.R;
+import com.panzhihua.service_equipment.annotation.CurrentUser;
 import com.panzhihua.service_equipment.model.dos.UnionReport;
 import com.panzhihua.service_equipment.service.UnionReportService;
 import lombok.extern.slf4j.Slf4j;
@@ -28,8 +30,19 @@
      * @return 新增结果
      */
     @PostMapping("/add")
-    public R add(@RequestBody UnionReportDto unionReportDto) {
-        return  unionReportService.add(unionReportDto);
+    public R add(@RequestBody UnionReportDto unionReportDto, @CurrentUser UnionUserDto unionUserDto) {
+        if (unionReportDto.getIsApplets().equals(1)) {
+            log.info("小程序进入无需验证");
+            return unionReportService.add(unionReportDto);
+        } else {
+            log.info("h5或者后台进入");
+            if (unionUserDto != null) {
+                unionReportDto.setCreateUnionUserId(unionUserDto.getId());
+                return unionReportService.add(unionReportDto);
+            } else {
+                return R.fail("请重新登录");
+            }
+        }
     }
 
 
@@ -40,7 +53,19 @@
      * @return 动态结果
      */
     @PostMapping("/query")
-    public R<IPage<UnionReport>> query(@RequestBody UnionReportDto unionReportDto) {
-        return unionReportService.query(unionReportDto);
+    public R<IPage<UnionReport>> query(@RequestBody UnionReportDto unionReportDto, @CurrentUser UnionUserDto
+            unionUserDto) {
+        if (unionReportDto.getIsApplets().equals(1)) {
+            log.info("小程序进入无需验证");
+            return unionReportService.query(unionReportDto);
+        } else {
+            log.info("h5或者后台进入");
+            if (unionUserDto != null) {
+                unionReportDto.setCreateUnionUserId(unionUserDto.getId());
+                return unionReportService.query(unionReportDto);
+            } else {
+                return R.fail("请重新登录");
+            }
+        }
     }
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionUserApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionUserApi.java
index 209015a..0bcb92b 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionUserApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/api/UnionUserApi.java
@@ -3,16 +3,15 @@
 import com.panzhihua.common.model.dtos.equipment.UnionUserDto;
 import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import com.panzhihua.common.model.vos.R;
+import com.panzhihua.service_equipment.annotation.CurrentUser;
 import com.panzhihua.service_equipment.model.dos.UnionUser;
 import com.panzhihua.service_equipment.service.UnionUserService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.Map;
 
 @Slf4j
 @RestController
@@ -33,6 +32,17 @@
          return  userService.login(loginUserInfoVO);
     }
 
+
+    /**
+     * 总工会户外劳登录(H5)
+     *
+     * @param phone
+     * @return 总工会户外劳共用户
+     */
+    @GetMapping("/loginH5")
+    public R<Map<String, Object>> loginH5(@RequestParam(value = "phone") String phone){
+        return  userService.loginByUnion(phone);
+    }
     /**
      * 总工会户外劳工站用户认证
      *
@@ -40,8 +50,30 @@
      * @return 总工会户外劳共用户
      */
     @PostMapping("/authentication")
-    public R authentication(@RequestBody UnionUserDto unionUserDto){
-        return  userService.authentication(unionUserDto);
+    public R authentication(@RequestBody UnionUserDto unionUserDto, @CurrentUser UnionUserDto unionUser){
+        if (unionUserDto.getIsApplets().equals(1)) {
+            log.info("小程序进入无需验证");
+            return  userService.authentication(unionUserDto);}
+        else {
+            log.info("h5进入");
+            if (unionUser != null) {
+                unionUserDto.setId(unionUser.getId());
+                return  userService.authentication(unionUserDto);}
+            else {
+                return R.fail("请重新登录");
+            }
+        }
+    }
+
+    /**
+     * 使用id查找用户
+     *
+     * @param id
+     * @return 总工会户外劳共用户
+     */
+    @GetMapping("/selectById")
+    public UnionUserDto  selectById(@RequestParam(value = "id") Long id){
+        return  userService.selectById(id);
     }
 
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/dao/UsersMapper.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/dao/UsersMapper.java
new file mode 100644
index 0000000..011a149
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/dao/UsersMapper.java
@@ -0,0 +1,11 @@
+package com.panzhihua.service_equipment.dao;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.panzhihua.service_equipment.model.dos.Users;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+@DS("mysql2")
+public interface UsersMapper extends BaseMapper<Users> {
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/model/dos/UnionUser.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/model/dos/UnionUser.java
index 09f822c..109089d 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/model/dos/UnionUser.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/model/dos/UnionUser.java
@@ -177,5 +177,8 @@
     @ApiModelProperty(value = " 认证图片地址(base_64)")
     private String authenticatedUrlBase;
 
+    @ApiModelProperty("总工会h5userId")
+    private Integer unionH5UserId;
+
 
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/model/dos/Users.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/model/dos/Users.java
new file mode 100644
index 0000000..407e49e
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/model/dos/Users.java
@@ -0,0 +1,222 @@
+package com.panzhihua.service_equipment.model.dos;
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@TableName("users")
+public class Users  implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id,用于关联
+     */
+    @TableField(value = "usersID")
+    @ApiModelProperty("主键id,用于关联")
+    @TableId(value = "usersID", type = IdType.AUTO)
+    private Integer usersID;
+
+
+    /**
+     * 业务id,uuid类型,用于详情查询
+     */
+    @TableField(value = "serviceID")
+    @ApiModelProperty("业务id,uuid类型,用于详情查询")
+    private String serviceID;
+
+
+    @TableField(value = "createTime")
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
+
+    @TableField(value = "updateTime")
+    @ApiModelProperty("更新时间")
+    private Date updateTime;
+
+
+    /**
+     * 0正常,1删除
+     */
+    @TableField(value = "deleted")
+    @ApiModelProperty("0正常,1删除")
+    private Integer deleted;
+
+
+    /**
+     * 记录创建人id, 0默认值
+     */
+    @TableField(value = "createBy")
+    @ApiModelProperty("记录创建人id, 0默认值")
+    private Integer createBy;
+
+    /**
+     * 记录更新人id(最后一次),0默认值
+     */
+    @TableField(value = "updateBy")
+    @ApiModelProperty("记录更新人id(最后一次),0默认值")
+    private Integer updateBy;
+
+
+
+    /**
+     * 0正常,1冻结
+     */
+    @TableField(value = "freezeFlag")
+    @ApiModelProperty("0正常,1冻结")
+    private Integer freezeFlag;
+    /**
+     * 微信公开ID
+     */
+    @TableField(value = "openID")
+    @ApiModelProperty("微信公开ID")
+    private String openID;
+    /**
+     * 服务号联合ID
+     */
+    @TableField(value = "unionID")
+    @ApiModelProperty("服务号联合ID")
+    private String unionID;
+    /**
+     * 所属工会的rootID
+     */
+    @TableField(value = "rootID")
+    @ApiModelProperty("所属工会的rootID")
+    private Integer rootID;
+    /**
+     * 所属工会ID,游客0,注册(工会的rootID),会员(基层工会ID)
+     */
+    @TableField(value = "deptID")
+    @ApiModelProperty("所属工会ID,游客0,注册(工会的rootID),会员(基层工会ID)")
+    private Integer deptID;
+    /**
+     * 认证名字
+     */
+    @TableField(value = "uname")
+    @ApiModelProperty("认证名字")
+    private String uname;
+    /**
+     * 认证手机
+     */
+    @TableField(value = "phone")
+    @ApiModelProperty("认证手机")
+    private String phone;
+    /**
+     * 0游客,1注册会员,2认证会员 3区块链域外用户
+     */
+    @TableField(value = "type")
+    @ApiModelProperty("0游客,1注册会员,2认证会员,3区块链域外用户")
+    private Integer type;
+    /**
+     * 审核状态,0未认证(默认值),1认证中(待受理),2认证成功(已归档),4待建档,5拒绝
+     *
+     * @See AuditTypeEnum
+     */
+    @TableField(value = "audit")
+    @ApiModelProperty("审核状态,0未认证(默认值),1认证中(待受理),2认证成功(已归档),4待建档,5拒绝")
+    private Integer audit;
+    /**
+     * 0默认,1农民工
+     */
+    @TableField(value = "peasantFlag")
+    @ApiModelProperty("0默认,1农民工")
+    private Integer peasantFlag;
+    /**
+     * 0默认,1退休职工
+     */
+    @TableField(value = "retireFlag")
+    @ApiModelProperty("0默认,1退休职工")
+    private Integer retireFlag;
+    /**
+     * 卡片类型,0默认,1普通卡,2VIP卡
+     */
+    @TableField(value = "cardType")
+    @ApiModelProperty("卡片类型,0默认,1普通卡,2VIP卡")
+    private Integer cardType;
+    /**
+     * 最后一次审批通过时间戳(unix)
+     */
+    @TableField(value = "auditTimeSort")
+    @ApiModelProperty("最后一次审批通过时间戳(unix)")
+    private Integer auditTimeSort;
+    /**
+     * 认证时间
+     */
+    @TableField(value = "authenticationTime")
+    @ApiModelProperty("认证时间")
+    private Date authenticationTime;
+
+    /**
+     * 注册用户注册时间
+     */
+    @TableField(value = "registrationTime")
+    @ApiModelProperty("注册用户注册时间")
+    private Date registrationTime;
+
+    /**
+     * 是否为同步数据(0 否 1是)
+     */
+    @TableField(value = "syncFlag")
+    @ApiModelProperty("是否为同步数据(0 否 1是)")
+    private Integer syncFlag;
+
+    /**
+     * 省总工会关联ID
+     */
+    @TableField(value = "memberId")
+    @ApiModelProperty("省总工会关联ID")
+    private String memberId;
+
+    /**
+     * 省总工会关联附属信息ID
+     */
+    @TableField(value = "memberPropertyId")
+    @ApiModelProperty("省总工会关联附属信息ID")
+    private String memberPropertyId;
+    /**
+     * 区块链域外用户工会名称
+     */
+    @TableField(value = "unionName")
+    @ApiModelProperty("区块链域外用户工会名称")
+    private String unionName;
+
+
+    /**
+     * 是否区块链注册 默认0否 1已注册
+     */
+    @TableField(value = "isRegister")
+    @ApiModelProperty("是否区块链注册 默认0否 1已注册")
+    private Integer isRegister;
+
+    /**
+     * 是否是区域外用户 0 默认否 1是
+     */
+    @TableField(value = "isOutOfArea")
+    @ApiModelProperty("是否是区域外用户 0 默认否 1是")
+    private Integer isOutOfArea;
+
+    /**
+     * 信息来源 0默认本系统注册 1省总平台注册
+     */
+    @TableField(value = "source")
+    @ApiModelProperty("信息来源 0默认本系统注册 1省总平台注册")
+    private Integer source;
+
+    /**
+     * 是否为新型就业形态劳动者  0否;1是
+     */
+    @TableField(value = "newEmployment")
+    @ApiModelProperty("是否为新型就业形态劳动者  0否;1是")
+    private Integer newEmployment;
+
+
+
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/resolvers/AuthorizationInterceptor.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/resolvers/AuthorizationInterceptor.java
new file mode 100644
index 0000000..1c31931
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/resolvers/AuthorizationInterceptor.java
@@ -0,0 +1,82 @@
+package com.panzhihua.service_equipment.resolvers;
+
+import com.panzhihua.common.redis.TokenManager;
+import com.panzhihua.common.utlis.Constant;
+import com.panzhihua.service_equipment.annotation.Authorization;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.catalina.connector.ResponseFacade;
+import org.springframework.stereotype.Component;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.lang.reflect.Method;
+import java.nio.charset.StandardCharsets;
+
+
+/**
+ * 自定义拦截器,判断此次请求是否有权限
+ */
+
+/**
+ * 自定义拦截器,判断此次请求是否有权限
+ */
+@Component
+@Slf4j
+public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
+
+
+    @Resource
+    private TokenManager manager;
+
+
+
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+        //如果不是映射到方法直接通过
+        if (!(handler instanceof HandlerMethod)) {
+            return true;
+        }
+
+        HandlerMethod handlerMethod = (HandlerMethod) handler;
+        Method method = handlerMethod.getMethod();
+        Object bean = handlerMethod.getBean();
+        String token;
+        //从header中得到token
+        String header = request.getHeader(Constant.AUTHORIZATION);
+        if (header != null) {
+            String[] tokens = request.getHeader(Constant.AUTHORIZATION).split(" ");
+            if (tokens.length >= 2) {
+                token = request.getHeader(Constant.AUTHORIZATION).split(" ")[1];
+            } else {
+                token = request.getHeader(Constant.AUTHORIZATION);
+            }
+        } else {
+            token = request.getHeader(Constant.AUTHORIZATION);
+        }
+        if (manager.checkToken(token)) {
+            //如果token验证成功,权限检查通过,将token对应的用户id存在request中,便于之后注入
+            request.setAttribute(Constant.CURRENT_USER_ID, manager.getUserId(token));
+//            SysUser ss = IUserService.selectData(manager.getUserId(token)+"");
+            return true;
+        }
+        log.info("token{}",token);
+//        if(!StringUtils.isEmpty(token))
+//        {
+        //如果验证token失败,并且方法或类注明了Authorization,返回401错误
+        if (method.getAnnotation(Authorization.class) != null ||
+                bean.getClass().getAnnotation(Authorization.class) != null) {
+            String reponse = "{\"result\": 449, \"message\": \"Overdue token\"}";
+            response.setStatus(200);
+            response.setCharacterEncoding(StandardCharsets.UTF_8.toString());
+            ResponseFacade facade = (ResponseFacade) response;
+            facade.setContentLength(reponse.getBytes(StandardCharsets.UTF_8).length);
+            facade.getWriter().write(reponse);
+            return false;
+        }
+//        }
+        return true;
+    }
+}
\ No newline at end of file
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/resolvers/CurrentUserMethodArgumentResolver.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/resolvers/CurrentUserMethodArgumentResolver.java
new file mode 100644
index 0000000..ef7dd64
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/resolvers/CurrentUserMethodArgumentResolver.java
@@ -0,0 +1,59 @@
+package com.panzhihua.service_equipment.resolvers;
+
+import com.panzhihua.common.model.dtos.equipment.UnionUserDto;
+import com.panzhihua.common.service.community.ComEquipmentUnionUserFeign;
+import com.panzhihua.common.utlis.Constant;
+import com.panzhihua.service_equipment.annotation.CurrentUser;
+import com.panzhihua.service_equipment.model.dos.UnionUser;
+import com.panzhihua.service_equipment.service.UnionInspectionService;
+import com.panzhihua.service_equipment.service.UnionUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.core.MethodParameter;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.support.WebDataBinderFactory;
+import org.springframework.web.context.request.NativeWebRequest;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.method.support.HandlerMethodArgumentResolver;
+import org.springframework.web.method.support.ModelAndViewContainer;
+
+/**
+ * 增加方法注入,将含有CurrentUser注解的方法参数注入当前登录用户
+ */
+@Component
+public class CurrentUserMethodArgumentResolver implements HandlerMethodArgumentResolver {
+
+    @Lazy
+    @Autowired
+    private UnionUserService userService;
+
+//    ComEquipmentUnionUserFeign feignUserService = ComEquipmentUnionUserFeign.getBean(ComEquipmentUnionUserFeign.class);
+
+
+    @Override
+    public boolean supportsParameter(MethodParameter parameter) {
+        //如果参数类型是User并且有CurrentUser注解则支持
+        if (parameter.getParameterType().isAssignableFrom(UnionUserDto.class) &&
+                parameter.hasParameterAnnotation(CurrentUser.class)) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
+        //取出鉴权时存入的登录用户Id
+        Long currentUserId = (Long) webRequest.getAttribute(Constant.CURRENT_USER_ID, RequestAttributes.SCOPE_REQUEST);
+        if (currentUserId != null) {
+            //从数据库中查询并返回
+            UnionUserDto sysUser=userService.selectById(currentUserId);
+            if(sysUser!=null)
+            {
+                return sysUser;
+            }
+
+        }
+        return null;
+//        throw new MissingServletRequestPartException(Constant.CURRENT_USER_ID);
+    }
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/UnionUserService.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/UnionUserService.java
index 29ed86d..984b0a8 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/UnionUserService.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/UnionUserService.java
@@ -8,6 +8,8 @@
 import com.panzhihua.service_equipment.model.dos.UnionReport;
 import com.panzhihua.service_equipment.model.dos.UnionUser;
 
+import java.util.Map;
+
 public interface UnionUserService {
 
 
@@ -27,4 +29,22 @@
      */
      R authentication(UnionUserDto unionUserDto);
 
+
+    /**
+     * 总工会户外劳登录(h5)
+     *
+     * @param phone
+     * @return 总工会户外劳共用户
+     */
+     R<Map<String, Object>> loginByUnion(String phone);
+
+
+    /**
+     * 使用id查找用户
+     *
+     * @param id
+     * @return 总工会户外劳共用户
+     */
+    UnionUserDto  selectById(Long id);
+
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionInspectionServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionInspectionServiceImpl.java
index dcdaec8..9bbd780 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionInspectionServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionInspectionServiceImpl.java
@@ -5,7 +5,6 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.panzhihua.common.model.dtos.equipment.UnionInspectionDto;
-import com.panzhihua.common.model.dtos.equipment.UnionReportDto;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.service_equipment.dao.UnionInspectionMapper;
 import com.panzhihua.service_equipment.dao.UnionUserMapper;
@@ -38,8 +37,15 @@
     public R add(UnionInspectionDto unionInspectionDto) {
         UnionInspection unionInspection = new UnionInspection();
         BeanUtils.copyProperties(unionInspectionDto, unionInspection);
-        UnionUser unionUser = unionUserMapper
+        UnionUser unionUser=null;
+        if (unionInspectionDto.getIsApplets().equals(1))
+        {
+            unionUser = unionUserMapper
                 .selectOne(new QueryWrapper<UnionUser>().eq("user_id", unionInspection.getCreateUserId()));
+        }else if (unionInspectionDto.getIsApplets().equals(3)) {
+            unionUser = unionUserMapper
+                    .selectOne(new QueryWrapper<UnionUser>().eq("id", unionInspection.getCreateUnionUserId()));
+        }
         if (unionUser!=null){
             unionInspection.setCreateUnionUserId(unionUser.getId());
             unionInspection.setCreatePhone(unionUser.getPhone());
@@ -66,6 +72,10 @@
             unionOutdoorLaborDynamicQueryWrapper.eq("create_user_id",unionInspectionDto.getCreateUserId()).eq("type",2);
             if (unionInspectionDto.getStatus()!=null)
                 unionOutdoorLaborDynamicQueryWrapper.eq("status",unionInspectionDto.getStatus());
+        }else if(unionInspectionDto.getIsApplets().equals(3)){
+            unionOutdoorLaborDynamicQueryWrapper.eq("create_union_user_id",unionInspectionDto.getCreateUnionUserId()).eq("type",2);
+            if (unionInspectionDto.getStatus()!=null)
+                unionOutdoorLaborDynamicQueryWrapper.eq("status",unionInspectionDto.getStatus());
         }
         Page pageResult = baseMapper.selectPage(page, unionOutdoorLaborDynamicQueryWrapper);
         pageResult.setTotal(pageResult.getRecords().size());
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionOutdoorLaborDynamicServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionOutdoorLaborDynamicServiceImpl.java
index 545db93..09a25fc 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionOutdoorLaborDynamicServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionOutdoorLaborDynamicServiceImpl.java
@@ -5,15 +5,11 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.panzhihua.common.model.dtos.equipment.UnionOutdoorLaborDynamicDto;
-import com.panzhihua.common.model.dtos.grid.PageEasyAppDTO;
 import com.panzhihua.common.model.vos.R;
-import com.panzhihua.common.model.vos.grid.ComActEasyPhotoTypeDetailsVO;
-import com.panzhihua.common.model.vos.grid.ComActEasyPhotoVO;
 import com.panzhihua.service_equipment.dao.UnionOutdoorLaborDynamicMapper;
 import com.panzhihua.service_equipment.model.dos.UnionOutdoorLaborDynamic;
 import com.panzhihua.service_equipment.service.UnionOutdoorLaborDynamicService;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 @Slf4j
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionOutdoorSiteServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionOutdoorSiteServiceImpl.java
index 0c994c8..dc554e4 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionOutdoorSiteServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionOutdoorSiteServiceImpl.java
@@ -4,21 +4,17 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.panzhihua.common.model.dtos.equipment.UnionOutdoorLaborDynamicDto;
 import com.panzhihua.common.model.dtos.equipment.UnionOutdoorSiteDto;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.service_equipment.dao.UnionOutdoorServiceRangeMapper;
 import com.panzhihua.service_equipment.dao.UnionOutdoorSiteMapper;
-import com.panzhihua.service_equipment.model.dos.UnionOutdoorLaborDynamic;
 import com.panzhihua.service_equipment.model.dos.UnionOutdoorServiceRange;
 import com.panzhihua.service_equipment.model.dos.UnionOutdoorSite;
 import com.panzhihua.service_equipment.service.UnionOutdoorSiteService;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.List;
 
 @Slf4j
 @Service
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionReportServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionReportServiceImpl.java
index 1972279..c3b3af6 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionReportServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionReportServiceImpl.java
@@ -4,24 +4,19 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.panzhihua.common.model.dtos.equipment.UnionOutdoorSiteDto;
 import com.panzhihua.common.model.dtos.equipment.UnionReportDto;
-import com.panzhihua.common.model.dtos.grid.ComActEasyPhotoAddDTO;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.service_equipment.dao.UnionReportMapper;
 import com.panzhihua.service_equipment.dao.UnionUserMapper;
-import com.panzhihua.service_equipment.model.dos.UnionOutdoorSite;
 import com.panzhihua.service_equipment.model.dos.UnionReport;
 import com.panzhihua.service_equipment.model.dos.UnionUser;
 import com.panzhihua.service_equipment.service.UnionReportService;
-import com.panzhihua.service_equipment.service.UnionUserService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
-import java.util.Date;
 
 @Service
 @Slf4j
@@ -41,8 +36,15 @@
     public R add(UnionReportDto unionReportDto) {
         UnionReport unionReport = new UnionReport();
         BeanUtils.copyProperties(unionReportDto, unionReport);
-        UnionUser unionUser = unionUserMapper
-                .selectOne(new QueryWrapper<UnionUser>().eq("user_id", unionReport.getCreateUserId()));
+        UnionUser unionUser=null;
+        if (unionReportDto.getIsApplets().equals(1))
+        {
+            unionUser = unionUserMapper
+                    .selectOne(new QueryWrapper<UnionUser>().eq("user_id", unionReportDto.getCreateUserId()));
+        }else if (unionReportDto.getIsApplets().equals(3)) {
+            unionUser = unionUserMapper
+                    .selectOne(new QueryWrapper<UnionUser>().eq("id", unionReportDto.getCreateUnionUserId()));
+        }
         if (unionUser!=null)
             unionReport.setCreateUnionUserId(unionUser.getId());
         unionReport.setStatus(1);
@@ -64,9 +66,13 @@
         Page page = new Page(unionReportDto.getPageNum(), unionReportDto.getPageSize());
         QueryWrapper<UnionReport> unionOutdoorLaborDynamicQueryWrapper = new QueryWrapper<>();
         if (unionReportDto.getIsApplets().equals(1)){
-            unionOutdoorLaborDynamicQueryWrapper.eq("create_user_id",unionReportDto.getCreateUserId());
-            if (unionReportDto.getType()!=null)
-                unionOutdoorLaborDynamicQueryWrapper.eq("type",unionReportDto.getType());
+            unionOutdoorLaborDynamicQueryWrapper.eq("create_user_id",unionReportDto.getCreateUserId()).eq("type",2);
+            if (unionReportDto.getStatus()!=null)
+                unionOutdoorLaborDynamicQueryWrapper.eq("status",unionReportDto.getStatus());
+        }else if(unionReportDto.getIsApplets().equals(3)){
+            unionOutdoorLaborDynamicQueryWrapper.eq("create_union_user_id",unionReportDto.getCreateUnionUserId()).eq("type",2);
+            if (unionReportDto.getStatus()!=null)
+                unionOutdoorLaborDynamicQueryWrapper.eq("status",unionReportDto.getStatus());
         }
         Page pageResult = baseMapper.selectPage(page, unionOutdoorLaborDynamicQueryWrapper);
         pageResult.setTotal(pageResult.getRecords().size());
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionUserServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionUserServiceImpl.java
index a0a095d..343f5e2 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionUserServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/service/impl/UnionUserServiceImpl.java
@@ -6,19 +6,24 @@
 import com.panzhihua.common.model.dtos.equipment.UnionUserDto;
 import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import com.panzhihua.common.model.vos.R;
-import com.panzhihua.service_equipment.config.AccessUtil;
+import com.panzhihua.common.redis.TokenManager;
+import com.panzhihua.service_equipment.until.AccessUtil;
 import com.panzhihua.service_equipment.dao.UnionAccessMapper;
 import com.panzhihua.service_equipment.dao.UnionUserMapper;
+import com.panzhihua.service_equipment.dao.UsersMapper;
 import com.panzhihua.service_equipment.model.dos.UnionAccess;
-import com.panzhihua.service_equipment.model.dos.UnionOutdoorSite;
 import com.panzhihua.service_equipment.model.dos.UnionUser;
+import com.panzhihua.service_equipment.model.dos.Users;
 import com.panzhihua.service_equipment.service.UnionUserService;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Service
 @Slf4j
@@ -29,6 +34,12 @@
 
     @Resource
     private UnionAccessMapper unionAccessMapper;
+
+    @Resource
+    private UsersMapper usersMapper;
+
+    @Resource
+    private TokenManager tokenManager;
 
     /**
      * 总工会户外劳登录
@@ -64,6 +75,85 @@
     }
 
     /**
+     * 总工会户外劳登录(h5)
+     *
+     * @param phone
+     * @return 总工会户外劳共用户
+     */
+    @Override
+    public  R<Map<String, Object>> loginByUnion(String phone){
+        Map<String, Object> mapUser = new HashMap<>();
+        Users users = usersMapper.selectOne(new QueryWrapper<Users>()
+                .eq("phone", phone)
+                .eq("deleted", 0)
+                .eq("freezeFlag", 0)
+                .orderByDesc("updateTime")
+                .last("limit 1"));
+        if (users!=null){
+            UnionUser unionUser = baseMapper.selectOne(new QueryWrapper<UnionUser>().eq("union_h5_user_id", users.getUsersID()));
+            if (unionUser!=null){
+                String token = tokenManager.getTokenByUserId(unionUser.getId().toString());
+//                String token=null;
+                if (token == null) {
+                    //生成一个token,保存用户登录状态
+                    token = tokenManager.createToken(unionUser.getId().toString(), unionUser.getId().toString());
+                }
+                mapUser.put("token", token);
+                mapUser.put("unionUser",unionUser);
+                log.info("mapUser{}",mapUser);
+                return R.ok(mapUser);
+            }
+            else {
+                unionUser=new UnionUser();
+                unionUser.setPhone(users.getPhone());
+                unionUser.setDeleteFlag(false);
+                unionUser.setCreateAt(LocalDateTime.now());
+                unionUser.setUpdateAt(LocalDateTime.now());
+                unionUser.setStatus(1);
+                unionUser.setNickName(users.getUname());
+                unionUser.setUnionH5UserId(users.getUsersID());
+                int insert = baseMapper.insert(unionUser);
+                if (insert >0){
+                    unionUser = baseMapper.selectOne(new QueryWrapper<UnionUser>().eq("union_h5_user_id", users.getUsersID()));
+                    if (unionUser!=null){
+                        String token = tokenManager.getTokenByUserId(unionUser.getId().toString());
+                        if (token == null) {
+                            //生成一个token,保存用户登录状态
+                            token = tokenManager.createToken(unionUser.getId().toString(), unionUser.getId().toString());
+                        }
+                        mapUser.put("token", token);
+                        mapUser.put("unionUser",unionUser);
+                        log.info("mapUser{}",mapUser);
+                        return  R.ok(mapUser);
+                    }
+
+                }
+
+            }
+            return R.fail("新增用户失败请查看是否在川共之家登录");
+        }else {
+           log.info("总工会数据库没有人物");
+           return  R.fail("数据错误,请先在川共之家登录");
+        }
+
+    }
+
+    /**
+     * 使用id查找用户
+     *
+     * @param id
+     * @return 总工会户外劳共用户
+     */
+    @Override
+    public UnionUserDto  selectById(Long id){
+        UnionUserDto unionUserDto=new UnionUserDto();
+        UnionUser unionUser = baseMapper.selectById(id);
+        BeanUtils.copyProperties(unionUser, unionUserDto);
+        return  unionUserDto;
+    }
+
+
+    /**
      * 总工会户外劳工站用户认证
      *
      * @param unionUserDto
@@ -72,7 +162,11 @@
 
     @Override
     public R authentication(UnionUserDto unionUserDto){
-        UnionUser unionUser = baseMapper.selectOne(new QueryWrapper<UnionUser>().eq("user_id", unionUserDto.getUserId()));
+        UnionUser unionUser=null;
+        if (unionUserDto.getIsApplets().equals(1))
+            unionUser = baseMapper.selectOne(new QueryWrapper<UnionUser>().eq("user_id", unionUserDto.getUserId()));
+        else
+            unionUser = baseMapper.selectOne(new QueryWrapper<UnionUser>().eq("id", unionUserDto.getId()));
         if (unionUser != null){
             log.info("查询到用户开始认证操作{}",unionUser);
             //设备下发照片代码
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/config/AccessUtil.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/AccessUtil.java
similarity index 96%
rename from springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/config/AccessUtil.java
rename to springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/AccessUtil.java
index a649e12..4dd94db 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/config/AccessUtil.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/AccessUtil.java
@@ -1,7 +1,8 @@
-package com.panzhihua.service_equipment.config;
+package com.panzhihua.service_equipment.until;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.panzhihua.service_equipment.config.AccessConfig;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/MonitorUtil.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/MonitorUtil.java
new file mode 100644
index 0000000..39cc5d6
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/MonitorUtil.java
@@ -0,0 +1,53 @@
+package com.panzhihua.service_equipment.until;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.util.Base64;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.panzhihua.common.utlis.HttpClientUtil.httpPostAndToken;
+
+@Slf4j
+@Service
+public class MonitorUtil {
+
+    /**
+     * 开门
+     * @return  返回结果
+     * @throws Exception
+     */
+    public Map getToken() {
+        String url="https://openaisc.sctel.com.cn/video-manage/appToken/getToken";
+        String accesskey = "96a88ccd5f42458b304ca291e710036d";
+        String accessKeySecret = "7b2ef41e0bcf8c94b193c7ec2e10d727";
+        long timestamp = new Date().getTime();
+        String signtype = "SHA1";
+        String params = ""; // 替换为你的请求参数
+
+        String appPolicy = accesskey + accessKeySecret + timestamp + params.substring(0, Math.min(params.length(), 512));
+
+        try {
+            Mac sha1Hmac = Mac.getInstance("HmacSHA1");
+            SecretKeySpec secretKey = new SecretKeySpec(accessKeySecret.getBytes(StandardCharsets.UTF_8), "HmacSHA 1");
+            sha1Hmac.init(secretKey);
+            byte[] hashBytes = sha1Hmac.doFinal(appPolicy.getBytes(StandardCharsets.UTF_8));
+            String sign = Base64.getEncoder().encodeToString(hashBytes);
+
+            System.out.println("Sign: " + sign);
+        } catch (NoSuchAlgorithmException | InvalidKeyException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/MvcConfig.java b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/MvcConfig.java
new file mode 100644
index 0000000..706e954
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/until/MvcConfig.java
@@ -0,0 +1,34 @@
+package com.panzhihua.service_equipment.until;
+
+
+import com.panzhihua.service_equipment.resolvers.AuthorizationInterceptor;
+import com.panzhihua.service_equipment.resolvers.CurrentUserMethodArgumentResolver;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.method.support.HandlerMethodArgumentResolver;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import java.util.List;
+
+/**
+ * 配置类,增加自定义拦截器和解析器
+ */
+@Configuration
+public class MvcConfig implements WebMvcConfigurer {
+
+    @Autowired
+    private AuthorizationInterceptor authorizationInterceptor;
+    @Autowired
+    private CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver;
+//
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+       registry.addInterceptor(authorizationInterceptor);
+    }
+
+    @Override
+    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
+        argumentResolvers.add(currentUserMethodArgumentResolver);
+    }
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java b/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java
index fe51847..282af0a 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java
@@ -335,7 +335,18 @@
                 noLoginUrl.add("/api/communitybackstage/comBatteryCommodityOrder/syncCloseOrder");
                 noLoginUrl.add("/api/applets/uu/getQRCode");
                 noLoginUrl.add("/api/huacheng-applets/uu/getQRCode");
-                noLoginUrl.add("/api/huacheng-applets/wx/flower/wxNotify");
+                noLoginUrl.add("/api/huacheng-union-applets/unionInspection/query");
+                noLoginUrl.add("/api/huacheng-union-applets/unionInspection/add");
+                noLoginUrl.add("/api/huacheng-union-applets/unionOutdoorLaborDynamic/page");
+                noLoginUrl.add("/api/huacheng-union-applets/unionOutdoorLaborDynamic/{id}");
+                noLoginUrl.add("/api/huacheng-union-applets/unionOutdoorSite/page");
+                noLoginUrl.add("/api/huacheng-union-applets/unionInspection/{id}");
+                noLoginUrl.add("/api/huacheng-union-applets/unionReport/add");
+                noLoginUrl.add("/api/huacheng-union-applets/unionReport/query");
+                noLoginUrl.add("/api/huacheng-union-applets/unionUser/authentication");
+                response.setHeader("Access-Control-Allow-Origin", "*");
+                response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
+                response.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
                 if (noLoginUrl.contains(requestURI)) {
                     List<SimpleGrantedAuthority> authorities = new ArrayList<>();
                     authorities.add(new SimpleGrantedAuthority(SecurityConstants.ROLE_APPLETS));
@@ -348,6 +359,7 @@
                 }
             }
         }
+        response.addHeader("Access-Control-Allow-Origin","*");
         filterChain.doFilter(safeboxRequestWrapper, response);
     }
 

--
Gitblit v1.7.1