Newspaper 1 gadu atpakaļ
vecāks
revīzija
5147d7ca10
67 mainītis faili ar 1379 papildinājumiem un 322 dzēšanām
  1. 6 0
      snowy-common/pom.xml
  2. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/bi/utils/UploadImage.java
  3. 12 12
      snowy-plugin-api/snowy-plugin-auth-api/src/main/java/vip/xiaonuo/auth/core/pojo/SaBaseLoginUser.java
  4. 13 0
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/controller/BizOrgController.java
  5. 2 0
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/BizOrgService.java
  6. 18 0
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/impl/BizOrgServiceImpl.java
  7. 30 2
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/controller/BizUserController.java
  8. 13 0
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/entity/BizUser.java
  9. 40 0
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/param/BizUserLastLoginParam.java
  10. 4 0
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/param/BizUserPageParam.java
  11. 40 0
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/param/BizUserPlatformParam.java
  12. 4 0
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/service/BizUserService.java
  13. 57 20
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/service/impl/BizUserServiceImpl.java
  14. 5 5
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/controller/SysUserController.java
  15. 14 0
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/entity/SysUser.java
  16. 1 1
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/service/SysUserService.java
  17. 29 8
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/service/impl/SysUserServiceImpl.java
  18. 0 184
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/utils/SysUploadImage.java
  19. 45 0
      snowy-web-app/src/main/java/vip/xiaonuo/Timer/DailyInspectionTimer.java
  20. 30 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/carCapture/controller/CarCaptureController.java
  21. 20 7
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/carCapture/entity/CarCapture.java
  22. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/carCapture/param/CarCaptureEditParam.java
  23. 18 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/carCapture/service/impl/CarCaptureServiceImpl.java
  24. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/dailyInspection/mapper/DailyInspectionMapper.java
  25. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/dailyInspection/mapper/mapping/DailyInspectionMapper.xml
  26. 2 11
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/dailyInspection/service/impl/DailyInspectionServiceImpl.java
  27. 18 4
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/dirtyCapture/entity/DirtyCapture.java
  28. 21 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/dirtyCapture/service/impl/DirtyCaptureServiceImpl.java
  29. 142 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/controller/FollowEventsController.java
  30. 60 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/entity/FollowEvents.java
  31. 32 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/entity/FollowEventsVo.java
  32. 34 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/enums/FollowEventsEnum.java
  33. 28 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/mapper/FollowEventsMapper.java
  34. 51 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/mapper/mapping/FollowEventsMapper.xml
  35. 42 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/param/FollowEventsAddParam.java
  36. 51 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/param/FollowEventsEditParam.java
  37. 35 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/param/FollowEventsIdParam.java
  38. 43 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/param/FollowEventsPageParam.java
  39. 83 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/service/FollowEventsService.java
  40. 105 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/service/impl/FollowEventsServiceImpl.java
  41. 7 2
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/personCapture/entity/PersonCapture.java
  42. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/personCapture/param/PersonCaptureEditParam.java
  43. 19 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/personCapture/service/impl/PersonCaptureServiceImpl.java
  44. 18 4
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/speciesCapture/entity/SpeciesCapture.java
  45. 21 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/speciesCapture/service/impl/SpeciesCaptureServiceImpl.java
  46. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/taskInspection/mapper/TaskInspectionMapper.java
  47. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/taskInspection/mapper/mapping/TaskInspectionMapper.xml
  48. 2 14
      snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/taskInspection/service/impl/TaskInspectionServiceImpl.java
  49. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/baseSeason/service/impl/BaseSeasonServiceImpl.java
  50. 14 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/department/controller/DepartmentController.java
  51. 35 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/department/param/DepartmentParentIdParam.java
  52. 2 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/department/service/DepartmentService.java
  53. 18 9
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/department/service/impl/DepartmentServiceImpl.java
  54. 5 3
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/inventoryUse/controller/InventoryUseController.java
  55. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/inventoryUse/entity/InventoryUse.java
  56. 1 12
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/inventoryUse/service/impl/InventoryUseServiceImpl.java
  57. 1 6
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/peoplelist/service/impl/PeopleListServiceImpl.java
  58. 13 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/controller/BasePigpenController.java
  59. 35 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/param/BasePigpenParentIdParam.java
  60. 2 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/service/BasePigpenService.java
  61. 11 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/service/impl/BasePigpenServiceImpl.java
  62. 1 2
      snowy-web-app/src/main/java/vip/xiaonuo/modular/bi/pigdeath/controller/PigDeathController.java
  63. 3 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/mapper/mapping/EnergyElectricityMapper.xml
  64. 5 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyThreshold/entity/vo/EnergyThresholdListVo.java
  65. 6 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/service/impl/EnergyThresholdServiceImpl.java
  66. 2 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/param/EnvThresholdSyncParam.java
  67. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/service/impl/EnvThresholdServiceImpl.java

+ 6 - 0
snowy-common/pom.xml

@@ -63,6 +63,12 @@
             <artifactId>mybatis-plus-boot-starter</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.jcraft</groupId>
+            <artifactId>jsch</artifactId>
+            <version>0.1.54</version>
+        </dependency>
+
         <!-- easy-trans -->
         <dependency>
             <groupId>com.fhs-opensource</groupId>

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/bi/utils/UploadImage.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.modular.bi.utils;
+package vip.xiaonuo.common.util;
 
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.lang.UUID;

+ 12 - 12
snowy-plugin-api/snowy-plugin-auth-api/src/main/java/vip/xiaonuo/auth/core/pojo/SaBaseLoginUser.java

@@ -41,6 +41,14 @@ public abstract class SaBaseLoginUser {
     @ApiModelProperty(value = "账号", position = 5)
     private String account;
 
+    /** 账号类别 */
+    @ApiModelProperty(value = "账号类别", position = 5)
+    private Integer accountType;
+
+    /** 平台类别 */
+    @ApiModelProperty(value = "平台类别", position = 5)
+    private Integer platformType;
+
     /** 姓名 */
     @ApiModelProperty(value = "姓名", position = 6)
     private String name;
@@ -57,18 +65,6 @@ public abstract class SaBaseLoginUser {
     @ApiModelProperty(value = "家庭住址", position = 13)
     private String homeAddress;
 
-    /** 通信地址 */
-    @ApiModelProperty(value = "通信地址", position = 14)
-    private String detailAddress;
-
-    /** 证件类型 */
-    @ApiModelProperty(value = "证件类型", position = 15)
-    private String idCardType;
-
-    /** 文化程度 */
-    @ApiModelProperty(value = "文化程度", position = 17)
-    private String cultureLevel;
-
     /** 手机 */
     @ApiModelProperty(value = "手机", position = 23)
     private String phone;
@@ -89,6 +85,10 @@ public abstract class SaBaseLoginUser {
     @ApiModelProperty(value = "组织id", position = 32)
     private String orgId;
 
+    /** 上次登录组织id */
+    @ApiModelProperty(value = "上次登录组织id", position = 32)
+    private String lastLoginOrgId;
+
     /** 组织名称 */
     @ApiModelProperty(value = "组织名称", position = 33)
     private String orgName;

+ 13 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/controller/BizOrgController.java

@@ -172,4 +172,17 @@ public class BizOrgController {
     public CommonResult<Page<BizUser>> userSelector(BizOrgSelectorUserParam bizOrgSelectorUserParam) {
         return CommonResult.data(bizOrgService.userSelector(bizOrgSelectorUserParam));
     }
+
+    /**
+     * 获取组织选择器
+     *
+     * @author xuyuxiang
+     * @date 2022/4/24 20:00
+     */
+    @ApiOperationSupport(order = 9)
+    @ApiOperation("获取组织选择器")
+    @GetMapping("/biz/org/orgSelector")
+    public CommonResult<List<BizOrg>> orgSelector() {
+        return CommonResult.data(bizOrgService.orgSelector());
+    }
 }

+ 2 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/BizOrgService.java

@@ -172,4 +172,6 @@ public interface BizOrgService extends IService<BizOrg> {
      * @date 2022/4/24 20:08
      */
     Page<BizUser> userSelector(BizOrgSelectorUserParam bizOrgSelectorUserParam);
+
+    List<BizOrg> orgSelector();
 }

+ 18 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/org/service/impl/BizOrgServiceImpl.java

@@ -27,6 +27,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.checkerframework.checker.units.qual.A;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
@@ -46,6 +47,7 @@ import vip.xiaonuo.common.page.CommonPageRequest;
 import vip.xiaonuo.sys.api.SysRoleApi;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
@@ -372,6 +374,22 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
         return bizUserService.page(CommonPageRequest.defaultPage(), lambdaQueryWrapper);
     }
 
+    @Override
+    public List<BizOrg> orgSelector() {
+        List<BizOrg> bizOrgs = new ArrayList<>();
+        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
+        BizOrg org = this.getOne(new QueryWrapper<BizOrg>().lambda().eq(BizOrg::getId, orgId));
+        if ("0".equals(org.getParentId())){
+            List<BizOrg> list = this.list(new QueryWrapper<BizOrg>().lambda().eq(BizOrg::getParentId, orgId));
+            if (ObjectUtil.isNotEmpty(list)){
+                bizOrgs.addAll(list);
+            }
+        }else {
+            bizOrgs.add(org);
+        }
+        return bizOrgs;
+    }
+
     /* ====以下为各种递归方法==== */
 
     @Override

+ 30 - 2
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/controller/BizUserController.java

@@ -240,12 +240,40 @@ public class BizUserController {
     }
 
     /**
-     * 人员导出
+     * 更新上次登录组织
      *
      * @author xuyuxiang
      * @date 2022/4/24 20:00
      */
     @ApiOperationSupport(order = 11)
+    @ApiOperation("更新上次登录组织id")
+    @GetMapping("/biz/user/updateLastLoginOrgId")
+    public CommonResult<String> updateLastLoginOrgId(@Valid BizUserLastLoginParam bizUserLastLoginParam) {
+        bizUserService.updateLastLoginOrgId(bizUserLastLoginParam);
+        return CommonResult.ok();
+    }
+
+    /**
+     * 更新平台类别
+     *
+     * @author xuyuxiang
+     * @date 2022/4/24 20:00
+     */
+    @ApiOperationSupport(order = 12)
+    @ApiOperation("更新平台类别")
+    @GetMapping("/biz/user/updatePlatformType")
+    public CommonResult<String> updatePlatformType(@Valid BizUserPlatformParam bizUserPlatformParam) {
+        bizUserService.updatePlatformType(bizUserPlatformParam);
+        return CommonResult.ok();
+    }
+
+    /**
+     * 人员导出
+     *
+     * @author xuyuxiang
+     * @date 2022/4/24 20:00
+     */
+    @ApiOperationSupport(order = 13)
     @ApiOperation("人员导出")
     @CommonLog("人员导出")
     @SaCheckPermission("/biz/user/export")
@@ -260,7 +288,7 @@ public class BizUserController {
      * @author xuyuxiang
      * @date 2022/4/24 20:00
      */
-    @ApiOperationSupport(order = 12)
+    @ApiOperationSupport(order = 14)
     @ApiOperation("导出人员个人信息")
     @CommonLog("导出人员个人信息")
     @SaCheckPermission("/biz/user/exportUserInfo")

+ 13 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/entity/BizUser.java

@@ -53,6 +53,14 @@ public class BizUser extends CommonEntity implements TransPojo {
     @ApiModelProperty(value = "账号", position = 4)
     private String account;
 
+    /** 账号类别 */
+    @ApiModelProperty(value = "账号类别", position = 4)
+    private Integer accountType;
+
+    /** 平台类别 */
+    @ApiModelProperty(value = "平台类别 1:企业 2:牧场", position = 4)
+    private Integer platformType;
+
     /** 密码 */
     @ApiModelProperty(value = "密码", position = 5)
     private String password;
@@ -114,6 +122,11 @@ public class BizUser extends CommonEntity implements TransPojo {
     @Trans(type = TransType.SIMPLE, target = BizOrg.class, fields = "name", alias = "org", ref = "orgName")
     private String orgId;
 
+    /** 上次登陆组织id */
+    @ApiModelProperty(value = "上次登陆组织id", position = 32)
+    @TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
+    private String lastLoginOrgId;
+
     /** 组织id */
     @ApiModelProperty(value = "部门id", position = 33)
     @TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)

+ 40 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/param/BizUserLastLoginParam.java

@@ -0,0 +1,40 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.biz.modular.user.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * 人员Id参数
+ *
+ * @author xuyuxiang
+ * @date 2022/4/21 16:13
+ **/
+@Getter
+@Setter
+public class BizUserLastLoginParam {
+
+    /** id */
+    @ApiModelProperty(value = "id", required = true)
+    @NotBlank(message = "id不能为空")
+    private String id;
+
+    /** 组织id */
+    @ApiModelProperty(value = "组织id", required = true)
+    @NotBlank(message = "cutId不能为空")
+    private String cutId;
+}

+ 4 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/param/BizUserPageParam.java

@@ -53,4 +53,8 @@ public class BizUserPageParam {
     /** 所属机构 */
     @ApiModelProperty(value = "所属机构")
     private String orgId;
+
+    /** 组织父id */
+    @ApiModelProperty(value = "组织父id")
+    private String parentId;
 }

+ 40 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/param/BizUserPlatformParam.java

@@ -0,0 +1,40 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.biz.modular.user.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * 人员Id参数
+ *
+ * @author xuyuxiang
+ * @date 2022/4/21 16:13
+ **/
+@Getter
+@Setter
+public class BizUserPlatformParam {
+
+    /** id */
+    @ApiModelProperty(value = "id", required = true)
+    @NotBlank(message = "id不能为空")
+    private String id;
+
+    /** 平台类型 */
+    @ApiModelProperty(value = "平台类型 1:企业 2:牧场", required = true)
+    @NotBlank(message = "platformType不能为空")
+    private Integer platformType;
+}

+ 4 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/service/BizUserService.java

@@ -170,4 +170,8 @@ public interface BizUserService extends IService<BizUser> {
      * @date 2022/4/24 20:08
      */
     Page<BizUser> userSelector(BizUserSelectorUserParam bizUserSelectorUserParam);
+
+    void updateLastLoginOrgId(BizUserLastLoginParam bizUserLastLoginParam);
+
+    void updatePlatformType(BizUserPlatformParam bizUserPlatformParam);
 }

+ 57 - 20
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/service/impl/BizUserServiceImpl.java

@@ -112,8 +112,8 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
     @Resource
     private BizOrgService bizOrgService;
 
-//    @Resource
-//    private BizUploadImage uploadImage;
+    @Resource
+    private UploadImage uploadImage;
 
     @Override
     public Page<BizUser> page(BizUserPageParam bizUserPageParam) {
@@ -122,8 +122,8 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
             queryWrapper.lambda().and(q -> q.like(BizUser::getAccount, bizUserPageParam.getSearchKey())
                     .or().like(BizUser::getName, bizUserPageParam.getSearchKey()));
         }
-        if (ObjectUtil.isNotEmpty(bizUserPageParam.getOrgId())) {
-            queryWrapper.lambda().eq(BizUser::getOrgId, bizUserPageParam.getOrgId());
+        if (ObjectUtil.isNotEmpty(bizUserPageParam.getParentId())) {
+            queryWrapper.lambda().eq(BizUser::getOrgId, bizUserPageParam.getParentId());
         }
         if (ObjectUtil.isNotEmpty(bizUserPageParam.getUserStatus())) {
             queryWrapper.lambda().eq(BizUser::getUserStatus, bizUserPageParam.getUserStatus());
@@ -151,11 +151,26 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
     @Override
     public void add(String empNo, String account, String name, String orgId, String departmentId, String workLocationId, String nickname, String gender, String homeAddress, String detailAddress, String idCardNumber, String phone, String emergencyPhone, String entryDate, MultipartFile avatar) throws IOException {
         checkParam(empNo,account,phone,orgId);
+
         BizUser bizUser = new BizUser();
         bizUser.setEmpNo(empNo);
         bizUser.setAccount(account);
+
         bizUser.setName(name);
         bizUser.setOrgId(orgId);
+        BizOrg bizOrg = bizOrgService.getById(orgId);
+        if ("0".equals(bizOrg.getParentId())){
+            List<BizOrg> bizOrgs = bizOrgService.list(new QueryWrapper<BizOrg>().lambda().eq(BizOrg::getParentId, orgId));
+            if (ObjectUtil.isNotEmpty(bizOrgs)){
+                bizUser.setLastLoginOrgId(bizOrgs.get(0).getId());
+            }
+            bizUser.setAccountType(1);
+            bizUser.setPlatformType(1);
+        }else {
+            bizUser.setLastLoginOrgId(orgId);
+            bizUser.setAccountType(2);
+            bizUser.setPlatformType(2);
+        }
         bizUser.setDepartmentId(departmentId);
         bizUser.setWorkLocationId(workLocationId);
         bizUser.setNickname(nickname);
@@ -166,11 +181,11 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
         bizUser.setPhone(phone);
         bizUser.setEmergencyPhone(emergencyPhone);
         bizUser.setEntryDate(entryDate);
-//        String avatarUrl = uploadImage.getImageCom(avatar);
-//        if (avatarUrl.equals("上传失败")){
-//            throw new CommonException("图片上传失败!");
-//        }
-//        bizUser.setAvatar(avatarUrl);
+        String avatarUrl = uploadImage.getImageCom(avatar);
+        if (avatarUrl.equals("上传失败")){
+            throw new CommonException("图片上传失败!");
+        }
+        bizUser.setAvatar(avatarUrl);
         // 设置密码
         bizUser.setPassword(CommonCryptogramUtil.doHashValue(devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_PASSWORD_KEY)));
         // 设置状态
@@ -224,8 +239,16 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
         bizUser.setAccount(account);
         bizUser.setName(name);
         bizUser.setOrgId(orgId);
-        bizUser.setDepartmentId(departmentId);
-        bizUser.setWorkLocationId(workLocationId);
+        BizOrg bizOrg = bizOrgService.getById(orgId);
+        if ("0".equals(bizOrg.getParentId())){
+            bizUser.setAccountType(1);
+            bizUser.setDepartmentId(null);
+            bizUser.setWorkLocationId(null);
+        }else {
+            bizUser.setAccountType(2);
+            bizUser.setDepartmentId(departmentId);
+            bizUser.setWorkLocationId(workLocationId);
+        }
         bizUser.setNickname(nickname);
         bizUser.setGender(gender);
         bizUser.setHomeAddress(homeAddress);
@@ -234,14 +257,13 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
         bizUser.setPhone(phone);
         bizUser.setEmergencyPhone(emergencyPhone);
         bizUser.setEntryDate(entryDate);
-//        if (ObjectUtil.isNotEmpty(avatar)){
-//            String avatarUrl = uploadImage.getImageCom(avatar);
-//            if (avatarUrl.equals("上传失败")){
-//                throw new CommonException("图片上传失败!");
-//            }
-//            bizUser.setAvatar(avatarUrl);
-//        }
-
+        if (ObjectUtil.isNotEmpty(avatar)){
+            String avatarUrl = uploadImage.getImageCom(avatar);
+            if (avatarUrl.equals("上传失败")){
+                throw new CommonException("图片上传失败!");
+            }
+            bizUser.setAvatar(avatarUrl);
+        }
         this.updateById(bizUser);
 
         // 发布更新事件
@@ -604,6 +626,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
 
     @Override
     public List<Tree<String>> orgTreeSelector() {
+        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
         LambdaQueryWrapper<BizOrg> lambdaQueryWrapper = new LambdaQueryWrapper<>();
         // 校验数据范围
         List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
@@ -612,7 +635,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
         if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
             // 获取所有机构
             List<BizOrg> allOrgList = bizOrgService.list();
-            loginUserDataScope.forEach(orgId -> bizOrgSet.addAll(bizOrgService.getParentListById(allOrgList, orgId, true)));
+            loginUserDataScope.forEach(orgId1 -> bizOrgSet.addAll(bizOrgService.getParentListById(allOrgList, orgId1, true)));
             List<String> loginUserDataScopeFullList = bizOrgSet.stream().map(BizOrg::getId).collect(Collectors.toList());
             lambdaQueryWrapper.in(BizOrg::getId, loginUserDataScopeFullList);
         } else {
@@ -706,4 +729,18 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
         lambdaQueryWrapper.orderByAsc(BizUser::getSortCode);
         return this.page(CommonPageRequest.defaultPage(), lambdaQueryWrapper);
     }
+
+    @Override
+    public void updateLastLoginOrgId(BizUserLastLoginParam bizUserLastLoginParam) {
+        BizUser bizUser = this.queryEntity(bizUserLastLoginParam.getId());
+        bizUser.setLastLoginOrgId(bizUserLastLoginParam.getCutId());
+        this.updateById(bizUser);
+    }
+
+    @Override
+    public void updatePlatformType(BizUserPlatformParam bizUserPlatformParam) {
+        BizUser bizUser = this.queryEntity(bizUserPlatformParam.getId());
+        bizUser.setPlatformType(bizUserPlatformParam.getPlatformType());
+        this.updateById(bizUser);
+    }
 }

+ 5 - 5
snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/controller/SysUserController.java

@@ -84,8 +84,8 @@ public class SysUserController {
                                     @RequestParam @ApiParam(value = "账号") String account,
                                     @RequestParam @ApiParam(value = "姓名") String name,
                                     @RequestParam @ApiParam(value = "组织id") String orgId,
-                                    @RequestParam @ApiParam(value = "部门id") String departmentId,
-                                    @RequestParam @ApiParam(value = "工作地点id") String workLocationId,
+                                    @RequestParam(required = false) @ApiParam(value = "部门id") String departmentId,
+                                    @RequestParam(required = false) @ApiParam(value = "工作地点id") String workLocationId,
                                     @RequestParam @ApiParam(value = "昵称") String nickname,
                                     @RequestParam @ApiParam(value = "性别") String gender,
                                     @RequestParam @ApiParam(value = "家庭住址") String homeAddress,
@@ -114,8 +114,8 @@ public class SysUserController {
                                      @RequestParam @ApiParam(value = "账号") String account,
                                      @RequestParam @ApiParam(value = "姓名") String name,
                                      @RequestParam @ApiParam(value = "组织id") String orgId,
-                                     @RequestParam @ApiParam(value = "部门id") String departmentId,
-                                     @RequestParam @ApiParam(value = "工作地点id") String workLocationId,
+                                     @RequestParam(required = false) @ApiParam(value = "部门id") String departmentId,
+                                     @RequestParam(required = false) @ApiParam(value = "工作地点id") String workLocationId,
                                      @RequestParam @ApiParam(value = "昵称") String nickname,
                                      @RequestParam @ApiParam(value = "性别") String gender,
                                      @RequestParam @ApiParam(value = "家庭住址") String homeAddress,
@@ -124,7 +124,7 @@ public class SysUserController {
                                      @RequestParam @ApiParam(value = "手机") String phone,
                                      @RequestParam @ApiParam(value = "紧急联系人电话") String emergencyPhone,
                                      @RequestParam @ApiParam(value = "入职日期") String entryDate,
-                                     @RequestParam @ApiParam(value = "员工照片") MultipartFile avatar) {
+                                     @RequestParam @ApiParam(value = "员工照片") MultipartFile avatar) throws IOException {
         sysUserService.edit(id,empNo,account,name,orgId,departmentId,workLocationId,nickname,gender,homeAddress,detailAddress,idCardNumber,phone,emergencyPhone,entryDate,avatar);
         return CommonResult.ok();
     }

+ 14 - 0
snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/entity/SysUser.java

@@ -20,6 +20,7 @@ import com.fhs.core.trans.anno.Trans;
 import com.fhs.core.trans.constant.TransType;
 import com.fhs.core.trans.vo.TransPojo;
 import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
 import lombok.Getter;
 import lombok.Setter;
 import vip.xiaonuo.common.handler.CommonSm4CbcTypeHandler;
@@ -54,6 +55,14 @@ public class SysUser extends CommonEntity implements TransPojo {
     @ApiModelProperty(value = "账号", position = 4)
     private String account;
 
+    /** 账号类别 */
+    @ApiModelProperty(value = "账号类别", position = 4)
+    private Integer accountType;
+
+    /** 平台类别 */
+    @ApiModelProperty(value = "平台类别 1:企业 2:牧场", position = 4)
+    private Integer platformType;
+
     /** 密码 */
     @ApiModelProperty(value = "密码", position = 5)
     private String password;
@@ -115,6 +124,11 @@ public class SysUser extends CommonEntity implements TransPojo {
     @Trans(type = TransType.SIMPLE, target = SysOrg.class, fields = "name", alias = "org", ref = "orgName")
     private String orgId;
 
+    /** 上次登陆组织id */
+    @ApiModelProperty(value = "上次登陆组织id", position = 32)
+    @TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
+    private String lastLoginOrgId;
+
     /** 组织id */
     @ApiModelProperty(value = "部门id", position = 33)
     @TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)

+ 1 - 1
snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/service/SysUserService.java

@@ -73,7 +73,7 @@ public interface SysUserService extends IService<SysUser> {
      * @author xuyuxiang
      * @date 2022/4/24 21:13
      */
-    void edit(String id, String empNo, String account, String name, String orgId, String departmentId, String workLocationId, String nickname, String gender, String homeAddress, String detailAddress, String idCardNumber, String phone, String emergencyPhone, String entryDate, MultipartFile avatar);
+    void edit(String id, String empNo, String account, String name, String orgId, String departmentId, String workLocationId, String nickname, String gender, String homeAddress, String detailAddress, String idCardNumber, String phone, String emergencyPhone, String entryDate, MultipartFile avatar) throws IOException;
 
     /**
      * 删除用户

+ 29 - 8
snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/service/impl/SysUserServiceImpl.java

@@ -61,6 +61,7 @@ import org.apache.poi.xwpf.usermodel.XWPFDocument;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
+import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.common.cache.CommonCacheOperator;
 import vip.xiaonuo.common.enums.CommonSortOrderEnum;
 import vip.xiaonuo.common.excel.CommonExcelCustomMergeStrategy;
@@ -160,8 +161,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Resource
     private MobileButtonApi mobileButtonApi;
 
-//    @Resource
-//    private SysUploadImage uploadImage;
+    @Resource
+    private UploadImage uploadImage;
 
     @Override
     public SysLoginUser getUserById(String id) {
@@ -225,6 +226,19 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         sysUser.setAccount(account);
         sysUser.setName(name);
         sysUser.setOrgId(orgId);
+        SysOrg sysOrg = sysOrgService.getById(orgId);
+        if ("0".equals(sysOrg.getParentId())){
+            List<SysOrg> sysOrgs = sysOrgService.list(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getParentId, orgId));
+            if (ObjectUtil.isNotEmpty(sysOrgs)){
+                sysUser.setLastLoginOrgId(sysOrgs.get(0).getId());
+            }
+            sysUser.setAccountType(1);
+            sysUser.setPlatformType(1);
+        }else {
+            sysUser.setLastLoginOrgId(orgId);
+            sysUser.setAccountType(2);
+            sysUser.setPlatformType(2);
+        }
         sysUser.setDepartmentId(departmentId);
         sysUser.setWorkLocationId(workLocationId);
         sysUser.setNickname(nickname);
@@ -235,11 +249,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         sysUser.setPhone(phone);
         sysUser.setEmergencyPhone(emergencyPhone);
         sysUser.setEntryDate(entryDate);
-//        String avatarUrl = uploadImage.getImageCom(avatar);
-//        if (avatarUrl.equals("上传失败")){
-//            throw new CommonException("图片上传失败!");
-//        }
-//        sysUser.setAvatar(avatarUrl);
+        String avatarUrl = uploadImage.getImageCom(avatar);
+        if (avatarUrl.equals("上传失败")){
+            throw new CommonException("图片上传失败!");
+        }
+        sysUser.setAvatar(avatarUrl);
         // 设置默认密码
         sysUser.setPassword(CommonCryptogramUtil.doHashValue(devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_PASSWORD_KEY)));
         // 设置状态
@@ -272,7 +286,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
 
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public void edit(String id, String empNo, String account, String name, String orgId, String departmentId, String workLocationId, String nickname, String gender, String homeAddress, String detailAddress, String idCardNumber, String phone, String emergencyPhone, String entryDate, MultipartFile avatar) {
+    public void edit(String id, String empNo, String account, String name, String orgId, String departmentId, String workLocationId, String nickname, String gender, String homeAddress, String detailAddress, String idCardNumber, String phone, String emergencyPhone, String entryDate, MultipartFile avatar) throws IOException {
         SysUser sysUser = this.queryEntity(id);
         checkParam(id,empNo,account,phone,orgId);
         boolean updateSuperAdminAccount = account.equals(SysBuildInEnum.BUILD_IN_USER_ACCOUNT.getValue()) &&
@@ -294,6 +308,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         sysUser.setPhone(phone);
         sysUser.setEmergencyPhone(emergencyPhone);
         sysUser.setEntryDate(entryDate);
+        if (ObjectUtil.isNotEmpty(avatar)){
+            String avatarUrl = uploadImage.getImageCom(avatar);
+            if (avatarUrl.equals("上传失败")){
+                throw new CommonException("图片上传失败!");
+            }
+            sysUser.setAvatar(avatarUrl);
+        }
 
         this.updateById(sysUser);
     }

+ 0 - 184
snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/utils/SysUploadImage.java

@@ -1,184 +0,0 @@
-//package vip.xiaonuo.sys.modular.user.utils;
-//
-//import cn.hutool.core.date.DateUtil;
-//import cn.hutool.core.lang.UUID;
-//import com.jcraft.jsch.*;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.stereotype.Component;
-//import org.springframework.util.StringUtils;
-//import org.springframework.web.multipart.MultipartFile;
-//
-//import javax.imageio.ImageIO;
-//import java.awt.*;
-//import java.awt.image.BufferedImage;
-//import java.io.*;
-//import java.util.Date;
-//
-//@Component
-//public class SysUploadImage {
-//
-//    @Value("${img.basePath}")
-//    private   String basePath;
-//
-//    @Value("${img.ip}")
-//    private    String ip ;
-////    private   String ip = "36.134.209.211";
-////    private   String ip = "192.168.0.13";
-//
-//    @Value("${img.user}")
-//    private  String user ;
-//
-////    private   String password = "!Hm537e@1";
-//
-//    @Value("${img.password}")
-//    private   String password ;
-//
-//    @Value("${img.port}")
-//    public   Integer port ;
-//
-//    @Value("${img.url}")
-//    public   String url ;
-//
-//
-//
-//    /**
-//     * 利用JSch包实现SFTP上传文件
-//     * @param bytes  文件字节流
-//     * @param fileName  文件名
-//     * @throws Exception
-//     */
-//    public   void sshSftp(byte[] bytes,String path,String fileName) throws Exception{
-//
-//        // 服务器保存路径
-//        String filepath = basePath +path ;
-//        Session session = null;
-//        Channel channel = null;
-//
-//        JSch jSch = new JSch();
-//
-//        if(port <=0){
-//            //连接服务器,采用默认端口
-//            session = jSch.getSession(user, ip);
-//        }else{
-//            //采用指定的端口连接服务器
-//            session = jSch.getSession(user, ip ,port);
-//        }
-//
-//        //如果服务器连接不上,则抛出异常
-//        if (session == null) {
-//            throw new Exception("session is null");
-//        }
-//
-//        //设置登陆主机的密码
-//        session.setPassword(password);//设置密码
-//        //设置第一次登陆的时候提示,可选值:(ask | yes | no)
-//        session.setConfig("userauth.gssapi-with-mic","no");
-//        session.setConfig("StrictHostKeyChecking", "no");
-//        //设置登陆超时时间
-//        session.connect(30000);
-//
-//        OutputStream outstream = null;
-//        try {
-//            //创建sftp通信通道
-//            channel = (Channel) session.openChannel("sftp");
-//            channel.connect(1000);
-//            ChannelSftp sftp = (ChannelSftp) channel;
-//
-//            //进入服务器指定的文件夹
-//            sftp.cd(basePath);
-//
-//            SftpATTRS attrs = null;
-//            try {
-//                attrs = sftp.stat(filepath);
-//            } catch (Exception e) {
-//                // TODO: handle exception
-//            }
-//            if (attrs == null) {
-//                sftp.mkdir(filepath);
-//                System.out.println(("创建子目录:" + filepath));
-//            }
-//            sftp.cd(filepath);
-//
-//            //以下代码实现从本地上传一个文件到服务器,如果要实现下载,对换一下流就可以了
-//            outstream = sftp.put(fileName);
-//            outstream.write(bytes);
-//
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        } finally {
-//            //关流操作
-//            if (outstream != null) {
-//                outstream.flush();
-//                outstream.close();
-//            }
-//            if (session != null) {
-//                session.disconnect();
-//            }
-//            if (channel != null) {
-//                channel.disconnect();
-//            }
-//            System.out.println("上传成功!");
-//        }
-//    }
-//
-//    //上传压缩的图片
-//    public  String getImageCom(MultipartFile image) throws IOException {
-//        //获取文件输入流
-//        InputStream inputStream = image.getInputStream();
-//        String originalFilename = image.getOriginalFilename();
-//        String filenameExtension = StringUtils.getFilenameExtension(originalFilename);
-//        String path = DateUtil.format(new Date(), "yyyy-MM");
-//
-//        try {
-//            // 把图片读入到内存中
-//            BufferedImage bufImg = ImageIO.read(inputStream);
-//            // 压缩代码,存储图片文件byte数组
-//            ByteArrayOutputStream bos = new ByteArrayOutputStream();
-//            //防止图片变红,这一步非常重要
-//            BufferedImage bufferedImage = new BufferedImage(bufImg.getWidth(), bufImg.getHeight(), BufferedImage.TYPE_INT_RGB);
-//            bufferedImage.createGraphics().drawImage(bufImg,0,0, Color.WHITE,null);
-//            //先转成jpg格式来压缩,然后在通过OSS来修改成源文件本来的后缀格式
-//            ImageIO.write(bufferedImage,"jpg",bos);
-//            byte[] bytes = bos.toByteArray();
-//            String imgname = UUID.randomUUID() + "." + filenameExtension;
-//            sshSftp(bytes, path, imgname);
-//            return url+ path + "/" + imgname;
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//            return "上传失败";
-//        } finally {
-//            inputStream.close();
-//        }
-//    }
-//
-//
-//    //上传原图
-//    public  String uploadImg( MultipartFile image ) {
-//        String originalFilename = image.getOriginalFilename();
-//        String filenameExtension = StringUtils.getFilenameExtension(originalFilename);
-//        String path = DateUtil.format(new Date(), "yyyy-MM");
-//        try {
-//            InputStream inputStream = image.getInputStream();
-//            BufferedInputStream in = new BufferedInputStream(inputStream);
-//            ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
-//
-//            byte[] temp = new byte[1024];
-//            int size = 0;
-//            while ((size = in.read(temp)) != -1) {
-//                out.write(temp, 0, size);
-//            }
-//            in.close();
-//            byte[] content = out.toByteArray();
-//            String imgname = UUID.randomUUID() + "." + filenameExtension;
-//            sshSftp(content, path, imgname);
-//            return url + path + "/" + imgname;
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//            return "上传失败";
-//        }
-//    }
-//
-//}
-//
-//
-//

+ 45 - 0
snowy-web-app/src/main/java/vip/xiaonuo/Timer/DailyInspectionTimer.java

@@ -0,0 +1,45 @@
+package vip.xiaonuo.Timer;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import vip.xiaonuo.common.timer.CommonTimerTaskRunner;
+import vip.xiaonuo.modular.ai.dailyInspection.entity.DailyInspection;
+import vip.xiaonuo.modular.ai.dailyInspection.service.DailyInspectionService;
+import vip.xiaonuo.sys.modular.user.entity.SysUser;
+import vip.xiaonuo.sys.modular.user.service.SysUserService;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Slf4j
+@Component
+public class DailyInspectionTimer implements CommonTimerTaskRunner {
+
+    @Resource
+    private SysUserService sysUserService;
+
+    @Resource
+    private DailyInspectionService dailyInspectionService;
+
+
+    @Override
+    public void action() {
+        List<SysUser> list = sysUserService.list(new QueryWrapper<SysUser>().lambda().isNotNull(SysUser::getWorkLocationId));
+        if (ObjectUtil.isNotEmpty(list)){
+            for (SysUser sysUser : list) {
+                String[] workLocations = sysUser.getWorkLocationId().split(",");
+                for (String workLocation : workLocations) {
+                    System.out.println("用户id为:" + sysUser.getId());
+                    System.out.println("单元id为:" + workLocation);
+                    DailyInspection dailyInspection = new DailyInspection();
+                    dailyInspection.setUnitId(workLocation);
+                    dailyInspection.setNotifierId(sysUser.getId());
+                    dailyInspectionService.save(dailyInspection);
+                }
+            }
+        }
+    }
+}

+ 30 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/carCapture/controller/CarCaptureController.java

@@ -68,6 +68,36 @@ public class CarCaptureController {
     }
 
     /**
+     * 添加车辆识别
+     *
+     * @author newspaper
+     * @date  2024/01/24 11:14
+     */
+    @ApiOperationSupport(order = 2)
+    @ApiOperation("添加车辆识别")
+    @CommonLog("添加车辆识别")
+    @PostMapping("/ai/carCapture/add")
+    public CommonResult<String> add(@RequestBody @Valid CarCaptureAddParam carCaptureAddParam) {
+        carCaptureService.add(carCaptureAddParam);
+        return CommonResult.ok();
+    }
+
+    /**
+     * 编辑车辆识别
+     *
+     * @author newspaper
+     * @date  2024/01/24 11:14
+     */
+    @ApiOperationSupport(order = 3)
+    @ApiOperation("编辑车辆识别")
+    @CommonLog("编辑车辆识别")
+    @PostMapping("/ai/carCapture/edit")
+    public CommonResult<String> edit(@RequestBody @Valid CarCaptureEditParam carCaptureEditParam) {
+        carCaptureService.edit(carCaptureEditParam);
+        return CommonResult.ok();
+    }
+
+    /**
      * 删除车辆识别
      *
      * @author newspaper

+ 20 - 7
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/carCapture/entity/CarCapture.java

@@ -14,9 +14,14 @@ package vip.xiaonuo.modular.ai.carCapture.entity;
 
 import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fhs.core.trans.anno.Trans;
+import com.fhs.core.trans.constant.TransType;
+import com.fhs.core.trans.vo.TransPojo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
+import vip.xiaonuo.sys.modular.user.entity.SysUser;
+
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -29,7 +34,7 @@ import java.util.Date;
 @Getter
 @Setter
 @TableName("car_capture")
-public class CarCapture {
+public class CarCapture implements TransPojo {
 
     /** id */
     @TableId
@@ -47,7 +52,7 @@ public class CarCapture {
 
     /** 类型 */
     @ApiModelProperty(value = "类型", position = 4)
-    private Integer carType;
+    private String carType;
 
     /** 照片 */
     @ApiModelProperty(value = "照片", position = 5)
@@ -62,16 +67,24 @@ public class CarCapture {
     private String capResult;
 
     /** 通知人 */
-    @ApiModelProperty(value = "通知人", position = 8)
+    @ApiModelProperty(value = "通知人id", position = 8)
+    @Trans(type = TransType.SIMPLE,target = SysUser.class,fields = "name", alias = "user", ref = "notifier")
+    private String notifierId;
+
+    @ApiModelProperty(value = "通知人名称", position = 9)
+    @TableField(exist = false)
     private String notifier;
 
-    /** 组织id */
-    @ApiModelProperty(value = "组织id", position = 9)
+    @ApiModelProperty(value = "是否关注, 0:未关注 1:已关注", position = 10)
+    @TableField(exist = false)
+    private Integer isFollow;
 
-private String orgId;
+    /** 组织id */
+    @ApiModelProperty(value = "组织id", position = 11)
+    private String orgId;
 
     /** 删除标志 */
-    @ApiModelProperty(value = "删除标志", position = 10)
+    @ApiModelProperty(value = "删除标志", position = 12)
     @TableLogic
     @TableField(fill = FieldFill.INSERT)
     private String deleteFlag;

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/carCapture/param/CarCaptureEditParam.java

@@ -46,7 +46,7 @@ public class CarCaptureEditParam {
 
     /** 类型 */
     @ApiModelProperty(value = "类型", position = 4)
-    private Integer carType;
+    private String carType;
 
     /** 照片 */
     @ApiModelProperty(value = "照片", position = 5)

+ 18 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/carCapture/service/impl/CarCaptureServiceImpl.java

@@ -36,6 +36,9 @@ import vip.xiaonuo.modular.ai.carCapture.param.CarCaptureEditParam;
 import vip.xiaonuo.modular.ai.carCapture.param.CarCaptureIdParam;
 import vip.xiaonuo.modular.ai.carCapture.param.CarCapturePageParam;
 import vip.xiaonuo.modular.ai.carCapture.service.CarCaptureService;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEvents;
+import vip.xiaonuo.modular.ai.followEvents.service.FollowEventsService;
+import vip.xiaonuo.modular.ai.personCapture.entity.PersonCapture;
 
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
@@ -52,6 +55,8 @@ import java.util.List;
 public class CarCaptureServiceImpl extends ServiceImpl<CarCaptureMapper, CarCapture> implements CarCaptureService {
     @Autowired
     private CarCaptureMapper carCaptureMapper;
+    @Autowired
+    private FollowEventsService followEventsService;
 
     @Override
     public Page<CarCapture> page(CarCapturePageParam carCapturePageParam) {
@@ -69,7 +74,19 @@ public class CarCaptureServiceImpl extends ServiceImpl<CarCaptureMapper, CarCapt
         if(ObjectUtil.isNotEmpty(carCapturePageParam.getCapResult())) {
             queryWrapper.lambda().eq(CarCapture::getCapResult, carCapturePageParam.getCapResult());
         }
-        return this.page(CommonPageRequest.defaultPage(), queryWrapper);
+        Page<CarCapture> page = this.page(CommonPageRequest.defaultPage(), queryWrapper);
+        List<CarCapture> records = page.getRecords();
+        for (CarCapture record : records) {
+            long count = followEventsService.count(new QueryWrapper<FollowEvents>().lambda()
+                    .eq(FollowEvents::getEventId, record.getId())
+                    .eq(FollowEvents::getEventType, 2).eq(FollowEvents::getUserId, StpLoginUserUtil.getLoginUser().getId()));
+            if (count > 0){
+                record.setIsFollow(1);
+            }else {
+                record.setIsFollow(0);
+            }
+        }
+        return page;
     }
 
     @Transactional(rollbackFor = Exception.class)

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/dailyInspection/mapper/DailyInspectionMapper.java

@@ -24,7 +24,7 @@ import vip.xiaonuo.modular.ai.dailyInspection.entity.vo.DailyInspectionPageVo;
  * @date  2024/01/08 15:58
  **/
 public interface DailyInspectionMapper extends BaseMapper<DailyInspection> {
-    Page<DailyInspectionPageVo> page(Page<Object> defaultPage, String userId, Integer status, String orgId);
+    Page<DailyInspectionPageVo> page(Page<Object> defaultPage, String userId, Integer status);
 
     DailyInspectionPageVo detail(String id);
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/dailyInspection/mapper/mapping/DailyInspectionMapper.xml

@@ -12,7 +12,7 @@
         `daily_inspection` d
         LEFT JOIN `base_pigpen` p ON d.unit_id = p.id
         WHERE
-        d.notifier_id = #{userId} AND d.org_id = #{orgId}
+        d.notifier_id = #{userId}
         <if test="status != null">
             AND d.status = #{status}
         </if>

+ 2 - 11
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/dailyInspection/service/impl/DailyInspectionServiceImpl.java

@@ -15,8 +15,6 @@ package vip.xiaonuo.modular.ai.dailyInspection.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollStreamUtil;
 import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,26 +22,20 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
-import vip.xiaonuo.common.enums.CommonSortOrderEnum;
 import vip.xiaonuo.common.exception.CommonException;
 import vip.xiaonuo.common.page.CommonPageRequest;
+import vip.xiaonuo.common.util.UploadImage;
 import vip.xiaonuo.modular.ai.dailyInspection.entity.DailyInspection;
 import vip.xiaonuo.modular.ai.dailyInspection.entity.vo.DailyInspectionImageVo;
 import vip.xiaonuo.modular.ai.dailyInspection.entity.vo.DailyInspectionPageVo;
 import vip.xiaonuo.modular.ai.dailyInspection.mapper.DailyInspectionMapper;
-import vip.xiaonuo.modular.ai.dailyInspection.param.DailyInspectionEditParam;
 import vip.xiaonuo.modular.ai.dailyInspection.param.DailyInspectionIdParam;
 import vip.xiaonuo.modular.ai.dailyInspection.param.DailyInspectionPageParam;
 import vip.xiaonuo.modular.ai.dailyInspection.service.DailyInspectionService;
-import vip.xiaonuo.modular.bi.utils.UploadImage;
 
-import javax.validation.constraints.NotBlank;
 import java.io.IOException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -64,8 +56,7 @@ public class DailyInspectionServiceImpl extends ServiceImpl<DailyInspectionMappe
     public Page<DailyInspectionPageVo> page(DailyInspectionPageParam dailyInspectionPageParam) {
         Integer status = dailyInspectionPageParam.getStatus();
         String userId = StpLoginUserUtil.getLoginUser().getId();
-        String orgId = dailyInspectionPageParam.getOrgId();
-        Page<DailyInspectionPageVo> page = dailyInspectionMapper.page(CommonPageRequest.defaultPage(), userId, status, orgId);
+        Page<DailyInspectionPageVo> page = dailyInspectionMapper.page(CommonPageRequest.defaultPage(), userId, status);
         return page;
     }
 

+ 18 - 4
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/dirtyCapture/entity/DirtyCapture.java

@@ -14,9 +14,14 @@ package vip.xiaonuo.modular.ai.dirtyCapture.entity;
 
 import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fhs.core.trans.anno.Trans;
+import com.fhs.core.trans.constant.TransType;
+import com.fhs.core.trans.vo.TransPojo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
+import vip.xiaonuo.sys.modular.user.entity.SysUser;
+
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -29,7 +34,7 @@ import java.util.Date;
 @Getter
 @Setter
 @TableName("dirty_capture")
-public class DirtyCapture {
+public class DirtyCapture implements TransPojo {
 
     /** id */
     @TableId
@@ -50,15 +55,24 @@ public class DirtyCapture {
     private String devName;
 
     /** 通知人 */
-    @ApiModelProperty(value = "通知人", position = 5)
+    @ApiModelProperty(value = "通知人id", position = 5)
+    @Trans(type = TransType.SIMPLE,target = SysUser.class,fields = "name", alias = "user", ref = "notifier")
+    private String notifierId;
+
+    @ApiModelProperty(value = "通知人名称", position = 6)
+    @TableField(exist = false)
     private String notifier;
 
     /** 组织id */
-    @ApiModelProperty(value = "组织id", position = 6)
+    @ApiModelProperty(value = "组织id", position = 7)
     private String orgId;
 
+    @ApiModelProperty(value = "是否关注, 0:未关注 1:已关注", position = 6)
+    @TableField(exist = false)
+    private Integer isFollow;
+
     /** 删除标志 */
-    @ApiModelProperty(value = "删除标志", position = 7)
+    @ApiModelProperty(value = "删除标志", position = 8)
     @TableLogic
     @TableField(fill = FieldFill.INSERT)
     private String deleteFlag;

+ 21 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/dirtyCapture/service/impl/DirtyCaptureServiceImpl.java

@@ -19,8 +19,10 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.common.enums.CommonSortOrderEnum;
 import vip.xiaonuo.common.exception.CommonException;
 import vip.xiaonuo.common.page.CommonPageRequest;
@@ -31,6 +33,9 @@ import vip.xiaonuo.modular.ai.dirtyCapture.param.DirtyCaptureEditParam;
 import vip.xiaonuo.modular.ai.dirtyCapture.param.DirtyCaptureIdParam;
 import vip.xiaonuo.modular.ai.dirtyCapture.param.DirtyCapturePageParam;
 import vip.xiaonuo.modular.ai.dirtyCapture.service.DirtyCaptureService;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEvents;
+import vip.xiaonuo.modular.ai.followEvents.service.FollowEventsService;
+import vip.xiaonuo.modular.ai.personCapture.entity.PersonCapture;
 
 import java.util.List;
 
@@ -43,6 +48,9 @@ import java.util.List;
 @Service
 public class DirtyCaptureServiceImpl extends ServiceImpl<DirtyCaptureMapper, DirtyCapture> implements DirtyCaptureService {
 
+    @Autowired
+    private FollowEventsService followEventsService;
+
     @Override
     public Page<DirtyCapture> page(DirtyCapturePageParam dirtyCapturePageParam) {
         QueryWrapper<DirtyCapture> queryWrapper = new QueryWrapper<>();
@@ -57,7 +65,19 @@ public class DirtyCaptureServiceImpl extends ServiceImpl<DirtyCaptureMapper, Dir
             queryWrapper.lambda().orderByDesc(DirtyCapture::getCapTime);
         }
         queryWrapper.lambda().eq(DirtyCapture::getOrgId,dirtyCapturePageParam.getOrgId());
-        return this.page(CommonPageRequest.defaultPage(), queryWrapper);
+        Page<DirtyCapture> page = this.page(CommonPageRequest.defaultPage(), queryWrapper);
+        List<DirtyCapture> records = page.getRecords();
+        for (DirtyCapture record : records) {
+            long count = followEventsService.count(new QueryWrapper<FollowEvents>().lambda()
+                    .eq(FollowEvents::getEventId, record.getId())
+                    .eq(FollowEvents::getEventType, 4).eq(FollowEvents::getUserId, StpLoginUserUtil.getLoginUser().getId()));
+            if (count > 0){
+                record.setIsFollow(1);
+            }else {
+                record.setIsFollow(0);
+            }
+        }
+        return page;
     }
 
     @Transactional(rollbackFor = Exception.class)

+ 142 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/controller/FollowEventsController.java

@@ -0,0 +1,142 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.ai.followEvents.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.github.xiaoymin.knife4j.annotations.ApiSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+import vip.xiaonuo.common.annotation.CommonLog;
+import vip.xiaonuo.common.pojo.CommonResult;
+import vip.xiaonuo.common.pojo.CommonValidList;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEvents;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEventsVo;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsAddParam;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsEditParam;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsIdParam;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsPageParam;
+import vip.xiaonuo.modular.ai.followEvents.service.FollowEventsService;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import javax.validation.constraints.NotEmpty;
+
+/**
+ * 事件关注控制器
+ *
+ * @author newspaper
+ * @date  2024/01/24 10:50
+ */
+@Api(tags = "事件关注控制器")
+@ApiSupport(author = "SNOWY_TEAM", order = 1)
+@RestController
+@Validated
+public class FollowEventsController {
+
+    @Resource
+    private FollowEventsService followEventsService;
+
+    /**
+     * 获取事件关注分页
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     */
+    @ApiOperationSupport(order = 1)
+    @ApiOperation("获取事件关注分页")
+    @GetMapping("/ai/followEvents/page")
+    public CommonResult<Page<FollowEventsVo>> page(FollowEventsPageParam followEventsPageParam) {
+        return CommonResult.data(followEventsService.page(followEventsPageParam));
+    }
+
+    /**
+     * 添加事件关注
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     */
+    @ApiOperationSupport(order = 2)
+    @ApiOperation("添加事件关注")
+    @CommonLog("添加事件关注")
+    @PostMapping("/ai/followEvents/add")
+    public CommonResult<String> add(@RequestBody @Valid FollowEventsAddParam followEventsAddParam) {
+        followEventsService.add(followEventsAddParam);
+        return CommonResult.ok("关注成功");
+    }
+
+    /**
+     * 编辑事件关注
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     */
+    @ApiOperationSupport(order = 3)
+    @ApiOperation("编辑事件关注")
+    @CommonLog("编辑事件关注")
+    @PostMapping("/ai/followEvents/edit")
+    public CommonResult<String> edit(@RequestBody @Valid FollowEventsEditParam followEventsEditParam) {
+        followEventsService.edit(followEventsEditParam);
+        return CommonResult.ok();
+    }
+
+    /**
+     * 删除事件关注
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     */
+    @ApiOperationSupport(order = 4)
+    @ApiOperation("删除事件关注")
+    @CommonLog("删除事件关注")
+    @PostMapping("/ai/followEvents/delete")
+    public CommonResult<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
+                                                   CommonValidList<FollowEventsIdParam> followEventsIdParamList) {
+        followEventsService.delete(followEventsIdParamList);
+        return CommonResult.ok();
+    }
+
+    /**
+     * 获取事件关注详情
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     */
+    @ApiOperationSupport(order = 5)
+    @ApiOperation("获取事件关注详情")
+    @GetMapping("/ai/followEvents/detail")
+    public CommonResult<FollowEvents> detail(@Valid FollowEventsIdParam followEventsIdParam) {
+        return CommonResult.data(followEventsService.detail(followEventsIdParam));
+    }
+
+
+    /**
+     * 单独事件取消关注
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     */
+    @ApiOperationSupport(order = 1)
+    @ApiOperation("单独事件取消关注")
+    @PostMapping("/ai/followEvents/cancel")
+    public CommonResult<String> cancel(@RequestBody FollowEventsAddParam followEventsAddParam) {
+        followEventsService.cancel(followEventsAddParam);
+        return CommonResult.ok("取消关注成功");
+    }
+}

+ 60 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/entity/FollowEvents.java

@@ -0,0 +1,60 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.ai.followEvents.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 事件关注实体
+ *
+ * @author newspaper
+ * @date  2024/01/24 10:50
+ **/
+@Getter
+@Setter
+@TableName("follow_events")
+public class FollowEvents {
+
+    /** id */
+    @TableId
+    @ApiModelProperty(value = "id", position = 1)
+    private String id;
+
+    /** 用户id */
+    @ApiModelProperty(value = "用户id", position = 2)
+    private String userId;
+
+    /** 事件id */
+    @ApiModelProperty(value = "事件id", position = 3)
+    private String eventId;
+
+    /** 事件类型 1:人员 2:车辆 3:生物 4:摄像头 */
+    @ApiModelProperty(value = "事件类型 1:人员 2:车辆 3:生物 4:摄像头", position = 4)
+    private Integer eventType;
+
+    /** 创建时间 */
+    @ApiModelProperty(value = "创建时间", position = 5)
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    /** 删除标志 */
+    @ApiModelProperty(value = "删除标志", position = 6)
+    @TableLogic
+    @TableField(fill = FieldFill.INSERT)
+    private String deleteFlag;
+}

+ 32 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/entity/FollowEventsVo.java

@@ -0,0 +1,32 @@
+package vip.xiaonuo.modular.ai.followEvents.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class FollowEventsVo {
+
+    private String id;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    private Date capTime;
+
+    private String name;
+
+    private String type;
+
+    private String imgUrl;
+
+    private String devName;
+
+    private String capResult;
+
+    private String notifierName;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    private Date createTime;
+
+    private Integer eventType;
+}

+ 34 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/enums/FollowEventsEnum.java

@@ -0,0 +1,34 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.ai.followEvents.enums;
+
+import lombok.Getter;
+
+/**
+ * 事件关注枚举
+ *
+ * @author newspaper
+ * @date  2024/01/24 10:50
+ **/
+@Getter
+public enum FollowEventsEnum {
+
+    /** 测试 */
+    TEST("TEST");
+
+    private final String value;
+
+    FollowEventsEnum(String value) {
+        this.value = value;
+    }
+}

+ 28 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/mapper/FollowEventsMapper.java

@@ -0,0 +1,28 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.ai.followEvents.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEvents;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEventsVo;
+
+/**
+ * 事件关注Mapper接口
+ *
+ * @author newspaper
+ * @date  2024/01/24 10:50
+ **/
+public interface FollowEventsMapper extends BaseMapper<FollowEvents> {
+    Page<FollowEventsVo> page(Page<Object> defaultPage, String id, Integer eventType);
+}

+ 51 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/mapper/mapping/FollowEventsMapper.xml

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="vip.xiaonuo.modular.ai.followEvents.mapper.FollowEventsMapper">
+
+    <select id="page" resultType="vip.xiaonuo.modular.ai.followEvents.entity.FollowEventsVo">
+        SELECT * FROM (
+            SELECT p.id,p.cap_time,p.name,p.person_type AS TYPE,p.car_img_url AS 'imgUrl',p.dev_name AS devName,p.cap_result AS capResult,u.name AS 'notifierName',e.create_time, 1 AS eventType  FROM
+             `follow_events` e
+             LEFT JOIN `person_capture` p ON e.event_id = p.id
+             LEFT JOIN `SYS_USER` u ON p.notifier_id = u.id
+             WHERE e.event_type = 1
+             AND e.user_id = #{id}
+             AND e.delete_flag = 'NOT_DELETE'
+
+             UNION ALL
+
+             SELECT c.id,c.cap_time,c.car_num AS NAME,c.car_type AS TYPE,c.car_img_url AS 'imgUrl',c.dev_name AS devName,c.cap_result AS capResult,u.name AS notifierName,e.create_time, 2 AS eventType FROM
+             `follow_events` e
+             LEFT JOIN `car_capture` c ON e.event_id = c.id
+             LEFT JOIN `SYS_USER` u ON c.notifier_id = u.id
+             WHERE e.event_type = 2
+             AND e.user_id = #{id}
+             AND e.delete_flag = 'NOT_DELETE'
+
+	     UNION ALL
+
+             SELECT s.id,s.cap_time,NULL AS NAME,NULL AS TYPE,s.img_url AS 'imgUrl',s.dev_name AS devName,NULL AS capResult,u.name AS notifierName,e.create_time, 3 AS eventType FROM
+             `follow_events` e
+             LEFT JOIN `species_capture` s ON e.event_id = s.id
+             LEFT JOIN `SYS_USER` u ON s.notifier_id = u.id
+             WHERE e.event_type = 3
+             AND e.user_id = #{id}
+             AND e.delete_flag = 'NOT_DELETE'
+
+             UNION ALL
+
+             SELECT d.id,d.cap_time,NULL AS NAME,NULL AS TYPE,d.img_url AS 'imgUrl',d.dev_name AS devName,NULL AS capResult,u.name AS notifierName,e.create_time, 4 AS eventType FROM
+             `follow_events` e
+             LEFT JOIN `dirty_capture` d ON e.event_id = d.id
+             LEFT JOIN `SYS_USER` u ON d.notifier_id = u.id
+             WHERE e.event_type = 4
+             AND e.user_id = #{id}
+             AND e.delete_flag = 'NOT_DELETE'
+             ) a
+             <if test="eventType != null and eventType != ''">
+                 WHERE a.eventType = #{eventType}
+             </if>
+             ORDER BY create_time DESC
+
+    </select>
+</mapper>

+ 42 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/param/FollowEventsAddParam.java

@@ -0,0 +1,42 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.ai.followEvents.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 事件关注添加参数
+ *
+ * @author newspaper
+ * @date  2024/01/24 10:50
+ **/
+@Getter
+@Setter
+public class FollowEventsAddParam {
+
+    /** 事件id */
+    @ApiModelProperty(value = "事件id", position = 1)
+    private String eventId;
+
+    /** 事件类型 1:人员 2:车辆 3:生物 4:摄像头 */
+    @ApiModelProperty(value = "事件类型 1:人员 2:车辆 3:生物 4:摄像头", position = 2)
+    private Integer eventType;
+
+}

+ 51 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/param/FollowEventsEditParam.java

@@ -0,0 +1,51 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.ai.followEvents.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 事件关注编辑参数
+ *
+ * @author newspaper
+ * @date  2024/01/24 10:50
+ **/
+@Getter
+@Setter
+public class FollowEventsEditParam {
+
+    /** id */
+    @ApiModelProperty(value = "id", required = true, position = 1)
+    @NotBlank(message = "id不能为空")
+    private String id;
+
+    /** 用户id */
+    @ApiModelProperty(value = "用户id", position = 2)
+    private String userId;
+
+    /** 事件id */
+    @ApiModelProperty(value = "事件id", position = 3)
+    private String eventId;
+
+    /** 事件类型 1:人员 2:车辆 3:生物 4:摄像头 */
+    @ApiModelProperty(value = "事件类型 1:人员 2:车辆 3:生物 4:摄像头", position = 4)
+    private Integer eventType;
+
+}

+ 35 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/param/FollowEventsIdParam.java

@@ -0,0 +1,35 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.ai.followEvents.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * 事件关注Id参数
+ *
+ * @author newspaper
+ * @date  2024/01/24 10:50
+ **/
+@Getter
+@Setter
+public class FollowEventsIdParam {
+
+    /** id */
+    @ApiModelProperty(value = "id", required = true)
+    @NotBlank(message = "id不能为空")
+    private String id;
+}

+ 43 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/param/FollowEventsPageParam.java

@@ -0,0 +1,43 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.ai.followEvents.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 事件关注查询参数
+ *
+ * @author newspaper
+ * @date  2024/01/24 10:50
+ **/
+@Getter
+@Setter
+public class FollowEventsPageParam {
+
+    /** 当前页 */
+    @ApiModelProperty(value = "当前页码")
+    private Integer current;
+
+    /** 每页条数 */
+    @ApiModelProperty(value = "每页条数")
+    private Integer size;
+
+    /** 事件类型 */
+    @ApiModelProperty(value = "事件类型")
+    private Integer eventType;
+
+}

+ 83 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/service/FollowEventsService.java

@@ -0,0 +1,83 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.ai.followEvents.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEvents;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEventsVo;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsAddParam;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsEditParam;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsIdParam;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsPageParam;
+
+import java.util.List;
+
+/**
+ * 事件关注Service接口
+ *
+ * @author newspaper
+ * @date  2024/01/24 10:50
+ **/
+public interface FollowEventsService extends IService<FollowEvents> {
+
+    /**
+     * 获取事件关注分页
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     */
+    Page<FollowEventsVo> page(FollowEventsPageParam followEventsPageParam);
+
+    /**
+     * 添加事件关注
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     */
+    void add(FollowEventsAddParam followEventsAddParam);
+
+    /**
+     * 编辑事件关注
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     */
+    void edit(FollowEventsEditParam followEventsEditParam);
+
+    /**
+     * 删除事件关注
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     */
+    void delete(List<FollowEventsIdParam> followEventsIdParamList);
+
+    /**
+     * 获取事件关注详情
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     */
+    FollowEvents detail(FollowEventsIdParam followEventsIdParam);
+
+    /**
+     * 获取事件关注详情
+     *
+     * @author newspaper
+     * @date  2024/01/24 10:50
+     **/
+    FollowEvents queryEntity(String id);
+
+    void cancel(FollowEventsAddParam followEventsAddParam);
+}

+ 105 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/followEvents/service/impl/FollowEventsServiceImpl.java

@@ -0,0 +1,105 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.ai.followEvents.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollStreamUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import io.swagger.models.auth.In;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
+import vip.xiaonuo.common.enums.CommonSortOrderEnum;
+import vip.xiaonuo.common.exception.CommonException;
+import vip.xiaonuo.common.page.CommonPageRequest;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEvents;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEventsVo;
+import vip.xiaonuo.modular.ai.followEvents.mapper.FollowEventsMapper;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsAddParam;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsEditParam;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsIdParam;
+import vip.xiaonuo.modular.ai.followEvents.param.FollowEventsPageParam;
+import vip.xiaonuo.modular.ai.followEvents.service.FollowEventsService;
+
+import java.util.List;
+
+/**
+ * 事件关注Service接口实现类
+ *
+ * @author newspaper
+ * @date  2024/01/24 10:50
+ **/
+@Service
+public class FollowEventsServiceImpl extends ServiceImpl<FollowEventsMapper, FollowEvents> implements FollowEventsService {
+
+    @Autowired
+    private FollowEventsMapper followEventsMapper;
+
+    @Override
+    public Page<FollowEventsVo> page(FollowEventsPageParam followEventsPageParam) {
+        String id = StpLoginUserUtil.getLoginUser().getId();
+        Integer eventType = followEventsPageParam.getEventType();
+        return followEventsMapper.page(CommonPageRequest.defaultPage(), id,eventType);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void add(FollowEventsAddParam followEventsAddParam) {
+        FollowEvents followEvents = BeanUtil.toBean(followEventsAddParam, FollowEvents.class);
+        followEvents.setUserId(StpLoginUserUtil.getLoginUser().getId());
+        this.save(followEvents);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(FollowEventsEditParam followEventsEditParam) {
+        FollowEvents followEvents = this.queryEntity(followEventsEditParam.getId());
+        BeanUtil.copyProperties(followEventsEditParam, followEvents);
+        this.updateById(followEvents);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(List<FollowEventsIdParam> followEventsIdParamList) {
+        // 执行删除
+        this.removeByIds(CollStreamUtil.toList(followEventsIdParamList, FollowEventsIdParam::getId));
+    }
+
+    @Override
+    public FollowEvents detail(FollowEventsIdParam followEventsIdParam) {
+        return this.queryEntity(followEventsIdParam.getId());
+    }
+
+    @Override
+    public FollowEvents queryEntity(String id) {
+        FollowEvents followEvents = this.getById(id);
+        if(ObjectUtil.isEmpty(followEvents)) {
+            throw new CommonException("事件关注不存在,id值为:{}", id);
+        }
+        return followEvents;
+    }
+
+    @Override
+    public void cancel(FollowEventsAddParam followEventsAddParam) {
+        String userId = StpLoginUserUtil.getLoginUser().getId();
+        this.remove(new QueryWrapper<FollowEvents>().lambda()
+                .eq(FollowEvents::getUserId,userId)
+                .eq(FollowEvents::getEventId,followEventsAddParam.getEventId())
+                .eq(FollowEvents::getEventType,followEventsAddParam.getEventType()));
+    }
+}

+ 7 - 2
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/personCapture/entity/PersonCapture.java

@@ -18,6 +18,7 @@ import com.fhs.core.trans.anno.Trans;
 import com.fhs.core.trans.constant.TransType;
 import com.fhs.core.trans.vo.TransPojo;
 import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
 import lombok.Getter;
 import lombok.Setter;
 import vip.xiaonuo.modular.base.pigpen.entity.BasePigpen;
@@ -76,12 +77,16 @@ public class PersonCapture implements TransPojo {
     @TableField(exist = false)
     private String notifier;
 
+    @ApiModelProperty(value = "是否关注, 0:未关注 1:已关注", position = 10)
+    @TableField(exist = false)
+    private Integer isFollow;
+
     /** 组织id */
-    @ApiModelProperty(value = "组织id", position = 9)
+    @ApiModelProperty(value = "组织id", position = 11)
     private String orgId;
 
     /** 删除标志 */
-    @ApiModelProperty(value = "删除标志", position = 10)
+    @ApiModelProperty(value = "删除标志", position = 12)
     @TableLogic
     @TableField(fill = FieldFill.INSERT)
     private String deleteFlag;

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/personCapture/param/PersonCaptureEditParam.java

@@ -46,7 +46,7 @@ public class PersonCaptureEditParam {
 
     /** 类型 */
     @ApiModelProperty(value = "类型", position = 4)
-    private Integer personType;
+    private String personType;
 
     /** 照片 */
     @ApiModelProperty(value = "照片", position = 5)

+ 19 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/personCapture/service/impl/PersonCaptureServiceImpl.java

@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.common.enums.CommonSortOrderEnum;
 import vip.xiaonuo.common.exception.CommonException;
 import vip.xiaonuo.common.page.CommonPageRequest;
@@ -29,6 +30,8 @@ import vip.xiaonuo.core.param.OrgIdParam;
 import vip.xiaonuo.modular.ai.carCapture.entity.CarCapture;
 import vip.xiaonuo.modular.ai.carCapture.entity.vo.CarCaptureHourVo;
 import vip.xiaonuo.modular.ai.carCapture.entity.vo.CarCapturePastVo;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEvents;
+import vip.xiaonuo.modular.ai.followEvents.service.FollowEventsService;
 import vip.xiaonuo.modular.ai.personCapture.entity.PersonCapture;
 import vip.xiaonuo.modular.ai.personCapture.entity.vo.PersonCaptureHourVo;
 import vip.xiaonuo.modular.ai.personCapture.entity.vo.PersonCapturePastVo;
@@ -55,6 +58,9 @@ public class PersonCaptureServiceImpl extends ServiceImpl<PersonCaptureMapper, P
     @Autowired
     private PersonCaptureMapper personCaptureMapper;
 
+    @Autowired
+    private FollowEventsService followEventsService;
+
     @Override
     public Page<PersonCapture> page(PersonCapturePageParam personCapturePageParam) {
         QueryWrapper<PersonCapture> queryWrapper = new QueryWrapper<>();
@@ -75,7 +81,19 @@ public class PersonCaptureServiceImpl extends ServiceImpl<PersonCaptureMapper, P
             queryWrapper.lambda().orderByDesc(PersonCapture::getCapTime);
         }
         queryWrapper.lambda().eq(PersonCapture::getOrgId,personCapturePageParam.getOrgId());
-        return this.page(CommonPageRequest.defaultPage(), queryWrapper);
+        Page<PersonCapture> page = this.page(CommonPageRequest.defaultPage(), queryWrapper);
+        List<PersonCapture> records = page.getRecords();
+        for (PersonCapture record : records) {
+            long count = followEventsService.count(new QueryWrapper<FollowEvents>().lambda()
+                    .eq(FollowEvents::getEventId, record.getId())
+                    .eq(FollowEvents::getEventType, 1).eq(FollowEvents::getUserId, StpLoginUserUtil.getLoginUser().getId()));
+            if (count > 0){
+                record.setIsFollow(1);
+            }else {
+                record.setIsFollow(0);
+            }
+        }
+        return page;
     }
 
     @Transactional(rollbackFor = Exception.class)

+ 18 - 4
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/speciesCapture/entity/SpeciesCapture.java

@@ -14,9 +14,14 @@ package vip.xiaonuo.modular.ai.speciesCapture.entity;
 
 import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fhs.core.trans.anno.Trans;
+import com.fhs.core.trans.constant.TransType;
+import com.fhs.core.trans.vo.TransPojo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
+import vip.xiaonuo.sys.modular.user.entity.SysUser;
+
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -29,7 +34,7 @@ import java.util.Date;
 @Getter
 @Setter
 @TableName("species_capture")
-public class SpeciesCapture {
+public class SpeciesCapture implements TransPojo {
 
     /** id */
     @TableId
@@ -50,15 +55,24 @@ public class SpeciesCapture {
     private String devName;
 
     /** 通知人 */
-    @ApiModelProperty(value = "通知人", position = 5)
+    @ApiModelProperty(value = "通知人id", position = 5)
+    @Trans(type = TransType.SIMPLE,target = SysUser.class,fields = "name", alias = "user", ref = "notifier")
+    private String notifierId;
+
+    @ApiModelProperty(value = "通知人名称", position = 6)
+    @TableField(exist = false)
     private String notifier;
 
+    @ApiModelProperty(value = "是否关注, 0:未关注 1:已关注", position = 7)
+    @TableField(exist = false)
+    private Integer isFollow;
+
     /** 组织id */
-    @ApiModelProperty(value = "组织id", position = 6)
+    @ApiModelProperty(value = "组织id", position = 8)
     private String orgId;
 
     /** 删除标志 */
-    @ApiModelProperty(value = "删除标志", position = 7)
+    @ApiModelProperty(value = "删除标志", position = 9)
     @TableLogic
     @TableField(fill = FieldFill.INSERT)
     private String deleteFlag;

+ 21 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/speciesCapture/service/impl/SpeciesCaptureServiceImpl.java

@@ -19,11 +19,16 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.common.enums.CommonSortOrderEnum;
 import vip.xiaonuo.common.exception.CommonException;
 import vip.xiaonuo.common.page.CommonPageRequest;
+import vip.xiaonuo.modular.ai.followEvents.entity.FollowEvents;
+import vip.xiaonuo.modular.ai.followEvents.service.FollowEventsService;
+import vip.xiaonuo.modular.ai.personCapture.entity.PersonCapture;
 import vip.xiaonuo.modular.ai.speciesCapture.entity.SpeciesCapture;
 import vip.xiaonuo.modular.ai.speciesCapture.mapper.SpeciesCaptureMapper;
 import vip.xiaonuo.modular.ai.speciesCapture.param.SpeciesCaptureAddParam;
@@ -43,6 +48,9 @@ import java.util.List;
 @Service
 public class SpeciesCaptureServiceImpl extends ServiceImpl<SpeciesCaptureMapper, SpeciesCapture> implements SpeciesCaptureService {
 
+    @Autowired
+    private FollowEventsService followEventsService;
+
     @Override
     public Page<SpeciesCapture> page(SpeciesCapturePageParam speciesCapturePageParam) {
         QueryWrapper<SpeciesCapture> queryWrapper = new QueryWrapper<>();
@@ -57,7 +65,19 @@ public class SpeciesCaptureServiceImpl extends ServiceImpl<SpeciesCaptureMapper,
             queryWrapper.lambda().orderByDesc(SpeciesCapture::getCapTime);
         }
         queryWrapper.lambda().eq(SpeciesCapture::getOrgId,speciesCapturePageParam.getOrgId());
-        return this.page(CommonPageRequest.defaultPage(), queryWrapper);
+        Page<SpeciesCapture> page = this.page(CommonPageRequest.defaultPage(), queryWrapper);
+        List<SpeciesCapture> records = page.getRecords();
+        for (SpeciesCapture record : records) {
+            long count = followEventsService.count(new QueryWrapper<FollowEvents>().lambda()
+                    .eq(FollowEvents::getEventId, record.getId())
+                    .eq(FollowEvents::getEventType, 3).eq(FollowEvents::getUserId, StpLoginUserUtil.getLoginUser().getId()));
+            if (count > 0){
+                record.setIsFollow(1);
+            }else {
+                record.setIsFollow(0);
+            }
+        }
+        return page;
     }
 
     @Transactional(rollbackFor = Exception.class)

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/taskInspection/mapper/TaskInspectionMapper.java

@@ -25,7 +25,7 @@ import vip.xiaonuo.modular.ai.taskInspection.entity.vo.TaskInspectionPageVo;
  * @date  2024/01/08 09:21
  **/
 public interface TaskInspectionMapper extends BaseMapper<TaskInspection> {
-    Page<TaskInspectionPageVo> page(Page<Object> defaultPage, String userId, Integer status, String orgId);
+    Page<TaskInspectionPageVo> page(Page<Object> defaultPage, String userId, Integer status);
 
     TaskInspectionPageVo detail(String id);
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/taskInspection/mapper/mapping/TaskInspectionMapper.xml

@@ -16,7 +16,7 @@
             LEFT JOIN `base_config` c ON w.warning_type_id = c.id
             LEFT JOIN `base_pigpen` p ON w.unit_id = p.id
         WHERE
-            t.notifier_id = #{userId} AND t.org_id = #{orgId}
+            t.notifier_id = #{userId}
              <if test="status != null">
                 AND t.status = #{status}
             </if>

+ 2 - 14
snowy-web-app/src/main/java/vip/xiaonuo/modular/ai/taskInspection/service/impl/TaskInspectionServiceImpl.java

@@ -15,7 +15,6 @@ package vip.xiaonuo.modular.ai.taskInspection.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollStreamUtil;
 import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -24,38 +23,28 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
-import vip.xiaonuo.common.enums.CommonSortOrderEnum;
 import vip.xiaonuo.common.exception.CommonException;
 import vip.xiaonuo.common.page.CommonPageRequest;
-import vip.xiaonuo.dev.modular.file.enums.DevFileEngineTypeEnum;
-import vip.xiaonuo.dev.modular.file.service.DevFileService;
+import vip.xiaonuo.common.util.UploadImage;
 import vip.xiaonuo.modular.ai.dailyInspection.entity.DailyInspection;
 import vip.xiaonuo.modular.ai.dailyInspection.mapper.DailyInspectionMapper;
 import vip.xiaonuo.modular.ai.taskInspection.entity.TaskInspection;
-import vip.xiaonuo.modular.ai.taskInspection.entity.vo.TaskInspectionDetailVo;
 import vip.xiaonuo.modular.ai.taskInspection.entity.vo.TaskInspectionImageVo;
 import vip.xiaonuo.modular.ai.taskInspection.entity.vo.TaskInspectionNumVo;
 import vip.xiaonuo.modular.ai.taskInspection.entity.vo.TaskInspectionPageVo;
 import vip.xiaonuo.modular.ai.taskInspection.mapper.TaskInspectionMapper;
-import vip.xiaonuo.modular.ai.taskInspection.param.TaskInspectionAddParam;
-import vip.xiaonuo.modular.ai.taskInspection.param.TaskInspectionEditParam;
 import vip.xiaonuo.modular.ai.taskInspection.param.TaskInspectionIdParam;
 import vip.xiaonuo.modular.ai.taskInspection.param.TaskInspectionPageParam;
 import vip.xiaonuo.modular.ai.taskInspection.service.TaskInspectionService;
 import vip.xiaonuo.modular.ai.warningRemind.entity.WarningRemind;
 import vip.xiaonuo.modular.ai.warningRemind.mapper.WarningRemindMapper;
 import vip.xiaonuo.modular.base.baseConfig.mapper.BaseConfigMapper;
-import vip.xiaonuo.modular.bi.utils.UploadImage;
 import vip.xiaonuo.modular.warning.warningInfo.entity.WarningInfo;
 import vip.xiaonuo.modular.warning.warningInfo.mapper.WarningInfoMapper;
 
-import javax.validation.constraints.NotBlank;
 import java.io.IOException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -84,8 +73,7 @@ public class TaskInspectionServiceImpl extends ServiceImpl<TaskInspectionMapper,
     public Page<TaskInspectionPageVo> page(TaskInspectionPageParam taskInspectionPageParam) {
         Integer status = taskInspectionPageParam.getStatus();
         String userId = StpLoginUserUtil.getLoginUser().getId();
-        String orgId = taskInspectionPageParam.getOrgId();
-        Page<TaskInspectionPageVo> taskInspectionPageVoPage = taskInspectionMapper.page(CommonPageRequest.defaultPage(), userId, status, orgId);
+        Page<TaskInspectionPageVo> taskInspectionPageVoPage = taskInspectionMapper.page(CommonPageRequest.defaultPage(), userId, status);
         return taskInspectionPageVoPage;
     }
 

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/baseSeason/service/impl/BaseSeasonServiceImpl.java

@@ -106,7 +106,7 @@ public class BaseSeasonServiceImpl extends ServiceImpl<BaseSeasonMapper, BaseSea
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void edit(BaseSeasonEditParam baseSeasonEditParam) throws ParseException {
-        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
+        String orgId = baseSeasonEditParam.getOrgId();
         Integer seasonType = baseSeasonEditParam.getSeasonType();
         SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
         LocalDate currentDate = LocalDate.now();

+ 14 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/department/controller/DepartmentController.java

@@ -66,6 +66,20 @@ public class DepartmentController {
         return CommonResult.data(departmentService.tree(departmentOrgIdParam));
     }
 
+
+    /**
+     * 获取员工部门树
+     *
+     * @author newspaper
+     * @date  2023/12/13 08:44
+     */
+    @ApiOperationSupport(order = 1)
+    @ApiOperation("获取员工部门树")
+    @GetMapping("/base/department/getTree")
+    public CommonResult<List<Tree<String>>> getTree(DepartmentParentIdParam departmentParentIdParam) {
+        return CommonResult.data(departmentService.getTree(departmentParentIdParam));
+    }
+
     /**
      * 获取所有部门
      *

+ 35 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/department/param/DepartmentParentIdParam.java

@@ -0,0 +1,35 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.base.department.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * 部门Id参数
+ *
+ * @author newspaper
+ * @date  2023/12/13 08:44
+ **/
+@Getter
+@Setter
+public class DepartmentParentIdParam {
+
+    /** 父id */
+    @ApiModelProperty(value = "父id", required = true,position = 99)
+    @NotBlank(message = "parentId不能为空")
+    private String parentId;
+}

+ 2 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/department/service/DepartmentService.java

@@ -85,4 +85,6 @@ public interface DepartmentService extends IService<Department> {
     Page<Department> listChild(DepartmentChildParam departmentChildParam);
 
     List<BizUser> userSelector(DepartmentOrgIdParam departmentOrgIdParam);
+
+    List<Tree<String>> getTree(DepartmentParentIdParam departmentParentIdParam);
 }

+ 18 - 9
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/department/service/impl/DepartmentServiceImpl.java

@@ -12,7 +12,6 @@
  */
 package vip.xiaonuo.modular.base.department.service.impl;
 
-import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollStreamUtil;
 import cn.hutool.core.lang.tree.Tree;
 import cn.hutool.core.lang.tree.TreeNode;
@@ -28,28 +27,22 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
-import vip.xiaonuo.auth.core.pojo.SaBaseLoginUser;
-import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.biz.modular.user.entity.BizUser;
 import vip.xiaonuo.biz.modular.user.mapper.BizUserMapper;
 import vip.xiaonuo.common.enums.CommonSortOrderEnum;
 import vip.xiaonuo.common.exception.CommonException;
 import vip.xiaonuo.common.listener.CommonDataChangeEventCenter;
 import vip.xiaonuo.common.page.CommonPageRequest;
+import vip.xiaonuo.common.util.UploadImage;
 import vip.xiaonuo.core.enums.BaseDataTypeEnum;
-import vip.xiaonuo.dev.modular.file.enums.DevFileEngineTypeEnum;
 import vip.xiaonuo.dev.modular.file.service.DevFileService;
-import vip.xiaonuo.modular.base.baseConfig.entity.BaseConfig;
 import vip.xiaonuo.modular.base.department.entity.Department;
 import vip.xiaonuo.modular.base.department.mapper.DepartmentMapper;
 import vip.xiaonuo.modular.base.department.param.*;
 import vip.xiaonuo.modular.base.department.service.DepartmentService;
-import vip.xiaonuo.modular.bi.utils.UploadImage;
-import vip.xiaonuo.sys.core.enums.SysDataTypeEnum;
 import vip.xiaonuo.sys.modular.user.entity.SysUser;
 import vip.xiaonuo.sys.modular.user.mapper.SysUserMapper;
 
-import javax.validation.constraints.NotBlank;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -67,6 +60,8 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
     @Autowired
     private BizUserMapper bizUserMapper;
     @Autowired
+    private SysUserMapper sysUserMapper;
+    @Autowired
     private DevFileService devFileService;
     @Autowired
     private UploadImage uploadImage;
@@ -161,7 +156,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
             if (this.count(new QueryWrapper<Department>().lambda().eq(Department::getParentId,s)) > 0) {
                 throw new CommonException("部门存在下级,请先删除下级部门!");
             }
-            if (bizUserMapper.selectCount(new QueryWrapper<BizUser>().lambda().eq(BizUser::getDepartmentId,s)) > 0){
+            if (sysUserMapper.selectCount(new QueryWrapper<SysUser>().lambda().eq(SysUser::getDepartmentId,s)) > 0){
                 throw new CommonException("部门存在人员,请先编辑或删除下属人员!");
             }
         }
@@ -200,5 +195,19 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
         return users;
     }
 
+    @Override
+    public List<Tree<String>> getTree(DepartmentParentIdParam departmentParentIdParam) {
+        String orgId = departmentParentIdParam.getParentId();
+        List<Department> allDepartment= new ArrayList<>();
+        List<Department> baseConfigs = this.list(new LambdaQueryWrapper<Department>().eq(Department::getOrgId, orgId).orderByAsc(Department::getSortCode));
+
+        allDepartment.addAll(baseConfigs);
+        List<TreeNode<String>> treeNodeList = allDepartment.stream().map(department ->
+                new TreeNode<>(department.getId(), department.getParentId(),
+                        department.getDepartmentName(), department.getSortCode()).setExtra(JSONUtil.parseObj(department)))
+                .collect(Collectors.toList());
+        return TreeUtil.build(treeNodeList, "0");
+    }
+
 
 }

+ 5 - 3
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/inventoryUse/controller/InventoryUseController.java

@@ -35,6 +35,8 @@ import vip.xiaonuo.modular.base.inventoryUse.param.*;
 import vip.xiaonuo.modular.base.inventoryUse.service.InventoryUseService;
 import vip.xiaonuo.modular.base.peoplelist.entity.PeopleList;
 import vip.xiaonuo.modular.base.peoplelist.service.PeopleListService;
+import vip.xiaonuo.sys.modular.user.entity.SysUser;
+import vip.xiaonuo.sys.modular.user.service.SysUserService;
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
@@ -61,7 +63,7 @@ public class InventoryUseController {
     @Resource
     private BaseConfigService baseConfigService;
     @Resource
-    private PeopleListService peopleListService;
+    private SysUserService sysUserService;
 
     /**
      * 获取物资领用分页
@@ -194,8 +196,8 @@ public class InventoryUseController {
     @ApiOperationSupport(order = 9)
     @ApiOperation("获取部门人员选择器")
     @GetMapping("/base/inventoryUse/departmentPersonSelector")
-    public CommonResult<List<PeopleList>> departmentPersonSelector(InventoryUseDepartmentIdParam inventoryUseDepartmentIdParam) {
-        List<vip.xiaonuo.modular.base.peoplelist.entity.PeopleList> list = peopleListService.list(new QueryWrapper<vip.xiaonuo.modular.base.peoplelist.entity.PeopleList>().lambda().eq(vip.xiaonuo.modular.base.peoplelist.entity.PeopleList::getDepartment, inventoryUseDepartmentIdParam.getDepartmentId()));
+    public CommonResult<List<SysUser>> departmentPersonSelector(InventoryUseDepartmentIdParam inventoryUseDepartmentIdParam) {
+        List<SysUser> list = sysUserService.list(new QueryWrapper<SysUser>().lambda().eq(SysUser::getDepartmentId, inventoryUseDepartmentIdParam.getDepartmentId()));
         return CommonResult.data(list);
     }
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/inventoryUse/entity/InventoryUse.java

@@ -90,7 +90,7 @@ public class InventoryUse extends CommonEntity implements TransPojo {
 
     /** 领用人ID */
     @ApiModelProperty(value = "领用人ID", position = 12)
-    @Trans(type = TransType.SIMPLE, target = PeopleList.class, fields = "userName", alias = "user", ref = "userName")
+    @Trans(type = TransType.SIMPLE, target = SysUser.class, fields = "name", alias = "user", ref = "userName")
     private String userId;
 
     /** 预计归还时间 */

+ 1 - 12
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/inventoryUse/service/impl/InventoryUseServiceImpl.java

@@ -15,8 +15,6 @@ package vip.xiaonuo.modular.base.inventoryUse.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollStreamUtil;
 import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -24,26 +22,17 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
-import vip.xiaonuo.common.enums.CommonSortOrderEnum;
 import vip.xiaonuo.common.exception.CommonException;
-import vip.xiaonuo.common.listener.CommonDataChangeEventCenter;
 import vip.xiaonuo.common.page.CommonPageRequest;
-import vip.xiaonuo.core.enums.BaseDataTypeEnum;
-import vip.xiaonuo.dev.modular.file.enums.DevFileEngineTypeEnum;
-import vip.xiaonuo.dev.modular.file.service.DevFileService;
+import vip.xiaonuo.common.util.UploadImage;
 import vip.xiaonuo.modular.base.inventoryUse.entity.InventoryUse;
-import vip.xiaonuo.modular.base.inventoryUse.entity.vo.InventoryUseDetailVo;
-import vip.xiaonuo.modular.base.inventoryUse.entity.vo.InventoryUseVo;
 import vip.xiaonuo.modular.base.inventoryUse.mapper.InventoryUseMapper;
 import vip.xiaonuo.modular.base.inventoryUse.param.*;
 import vip.xiaonuo.modular.base.inventoryUse.service.InventoryUseService;
-import vip.xiaonuo.modular.bi.utils.UploadImage;
 
-import javax.validation.constraints.NotBlank;
 import java.io.IOException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.List;
 
 /**

+ 1 - 6
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/peoplelist/service/impl/PeopleListServiceImpl.java

@@ -12,7 +12,6 @@
  */
 package vip.xiaonuo.modular.base.peoplelist.service.impl;
 
-import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollStreamUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
@@ -27,23 +26,19 @@ import org.springframework.web.multipart.MultipartFile;
 import vip.xiaonuo.common.enums.CommonSortOrderEnum;
 import vip.xiaonuo.common.exception.CommonException;
 import vip.xiaonuo.common.page.CommonPageRequest;
-import vip.xiaonuo.dev.modular.file.enums.DevFileEngineTypeEnum;
+import vip.xiaonuo.common.util.UploadImage;
 import vip.xiaonuo.dev.modular.file.service.DevFileService;
 import vip.xiaonuo.modular.base.department.entity.Department;
 import vip.xiaonuo.modular.base.department.mapper.DepartmentMapper;
 import vip.xiaonuo.modular.base.peoplelist.entity.PeopleList;
 import vip.xiaonuo.modular.base.peoplelist.mapper.PeopleListMapper;
-import vip.xiaonuo.modular.base.peoplelist.param.PeopleListAddParam;
-import vip.xiaonuo.modular.base.peoplelist.param.PeopleListEditParam;
 import vip.xiaonuo.modular.base.peoplelist.param.PeopleListIdParam;
 import vip.xiaonuo.modular.base.peoplelist.param.PeopleListPageParam;
 import vip.xiaonuo.modular.base.peoplelist.service.PeopleListService;
-import vip.xiaonuo.modular.bi.utils.UploadImage;
 import vip.xiaonuo.sys.modular.user.entity.SysUser;
 import vip.xiaonuo.sys.modular.user.mapper.SysUserMapper;
 
 import java.io.IOException;
-import java.util.Date;
 import java.util.List;
 
 /**

+ 13 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/controller/BasePigpenController.java

@@ -87,6 +87,19 @@ public class BasePigpenController {
     }
 
     /**
+     * 获取员工栋舍树
+     *
+     * @author newspaper
+     * @date  2023/12/05 08:55
+     */
+    @ApiOperationSupport(order = 2)
+    @ApiOperation("获取员工栋舍树")
+    @GetMapping("/biz/pigpen/getTree")
+    public CommonResult<List<Tree<String>>> getTree(BasePigpenParentIdParam basePigpenParentIdParam) {
+        return CommonResult.data(basePigpenService.getTree(basePigpenParentIdParam));
+    }
+
+    /**
      * 获取移动端栋舍树
      *
      * @author newspaper

+ 35 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/param/BasePigpenParentIdParam.java

@@ -0,0 +1,35 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.base.pigpen.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * base_pigpenId参数
+ *
+ * @author newspaper
+ * @date  2023/12/05 08:55
+ **/
+@Getter
+@Setter
+public class BasePigpenParentIdParam {
+
+    /** 父id */
+    @ApiModelProperty(value = "父id", required = true, position = 99)
+    @NotBlank(message = "parentId不能为空")
+    private String parentId;
+}

+ 2 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/service/BasePigpenService.java

@@ -110,4 +110,6 @@ public interface BasePigpenService extends IService<BasePigpen> {
     List<BasePigpen> listBuild(OrgIdParam orgIdParam);
 
     List<BasePigpen> listUnit(BasePigpenIdParam basePigpenIdParam);
+
+    List<Tree<String>> getTree(BasePigpenParentIdParam basePigpenParentIdParam);
 }

+ 11 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/service/impl/BasePigpenServiceImpl.java

@@ -299,6 +299,17 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
         return list;
     }
 
+    @Override
+    public List<Tree<String>> getTree(BasePigpenParentIdParam basePigpenParentIdParam) {
+        String orgId = basePigpenParentIdParam.getParentId();
+        List<BasePigpen> allPigpenList = this.getAllPigpenList(orgId);
+        List<TreeNode<String>> treeNodeList = allPigpenList.stream().map(basePigpen ->
+                new TreeNode<>(basePigpen.getId(), basePigpen.getParentId(),
+                        basePigpen.getBuildName(), basePigpen.getSort()).setExtra(JSONUtil.parseObj(basePigpen)))
+                .collect(Collectors.toList());
+        return TreeUtil.build(treeNodeList, "0");
+    }
+
     private List<BasePigpen> getPigpenListByTypeAndPids(String orgId, int type, String pids) {
         return this.list(new QueryWrapper<BasePigpen>().lambda()
                 .eq(BasePigpen::getType, type)

+ 1 - 2
snowy-web-app/src/main/java/vip/xiaonuo/modular/bi/pigdeath/controller/PigDeathController.java

@@ -12,7 +12,6 @@
  */
 package vip.xiaonuo.modular.bi.pigdeath.controller;
 
-import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@@ -26,13 +25,13 @@ import org.springframework.web.multipart.MultipartFile;
 import vip.xiaonuo.common.annotation.CommonLog;
 import vip.xiaonuo.common.pojo.CommonResult;
 import vip.xiaonuo.common.pojo.CommonValidList;
+import vip.xiaonuo.common.util.UploadImage;
 import vip.xiaonuo.modular.bi.pigdeath.entity.PigDeath;
 import vip.xiaonuo.modular.bi.pigdeath.param.PigDeathAddParam;
 import vip.xiaonuo.modular.bi.pigdeath.param.PigDeathEditParam;
 import vip.xiaonuo.modular.bi.pigdeath.param.PigDeathIdParam;
 import vip.xiaonuo.modular.bi.pigdeath.param.PigDeathPageParam;
 import vip.xiaonuo.modular.bi.pigdeath.service.PigDeathService;
-import vip.xiaonuo.modular.bi.utils.UploadImage;
 
 
 import javax.annotation.Resource;

+ 3 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/mapper/mapping/EnergyElectricityMapper.xml

@@ -272,6 +272,7 @@
                 SUM(water_value) AS waterValue
             FROM energy_water
             WHERE YEAR(create_date) = YEAR(CURDATE())
+            AND org_id = #{orgId}
             GROUP BY MONTH(create_date)
         ) w ON m.month = w.month
         LEFT JOIN (
@@ -280,6 +281,7 @@
                 SUM(electricity_value) AS electricityValue
             FROM energy_electricity
             WHERE YEAR(create_date) = YEAR(CURDATE())
+            AND org_id = #{orgId}
             GROUP BY MONTH(create_date)
         ) e ON m.month = e.month
         LEFT JOIN (
@@ -288,6 +290,7 @@
                 ROUND(SUM(feed_value)/1000,1) AS feedValue
             FROM feeding_fat
             WHERE YEAR(create_time) = YEAR(CURDATE())
+            AND org_id = #{orgId}
             GROUP BY MONTH(create_time)
         ) f ON m.month = f.month
         ORDER BY m.month

+ 5 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyThreshold/entity/vo/EnergyThresholdListVo.java

@@ -33,6 +33,10 @@ public class EnergyThresholdListVo{
     @ApiModelProperty(value = "栋舍名称", position = 2)
     private String buildingName;
 
-    @ApiModelProperty(value = "单元阈值数组", position = 3)
+    /** 状态 */
+    @ApiModelProperty(value = "状态", position = 3)
+    private Integer isEnable;
+
+    @ApiModelProperty(value = "单元阈值数组", position = 4)
     private List<EnergyThresholdVo> list;
 }

+ 6 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/service/impl/EnergyThresholdServiceImpl.java

@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.modular.base.pigpen.entity.BasePigpen;
 import vip.xiaonuo.modular.base.pigpen.mapper.BasePigpenMapper;
 import vip.xiaonuo.modular.energy.energyThreshold.entity.EnergyThreshold;
@@ -72,6 +73,11 @@ public class EnergyThresholdServiceImpl extends ServiceImpl<EnergyThresholdMappe
                     energyThresholdVos.add(energyThresholdVo);
                 }
             }
+            if (ObjectUtil.isNotEmpty(energyThresholdVos)){
+                energyThresholdListVo.setIsEnable(energyThresholdVos.get(0).getIsEnable());
+            }else {
+                energyThresholdListVo.setIsEnable(0);
+            }
             energyThresholdListVo.setList(energyThresholdVos);
             resultList.add(energyThresholdListVo);
         }

+ 2 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/param/EnvThresholdSyncParam.java

@@ -15,6 +15,7 @@ package vip.xiaonuo.modular.env.envThreshold.param;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
+import vip.xiaonuo.core.param.OrgIdParam;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
@@ -28,7 +29,7 @@ import java.math.BigDecimal;
  **/
 @Getter
 @Setter
-public class EnvThresholdSyncParam {
+public class EnvThresholdSyncParam extends OrgIdParam {
 
     /** 春季温度上限 */
     @ApiModelProperty(value = "春季温度上限", required = true, position = 1)

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/service/impl/EnvThresholdServiceImpl.java

@@ -111,7 +111,7 @@ public class EnvThresholdServiceImpl extends ServiceImpl<EnvThresholdMapper, Env
     @Override
     @Transactional
     public void syncThreshold(EnvThresholdSyncParam envThresholdSyncParam) {
-        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
+        String orgId = envThresholdSyncParam.getOrgId();
         List<BasePigpen> basePigpens = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().lambda()
                 .like(BasePigpen::getPids, envThresholdSyncParam.getUnitId())
                 .eq(BasePigpen::getOrgId, orgId)