Explorar o código

Merge remote-tracking branch 'origin/master'

soft5566 %!s(int64=2) %!d(string=hai) anos
pai
achega
4854ce2174
Modificáronse 96 ficheiros con 6777 adicións e 430 borrados
  1. 391 349
      .idea/workspace.xml
  2. 5 0
      pom.xml
  3. 3 3
      src/main/java/com/template/AutoCode.java
  4. 35 0
      src/main/java/com/template/api/SmartAttendanceControllerAPI.java
  5. 10 7
      src/main/java/com/template/api/SmartAuthorGroupControllerAPI.java
  6. 35 0
      src/main/java/com/template/api/SmartClassControllerAPI.java
  7. 8 2
      src/main/java/com/template/api/SmartDepartmentControllerAPI.java
  8. 35 0
      src/main/java/com/template/api/SmartGradeControllerAPI.java
  9. 78 0
      src/main/java/com/template/api/WechatScanLoginControllerAPI.java
  10. 16 0
      src/main/java/com/template/common/constanst/Constanst.java
  11. 165 0
      src/main/java/com/template/common/utils/AesUtil.java
  12. 47 0
      src/main/java/com/template/common/utils/Base64Util.java
  13. 9 0
      src/main/java/com/template/common/utils/DataBliu.java
  14. 241 0
      src/main/java/com/template/common/utils/DateUtils.java
  15. 241 0
      src/main/java/com/template/common/utils/HttpClientUtils.java
  16. 112 0
      src/main/java/com/template/common/utils/HttpUtils.java
  17. 3 5
      src/main/java/com/template/common/utils/JWTUtil.java
  18. 99 0
      src/main/java/com/template/common/utils/PropertiesUtil.java
  19. 32 0
      src/main/java/com/template/common/utils/RandomTrackAlgorithm.java
  20. 125 0
      src/main/java/com/template/common/utils/RequestUtils.java
  21. 617 0
      src/main/java/com/template/common/utils/TimeExchange2.java
  22. 41 0
      src/main/java/com/template/common/utils/TreeRecordsUtil.java
  23. 25 0
      src/main/java/com/template/common/utils/UUIDUtil.java
  24. 32 0
      src/main/java/com/template/config/ParkConfig.java
  25. 20 0
      src/main/java/com/template/config/ScheduleConfig.java
  26. 3 2
      src/main/java/com/template/controller/LoginController.java
  27. 97 0
      src/main/java/com/template/controller/ScheduleController.java
  28. 43 0
      src/main/java/com/template/controller/SmartAttendanceController.java
  29. 322 33
      src/main/java/com/template/controller/SmartAuthorGroupController.java
  30. 42 0
      src/main/java/com/template/controller/SmartClassController.java
  31. 111 12
      src/main/java/com/template/controller/SmartDepartmentController.java
  32. 44 0
      src/main/java/com/template/controller/SmartGradeController.java
  33. 4 0
      src/main/java/com/template/controller/SmartUserController.java
  34. 80 13
      src/main/java/com/template/controller/SmartVisitorController.java
  35. 263 0
      src/main/java/com/template/controller/WechatScanLoginController.java
  36. 18 0
      src/main/java/com/template/mapper/SmartAttendanceMapper.java
  37. 18 0
      src/main/java/com/template/mapper/SmartClassMapper.java
  38. 18 0
      src/main/java/com/template/mapper/SmartGradeMapper.java
  39. 2 0
      src/main/java/com/template/mapper/SmartVisitorMapper.java
  40. 63 0
      src/main/java/com/template/mapper/WechatScanLoginMapper.java
  41. 308 0
      src/main/java/com/template/model/pojo/AttendanceRuleListSchoolAttendRuleParam.java
  42. 35 0
      src/main/java/com/template/model/pojo/AttendanceRuleListSchoolAttendRuleRequest.java
  43. 218 0
      src/main/java/com/template/model/pojo/AttendanceRuleListSchoolAttendRuleResult.java
  44. 251 0
      src/main/java/com/template/model/pojo/AttendanceServiceListAttendClassRecordsParam.java
  45. 35 0
      src/main/java/com/template/model/pojo/AttendanceServiceListAttendClassRecordsRequest.java
  46. 182 0
      src/main/java/com/template/model/pojo/AttendanceServiceListAttendClassRecordsResult.java
  47. 121 0
      src/main/java/com/template/model/pojo/OrgClassOpenSeewoUcOpenV1ClassFullParam.java
  48. 35 0
      src/main/java/com/template/model/pojo/OrgClassOpenSeewoUcOpenV1ClassFullRequest.java
  49. 126 0
      src/main/java/com/template/model/pojo/OrgClassOpenSeewoUcOpenV1ClassFullResult.java
  50. 71 0
      src/main/java/com/template/model/pojo/SmartAttendance.java
  51. 0 2
      src/main/java/com/template/model/pojo/SmartAuthorGroup.java
  52. 0 2
      src/main/java/com/template/model/pojo/SmartAuthority.java
  53. 71 0
      src/main/java/com/template/model/pojo/SmartClass.java
  54. 65 0
      src/main/java/com/template/model/pojo/SmartGrade.java
  55. 30 0
      src/main/java/com/template/model/request/insertDepartmentRequest.java
  56. 35 0
      src/main/java/com/template/model/request/updateDepartmentRequest.java
  57. 14 0
      src/main/java/com/template/model/tongji/All.java
  58. 16 0
      src/main/java/com/template/model/tongji/DAll.java
  59. 41 0
      src/main/java/com/template/model/tongji/DayMeterDetail.java
  60. 53 0
      src/main/java/com/template/model/tongji/EnergyTj.java
  61. 50 0
      src/main/java/com/template/model/tongji/MeterMonthData.java
  62. 25 0
      src/main/java/com/template/model/tongji/MonthMeterDetail.java
  63. 24 0
      src/main/java/com/template/model/tongji/Tj.java
  64. 38 0
      src/main/java/com/template/model/vo/DepartmentTreeVo.java
  65. 17 0
      src/main/java/com/template/model/vo/VisitorCountVo.java
  66. 89 0
      src/main/java/com/template/model/weixin/AccessToken.java
  67. 36 0
      src/main/java/com/template/model/weixin/AuthorAndGroup.java
  68. 27 0
      src/main/java/com/template/model/weixin/AuthorAndGroup2.java
  69. 101 0
      src/main/java/com/template/model/weixin/AuthorListGroup.java
  70. 43 0
      src/main/java/com/template/model/weixin/HttpParame.java
  71. 65 0
      src/main/java/com/template/model/weixin/Result.java
  72. 135 0
      src/main/java/com/template/model/weixin/WechatUserUnionID.java
  73. 42 0
      src/main/java/com/template/model/weixin/userAuthor.java
  74. 16 0
      src/main/java/com/template/services/SmartAttendanceService.java
  75. 7 0
      src/main/java/com/template/services/SmartAuthorGroupService.java
  76. 6 0
      src/main/java/com/template/services/SmartAuthorityService.java
  77. 16 0
      src/main/java/com/template/services/SmartClassService.java
  78. 8 0
      src/main/java/com/template/services/SmartDepartmentService.java
  79. 16 0
      src/main/java/com/template/services/SmartGradeService.java
  80. 3 0
      src/main/java/com/template/services/SmartVisitorService.java
  81. 63 0
      src/main/java/com/template/services/WechatScanLoginService.java
  82. 20 0
      src/main/java/com/template/services/impl/SmartAttendanceServiceImpl.java
  83. 16 0
      src/main/java/com/template/services/impl/SmartAuthorGroupServiceImpl.java
  84. 10 0
      src/main/java/com/template/services/impl/SmartAuthorityServiceImpl.java
  85. 20 0
      src/main/java/com/template/services/impl/SmartClassServiceImpl.java
  86. 32 0
      src/main/java/com/template/services/impl/SmartDepartmentServiceImpl.java
  87. 20 0
      src/main/java/com/template/services/impl/SmartGradeServiceImpl.java
  88. 6 0
      src/main/java/com/template/services/impl/SmartVisitorServiceImpl.java
  89. 286 0
      src/main/java/com/template/services/impl/WechatScanLoginServiceImpl.java
  90. 14 0
      src/main/resources/application-dev.yml
  91. 6 0
      src/main/resources/application.properties
  92. 20 0
      src/main/resources/mapper/template/SmartVisitorMapper.xml
  93. 206 0
      src/main/resources/mapper/template/WechatScanLoginMapper.xml
  94. 14 0
      target/classes/application-dev.yml
  95. 20 0
      target/classes/mapper/template/SmartVisitorMapper.xml
  96. BIN=BIN
      target/mybatis_plus-0.0.1-SNAPSHOT.jar.original

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 391 - 349
.idea/workspace.xml


+ 5 - 0
pom.xml

@@ -212,6 +212,11 @@
             <version>5.4.3</version>
             <version>5.4.3</version>
         </dependency>
         </dependency>
 
 
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.4.2</version>
+        </dependency>
     </dependencies>
     </dependencies>
 
 
     <build>
     <build>

+ 3 - 3
src/main/java/com/template/AutoCode.java

@@ -39,10 +39,10 @@ public class AutoCode {
         mpg.setGlobalConfig(gc);
         mpg.setGlobalConfig(gc);
 //2、设置数据源
 //2、设置数据源
         DataSourceConfig dsc = new DataSourceConfig();
         DataSourceConfig dsc = new DataSourceConfig();
-        dsc.setUrl("jdbc:mysql://192.168.1.34:3306/smart_middle?useUnicode=tru&characterEncoding=UTF-8&useSSL=false&useAffectedRows=true&allowPublicKeyRetrieval=true&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai");
+        dsc.setUrl("jdbc:mysql://111.231.169.217:3306/smart_middle?useUnicode=tru&characterEncoding=UTF-8&useSSL=false&useAffectedRows=true&allowPublicKeyRetrieval=true&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai");
         dsc.setDriverName("com.mysql.cj.jdbc.Driver");
         dsc.setDriverName("com.mysql.cj.jdbc.Driver");
         dsc.setUsername("root");
         dsc.setUsername("root");
-        dsc.setPassword("Ro0!ot_369!");
+        dsc.setPassword("Chuanghai2023.");
         dsc.setDbType(DbType.MYSQL);
         dsc.setDbType(DbType.MYSQL);
         mpg.setDataSource(dsc);
         mpg.setDataSource(dsc);
         //3、包的配置
         //3、包的配置
@@ -56,7 +56,7 @@ public class AutoCode {
         mpg.setPackageInfo(pc);
         mpg.setPackageInfo(pc);
         //4、策略配置
         //4、策略配置
         StrategyConfig strategy = new StrategyConfig();
         StrategyConfig strategy = new StrategyConfig();
-        strategy.setInclude("smart_data_class","smart_data_source","smart_data_source_log"); // 设置要映射的表名
+        strategy.setInclude("smart_class","smart_grade","smart_attendance"); // 设置要映射的表名
         strategy.setNaming(NamingStrategy.underline_to_camel);//下划线转驼峰
         strategy.setNaming(NamingStrategy.underline_to_camel);//下划线转驼峰
         strategy.setColumnNaming(NamingStrategy.underline_to_camel);//下划线转驼峰
         strategy.setColumnNaming(NamingStrategy.underline_to_camel);//下划线转驼峰
         strategy.setEntityLombokModel(true); // 自动lombok;
         strategy.setEntityLombokModel(true); // 自动lombok;

+ 35 - 0
src/main/java/com/template/api/SmartAttendanceControllerAPI.java

@@ -0,0 +1,35 @@
+package com.template.api;
+
+import com.template.model.pojo.SmartAttendance;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/3/30 星期四 17:28
+ * @Description: com.video.api
+ * @Version: 1.0
+ */
+@RequestMapping("/api/smartAttendance")
+@Api(tags = {"SmartAttendanceControllerAPI"}, value = "考勤")
+public interface SmartAttendanceControllerAPI {
+    @PostMapping(value = "/insertSmartAttendance")
+    @ApiOperation(value = "添加考勤", notes = "添加考勤数据", httpMethod = "POST")
+    CommonResult insertSmartAttendance(@Validated @RequestBody SmartAttendance smartApply, BindingResult bindingResult);
+
+    @PostMapping(value = "/updateSmartAttendanceById")
+    @ApiOperation(value = "编辑考勤数据", notes = "编辑考勤数据", httpMethod = "POST")
+    CommonResult updateSmartAttendanceById(@Validated @RequestBody SmartAttendance ra, BindingResult bindingResult);
+
+    @GetMapping(value = "/queryPageSmartAttendance")
+    @ApiOperation(value = "考勤分页数据", notes = "考勤分页数据", httpMethod = "GET")
+    CommonResult queryPageSmartAttendances(@RequestParam int currentPage, @RequestParam int pageCount, String name);
+
+    @GetMapping(value = "/deleteSmartAttendanceById")
+    @ApiOperation(value = "根据ID删除指定考勤", notes = "根据ID删除指定考勤", httpMethod = "GET")
+    CommonResult deleteSmartAttendanceById(@RequestParam int id);
+}

+ 10 - 7
src/main/java/com/template/api/SmartAuthorGroupControllerAPI.java

@@ -1,5 +1,6 @@
 package com.template.api;
 package com.template.api;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.model.result.CommonResult;
 import com.template.model.result.CommonResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -8,6 +9,8 @@ import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.text.ParseException;
+
 /**
 /**
  * @Author: binguo
  * @Author: binguo
  * @Date: 2023/3/30 星期四 17:28
  * @Date: 2023/3/30 星期四 17:28
@@ -17,19 +20,19 @@ import org.springframework.web.bind.annotation.*;
 @RequestMapping("/api/smartAuthorGroup")
 @RequestMapping("/api/smartAuthorGroup")
 @Api(tags = {"SmartAuthorGroupControllerAPI"}, value = "权限组")
 @Api(tags = {"SmartAuthorGroupControllerAPI"}, value = "权限组")
 public interface SmartAuthorGroupControllerAPI {
 public interface SmartAuthorGroupControllerAPI {
-    @PostMapping(value = "/insertSmartAuthorGroup")
+    @RequestMapping(value = "/insertSmartAuthorGroup")
     @ApiOperation(value = "添加权限组", notes = "添加权限组数据", httpMethod = "POST")
     @ApiOperation(value = "添加权限组", notes = "添加权限组数据", httpMethod = "POST")
-    CommonResult insertSmartAuthorGroup(@Validated @RequestBody SmartAuthorGroup smartApply, BindingResult bindingResult);
+    CommonResult insertSmartAuthorGroup(@Validated @RequestBody JSONObject jsonObject, Integer samePower) throws ParseException;
 
 
-    @PostMapping(value = "/updateSmartAuthorGroupById")
+    @RequestMapping(value = "/updateSmartAuthorGroup")
     @ApiOperation(value = "编辑权限组数据", notes = "编辑权限组数据", httpMethod = "POST")
     @ApiOperation(value = "编辑权限组数据", notes = "编辑权限组数据", httpMethod = "POST")
-    CommonResult updateSmartAuthorGroupById(@Validated @RequestBody SmartAuthorGroup ra, BindingResult bindingResult);
+    CommonResult updateSmartAuthorGroup(@Validated @RequestBody JSONObject jsonObject, Integer samePower) throws ParseException;
 
 
-    @GetMapping(value = "/queryPageSmartAuthorGroup")
+    @RequestMapping(value = "/querySmartAuthorGroup")
     @ApiOperation(value = "权限组分页数据", notes = "权限组分页数据", httpMethod = "GET")
     @ApiOperation(value = "权限组分页数据", notes = "权限组分页数据", httpMethod = "GET")
-    CommonResult queryPageSmartAuthorGroups(@RequestParam int currentPage, @RequestParam int pageCount, String name);
+    CommonResult querySmartAuthorGroup(@RequestParam Integer authorGroupId);
 
 
-    @GetMapping(value = "/deleteSmartAuthorGroupById")
+    @RequestMapping(value = "/deleteSmartAuthorGroupById")
     @ApiOperation(value = "根据ID删除指定权限组", notes = "根据ID删除指定权限组", httpMethod = "GET")
     @ApiOperation(value = "根据ID删除指定权限组", notes = "根据ID删除指定权限组", httpMethod = "GET")
     CommonResult deleteSmartAuthorGroupById(@RequestParam int id);
     CommonResult deleteSmartAuthorGroupById(@RequestParam int id);
 }
 }

+ 35 - 0
src/main/java/com/template/api/SmartClassControllerAPI.java

@@ -0,0 +1,35 @@
+package com.template.api;
+
+import com.template.model.pojo.SmartClass;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/3/30 星期四 17:28
+ * @Description: com.video.api
+ * @Version: 1.0
+ */
+@RequestMapping("/api/smartClass")
+@Api(tags = {"SmartClassControllerAPI"}, value = "班级")
+public interface SmartClassControllerAPI {
+    @PostMapping(value = "/insertSmartClass")
+    @ApiOperation(value = "添加班级", notes = "添加班级数据", httpMethod = "POST")
+    CommonResult insertSmartClass(@Validated @RequestBody SmartClass smartApply, BindingResult bindingResult);
+
+    @PostMapping(value = "/updateSmartClassById")
+    @ApiOperation(value = "编辑班级数据", notes = "编辑班级数据", httpMethod = "POST")
+    CommonResult updateSmartClassById(@Validated @RequestBody SmartClass ra, BindingResult bindingResult);
+
+    @GetMapping(value = "/queryPageSmartClass")
+    @ApiOperation(value = "班级分页数据", notes = "班级分页数据", httpMethod = "GET")
+    CommonResult queryPageSmartClasss(@RequestParam int currentPage, @RequestParam int pageCount, String name);
+
+    @GetMapping(value = "/deleteSmartClassById")
+    @ApiOperation(value = "根据ID删除指定班级", notes = "根据ID删除指定班级", httpMethod = "GET")
+    CommonResult deleteSmartClassById(@RequestParam int id);
+}

+ 8 - 2
src/main/java/com/template/api/SmartDepartmentControllerAPI.java

@@ -1,6 +1,8 @@
 package com.template.api;
 package com.template.api;
 
 
 import com.template.model.pojo.SmartDepartment;
 import com.template.model.pojo.SmartDepartment;
+import com.template.model.request.insertDepartmentRequest;
+import com.template.model.request.updateDepartmentRequest;
 import com.template.model.result.CommonResult;
 import com.template.model.result.CommonResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
@@ -19,11 +21,11 @@ import org.springframework.web.bind.annotation.*;
 public interface SmartDepartmentControllerAPI {
 public interface SmartDepartmentControllerAPI {
     @PostMapping(value = "/insertSmartDepartment")
     @PostMapping(value = "/insertSmartDepartment")
     @ApiOperation(value = "添加部门", notes = "添加部门数据", httpMethod = "POST")
     @ApiOperation(value = "添加部门", notes = "添加部门数据", httpMethod = "POST")
-    CommonResult insertSmartDepartment(@Validated @RequestBody SmartDepartment smartApply, BindingResult bindingResult);
+    CommonResult insertSmartDepartment(@Validated @RequestBody insertDepartmentRequest smartApply, BindingResult bindingResult);
 
 
     @PostMapping(value = "/updateSmartDepartmentById")
     @PostMapping(value = "/updateSmartDepartmentById")
     @ApiOperation(value = "编辑部门数据", notes = "编辑部门数据", httpMethod = "POST")
     @ApiOperation(value = "编辑部门数据", notes = "编辑部门数据", httpMethod = "POST")
-    CommonResult updateSmartDepartmentById(@Validated @RequestBody SmartDepartment ra, BindingResult bindingResult);
+    CommonResult updateSmartDepartmentById(@Validated @RequestBody updateDepartmentRequest udr, BindingResult bindingResult);
 
 
     @GetMapping(value = "/queryPageSmartDepartment")
     @GetMapping(value = "/queryPageSmartDepartment")
     @ApiOperation(value = "部门分页数据", notes = "部门分页数据", httpMethod = "GET")
     @ApiOperation(value = "部门分页数据", notes = "部门分页数据", httpMethod = "GET")
@@ -32,4 +34,8 @@ public interface SmartDepartmentControllerAPI {
     @GetMapping(value = "/deleteSmartDepartmentById")
     @GetMapping(value = "/deleteSmartDepartmentById")
     @ApiOperation(value = "根据ID删除指定部门", notes = "根据ID删除指定部门", httpMethod = "GET")
     @ApiOperation(value = "根据ID删除指定部门", notes = "根据ID删除指定部门", httpMethod = "GET")
     CommonResult deleteSmartDepartmentById(@RequestParam int id);
     CommonResult deleteSmartDepartmentById(@RequestParam int id);
+
+    @GetMapping(value = "/queryDepartmentTree")
+    @ApiOperation(value = "查询部门树形结构数据", notes = "查询部门树形结构数据", httpMethod = "GET")
+    CommonResult queryDepartmentTree(String name);
 }
 }

+ 35 - 0
src/main/java/com/template/api/SmartGradeControllerAPI.java

@@ -0,0 +1,35 @@
+package com.template.api;
+
+import com.template.model.pojo.SmartGrade;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/3/30 星期四 17:28
+ * @Description: com.video.api
+ * @Version: 1.0
+ */
+@RequestMapping("/api/smartGrade")
+@Api(tags = {"SmartGradeControllerAPI"}, value = "年级")
+public interface SmartGradeControllerAPI {
+    @PostMapping(value = "/insertSmartGrade")
+    @ApiOperation(value = "添加年级", notes = "添加年级数据", httpMethod = "POST")
+    CommonResult insertSmartGrade(@Validated @RequestBody SmartGrade smartApply, BindingResult bindingResult);
+
+    @PostMapping(value = "/updateSmartGradeById")
+    @ApiOperation(value = "编辑年级数据", notes = "编辑年级数据", httpMethod = "POST")
+    CommonResult updateSmartGradeById(@Validated @RequestBody SmartGrade ra, BindingResult bindingResult);
+
+    @GetMapping(value = "/queryPageSmartGrade")
+    @ApiOperation(value = "年级分页数据", notes = "年级分页数据", httpMethod = "GET")
+    CommonResult queryPageSmartGrades(@RequestParam int currentPage, @RequestParam int pageCount, String name);
+
+    @GetMapping(value = "/deleteSmartGradeById")
+    @ApiOperation(value = "根据ID删除指定年级", notes = "根据ID删除指定年级", httpMethod = "GET")
+    CommonResult deleteSmartGradeById(@RequestParam int id);
+}

+ 78 - 0
src/main/java/com/template/api/WechatScanLoginControllerAPI.java

@@ -0,0 +1,78 @@
+package com.template.api;
+
+import com.template.model.result.CommonResult;
+import com.template.model.tongji.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.io.UnsupportedEncodingException;
+import java.text.ParseException;
+
+@RequestMapping("/api/wechat")
+@Api(tags = {"WechatScanLoginController"}, value = "扫码登录")
+public interface WechatScanLoginControllerAPI {
+
+    @RequestMapping(value = "/login")
+    @ApiOperation(value = "二维码登录")
+    public String login(Model model) throws UnsupportedEncodingException;
+
+    @RequestMapping(value = "/callback")
+    @ApiOperation(value = "登录回调")
+    public String callback(String code, String state) throws UnsupportedEncodingException;
+
+    @RequestMapping(value = "/bind")
+    @ApiOperation(value = "绑定微信", httpMethod = "GET")
+    public String bindUserMac(String cardNo) throws UnsupportedEncodingException;
+
+    @RequestMapping(value = "/bindcallback")
+    @ApiOperation(value = "绑定微信回调", httpMethod = "GET")
+    public String bindcallback(String code, String state, String cardNo) throws UnsupportedEncodingException;
+
+    @RequestMapping(value = "/insertMonthMeter")
+    @ResponseBody
+    public String insertMonthMeter(String month);
+
+    @RequestMapping(value = "/insertDayMeter")
+    @ResponseBody
+    public String insertDayMeter(String day);
+
+    @RequestMapping(value = "/getUserIdTj")
+    @ResponseBody
+    public CommonResult getUserIdTj();
+
+    @RequestMapping(value = "/getUserIdTjt")
+    @ResponseBody
+    public CommonResult getUserIdTjt();
+
+    @RequestMapping(value = "/getWaterTj")
+    @ResponseBody
+    public CommonResult getWaterTj();
+
+    @RequestMapping(value = "/getElcTj")
+    @ResponseBody
+    public CommonResult getElcTj();
+
+    @RequestMapping(value = "/getMonWater")
+    @ResponseBody
+    public CommonResult getMonWater() throws ParseException;
+
+    @RequestMapping(value = "/getMonElc")
+    @ResponseBody
+    public CommonResult getMonElc() throws ParseException;
+
+    @RequestMapping(value = "/getMeterMonthPage")
+    @ResponseBody
+    public CommonResult getMeterMonthPage(MeterMonthData meterMonthData,int currentPage, int pageCount);
+
+    @RequestMapping(value = "/getMeterDayPage")
+    @ResponseBody
+    public CommonResult getMeterDayPage(MeterMonthData meterMonthData,int currentPage, int pageCount);
+
+    @RequestMapping(value = "/getPosition")
+    @ResponseBody
+    public CommonResult getPosition();
+}

+ 16 - 0
src/main/java/com/template/common/constanst/Constanst.java

@@ -0,0 +1,16 @@
+package com.template.common.constanst;
+
+/**
+ * <p>Title: Constanst</p>
+ * <p>Description: 系统所用到的常量 </p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+public class Constanst {
+	
+	/**
+	 * 自定义加密措施
+	 */
+	public static final String PWD_MD5 = "FeNG#@YOnG";
+
+}

+ 165 - 0
src/main/java/com/template/common/utils/AesUtil.java

@@ -0,0 +1,165 @@
+package com.template.common.utils;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.util.UUID;
+
+/**
+ * <p>Title: AesUtil</p>
+ * <p>Description: AES加密解密</p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+public class AesUtil {
+
+	/**
+	 * 秘钥
+	 */
+	public static final String PASSWORD_SECRET_KEY = "EasyRailEveryday";
+	
+	/**
+	 * 初始向量
+	 */
+	public static final String INITIAL_VECTOR = "EasyRailEasyRail";
+	
+    /**
+     * 加密
+     * @param content 需要加密的内容
+     * @param password  加密密码
+     * @param keySize 密钥长度16,24,32(密码长度为24和32时需要将local_policy.jar/US_export_policy.jar两个jar包放到JRE目录%jre%/lib/security下)
+     * @return
+     */
+    public static byte[] encrypt(String content, String password, int keySize){
+    	try {                              
+        	//密钥长度不够用0补齐。
+    		SecretKeySpec key = new SecretKeySpec(ZeroPadding(password.getBytes(Base64Util.DEFAULT_CHARSET), keySize), "AES");
+    		//定义加密算法AES、算法模式ECB、补码方式PKCS5Padding
+            //Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+    		//定义加密算法AES 算法模式CBC、补码方式PKCS5Padding
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+            //CBC模式模式下初始向量 不足16位用0补齐
+            IvParameterSpec iv = new IvParameterSpec(ZeroPadding(INITIAL_VECTOR.getBytes(Base64Util.DEFAULT_CHARSET),16));
+            byte[] byteContent = content.getBytes();  
+            //初始化加密
+            //ECB
+            //cipher.init(Cipher.ENCRYPT_MODE, key);
+            //CBC 
+			cipher.init(Cipher.ENCRYPT_MODE, key,iv);
+            byte[] result = cipher.doFinal(byteContent);
+            return result; 
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        } catch (NoSuchPaddingException e) {
+            e.printStackTrace();
+        } catch (InvalidKeyException e) {
+            e.printStackTrace();
+        } catch (IllegalBlockSizeException e) {
+            e.printStackTrace();
+        } catch (BadPaddingException e) {
+            e.printStackTrace();
+        } catch (InvalidAlgorithmParameterException e) {
+        	e.printStackTrace();
+        } catch (Exception e) {
+        	e.printStackTrace();
+        }
+        return null;
+    }
+    
+    /**解密
+     * @param content  待解密内容
+     * @param password 解密密钥
+     * @param keySize 密钥长度16,24,32(密码长度为24和32时需要将local_policy.jar/US_export_policy.jar两个jar包放到JRE目录%jre%/lib/security下)
+     * @return
+     */
+    public static String decrypt(byte[] content, String password, int keySize) {
+        try { 
+        	//密钥长度不够用0补齐。
+    		SecretKeySpec key = new SecretKeySpec(ZeroPadding(password.getBytes(), keySize), "AES");
+    		//定义加密算法AES、算法模式ECB、补码方式PKCS5Padding
+            //Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+    		//定义加密算法AES 算法模式CBC、补码方式PKCS5Padding
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+            //CBC模式模式下初始向量 不足16位用0补齐
+            IvParameterSpec iv = new IvParameterSpec(ZeroPadding(INITIAL_VECTOR.getBytes(Base64Util.DEFAULT_CHARSET),16));
+            // 初始化解密
+            //ECB
+            //cipher.init(Cipher.DECRYPT_MODE, key);
+            //CBC
+            cipher.init(Cipher.DECRYPT_MODE, key,iv);
+            byte[] result = cipher.doFinal(content);
+            return new String(result,Base64Util.DEFAULT_CHARSET); 
+        } catch (NoSuchAlgorithmException e) {
+        	e.printStackTrace();
+        } catch (NoSuchPaddingException e) {
+        	e.printStackTrace();
+        } catch (InvalidKeyException e) {
+        	e.printStackTrace();
+        } catch (IllegalBlockSizeException e) {
+        	e.printStackTrace();
+        } catch (BadPaddingException e) {
+        	e.printStackTrace();
+        } catch (InvalidAlgorithmParameterException e){
+        	e.printStackTrace();
+        } catch (Exception e){
+        	e.printStackTrace();
+        }
+        return null;
+    }
+    
+    /**将二进制转换成16进制
+     * @param buf
+     * @return
+     */
+    public static String parseByte2HexStr(byte buf[]) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < buf.length; i++) {
+            String hex = Integer.toHexString(buf[i] & 0xFF);
+            if (hex.length() == 1) {
+                    hex = '0' + hex;
+            }
+            sb.append(hex.toUpperCase());
+        }
+        return sb.toString();
+    }
+    
+    /**将16进制转换为二进制
+     * @param hexStr
+     * @return
+     */
+    public static byte[] parseHexStr2Byte(String hexStr) {
+        if (hexStr.length() < 1){
+        	return null;
+        }
+        byte[] result = new byte[hexStr.length()/2];
+        for (int i = 0;i< hexStr.length()/2; i++) {
+            int high = Integer.parseInt(hexStr.substring(i*2, i*2+1), 16);
+            int low = Integer.parseInt(hexStr.substring(i*2+1, i*2+2), 16);
+            result[i] = (byte) (high * 16 + low);
+        }
+        return result;
+    }
+    
+    /**
+     * 字符达不到指定长度补0
+     * @param in 字符数组
+     * @param blockSize 长度
+     * @return
+     */
+    public static byte[] ZeroPadding(byte[] in,Integer blockSize){
+    	Integer copyLen = in.length;
+    	if (copyLen > blockSize) {
+			copyLen = blockSize;
+		}
+    	byte[] out = new byte[blockSize];
+    	System.arraycopy(in, 0, out, 0, copyLen);
+    	return out;
+    }
+
+}

+ 47 - 0
src/main/java/com/template/common/utils/Base64Util.java

@@ -0,0 +1,47 @@
+package com.template.common.utils;
+
+import org.apache.tomcat.util.codec.binary.Base64;
+
+import java.nio.charset.Charset;
+
+/**
+ * <p>Title: Base64Util</p>
+ * <p>Description: Base64Util工具类 --- 加密和解密</p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+public class Base64Util {
+	
+	public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
+	/**
+     * 解密
+     * @param str
+     * @return
+     */
+    public static String decodeStr(String str){
+        if (str == null) {
+			return null;
+		}
+		if (str.length() == 0) {
+			return "";
+		}
+		return new String(Base64.decodeBase64(new String(str).getBytes(DEFAULT_CHARSET)),DEFAULT_CHARSET).trim();
+    }
+
+    /**
+     * 加密
+     * 
+     * @param str
+     * @return
+     */
+    public static String encodeStr(String str){
+        if (str == null) {
+			return null;
+		}
+		if (str.length() == 0) {
+			return "";
+		}
+        return new String(Base64.encodeBase64Chunked(str.getBytes(DEFAULT_CHARSET)),DEFAULT_CHARSET).trim();
+    }
+
+}

+ 9 - 0
src/main/java/com/template/common/utils/DataBliu.java

@@ -0,0 +1,9 @@
+package com.template.common.utils;
+
+public class DataBliu {
+
+    public static double getTwo(double d1){
+        return (double) Math.round(d1 * 100) / 100;
+    }
+
+}

+ 241 - 0
src/main/java/com/template/common/utils/DateUtils.java

@@ -0,0 +1,241 @@
+package com.template.common.utils;
+
+import org.springframework.stereotype.Component;
+
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+/**
+ * <p>Title: DateUtils</p>
+ * <p>Description:日期工具类 </p>
+ * 
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+@Component // 加此注解是把此类实例化spring容器中
+public class DateUtils {
+
+	/**
+	 * 默认日期格式
+	 */
+	public static final String DEFAULT_FORMAT = "yyyy-MM-dd HH:mm:ss";
+
+	/**
+	 * 如2018 0901 232211(年月日时分秒)
+	 * 
+	 * @return
+	 */
+	public String yyyyMMddHHmmss() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如20180901
+	 * 
+	 * @return
+	 */
+	public static String getYYYYMMdd() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如180901
+	 * @return
+	 */
+	public String getYYMMdd() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如201809
+	 * @return
+	 */
+	public String getYYYYMM() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如 2018/02/11
+	 * @return
+	 */
+	public String getQueryEndDate() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如 2018/02/11
+	 * @return
+	 */
+	public String getQueryStartDate() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		Calendar cal = Calendar.getInstance();
+		cal.add(Calendar.DAY_OF_YEAR, -30);
+		return sdf.format(cal.getTime());
+	}
+
+	/**
+	 * 如 2018/02/11 12:30:00
+	 * @return
+	 */
+	public static String getQueryEndTime() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如 2018/02/11
+	 * @return
+	 */
+	public String getQueryStartTime() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		Calendar cal = Calendar.getInstance();
+		cal.add(Calendar.DAY_OF_YEAR, -30);
+		return sdf.format(cal.getTime());
+	}
+
+	public String getQueryTwoAgoDate() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		Calendar cal = Calendar.getInstance();
+		cal.add(Calendar.DAY_OF_YEAR, -2);
+		return sdf.format(cal.getTime());
+	}
+
+	/**
+	 * 字符串转换成日期
+	 * 
+	 * @param str 字符串
+	 * @param format 日期格式
+	 * @return 日期
+	 */
+	public static Date str2Date(String str, String format) {
+		if (null == str || "".equals(str)) {
+			return null;
+		}
+		// 如果没有指定字符串转换的格式,则用默认格式进行转换
+		if (null == format || "".equals(format)) {
+			format = DEFAULT_FORMAT;
+		}
+		SimpleDateFormat sdf = new SimpleDateFormat(format);
+		Date date = null;
+		try {
+			date = sdf.parse(str);
+			return date;
+		} catch (ParseException e) {
+		}
+		return null;
+	}
+
+	/**
+	 * @param date 日期
+	 * @param format 日期格式
+	 * @return 字符串
+	 */
+	public static String date2Str(Date date, String format) {
+		if (null == date) {
+			return null;
+		}
+		SimpleDateFormat sdf = new SimpleDateFormat(format);
+		return sdf.format(date);
+	}
+
+	/**
+	 * 时间戳转换为字符串
+	 * @param time
+	 * @return
+	 */
+	public static String timestamp2Str(Timestamp time) {
+		Date date = new Date(time.getTime());
+		return date2Str(date, DEFAULT_FORMAT);
+	}
+
+	/**
+	 * 字符串转换为时间
+	 * @param str
+	 * @return
+	 */
+	public static Timestamp str2Timestamp(String str) {
+		Date date = str2Date(str, DEFAULT_FORMAT);
+		return new Timestamp(date.getTime());
+	}
+
+	/**
+	 * 字符串转换为时间
+	 * @param str
+	 * @return
+	 */
+	public static Timestamp str2Timestamp(String str, String formatStr) {
+		if (null == str) {
+			return null;
+		}
+		Date date = str2Date(str, formatStr);
+		return new Timestamp(date.getTime());
+	}
+
+	/**
+	 * 获取某年第一天日期
+	 * @param year 年份
+	 * @return Date
+	 */
+	public static Date getYearFirst(int year) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.clear();
+		calendar.set(Calendar.YEAR, year);
+		Date currYearFirst = calendar.getTime();
+		return currYearFirst;
+	}
+
+	/**
+	 * 获取某年最后一天日期
+	 * @param year  年份
+	 * @return Date
+	 */
+	public static Date getYearLast(int year) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.clear();
+		calendar.set(Calendar.YEAR, year);
+		calendar.roll(Calendar.DAY_OF_YEAR, -1);
+		Date currYearLast = calendar.getTime();
+
+		return currYearLast;
+	}
+
+	@SuppressWarnings("static-access")
+	public static Date getnextLast(String datetime, int year) {
+		Calendar calendar = new GregorianCalendar();
+		Date date = null;
+		if (datetime.length() > 7) {
+			date = str2Date(datetime, "yyyy-MM-dd");
+		} else {
+			date = str2Date(datetime, "yyyy-MM");
+		}
+		calendar.setTime(date);
+		calendar.add(calendar.YEAR, year);// 把日期往后增加一年.整数往后推,负数往前移动
+		date = calendar.getTime();
+		return date;
+
+	}
+
+	public static String getrightDate(String datetime, int year) {
+		String date = "";
+		String years = datetime.substring(0, 4);
+		String dates = datetime.substring(4, datetime.length());
+		Integer s = new Integer(years) + year;
+		date = s + dates;
+		return date;
+	}
+
+	public static void main(String[] args) {
+		System.out.println(getrightDate("2018-09", 4));
+		System.out.println(date2Str(getnextLast("2018-09", 4), "yyyy-MM"));
+	}
+
+}

+ 241 - 0
src/main/java/com/template/common/utils/HttpClientUtils.java

@@ -0,0 +1,241 @@
+package com.template.common.utils;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ssl.DefaultHostnameVerifier;
+import org.apache.http.conn.util.PublicSuffixMatcher;
+import org.apache.http.conn.util.PublicSuffixMatcherLoader;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>Title: HttpClientUtils</p>
+ * <p>Description: httpClient 工具类</p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+public class HttpClientUtils {
+	
+	/**
+	 * 默认参数设置
+	 * setConnectTimeout:设置连接超时时间,单位毫秒。
+	 * setConnectionRequestTimeout:设置从connect Manager获取Connection 超时时间,单位毫秒。
+	 * setSocketTimeout:请求获取数据的超时时间,单位毫秒。访问一个接口,多少时间内无法返回数据,就直接放弃此次调用。 暂时定义15分钟
+	 */
+	private RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(600000).setConnectTimeout(600000).setConnectionRequestTimeout(600000).build();
+	
+	/**
+	 * 静态内部类---作用:单例产生类的实例
+	 * @author Administrator
+	 *
+	 */
+	private static class LazyHolder {    
+       private static final HttpClientUtils INSTANCE = new HttpClientUtils();    
+       
+    }  
+	private HttpClientUtils(){}
+	public static HttpClientUtils getInstance(){
+		return LazyHolder.INSTANCE;    
+	}
+	
+	/**
+	 * 发送 post请求
+	 * @param httpUrl 地址
+	 */
+	public String sendHttpPost(String httpUrl) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost  
+		return sendHttpPost(httpPost);
+	}
+	
+	/**
+	 * 发送 post请求
+	 * @param httpUrl 地址
+	 * @param params 参数(格式:key1=value1&key2=value2)
+	 */
+	public String sendHttpPost(String httpUrl, String params) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost  
+		try {
+			//设置参数
+			StringEntity stringEntity = new StringEntity(params, "UTF-8");
+			stringEntity.setContentType("application/x-www-form-urlencoded");
+			httpPost.setEntity(stringEntity);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return sendHttpPost(httpPost);
+	}
+	
+	/**
+	 * 发送 post请求
+	 * @param httpUrl 地址
+	 * @param maps 参数
+	 */
+	public String sendHttpPost(String httpUrl, Map<String, String> maps) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost  
+		// 创建参数队列  
+		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
+		for (String key : maps.keySet()) {
+			nameValuePairs.add(new BasicNameValuePair(key, maps.get(key)));
+		}
+		try {
+			httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return sendHttpPost(httpPost);
+	}
+	
+	/**
+	 * 发送Post请求
+	 * @param httpPost
+	 * @return
+	 */
+	private String sendHttpPost(HttpPost httpPost) {
+		CloseableHttpClient httpClient = null;
+		CloseableHttpResponse response = null;
+		HttpEntity entity = null;
+		String responseContent = null;
+		try {
+			// 创建默认的httpClient实例
+			httpClient = HttpClients.createDefault();
+			httpPost.setConfig(requestConfig);
+			// 执行请求
+			long execStart = System.currentTimeMillis();
+			response = httpClient.execute(httpPost);
+			long execEnd = System.currentTimeMillis();
+			System.out.println("=================执行post请求耗时:"+(execEnd-execStart)+"ms");
+			long getStart = System.currentTimeMillis();
+			entity = response.getEntity();
+			responseContent = EntityUtils.toString(entity, "UTF-8");
+			long getEnd = System.currentTimeMillis();
+			System.out.println("=================获取响应结果耗时:"+(getEnd-getStart)+"ms");
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				// 关闭连接,释放资源
+				if (response != null) {
+					response.close();
+				}
+				if (httpClient != null) {
+					httpClient.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return responseContent;
+	}
+
+	/**
+	 * 发送 get请求
+	 * @param httpUrl
+	 */
+	public String sendHttpGet(String httpUrl) {
+		HttpGet httpGet = new HttpGet(httpUrl);// 创建get请求
+		return sendHttpGet(httpGet);
+	}
+	
+	/**
+	 * 发送 get请求Https
+	 * @param httpUrl
+	 */
+	public String sendHttpsGet(String httpUrl) {
+		HttpGet httpGet = new HttpGet(httpUrl);// 创建get请求
+		return sendHttpsGet(httpGet);
+	}
+	
+	/**
+	 * 发送Get请求
+	 * @param httpPost
+	 * @return
+	 */
+	private String sendHttpGet(HttpGet httpGet) {
+		CloseableHttpClient httpClient = null;
+		CloseableHttpResponse response = null;
+		HttpEntity entity = null;
+		String responseContent = null;
+		try {
+			// 创建默认的httpClient实例.
+
+			
+			httpClient = HttpClients.createDefault();
+
+			httpGet.setConfig(requestConfig);
+			// 执行请求
+			response = httpClient.execute(httpGet);
+			entity = response.getEntity();
+			responseContent = EntityUtils.toString(entity, "UTF-8");
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				// 关闭连接,释放资源
+				if (response != null) {
+					response.close();
+				}
+				if (httpClient != null) {
+					httpClient.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return responseContent;
+	}
+	
+	/**
+	 * 发送Get请求Https
+	 * @param httpPost
+	 * @return
+	 */
+	private String sendHttpsGet(HttpGet httpGet) {
+		CloseableHttpClient httpClient = null;
+		CloseableHttpResponse response = null;
+		HttpEntity entity = null;
+		String responseContent = null;
+		try {
+			// 创建默认的httpClient实例.
+			PublicSuffixMatcher publicSuffixMatcher = PublicSuffixMatcherLoader.load(new URL(httpGet.getURI().toString()));
+			DefaultHostnameVerifier hostnameVerifier = new DefaultHostnameVerifier(publicSuffixMatcher);
+			httpClient = HttpClients.custom().setSSLHostnameVerifier(hostnameVerifier).build();
+			httpGet.setConfig(requestConfig);
+			// 执行请求
+			response = httpClient.execute(httpGet);
+			entity = response.getEntity();
+			responseContent = EntityUtils.toString(entity, "UTF-8");
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				// 关闭连接,释放资源
+				if (response != null) {
+					response.close();
+				}
+				if (httpClient != null) {
+					httpClient.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return responseContent;
+	}
+	
+	
+	
+}

+ 112 - 0
src/main/java/com/template/common/utils/HttpUtils.java

@@ -0,0 +1,112 @@
+package com.template.common.utils;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/8/21 星期一 14:58
+ * @Description: com.repair.common.utils
+ * @Version: 1.0
+ */
+public class HttpUtils {
+    /**
+     * 发送http post请求
+     *
+     * @param
+     *
+     * @param
+     *
+     */
+    public static String post(String url, Map<String, String> params){
+        CloseableHttpClient httpClient = null;
+        HttpPost httpPost = null;
+        String re = "";
+        try {
+            httpClient = HttpClients.createDefault();
+            RequestConfig requestConfig = RequestConfig.custom()
+                    .setSocketTimeout(20000).setConnectTimeout(20000).build();
+            httpPost = new HttpPost(url);
+            httpPost.setConfig(requestConfig);
+            List<NameValuePair> ps = new ArrayList<NameValuePair>();
+            for (String pKey : params.keySet()) {
+                ps.add(new BasicNameValuePair(pKey, params.get(pKey)));
+            }
+            httpPost.setEntity(new UrlEncodedFormEntity(ps));
+            CloseableHttpResponse response = httpClient.execute(httpPost);
+            HttpEntity httpEntity = response.getEntity();
+            re = EntityUtils.toString(httpEntity, "utf-8");
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (httpPost != null) {
+                    httpPost.releaseConnection();
+                }
+                if (httpClient != null) {
+                    httpClient.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return re;
+    }
+
+    /**
+     * 发送post请求Https,参数是字符串
+     *
+     * @param
+     * @return
+     */
+    public static String post(String url, String body){
+        String str = "";
+        CloseableHttpClient httpClient = null;
+        HttpPost httpPost = null;
+        try {
+            httpClient = HttpClients.createDefault();
+            RequestConfig requestConfig = RequestConfig.custom()
+                    .setSocketTimeout(20000).setConnectTimeout(20000).build();
+            httpPost = new HttpPost(url);
+            httpPost.setConfig(requestConfig);
+            httpPost.setEntity(new StringEntity(body, "utf-8"));
+            CloseableHttpResponse response = httpClient.execute(httpPost);
+            HttpEntity httpEntity = response.getEntity();
+            str = EntityUtils.toString(httpEntity, "utf-8");
+
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (httpPost != null) {
+                    httpPost.releaseConnection();
+                }
+                if (httpClient != null) {
+                    httpClient.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return str;
+    }
+}

+ 3 - 5
src/main/java/com/template/common/utils/JWTUtil.java

@@ -7,6 +7,7 @@ import com.auth0.jwt.algorithms.Algorithm;
 import com.auth0.jwt.interfaces.Claim;
 import com.auth0.jwt.interfaces.Claim;
 import com.auth0.jwt.interfaces.DecodedJWT;
 import com.auth0.jwt.interfaces.DecodedJWT;
 import com.template.model.pojo.RepairAdmin;
 import com.template.model.pojo.RepairAdmin;
+import com.template.model.pojo.SmartUser;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 
 
 import java.util.Date;
 import java.util.Date;
@@ -31,7 +32,7 @@ public class JWTUtil {
      * 生成token 有过期时间
      * 生成token 有过期时间
      * @return 返回token
      * @return 返回token
      */
      */
-    public static String getToken(RepairAdmin ra){
+    public static String getToken(SmartUser user){
 
 
         // 签发时间
         // 签发时间
         Date iatDate = new Date();
         Date iatDate = new Date();
@@ -46,8 +47,7 @@ public class JWTUtil {
         map.put("typ", "JWT");
         map.put("typ", "JWT");
         String token = JWT.create()
         String token = JWT.create()
                 .withHeader(map) // header
                 .withHeader(map) // header
-                .withClaim("account", ra.getAccount()) // 账号
-                .withClaim("password", ra.getPassword()) // 密码
+                .withClaim("cardNo", user.getCardNo()) // 账号
                 .withExpiresAt(new Date(CommonUtil.getCurrentTimestamp() + EXPIRED)) // 设置过期时间。过期时间要大于签发时间
                 .withExpiresAt(new Date(CommonUtil.getCurrentTimestamp() + EXPIRED)) // 设置过期时间。过期时间要大于签发时间
                 .withIssuedAt(iatDate) // 设置签发时间
                 .withIssuedAt(iatDate) // 设置签发时间
                 .sign(Algorithm.HMAC256(SIGNATURE)); // 加密
                 .sign(Algorithm.HMAC256(SIGNATURE)); // 加密
@@ -86,8 +86,6 @@ public class JWTUtil {
         return JWT.require(Algorithm.HMAC256(SIGNATURE)).build().verify(token);
         return JWT.require(Algorithm.HMAC256(SIGNATURE)).build().verify(token);
     }
     }
 
 
-
-
     /*
     /*
      * 解密Token
      * 解密Token
      * */
      * */

+ 99 - 0
src/main/java/com/template/common/utils/PropertiesUtil.java

@@ -0,0 +1,99 @@
+package com.template.common.utils;
+
+import java.io.*;
+import java.net.URI;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * <p>Title: PropertiesUtil</p>
+ * <p>Description: properties资源文件解析工具</p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+public class PropertiesUtil {
+
+	private static Properties props = null;
+	private static URI uri;
+	private static String fileName = "/application.properties";
+	
+	private static InputStream in = null;
+
+	static {
+		try {
+			props = new Properties();
+			InputStream fis = PropertiesUtil.class.getResourceAsStream(fileName);
+			props.load(fis);
+			uri = PropertiesUtil.class.getResource(fileName).toURI();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * 获取某个属性
+	 */
+	public static String getProperty(String key) {
+		try {
+			props.load(PropertiesUtil.class.getResourceAsStream(fileName));
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return props.getProperty(key);
+	}
+
+	/**
+	 * 获取所有属性,返回一个map,不常用 可以试试props.putAll(t)
+	 */
+	@SuppressWarnings("rawtypes")
+	public static Map<String, String> getAllProperty() {
+		Map<String, String> map = new HashMap<String, String>();
+		Enumeration enu = props.propertyNames();
+		while (enu.hasMoreElements()) {
+			String key = (String) enu.nextElement();
+			String value = props.getProperty(key);
+			map.put(key, value);
+		}
+		return map;
+	}
+
+	/**
+	 * 在控制台上打印出所有属性,调试时用。
+	 */
+	public static void printProperties() {
+		props.list(System.out);
+	}
+
+	/**
+	 * 写入properties信息
+	 */
+	public static void writeProperties(String key, String value) {
+		try {
+			OutputStream fos = new FileOutputStream(new File(uri));
+			props.setProperty(key, value);
+			// 将此 Properties 表中的属性列表(键和元素对)写入输出流
+			props.store(fos, "『comments』Update key:" + key);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	/**
+	 * 取默认key的value
+	 * */
+	public static String getValue(String key){
+		String value = null;
+		props = new Properties();
+		in = PropertiesUtil.class.getResourceAsStream(fileName);
+		try {
+			props.load(in);
+		} catch (IOException e) {
+//			e.printStackTrace();
+		}
+		value = (String) props.get(key);
+		return value;
+	}
+
+}

+ 32 - 0
src/main/java/com/template/common/utils/RandomTrackAlgorithm.java

@@ -0,0 +1,32 @@
+package com.template.common.utils;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+public class RandomTrackAlgorithm {
+
+    public static BigDecimal makeRandom(float max, float min, int scale){
+        BigDecimal cha = new BigDecimal(Math.random() * (max-min) + min);
+        return cha.setScale(scale,BigDecimal.ROUND_HALF_UP);//保留 scale 位小数,并四舍五入
+    }
+
+    public static List<List<BigDecimal>> getPosition(){
+        List<List<BigDecimal>> all = new ArrayList<>();
+        // 生成随机坐标点
+        BigDecimal x = null;
+        BigDecimal y = null;
+        for (int i = 0; i < 10; i++) {
+            List<BigDecimal> list = new LinkedList<>();
+            // 114.449557,28.109357
+            x = makeRandom(0.001f,0.000001f,6).add(BigDecimal.valueOf(114.449557));
+            y = makeRandom(0.001f,0.000001f,6).add(BigDecimal.valueOf(28.109357));
+            list.add(x);
+            list.add(y);
+            all.add(list);
+        }
+        return all;
+    }
+
+}

+ 125 - 0
src/main/java/com/template/common/utils/RequestUtils.java

@@ -0,0 +1,125 @@
+package com.template.common.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/12/21 星期四 9:39
+ * @Description: com.template.common.utils
+ * @Version: 1.0
+ */
+public class RequestUtils {
+    /**
+     * GET请求
+     * @param url 请求地址
+     * @param param 请求参数
+     * @return
+     */
+    public static String httpGet(String url,String param){
+        String result = "";
+        BufferedReader in = null;
+        try {
+            String urlNameString = url + "?" + param;
+            URL realUrl = new URL(urlNameString);
+            // 打开和URL之间的连接
+            URLConnection connection = realUrl.openConnection();
+            // 设置通用的请求属性
+            connection.setRequestProperty("accept", "*/*");
+            connection.setRequestProperty("connection", "Keep-Alive");
+            connection.setRequestProperty("user-agent",
+                    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            // 建立实际的连接
+            connection.connect();
+            // 获取所有响应头字段
+            Map<String, List<String>> map = connection.getHeaderFields();
+            // 遍历所有的响应头字段
+            for (String key : map.keySet()) {
+                System.out.println(key + "--->" + map.get(key));
+            }
+            // 定义 BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(new InputStreamReader(
+                    connection.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送GET请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输入流
+        finally {
+            try {
+                if (in != null) {
+                    in.close();
+                }
+            } catch (Exception e2) {
+                e2.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+
+    /**
+     * POST请求
+     * @param url 请求的url
+     * @param param 参数
+     * @return
+     */
+    public static String httpPost(String url, String param){
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            conn.setRequestProperty("Content-Type", "application/json");
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(conn.getOutputStream());
+            // 发送请求参数
+            out.print(param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(
+                    new InputStreamReader(conn.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送 POST 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        //使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+}

+ 617 - 0
src/main/java/com/template/common/utils/TimeExchange2.java

@@ -0,0 +1,617 @@
+package com.template.common.utils;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 时间转化工具 date转为时间戳 时间戳转date 互相与String的转换
+ * 所有出现的String time 格式都必须为(yyyy-MM-dd HH:mm:ss),否则出错
+ * @author 赵仁杰
+ *
+ */
+public class TimeExchange2 {
+
+    /**
+     * String(yyyy-MM-dd HH:mm:ss) 转 Date
+     *
+     * @param time
+     * @return
+     * @throws ParseException
+     */
+    // String date = "2010/05/04 12:34:23";
+    public static Date StringToDate(String time) throws ParseException {
+
+        Date date = new Date();
+        // 注意format的格式要与日期String的格式相匹配
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            date = dateFormat.parse(time);
+            System.out.println(date.toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return date;
+    }
+
+    public static Date StringToDate2(String time) throws ParseException {
+
+        Date date = new Date();
+        // 注意format的格式要与日期String的格式相匹配
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            date = dateFormat.parse(time);
+            System.out.println(date.toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return date;
+    }
+
+    /**
+     * String(yyyy-MM-dd HH:mm:ss) 转 Date
+     *
+     * @param time
+     * @return
+     * @throws ParseException
+     */
+    // String date = "2010/05/04 12:34:23";
+    public static Date StringToDate(String time, String formatStr) throws ParseException {
+
+        Date date = new Date();
+        // 注意format的格式要与日期String的格式相匹配
+        DateFormat dateFormat = new SimpleDateFormat(formatStr);
+        try {
+            date = dateFormat.parse(time);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return date;
+    }
+
+
+    /**
+     * Date转为String(yyyy-MM-dd HH:mm:ss)
+     *
+     * @param time
+     * @return
+     */
+    public static String DateToString(Date time) {
+        String dateStr = "";
+        Date date = new Date();
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH/mm/ss");
+        try {
+            dateStr = dateFormat.format(time);
+            System.out.println(dateStr);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dateStr;
+    }
+
+    public static String ToSimpleMonth(Date time) {
+        String dateStr = "";
+        DateFormat dateFormat = new SimpleDateFormat("M");
+        try {
+            dateStr = dateFormat.format(time);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dateStr;
+    }
+
+    /**
+     * String(yyyy-MM-dd HH:mm:ss)转10位时间戳
+     * @param time
+     * @return
+     */
+    public static Integer StringToTimestamp(String time){
+
+        int times = 0;
+        try {
+            times = (int) ((Timestamp.valueOf(time).getTime())/1000);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if(times==0){
+            System.out.println("String转10位时间戳失败");
+        }
+        return times;
+
+    }
+    /**
+     * 10位int型的时间戳转换为String(yyyy-MM-dd HH:mm:ss)
+     * @param time
+     * @return
+     */
+    public static String timestampToString(Integer time){
+        //int转long时,先进行转型再进行计算,否则会是计算结束后在转型
+        long temp = (long)time*1000;
+        Timestamp ts = new Timestamp(temp);
+        String tsStr = "";
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            //方法一
+            tsStr = dateFormat.format(ts);
+            System.out.println(tsStr);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return tsStr;
+    }
+    /**
+     * 10位时间戳转Date
+     * @param time
+     * @return
+     */
+    public static Date TimestampToDate(Integer time){
+        long temp = (long)time*1000;
+        Timestamp ts = new Timestamp(temp);
+        Date date = new Date();
+        try {
+            date = ts;
+            //System.out.println(date);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return date;
+    }
+    /**
+     * Date类型转换为10位时间戳
+     * @param time
+     * @return
+     */
+    public static Integer DateToTimestamp(Date time){
+        Timestamp ts = new Timestamp(time.getTime());
+
+        return (int) ((ts.getTime())/1000);
+    }
+
+    // 当前时间减1小时
+    public static String TimeDesH(String time) throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(time));
+        nowTime2.add(Calendar.HOUR, -1);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 最近两天
+    public static String getLastTwo() throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(getTime()));
+        nowTime2.add(Calendar.DATE, -2);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 当前时间加2分钟
+    public static String TimeRangeI10(String time,int m) throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(time));
+        nowTime2.add(Calendar.SECOND, m);//10分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 当前时间加多少分钟
+    public static String TimeRangeM(String time,int m) throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate2(time));
+        nowTime2.add(Calendar.MINUTE, m);//10分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+
+    // 当前时间减5分钟
+    public static String TimeRangeD(String time) throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(time));
+        nowTime2.add(Calendar.MINUTE, -300);//5分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 获取当前日期
+    public static String getDateStr(){
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
+        return sp.format(new Date());
+    }
+
+    // 获取当前日期
+    public static String getDate(){
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return sp.format(new Date());
+    }
+
+    // 获取前天
+    public static String getQianDay() throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(getTime()));
+        nowTime2.add(Calendar.DATE, -5);//5分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 获取明天
+    public static String getTomorrow() throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(getTime()));
+        nowTime2.add(Calendar.DATE, 1);//5分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 获取昨天
+    public static String getYesturday()  {
+        try {
+            Calendar nowTime2 = Calendar.getInstance();
+            nowTime2.setTime(StringToDate(getTime()));
+            nowTime2.add(Calendar.DATE, -1);
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            return simpleDateFormat.format(nowTime2.getTime());
+        } catch (ParseException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    // 获取最近7个月
+    public static List<String> getLastSevenMonth() throws ParseException {
+        List<String> ls = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+        for (int i = -6; i <= 0; i++) {
+            Calendar nowTime2 = Calendar.getInstance();
+            nowTime2.setTime(StringToDate(getTime()));
+            nowTime2.add(Calendar.MONTH, i);//5分钟前的时间
+            ls.add(simpleDateFormat.format(nowTime2.getTime()));
+        }
+        return ls;
+    }
+
+    public static String getTomorrowTime() throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(getTime()));
+        nowTime2.add(Calendar.DATE, 1);//5分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    public static String getWeek(String sdate) throws ParseException {
+        // 再转换为时间
+        Date date = StringToDate(sdate,"yyyy-MM-dd");
+        Calendar c = Calendar.getInstance();
+        c.setTime(date);
+        // int hour=c.get(Calendar.DAY_OF_WEEK);
+        // hour中存的就是星期几了,其范围 1~7
+        // 1=星期日 7=星期六,其他类推
+        return new SimpleDateFormat("EEEE").format(c.getTime());
+    }
+
+    // 今天星期几
+    public static String getWeek() throws ParseException {
+        String[] weeks = {"7","1","2","3","4","5","6"};
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(StringToDate(getTime()));
+        int week_index = cal.get(Calendar.DAY_OF_WEEK) - 1;
+        if(week_index<0){
+            week_index = 0;
+        }
+        return weeks[week_index];
+    }
+
+    // 明天星期几
+    public static String getTomorrowWeek() throws ParseException {
+        String[] weeks = {"7","1","2","3","4","5","6"};
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(StringToDate(getTomorrowTime()));
+        int week_index = cal.get(Calendar.DAY_OF_WEEK) - 1;
+        if(week_index<0){
+            week_index = 0;
+        }
+        return weeks[week_index];
+    }
+
+    // 获取当前时间
+    public static String getTime(){
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return sp.format(new Date());
+    }
+
+    public static String getOnlyMM(){
+        SimpleDateFormat sp = new SimpleDateFormat("HH:mm");
+        return sp.format(new Date());
+    }
+
+    public static String getOnlyDesMM() throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(getTime()));
+        nowTime2.add(Calendar.MINUTE, -5);//5分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    public static String getYear(){
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy");
+        return sp.format(new Date());
+    }
+
+    public static String getMonth(){
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM");
+        return sp.format(new Date());
+    }
+
+    // 获取当前时间
+    public static String getOnlyTime(){
+        SimpleDateFormat sp = new SimpleDateFormat("HH:mm:ss");
+        return sp.format(new Date());
+    }
+    /**
+     * 计算两个日期的时间差
+     * @param time1
+     * @param time2
+     * @return
+     */
+    public static double getTimeDifference(String time1, String time2) {
+        SimpleDateFormat timeformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        long t1 = 0L;
+        long t2 = 0L;
+        try {
+            t1 = timeformat.parse(time1).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        try {
+            t2 = timeformat.parse(time2).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        //因为t1-t2得到的是毫秒级,所以要初3600000得出小时.算天数或秒同理
+        double hours=(double) ((t2 - t1)/3600000);
+        double minutes=(double) (((t2 - t1)/1000-hours*3600)/60/60);
+        return hours+minutes;
+    }
+
+    public static double getOnlyTimeDifference(String time1, String time2) {
+        SimpleDateFormat timeformat = new SimpleDateFormat("HH:mm:ss");
+        long t1 = 0L;
+        long t2 = 0L;
+        try {
+            t1 = timeformat.parse(time1).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        try {
+            t2 = timeformat.parse(time2).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        //因为t1-t2得到的是毫秒级,所以要初3600000得出小时.算天数或秒同理
+        double hours=(double) ((t2 - t1)/3600000);
+        double minutes=(double) (((t2 - t1)/1000-hours*3600)/60/60);
+        return hours+minutes;
+    }
+
+    public static double getDiff(String str1, String str2){
+        return str2.compareTo(str1);
+    }
+
+    /**
+     * String 转 Date
+     * @param time 时间
+     * @param formatStr 自定义时间格式
+     * @return
+     * @throws ParseException
+     */
+    public static Date ShortStringToDate(String time, String formatStr) throws ParseException {
+
+        Date date = new Date();
+        // 注意format的格式要与日期String的格式相匹配
+        DateFormat dateFormat = new SimpleDateFormat(formatStr);
+        try {
+            date = dateFormat.parse(time);
+            System.out.println(date.toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return date;
+    }
+
+    /**
+     * 获取指定月份有多少天
+     *
+     * @param month
+     * @return
+     */
+    public static int getMonthDays(String date, int month) {
+        int year = Integer.valueOf(date.substring(0, 4));
+        int[] arr = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+        int day = arr[month - 1];//天数对应=数组-1
+        if (month == 2 && year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
+            day = 29;
+        }
+
+        return day;
+
+    }
+
+    /**
+     * Date转为String
+     * @param time 时间
+     * @param FormatStr 自定义时间格式
+     * @return
+     */
+    public static String DateToString(Date time, String FormatStr) {
+        String dateStr = "";
+        DateFormat dateFormat = new SimpleDateFormat(FormatStr);
+        try {
+            dateStr = dateFormat.format(time);
+            System.out.println(dateStr);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dateStr;
+    }
+
+    /**
+     * 比较时间1是否小于时间2
+     * 如果时间1小于时间2,接口返回true
+     * 如果时间1大于时间2,接口返回false
+     * @param dateOne 时间1
+     * @param dateTwo 时间2
+     * @return
+     * @throws ParseException
+     */
+    public static boolean CompareDate(String dateOne, String dateTwo) throws ParseException {
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date sd1=df.parse(dateOne);
+        Date sd2=df.parse(dateTwo);
+        return sd1.before(sd2);
+    }
+
+    /**
+     * 比较时间1是否小于时间2
+     * 如果时间1小于时间2,接口返回true
+     * 如果时间1大于时间2,接口返回false
+     *
+     * @param dateOne 时间1
+     * @param dateTwo 时间2
+     * @param Forma   时间格式
+     * @return
+     * @throws ParseException
+     */
+    public static boolean CompareDate(String dateOne, String dateTwo, String Forma) throws ParseException {
+        SimpleDateFormat df = new SimpleDateFormat(Forma);
+        Date sd1 = df.parse(dateOne);
+        Date sd2 = df.parse(dateTwo);
+        return sd1.before(sd2);
+    }
+
+    /**
+     * 时间加减天数
+     *
+     * @param time   时间
+     * @param amount 天数 负的为减多少天 正的为加多少天
+     * @return
+     * @throws ParseException
+     */
+    public static String TimeDesD(String time, int amount) throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(time, "yyyy-MM-dd"));
+        nowTime2.add(Calendar.DATE, amount);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    /**
+     * 相差的天数
+     */
+    public static int daysBetween(String smdate, String bdate) throws ParseException {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(sdf.parse(smdate));
+        long time1 = cal.getTimeInMillis();
+        cal.setTime(sdf.parse(bdate));
+        long time2 = cal.getTimeInMillis();
+        long between_days = (time2 - time1) / (1000 * 3600 * 24);
+
+        return Integer.parseInt(String.valueOf(between_days));
+    }
+
+    /**
+     * 获取一周的开始时间和结束时间
+     * 获取本周星期一作为一周的第一天的起始时间和结束时间
+     *
+     * @return 返回的数据中第一个是开始时间 第二个是结束时间
+     */
+    public static String[] getCurrentWeekTimeFrame() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTimeZone(TimeZone.getTimeZone("GMT+8"));
+        //start of the week
+        if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
+            calendar.add(Calendar.DAY_OF_YEAR,-1);
+        }
+        calendar.add(Calendar.DAY_OF_WEEK, -(calendar.get(Calendar.DAY_OF_WEEK) - 2));
+        //给0的时候查不出数据
+//        calendar.set(Calendar.HOUR_OF_DAY, 0);
+//        calendar.set(Calendar.MINUTE, 0);
+//        calendar.set(Calendar.SECOND, 0);
+//        calendar.set(Calendar.MILLISECOND, 0);
+
+        String startTime = DateToString(calendar.getTime(), "yyyy-MM-dd");
+        //end of the week
+        calendar.add(Calendar.DAY_OF_WEEK, 6);
+        calendar.set(Calendar.HOUR_OF_DAY, 23);
+        calendar.set(Calendar.MINUTE, 59);
+        calendar.set(Calendar.SECOND, 59);
+        calendar.set(Calendar.MILLISECOND, 999);
+        String endTime = DateToString(calendar.getTime());
+        return new String[]{startTime, endTime};
+    }
+
+    /**
+     * 获取指定月份的第一天和最后一天
+     * @param DateStr 指定月份
+     * @return 返回的数据中第一个是开始时间 第二个是结束时间
+     */
+    public static String[] getCurrentMonthTimeFrame(String DateStr) {
+        Calendar c = Calendar.getInstance();//获取Calendar实例
+        c.set(Calendar.YEAR, Integer.parseInt(DateStr.substring(0, 4)));
+        c.set(Calendar.MONTH, Integer.parseInt(DateStr.substring(5, 7).replace("-", "")) - 1);
+
+        c.set(Calendar.DAY_OF_MONTH, 1);
+
+        String startDate = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
+
+        int lastDay = c.getActualMaximum(Calendar.DAY_OF_MONTH);
+        c.set(Calendar.DAY_OF_MONTH, lastDay);
+        String endDate = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
+
+        return new String[]{startDate, endDate};
+    }
+
+    public static List<String> getHighTime(){
+        String year = getYear();
+        return Arrays.asList(year+"-"+"08-30",year+"-"+"08-31",year+"-"+"09-01",year+"-"+"09-02",year+"-"+"09-03",year+"-"+"09-04");
+    }
+
+    public static List<String> getDays(String startTime, String endTime) {
+        // 返回的日期集合
+        List<String> days = new ArrayList<String>();
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            Date start = dateFormat.parse(startTime);
+            Date end = dateFormat.parse(endTime);
+            Calendar tempStart = Calendar.getInstance();
+            tempStart.setTime(start);
+
+            Calendar tempEnd = Calendar.getInstance();
+            tempEnd.setTime(end);
+            tempEnd.add(Calendar.DATE, 0);// 日期加1(包含结束)
+            while (tempStart.before(tempEnd)) {
+                days.add(dateFormat.format(tempStart.getTime()));
+                tempStart.add(Calendar.DAY_OF_YEAR, 1);
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return days;
+    }
+
+
+    public static void main(String[] args) throws ParseException {
+        System.out.println(ToSimpleMonth(StringToDate("2023-11","yyyy-MM")));
+    }
+
+}
+

+ 41 - 0
src/main/java/com/template/common/utils/TreeRecordsUtil.java

@@ -0,0 +1,41 @@
+package com.template.common.utils;
+
+import com.template.model.pojo.SmartAuthorGroup;
+import com.template.model.weixin.AuthorListGroup;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class TreeRecordsUtil {
+
+    public static List<AuthorListGroup> queryCommentTreeRecords(Integer pid, List<SmartAuthorGroup> lists) {
+        List<AuthorListGroup> newTrees = new ArrayList<>();
+
+        List<SmartAuthorGroup> datas = lists.stream().filter(e -> e.getParentId().equals(pid)).collect(Collectors.toList());
+
+        for (SmartAuthorGroup data : datas) {
+            AuthorListGroup item = AuthorListGroup.builder()
+                    .id(data.getId())
+                    .parentId(data.getParentId())
+                    .name(data.getName())
+                    .userId(data.getUserId())
+                    .applyId(data.getApplyId())
+                    .updateTime(data.getUpdateTime())
+                    .createUser(data.getCreateUser())
+                    .updateUser(data.getUpdateUser())
+                    .deleted(data.getDeleted())
+                    .build();
+            List<AuthorListGroup> news = queryCommentTreeRecords(item.getId(), lists);
+            if (news == null || news.size() == 0) {
+                newTrees.add(item);
+                continue;
+            } else {
+                item.setAuthorListGroups(news);
+                newTrees.add(item);
+            }
+        }
+
+        return newTrees;
+    }
+}

+ 25 - 0
src/main/java/com/template/common/utils/UUIDUtil.java

@@ -0,0 +1,25 @@
+package com.template.common.utils;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+
+public class UUIDUtil {
+
+    public static long generateID(){
+
+        Random r = new Random();
+        long numbers = 1000000000L + (long)(r.nextDouble() * 999999999L);
+
+        return numbers;
+    }
+
+    public static String getNewDate(){
+        Date nowDate = new Date();// 取当前时间
+        SimpleDateFormat dateFormat = new SimpleDateFormat(
+                "yyyy-MM-dd HH:mm:ss"); // 转换时间格式
+        String date = dateFormat.format(nowDate);
+        return date;
+    }
+
+}

+ 32 - 0
src/main/java/com/template/config/ParkConfig.java

@@ -0,0 +1,32 @@
+package com.template.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties(prefix = "park")
+@Data
+public class ParkConfig {
+
+    /**
+     * APP ID
+     */
+    private String appId;
+
+    /**
+     * 车场唯一编号
+     */
+    private String parkKey;
+
+    /**
+     * APP SECRET
+     */
+    private String appSecret;
+
+    /**
+     * url
+     */
+    private String url;
+}
+

+ 20 - 0
src/main/java/com/template/config/ScheduleConfig.java

@@ -0,0 +1,20 @@
+package com.template.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties(prefix = "schedule")
+@Data
+public class ScheduleConfig {
+
+    /**
+     * 是否开启定时
+     * 不开启:0
+     * 开始:1
+     */
+    private String isOpen;
+
+}
+

+ 3 - 2
src/main/java/com/template/controller/LoginController.java

@@ -4,6 +4,7 @@ import com.template.annotation.PassToken;
 import com.template.api.LoginControllerAPI;
 import com.template.api.LoginControllerAPI;
 import com.template.model.enumModel.eStatu;
 import com.template.model.enumModel.eStatu;
 import com.template.model.pojo.RepairAdmin;
 import com.template.model.pojo.RepairAdmin;
+import com.template.model.pojo.SmartUser;
 import com.template.model.request.changePasswordRequest;
 import com.template.model.request.changePasswordRequest;
 import com.template.model.request.loginRequest;
 import com.template.model.request.loginRequest;
 import com.template.model.result.CommonResult;
 import com.template.model.result.CommonResult;
@@ -106,8 +107,8 @@ public class LoginController implements LoginControllerAPI {
         if(!encPassword.equals(result.getPassword())){
         if(!encPassword.equals(result.getPassword())){
             return CommonResult.fail("密码错误");
             return CommonResult.fail("密码错误");
         }
         }
-
-        String token = JWTUtil.getToken(result);
+        SmartUser user = new SmartUser();
+        String token = JWTUtil.getToken(user);
         LoginVO login = new LoginVO();
         LoginVO login = new LoginVO();
         login.setToken(token);
         login.setToken(token);
         login.setTokenTtl(JWTUtil.getExpired());
         login.setTokenTtl(JWTUtil.getExpired());

+ 97 - 0
src/main/java/com/template/controller/ScheduleController.java

@@ -0,0 +1,97 @@
+package com.template.controller;
+
+import com.seewo.open.sdk.DefaultSeewoClient;
+import com.seewo.open.sdk.SeewoClient;
+import com.seewo.open.sdk.auth.Account;
+import com.template.common.utils.TimeExchange;
+import com.template.config.ParkConfig;
+import com.template.config.ScheduleConfig;
+import com.template.config.SeewoConfig;
+import com.template.model.pojo.AttendanceServiceListAttendClassRecordsParam;
+import com.template.model.pojo.AttendanceServiceListAttendClassRecordsRequest;
+import com.template.model.pojo.AttendanceServiceListAttendClassRecordsResult;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+
+@Component
+//@EnableAsync
+public class ScheduleController {
+
+    @Resource
+    private SeewoConfig seewoConfig;
+
+    @Resource
+    private ScheduleConfig scheduleConfig;
+
+    /**
+     * @Scheduled注解会在默认情况下以单线程的方式执行定时任务。 这个“单线程”指两个方面:
+     * 如果一个定时任务执行时间大于其任务间隔时间,那么下一次将会等待上一次执行结束后再继续执行。
+     * 如果多个定时任务在同一时刻执行,任务会依次执行。
+     * @Async:对某个方法进行异步执行
+     * @EnableAsync:开启异步支持
+     */
+
+    //定时格式参考:https://blog.csdn.net/java13992394428/article/details/108740453
+
+    /**
+     * 每天八点自动派单
+     * 周六周日定时器不生效
+     * 其余时间都是早上八点前捞一遍当前时间以前的单子
+     * 有合适的维修师傅就把单子派给维修师傅
+     * 周一到周五早上七点执行:0 0 7 ? * MON-FRI
+     * 周一到周五1、2、3、4、5、6、7、18、19、20、21、22点执行:0 0 1,2,3,4,5,6,7,18,19,20,21,22 ? * MON-FRI
+     */
+    //凌晨两点:0 0 2 * * ?
+    //每小时执行一次:0 0 */1 * * ?
+    //每分钟执行一次:0 */1 * * * ?
+    //周一到周五早上七点执行:0 0 7 ? * MON-FRI
+    @Async
+    @Scheduled(cron = "0 */1 * * * ? ")
+    @Transactional(rollbackFor = {Exception.class})
+    public void autoDispatch() throws Exception {
+
+        if(scheduleConfig.getIsOpen().equals("1")){
+
+            //循环班级的classUid
+
+
+            /**
+             * 定时获取考勤
+             */
+            //初始化客户端
+            SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
+            AttendanceServiceListAttendClassRecordsParam param = new AttendanceServiceListAttendClassRecordsParam();
+            //响应体,MimeType为 application/json
+            AttendanceServiceListAttendClassRecordsParam.RequestBody requestBody = AttendanceServiceListAttendClassRecordsParam.RequestBody.builder()
+                    .build();
+            param.setRequestBody(requestBody);
+            //query
+            AttendanceServiceListAttendClassRecordsParam.Query query = AttendanceServiceListAttendClassRecordsParam.Query.builder()
+                    .eventId("1316302749783220225")//考勤事件ID 固定写死
+                    .attendDate(TimeExchange.getDate())//考勤日期
+                    .appId(seewoConfig.getAppId())//appid
+                    .grade(1)//年级序号
+                    .classUid("123456789")//班级uid 班级uid与年级序号、班级序号二选一确定具体的班级,如果都填以classUid为准
+                    .clazz(1)//班级序号
+                    .schoolUid(seewoConfig.getSchoolId())//学校uid
+                    .attendType(1)//考勤类型 时间考勤(默认):1  课程考勤:2
+                    .build();
+            requestBody.setQuery(query);
+            param.setRequestBody(requestBody);
+            AttendanceServiceListAttendClassRecordsRequest request = new AttendanceServiceListAttendClassRecordsRequest(param);
+            System.out.println("入参:" +request);
+            //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
+            //request.setServerUrl("https://openapi.test.seewo.com")
+            //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
+            AttendanceServiceListAttendClassRecordsResult result = seewoClient.invoke(request);
+            System.out.println("出参:" +result);
+
+
+        }
+    }
+}

+ 43 - 0
src/main/java/com/template/controller/SmartAttendanceController.java

@@ -0,0 +1,43 @@
+package com.template.controller;
+
+
+import com.template.api.SmartAttendanceControllerAPI;
+import com.template.model.pojo.SmartAttendance;
+import com.template.model.result.CommonResult;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 楼栋表 前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@RestController
+public class SmartAttendanceController implements SmartAttendanceControllerAPI {
+
+    @Override
+    public CommonResult insertSmartAttendance(SmartAttendance smartApply, BindingResult bindingResult) {
+        return null;
+    }
+
+    @Override
+    public CommonResult updateSmartAttendanceById(SmartAttendance ra, BindingResult bindingResult) {
+        return null;
+    }
+
+    @Override
+    public CommonResult queryPageSmartAttendances(int currentPage, int pageCount, String name) {
+        return null;
+    }
+
+    @Override
+    public CommonResult deleteSmartAttendanceById(int id) {
+        return null;
+    }
+}
+

+ 322 - 33
src/main/java/com/template/controller/SmartAuthorGroupController.java

@@ -1,21 +1,29 @@
 package com.template.controller;
 package com.template.controller;
 
 
 
 
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.template.annotation.PassToken;
 import com.template.api.SmartAuthorGroupControllerAPI;
 import com.template.api.SmartAuthorGroupControllerAPI;
-import com.template.common.utils.paramUtils;
-import com.template.model.pojo.SmartAuthorGroup;
+import com.template.common.utils.TimeExchange2;
+import com.template.common.utils.TreeRecordsUtil;
+import com.template.common.utils.UUIDUtil;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.model.pojo.SmartAuthorGroup;
+import com.template.model.pojo.SmartAuthority;
 import com.template.model.result.CommonResult;
 import com.template.model.result.CommonResult;
-import com.template.model.result.PageUtils;
-import com.template.model.vo.ApplyVo;
+import com.template.model.weixin.AuthorAndGroup;
+import com.template.model.weixin.AuthorAndGroup2;
+import com.template.model.weixin.AuthorListGroup;
+import com.template.model.weixin.userAuthor;
 import com.template.services.SmartAuthorGroupService;
 import com.template.services.SmartAuthorGroupService;
+import com.template.services.SmartAuthorityService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.RequestMapping;
 
 
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
-import java.util.List;
+import java.text.ParseException;
+import java.util.*;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -30,54 +38,335 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
 
 
     @Autowired
     @Autowired
     private SmartAuthorGroupService smartAuthorGroupService;
     private SmartAuthorGroupService smartAuthorGroupService;
+    @Autowired
+    public SmartAuthorityService smartAuthorityService;
 
 
     /**
     /**
      * 新增权限组
      * 新增权限组
-     * @param smartApply 权限组数据
-     * @param bindingResult
+     * @param
+     * @param
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public CommonResult insertSmartAuthorGroup(SmartAuthorGroup smartApply, BindingResult bindingResult) {
-        if (bindingResult.hasErrors()) {
-            String st = paramUtils.getParamError(bindingResult);
-            return CommonResult.fail(st);
+    @PassToken
+    public CommonResult insertSmartAuthorGroup(JSONObject jsonObject, Integer samePower) throws ParseException {
+        if (samePower==null){
+            return CommonResult.fail("samePower不能为空");
         }
         }
-
-        int result = smartAuthorGroupService.insertSmartAuthorGroup(smartApply);
-
-        return result > 0 ? CommonResult.ok("添加成功") : CommonResult.fail("添加失败");
+        // 所有管理员权限一样
+        if (samePower==1){
+            AuthorAndGroup authorAndGroup = JSONObject.parseObject(jsonObject.toString(), AuthorAndGroup.class);
+            SmartAuthorGroup sa = authorAndGroup.getSmartAuthorGroup();
+            sa.setId((int) UUIDUtil.generateID());
+            String[] userId = sa.getUserId().split(",");
+            // 相关判断
+            QueryWrapper<SmartAuthorGroup> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("deleted", "0");
+            queryWrapper.eq("parent_id", sa.getParentId());
+            queryWrapper.eq("name", sa.getName());
+            List<SmartAuthorGroup> querySmartGroup = smartAuthorGroupService.getAuthorGroupByKey(queryWrapper);
+            if (querySmartGroup.size()>0){
+                return CommonResult.fail("该管理员已存在,请勿重复添加");
+            }
+            QueryWrapper<SmartAuthority> queryWrapper2 = new QueryWrapper<>();
+            List<String> typeList = Arrays.asList(userId);
+            queryWrapper2.in("user_id", typeList);
+            queryWrapper2.eq("deleted", "0");
+            List<SmartAuthority> querySmart = smartAuthorityService.getAuthorByKey(queryWrapper2);
+            if (querySmart.size()>0){
+                return CommonResult.fail("该用户已分配其他权限组");
+            }
+            Set<String> set = new HashSet<>(typeList);
+            if (typeList.size()!=set.size()){
+                return CommonResult.fail("请勿选择重复用户");
+            }
+            for (int i = 0; i < userId.length; i++) {
+                SmartAuthority smartAuthority = new SmartAuthority();
+                smartAuthority.setUserId(Integer.parseInt(userId[i]));
+                smartAuthority.setGroupId(sa.getId());
+                smartAuthority.setDepartmentView(authorAndGroup.getDepartment_view());
+                smartAuthority.setDepartmentManage(authorAndGroup.getDepartment_manage());
+                smartAuthority.setCreateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                smartAuthority.setUpdateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                smartAuthority.setCreateUser("admin");
+                smartAuthority.setUpdateUser("admin");
+                smartAuthority.setDeleted(0);
+                smartAuthorityService.insertSmartAuthority(smartAuthority);
+            }
+            sa.setUpdateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+            sa.setCreateUser("admin");
+            sa.setUpdateUser("admin");
+            sa.setDeleted(0);
+            int result = smartAuthorGroupService.insertSmartAuthorGroup(sa);
+            return result > 0 ? CommonResult.ok("添加成功") : CommonResult.fail("添加失败");
+        }
+        // 每个管理员权限不一样
+        if (samePower==2){
+            AuthorAndGroup2 authorAndGroup2 = JSONObject.parseObject(jsonObject.toString(), AuthorAndGroup2.class);
+            SmartAuthorGroup sa = authorAndGroup2.getSmartAuthorGroup();
+            sa.setId((int) UUIDUtil.generateID());
+            List<userAuthor> userAuthors = authorAndGroup2.getUserAuthors();
+            // 相关查询
+            QueryWrapper<SmartAuthorGroup> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("deleted", 0);
+            queryWrapper.eq("parent_id", sa.getParentId());
+            queryWrapper.eq("name", sa.getName());
+            List<SmartAuthorGroup> querySmartGroup = smartAuthorGroupService.getAuthorGroupByKey(queryWrapper);
+            if (querySmartGroup.size()>0){
+                return CommonResult.fail("该管理员已存在,请勿重复添加");
+            }
+            List<Integer> uid =userAuthors.stream().map(userAuthor::getUserId).collect(Collectors.toList());
+            QueryWrapper<SmartAuthority> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.in("user_id", uid);
+            queryWrapper2.eq("deleted", 0);
+            List<SmartAuthority> querySmart = smartAuthorityService.getAuthorByKey(queryWrapper2);
+            if (querySmart.size()>0){
+                return CommonResult.fail("该用户已分配其他权限组");
+            }
+            Set<Integer> set = new HashSet<>(uid);
+            if (uid.size()!=set.size()){
+                return CommonResult.fail("请勿选择重复用户");
+            }
+            for (int i = 0; i < userAuthors.size(); i++) {
+                SmartAuthority smartAuthority = new SmartAuthority();
+                smartAuthority.setUserId(userAuthors.get(i).getUserId());
+                smartAuthority.setGroupId(sa.getId());
+                smartAuthority.setDepartmentView(userAuthors.get(i).getDepartment_view());
+                smartAuthority.setDepartmentManage(userAuthors.get(i).getDepartment_manage());
+                smartAuthority.setCreateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                smartAuthority.setUpdateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                smartAuthority.setCreateUser("admin");
+                smartAuthority.setUpdateUser("admin");
+                smartAuthority.setDeleted(0);
+                smartAuthorityService.insertSmartAuthority(smartAuthority);
+            }
+            sa.setUpdateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+            sa.setCreateUser("admin");
+            sa.setUpdateUser("admin");
+            sa.setDeleted(0);
+            int result = smartAuthorGroupService.insertSmartAuthorGroup(sa);
+            return result > 0 ? CommonResult.ok("添加成功") : CommonResult.fail("添加失败");
+        }
+        return CommonResult.errorMsg("参数格式错误");
     }
     }
 
 
     /**
     /**
      * 更新权限组
      * 更新权限组
-     * @param sa 权限组数据
-     * @param bindingResult
+     * @param
+     * @param
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public CommonResult updateSmartAuthorGroupById(SmartAuthorGroup sa, BindingResult bindingResult) {
-        if (bindingResult.hasErrors()) {
-            String st = paramUtils.getParamError(bindingResult);
-            return CommonResult.fail(st);
+    @PassToken
+    public CommonResult updateSmartAuthorGroup(JSONObject jsonObject, Integer samePower) throws ParseException {
+        if (samePower==null){
+            return CommonResult.errorMsg("samePower不能为空");
         }
         }
+        // 所有管理员权限一样
+        if (samePower==1){
+            AuthorAndGroup authorAndGroup = JSONObject.parseObject(jsonObject.toString(), AuthorAndGroup.class);
+            SmartAuthorGroup sa = authorAndGroup.getSmartAuthorGroup();
+            String[] userId = sa.getUserId().split(",");
+            // 相关判断
+            QueryWrapper<SmartAuthorGroup> queryWrapperA = new QueryWrapper<>();
+            queryWrapperA.eq("deleted", 0);
+            queryWrapperA.eq("id",sa.getId());
+            List<SmartAuthorGroup> querySmartGroupA = smartAuthorGroupService.getAuthorGroupByKey(queryWrapperA);
+            if (querySmartGroupA.size()<=0){
+                return CommonResult.fail("该条信息已删除");
+            }
+            QueryWrapper<SmartAuthorGroup> queryWrapperB = new QueryWrapper<>();
+            queryWrapperB.eq("deleted", 0);
+            queryWrapperB.eq("id",sa.getParentId());
+            List<SmartAuthorGroup> querySmartGroupB = smartAuthorGroupService.getAuthorGroupByKey(queryWrapperB);
+            if (querySmartGroupB.size()<=0 && sa.getParentId()!=0){
+                return CommonResult.fail("父ID不存在");
+            }
+            QueryWrapper<SmartAuthorGroup> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("deleted", 0);
+            queryWrapper.eq("parent_id", sa.getParentId());
+            queryWrapper.eq("name", sa.getName());
+            queryWrapper.ne("id",sa.getId());
+            List<SmartAuthorGroup> querySmartGroup = smartAuthorGroupService.getAuthorGroupByKey(queryWrapper);
+            if (querySmartGroup.size()>0){
+                return CommonResult.fail("该管理员已存在,请勿重复修改");
+            }
+            QueryWrapper<SmartAuthority> queryWrapper2 = new QueryWrapper<>();
+            List<String> typeList = Arrays.asList(userId);
+            queryWrapper2.in("user_id", typeList);
+            queryWrapper2.eq("deleted", 0);
+            queryWrapper2.ne("group_id", sa.getId());
+            List<SmartAuthority> querySmart = smartAuthorityService.getAuthorByKey(queryWrapper2);
+            if (querySmart.size()>0){
+                return CommonResult.fail("该用户已分配其他权限组");
+            }
+            Set<String> set = new HashSet<>(typeList);
+            if (typeList.size()!=set.size()){
+                return CommonResult.fail("请勿选择重复用户");
+            }
+            String[] old_userId = querySmartGroupA.get(0).getUserId().split(",");
+            for (int i = 0; i < old_userId.length; i++) {
+                if (!typeList.contains(old_userId[i])){
+                    QueryWrapper<SmartAuthority> queryWrapperC = new QueryWrapper<>();
+                    queryWrapperC.eq("deleted", 0);
+                    queryWrapperC.eq("user_id",Integer.parseInt(old_userId[i]));
+                    List<SmartAuthority> smartAuthorityC = smartAuthorityService.getAuthorByKey(queryWrapperC);
+                    if (smartAuthorityC.size()>0){
+                        SmartAuthority smartAuthority = smartAuthorityC.get(0);
+                        smartAuthority.setDeleted(1);
+                        System.out.println(")))"+smartAuthority.getId());
+                        smartAuthorityService.updateSmartAuthority(smartAuthority);
+                    }
+                }
+            }
+            for (int i = 0; i < userId.length; i++) {
+                QueryWrapper<SmartAuthority> queryWrapper3 = new QueryWrapper<>();
+                queryWrapper3.eq("deleted", 0);
+                queryWrapper3.eq("user_id",Integer.parseInt(userId[i]));
+                List<SmartAuthority> smartAuthoritys = smartAuthorityService.getAuthorByKey(queryWrapper3);
+                if (smartAuthoritys.size()>0){
+                    SmartAuthority smartAuthority = smartAuthoritys.get(0);
+                    smartAuthority.setGroupId(sa.getId());
+                    smartAuthority.setDepartmentView(authorAndGroup.getDepartment_view());
+                    smartAuthority.setDepartmentManage(authorAndGroup.getDepartment_manage());
+                    smartAuthority.setCreateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                    smartAuthority.setUpdateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                    smartAuthority.setCreateUser("admin");
+                    smartAuthority.setUpdateUser("admin");
+                    smartAuthority.setDeleted(0);
+                    smartAuthorityService.updateSmartAuthority(smartAuthority);
+                } else {
+                    SmartAuthority smartAuthority = new SmartAuthority();
+                    smartAuthority.setUserId(Integer.parseInt(userId[i]));
+                    smartAuthority.setGroupId(sa.getId());
+                    smartAuthority.setDepartmentView(authorAndGroup.getDepartment_view());
+                    smartAuthority.setDepartmentManage(authorAndGroup.getDepartment_manage());
+                    smartAuthority.setCreateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                    smartAuthority.setUpdateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                    smartAuthority.setCreateUser("admin");
+                    smartAuthority.setUpdateUser("admin");
+                    smartAuthority.setDeleted(0);
+                    smartAuthorityService.insertSmartAuthority(smartAuthority);
+                }
 
 
-        int result = smartAuthorGroupService.updateSmartAuthorGroup(sa);
-        return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
+            }
+            int result = smartAuthorGroupService.updateSmartAuthorGroup(sa);
+            return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
+        }
+        // 每个管理员权限不一样
+        if (samePower==2){
+            AuthorAndGroup2 authorAndGroup2 = JSONObject.parseObject(jsonObject.toString(), AuthorAndGroup2.class);
+            SmartAuthorGroup sa = authorAndGroup2.getSmartAuthorGroup();
+            List<userAuthor> userAuthors = authorAndGroup2.getUserAuthors();
+            // 相关查询
+            QueryWrapper<SmartAuthorGroup> queryWrapperA = new QueryWrapper<>();
+            queryWrapperA.eq("deleted", 0);
+            queryWrapperA.eq("id",sa.getId());
+            List<SmartAuthorGroup> querySmartGroupA = smartAuthorGroupService.getAuthorGroupByKey(queryWrapperA);
+            if (querySmartGroupA.size()<=0){
+                return CommonResult.fail("该条信息已删除");
+            }
+            QueryWrapper<SmartAuthorGroup> queryWrapperB = new QueryWrapper<>();
+            queryWrapperB.eq("deleted", 0);
+            queryWrapperB.eq("id",sa.getParentId());
+            List<SmartAuthorGroup> querySmartGroupB = smartAuthorGroupService.getAuthorGroupByKey(queryWrapperB);
+            if (querySmartGroupB.size()<=0 && sa.getParentId()!=0){
+                return CommonResult.fail("父ID不存在");
+            }
+            QueryWrapper<SmartAuthorGroup> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("deleted", 0);
+            queryWrapper.eq("parent_id", sa.getParentId());
+            queryWrapper.eq("name", sa.getName());
+            queryWrapper.ne("id",sa.getId());
+            List<SmartAuthorGroup> querySmartGroup = smartAuthorGroupService.getAuthorGroupByKey(queryWrapper);
+            if (querySmartGroup.size()>0){
+                return CommonResult.fail("该管理员已存在,请勿重复添加");
+            }
+            List<Integer> uid =userAuthors.stream().map(userAuthor::getUserId).collect(Collectors.toList());
+            QueryWrapper<SmartAuthority> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.in("user_id", uid);
+            queryWrapper2.eq("deleted", 0);
+            queryWrapper2.ne("group_id", sa.getId());
+            List<SmartAuthority> querySmart = smartAuthorityService.getAuthorByKey(queryWrapper2);
+            if (querySmart.size()>0){
+                return CommonResult.fail("该用户已分配其他权限组");
+            }
+            Set<Integer> set = new HashSet<>(uid);
+            if (uid.size()!=set.size()){
+                return CommonResult.fail("请勿选择重复用户");
+            }
+            String[] old_userId = querySmartGroupA.get(0).getUserId().split(",");
+            for (int i = 0; i < old_userId.length; i++) {
+                if (!uid.contains(Integer.parseInt(old_userId[i]))){
+                    QueryWrapper<SmartAuthority> queryWrapperC = new QueryWrapper<>();
+                    queryWrapperC.eq("deleted", 0);
+                    queryWrapperC.eq("user_id",Integer.parseInt(old_userId[i]));
+                    List<SmartAuthority> smartAuthorityC = smartAuthorityService.getAuthorByKey(queryWrapperC);
+                    if (smartAuthorityC.size()>0){
+                        SmartAuthority smartAuthority = smartAuthorityC.get(0);
+                        smartAuthority.setDeleted(1);
+                        smartAuthorityService.updateSmartAuthority(smartAuthority);
+                    }
+                }
+            }
+            String userid = "";
+            for (int i = 0; i < userAuthors.size(); i++) {
+                if (i==userAuthors.size()-1){
+                    userid+=userAuthors.get(i).getUserId();
+                } else {
+                    userid+=userAuthors.get(i).getUserId()+",";
+                }
+                QueryWrapper<SmartAuthority> queryWrapper3 = new QueryWrapper<>();
+                queryWrapper3.eq("deleted", 0);
+                queryWrapper3.eq("user_id",userAuthors.get(i).getUserId());
+                List<SmartAuthority> smartAuthoritys = smartAuthorityService.getAuthorByKey(queryWrapper3);
+                if (smartAuthoritys.size()>0){
+                    SmartAuthority smartAuthority = smartAuthoritys.get(0);
+                    smartAuthority.setUserId(userAuthors.get(i).getUserId());
+                    smartAuthority.setGroupId(sa.getId());
+                    smartAuthority.setDepartmentView(userAuthors.get(i).getDepartment_view());
+                    smartAuthority.setDepartmentManage(userAuthors.get(i).getDepartment_manage());
+                    smartAuthority.setCreateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                    smartAuthority.setUpdateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                    smartAuthority.setCreateUser("admin");
+                    smartAuthority.setUpdateUser("admin");
+                    smartAuthority.setDeleted(userAuthors.get(i).getDeleted());
+                    smartAuthorityService.updateSmartAuthority(smartAuthority);
+                } else {
+                    SmartAuthority smartAuthority = new SmartAuthority();
+                    smartAuthority.setUserId(userAuthors.get(i).getUserId());
+                    smartAuthority.setGroupId(sa.getId());
+                    smartAuthority.setDepartmentView(userAuthors.get(i).getDepartment_view());
+                    smartAuthority.setDepartmentManage(userAuthors.get(i).getDepartment_manage());
+                    smartAuthority.setCreateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                    smartAuthority.setUpdateTime(TimeExchange2.StringToDate(TimeExchange2.getTime(),"yyyy-MM-dd HH:mm:ss"));
+                    smartAuthority.setCreateUser("admin");
+                    smartAuthority.setUpdateUser("admin");
+                    smartAuthority.setDeleted(0);
+                    smartAuthorityService.insertSmartAuthority(smartAuthority);
+                }
+
+            }
+            sa.setUserId(userid);
+            int result = smartAuthorGroupService.updateSmartAuthorGroup(sa);
+            return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
+        }
+        return CommonResult.errorMsg("参数格式错误");
     }
     }
 
 
     /**
     /**
-     * 权限组分页数据查询
-     * @param currentPage 当前页数
-     * @param pageCount 一页数据条数
-     * @param name 查询名称
+     * 查看权限列表
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public CommonResult queryPageSmartAuthorGroups(int currentPage, int pageCount, String name) {
-        PageUtils<SmartAuthorGroup> result = smartAuthorGroupService.queryPageSmartAuthorGroups(currentPage, pageCount, name);
-
-        return CommonResult.ok(result);
+    @PassToken
+    public CommonResult querySmartAuthorGroup(Integer authorGroupId) {
+        List<SmartAuthorGroup> smartAuthorGroups = smartAuthorGroupService.getAuthorGroupList();
+        List<AuthorListGroup> authorListGroupList = null;
+        if (smartAuthorGroups.size()>0) {
+            authorListGroupList = TreeRecordsUtil.queryCommentTreeRecords(authorGroupId, smartAuthorGroups);
+        }
+        return CommonResult.ok(authorListGroupList);
     }
     }
 
 
 
 

+ 42 - 0
src/main/java/com/template/controller/SmartClassController.java

@@ -0,0 +1,42 @@
+package com.template.controller;
+
+
+import com.template.api.SmartClassControllerAPI;
+import com.template.model.pojo.SmartClass;
+import com.template.model.result.CommonResult;
+import org.springframework.validation.BindingResult;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 楼栋表 前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@RestController
+public class SmartClassController implements SmartClassControllerAPI {
+
+    @Override
+    public CommonResult insertSmartClass(SmartClass smartApply, BindingResult bindingResult) {
+        return null;
+    }
+
+    @Override
+    public CommonResult updateSmartClassById(SmartClass ra, BindingResult bindingResult) {
+        return null;
+    }
+
+    @Override
+    public CommonResult queryPageSmartClasss(int currentPage, int pageCount, String name) {
+        return null;
+    }
+
+    @Override
+    public CommonResult deleteSmartClassById(int id) {
+        return null;
+    }
+}
+

+ 111 - 12
src/main/java/com/template/controller/SmartDepartmentController.java

@@ -1,22 +1,28 @@
 package com.template.controller;
 package com.template.controller;
 
 
 
 
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.template.api.SmartDepartmentControllerAPI;
 import com.template.api.SmartDepartmentControllerAPI;
 import com.template.common.utils.paramUtils;
 import com.template.common.utils.paramUtils;
 import com.template.model.pojo.SmartDepartment;
 import com.template.model.pojo.SmartDepartment;
-import com.template.model.pojo.SmartDepartment;
+import com.template.model.request.insertDepartmentRequest;
+import com.template.model.request.updateDepartmentRequest;
 import com.template.model.result.CommonResult;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.DepartmentTreeVo;
 import com.template.services.SmartDepartmentService;
 import com.template.services.SmartDepartmentService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.RequestMapping;
 
 
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
 /**
  * <p>
  * <p>
- *  前端控制器
+ * 前端控制器
  * </p>
  * </p>
  *
  *
  * @author ceshi
  * @author ceshi
@@ -30,44 +36,68 @@ public class SmartDepartmentController implements SmartDepartmentControllerAPI {
 
 
     /**
     /**
      * 新增部门
      * 新增部门
-     * @param smartApply 部门数据
+     *
+     * @param smartDepartment    部门数据
      * @param bindingResult
      * @param bindingResult
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public CommonResult insertSmartDepartment(SmartDepartment smartApply, BindingResult bindingResult) {
+    public CommonResult insertSmartDepartment(insertDepartmentRequest smartDepartment, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
             String st = paramUtils.getParamError(bindingResult);
             return CommonResult.fail(st);
             return CommonResult.fail(st);
         }
         }
 
 
-        int result = smartDepartmentService.insertSmartDepartment(smartApply);
+        //新增的时候判断是否存在重复部门名称数据
+        int exist = smartDepartmentService.existDataByName(smartDepartment.getName());
+        if (exist > 0) {
+
+            return CommonResult.fail(smartDepartment.getName() + "部门名称数据已存在,请勿重复添加!");
+        }
+
+        SmartDepartment sd = new SmartDepartment();
+        sd.setParentId(smartDepartment.getParentId());
+        sd.setName(smartDepartment.getName());
+
+        int result = smartDepartmentService.insertSmartDepartment(sd);
 
 
         return result > 0 ? CommonResult.ok("添加成功") : CommonResult.fail("添加失败");
         return result > 0 ? CommonResult.ok("添加成功") : CommonResult.fail("添加失败");
     }
     }
 
 
     /**
     /**
      * 更新部门
      * 更新部门
-     * @param sa 部门数据
+     *
+     * @param udr            部门数据
      * @param bindingResult
      * @param bindingResult
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public CommonResult updateSmartDepartmentById(SmartDepartment sa, BindingResult bindingResult) {
+    public CommonResult updateSmartDepartmentById(updateDepartmentRequest udr, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
             String st = paramUtils.getParamError(bindingResult);
             return CommonResult.fail(st);
             return CommonResult.fail(st);
         }
         }
 
 
-        int result = smartDepartmentService.updateSmartDepartment(sa);
+        SmartDepartment exist = smartDepartmentService.getSmartByName(udr.getName());
+        if (exist != null && !exist.getId().equals(udr.getId())) {
+            return CommonResult.fail(udr.getName() + "部门名称数据已存在,请勿重复添加!");
+        }
+
+        SmartDepartment sd = new SmartDepartment();
+        sd.setId(udr.getId());
+        sd.setParentId(udr.getParentId());
+        sd.setName(udr.getName());
+
+        int result = smartDepartmentService.updateSmartDepartment(sd);
         return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
         return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
     }
     }
 
 
     /**
     /**
      * 部门分页数据查询
      * 部门分页数据查询
+     *
      * @param currentPage 当前页数
      * @param currentPage 当前页数
-     * @param pageCount 一页数据条数
-     * @param name 查询名称
+     * @param pageCount   一页数据条数
+     * @param name        查询名称
      * @return
      * @return
      */
      */
     @Override
     @Override
@@ -83,7 +113,7 @@ public class SmartDepartmentController implements SmartDepartmentControllerAPI {
 
 
         SmartDepartment data = smartDepartmentService.getSmartById(id);
         SmartDepartment data = smartDepartmentService.getSmartById(id);
 
 
-        if(data == null){
+        if (data == null) {
             return CommonResult.fail("当前数据不存在,删除失败!");
             return CommonResult.fail("当前数据不存在,删除失败!");
         }
         }
 
 
@@ -91,5 +121,74 @@ public class SmartDepartmentController implements SmartDepartmentControllerAPI {
 
 
         return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
         return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
     }
     }
+
+    /**
+     * 根据部门名称查询部门树形图结构数据
+     *
+     * @param name 部门名称
+     * @return
+     */
+    @Override
+    public CommonResult queryDepartmentTree(String name) {
+        List<SmartDepartment> result = smartDepartmentService.getSmartsByName(name);
+
+        List<SmartDepartment> zeroResult = result.stream().filter(e -> e.getParentId().intValue() == 0).collect(Collectors.toList());
+        List<DepartmentTreeVo> departments = new ArrayList<>();
+        if (ObjectUtils.isEmpty(name)) {
+            for (SmartDepartment data : zeroResult) {
+                DepartmentTreeVo newData = new DepartmentTreeVo().builder()
+                        .id(data.getId())
+                        .name(data.getName())
+                        .parentId(data.getParentId())
+                        .build();
+
+                List<DepartmentTreeVo> departmentTrees = QueryDepartmentTreeRecords(newData.getId(), result);
+                newData.setChildren(departmentTrees);
+                departments.add(newData);
+            }
+        } else {
+            for (SmartDepartment data : result) {
+                DepartmentTreeVo newData = new DepartmentTreeVo().builder()
+                        .id(data.getId())
+                        .name(data.getName())
+                        .parentId(data.getParentId())
+                        .build();
+                departments.add(newData);
+            }
+        }
+
+        return CommonResult.ok(departments);
+    }
+
+    /**
+     * 根据父级ID获取树形数据
+     *
+     * @param parentID 父级ID
+     * @param lists    数据集合
+     * @return
+     */
+    private List<DepartmentTreeVo> QueryDepartmentTreeRecords(Integer parentID, List<SmartDepartment> lists) {
+        List<DepartmentTreeVo> newTrees = new ArrayList<>();
+
+        List<SmartDepartment> datas = lists.stream().filter(e -> e.getParentId().equals(parentID)).collect(Collectors.toList());
+
+        for (SmartDepartment data : datas) {
+            DepartmentTreeVo item = DepartmentTreeVo.builder()
+                    .id(data.getId())
+                    .parentId(parentID)
+                    .name(data.getName())
+                    .build();
+            List<DepartmentTreeVo> news = QueryDepartmentTreeRecords(item.getId(), lists);
+            if (news == null || news.size() == 0) {
+                newTrees.add(item);
+                continue;
+            } else {
+                item.setChildren(news);
+                newTrees.add(item);
+            }
+        }
+
+        return newTrees;
+    }
 }
 }
 
 

+ 44 - 0
src/main/java/com/template/controller/SmartGradeController.java

@@ -0,0 +1,44 @@
+package com.template.controller;
+
+
+import com.template.api.SmartAttendanceControllerAPI;
+import com.template.api.SmartGradeControllerAPI;
+import com.template.model.pojo.SmartGrade;
+import com.template.model.result.CommonResult;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 楼栋表 前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@RestController
+public class SmartGradeController implements SmartGradeControllerAPI {
+
+    @Override
+    public CommonResult insertSmartGrade(SmartGrade smartApply, BindingResult bindingResult) {
+        return null;
+    }
+
+    @Override
+    public CommonResult updateSmartGradeById(SmartGrade ra, BindingResult bindingResult) {
+        return null;
+    }
+
+    @Override
+    public CommonResult queryPageSmartGrades(int currentPage, int pageCount, String name) {
+        return null;
+    }
+
+    @Override
+    public CommonResult deleteSmartGradeById(int id) {
+        return null;
+    }
+}
+

+ 4 - 0
src/main/java/com/template/controller/SmartUserController.java

@@ -45,6 +45,8 @@ public class SmartUserController implements SmartUserControllerAPI {
 
 
         int result = smartUserService.insertSmartUser(smartApply);
         int result = smartUserService.insertSmartUser(smartApply);
 
 
+        //新增用户得将用户信息通过接口推送到希沃、百胜
+
         return result > 0 ? CommonResult.ok("添加成功") : CommonResult.fail("添加失败");
         return result > 0 ? CommonResult.ok("添加成功") : CommonResult.fail("添加失败");
     }
     }
 
 
@@ -61,6 +63,8 @@ public class SmartUserController implements SmartUserControllerAPI {
             return CommonResult.fail(st);
             return CommonResult.fail(st);
         }
         }
 
 
+        //更新的同时将百胜用户信息同步过去或者同步过来?
+
         int result = smartUserService.updateSmartUser(sa);
         int result = smartUserService.updateSmartUser(sa);
         return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
         return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
     }
     }

+ 80 - 13
src/main/java/com/template/controller/SmartVisitorController.java

@@ -1,13 +1,18 @@
 package com.template.controller;
 package com.template.controller;
 
 
 
 
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.seewo.open.sdk.DefaultSeewoClient;
 import com.seewo.open.sdk.DefaultSeewoClient;
 import com.seewo.open.sdk.SeewoClient;
 import com.seewo.open.sdk.SeewoClient;
 import com.seewo.open.sdk.auth.Account;
 import com.seewo.open.sdk.auth.Account;
 import com.template.api.SmartVisitorControllerAPI;
 import com.template.api.SmartVisitorControllerAPI;
+import com.template.common.utils.CommonUtil;
+import com.template.common.utils.RequestUtils;
 import com.template.common.utils.TimeExchange;
 import com.template.common.utils.TimeExchange;
 import com.template.common.utils.paramUtils;
 import com.template.common.utils.paramUtils;
 import com.template.config.CosConfig;
 import com.template.config.CosConfig;
+import com.template.config.ParkConfig;
 import com.template.config.SeewoConfig;
 import com.template.config.SeewoConfig;
 import com.template.model.enumModel.eApproveStatu;
 import com.template.model.enumModel.eApproveStatu;
 import com.template.model.enumModel.eExamineStatu;
 import com.template.model.enumModel.eExamineStatu;
@@ -30,9 +35,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
@@ -51,9 +58,13 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
 
 
     @Autowired
     @Autowired
     private SmartUserService smartUserService;
     private SmartUserService smartUserService;
+
     @Resource
     @Resource
     private SeewoConfig seewoConfig;
     private SeewoConfig seewoConfig;
 
 
+    @Resource
+    private ParkConfig parkConfig;
+
     /**
     /**
      * 新增访客预约
      * 新增访客预约
      *
      *
@@ -143,6 +154,17 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
             return CommonResult.fail("当前用户信息不合法,无法进行预约!");
             return CommonResult.fail("当前用户信息不合法,无法进行预约!");
         }
         }
 
 
+        String startTime = par.getVisitorTime();
+        String endTime = TimeExchange.getEndOfDayStr(TimeExchange.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss"));
+
+        //要进行家长数据重复判断
+        //那是不是第二次预约的时间不能在那个可访问的时间段内
+        //例如:比如,第一次约了7:00-10:00;那第二次:6:00-7:30 或 8:11-13:00都不行
+        Integer count = smartVisitorService.queryVisitorCount(su.getIdCard(), startTime, endTime);
+        if(count <= 0){
+            return CommonResult.fail("该时间段已预约,请勿重复预约!");
+        }
+
         List<SmartVisitor> svs = new ArrayList<>();
         List<SmartVisitor> svs = new ArrayList<>();
         for (AffiliateUserVo student : par.getStudents()) {
         for (AffiliateUserVo student : par.getStudents()) {
             SmartVisitor sv = new SmartVisitor();
             SmartVisitor sv = new SmartVisitor();
@@ -155,7 +177,7 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
             sv.setVisitReason(par.getVisitReason());
             sv.setVisitReason(par.getVisitReason());
             sv.setStatu(eApproveStatu.Audit.getValue());
             sv.setStatu(eApproveStatu.Audit.getValue());
             sv.setVisitorTime(TimeExchange.StringToDate(par.getVisitorTime(), "yyyy-MM-dd HH:mm:ss"));
             sv.setVisitorTime(TimeExchange.StringToDate(par.getVisitorTime(), "yyyy-MM-dd HH:mm:ss"));
-            sv.setVisitorDeadline(TimeExchange.StringToDate(TimeExchange.TimeDesH(sv.getVisitorTime(),4),"yyyy-MM-dd HH:mm:ss"));
+            sv.setVisitorDeadline(TimeExchange.StringToDate(TimeExchange.TimeDesH(sv.getVisitorTime(), 4), "yyyy-MM-dd HH:mm:ss"));
             sv.setRespondent(student.getId());
             sv.setRespondent(student.getId());
             sv.setResponcode(student.getCardNo());
             sv.setResponcode(student.getCardNo());
             sv.setRespondentName(student.getName());
             sv.setRespondentName(student.getName());
@@ -183,6 +205,17 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
             return CommonResult.fail("当前用户信息不合法,无法进行预约!");
             return CommonResult.fail("当前用户信息不合法,无法进行预约!");
         }
         }
 
 
+        String startTime = oar.getVisitorTime();
+        String endTime = TimeExchange.getEndOfDayStr(TimeExchange.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss"));
+
+        //要进行访客数据重复判断
+        //那是不是第二次预约的时间不能在那个可访问的时间段内
+        //例如:比如,第一次约了7:00-10:00;那第二次:6:00-7:30 或 8:11-13:00都不行
+        Integer count = smartVisitorService.queryVisitorCount(su.getIdCard(), startTime, endTime);
+        if(count <= 0){
+            return CommonResult.fail("该时间段已预约,请勿重复预约!");
+        }
+
         SmartVisitor sv = new SmartVisitor();
         SmartVisitor sv = new SmartVisitor();
         sv.setUserId(oar.getUserId());
         sv.setUserId(oar.getUserId());
         sv.setUserName(su.getName());
         sv.setUserName(su.getName());
@@ -192,8 +225,8 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
         sv.setCarNum(oar.getCarNum());
         sv.setCarNum(oar.getCarNum());
         sv.setVisitReason(oar.getVisitReason());
         sv.setVisitReason(oar.getVisitReason());
         sv.setStatu(eApproveStatu.Audit.getValue());
         sv.setStatu(eApproveStatu.Audit.getValue());
-        sv.setVisitorTime(TimeExchange.StringToDate(oar.getVisitorTime(), "yyyy-MM-dd HH:mm:ss"));
-        sv.setVisitorDeadline(TimeExchange.StringToDate(TimeExchange.getEndOfDayStr(new Date()),"yyyy-MM-dd HH:mm:ss"));
+        sv.setVisitorTime(TimeExchange.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss"));
+        sv.setVisitorDeadline(TimeExchange.StringToDate(endTime, "yyyy-MM-dd HH:mm:ss"));
         sv.setRespondentName(oar.getRespondentName());
         sv.setRespondentName(oar.getRespondentName());
         sv.setRespondentPhone(oar.getRespondentPhone());
         sv.setRespondentPhone(oar.getRespondentPhone());
         sv.setVisitorType(eVisitorType.Other.getValue());
         sv.setVisitorType(eVisitorType.Other.getValue());
@@ -227,7 +260,7 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
             return CommonResult.fail("访客记录已失效,审核失败!");
             return CommonResult.fail("访客记录已失效,审核失败!");
         }
         }
 
 
-        try{
+        try {
             if (type == eExamineStatu.Agree.getValue()) {
             if (type == eExamineStatu.Agree.getValue()) {
                 visitor.setStatu(eApproveStatu.Pushed.getValue());
                 visitor.setStatu(eApproveStatu.Pushed.getValue());
 
 
@@ -236,14 +269,48 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
                     String content = visitor.getRespondentName() + "你的家长将于" + TimeExchange.chineseDateTime(visitor.getVisitorTime()) + "到校!";
                     String content = visitor.getRespondentName() + "你的家长将于" + TimeExchange.chineseDateTime(visitor.getVisitorTime()) + "到校!";
                     //将预约信息推送到希沃班牌
                     //将预约信息推送到希沃班牌
                     CommonResult seewo = pushInfo(visitor.getUserPhone(), visitor.getResponcode(), content);
                     CommonResult seewo = pushInfo(visitor.getUserPhone(), visitor.getResponcode(), content);
-                    if(!seewo.getCode().equals("200")){
+                    if (!seewo.getCode().equals("200")) {
                         throw new Exception("审核失败");
                         throw new Exception("审核失败");
                     }
                     }
                 }
                 }
                 //将数据写入门禁系统逻辑
                 //将数据写入门禁系统逻辑
-                else{
+                else {
                     //家长不能使用车牌系统 其他的可以使用车牌逻辑
                     //家长不能使用车牌系统 其他的可以使用车牌逻辑
-
+                    if(!ObjectUtils.isEmpty(visitor.getCarNum())){
+                        String appId = parkConfig.getAppId();
+                        String carNo = visitor.getCarNum();
+                        String parkKey = parkConfig.getParkKey();
+                        String rand = String.valueOf(Math.random());
+                        String reserveTime = TimeExchange.DateToString(visitor.getVisitorTime(),"yyyy-MM-dd HH:mm:ss") ;
+                        String reserveEndTime = TimeExchange.DateToString(visitor.getVisitorDeadline(),"yyyy-MM-dd HH:mm:ss");
+                        String version = "v1.0";
+                        String appSecret = parkConfig.getAppSecret();
+                        String url = parkConfig.getUrl();
+
+                        JSONObject jsonobject = new JSONObject();
+                        jsonobject.put("appid", appId);
+                        jsonobject.put("carNo", carNo);
+                        jsonobject.put("parkKey", parkKey);
+                        jsonobject.put("rand", rand);
+                        jsonobject.put("reserveEndTime", reserveEndTime);
+                        jsonobject.put("reserveTime", reserveTime);
+                        jsonobject.put("version", "v1.0");
+
+                        //appid=ymdd36ed157ac423e2&carNo=赣U123659&parkKey=wdcmq9rc&rand=9.94995525689689966&reserveEndTime=2023-12-22 20:12:10&reserveTime=2023-12-21 18:12:10&version=v1.0&50596cd243dc4547b4c05f01f8ea02a4
+                        String md5Str = "appid=" + appId + "&carNo=" + carNo + "&parkKey=" + parkKey + "&rand=" + rand + "&reserveEndTime=" + reserveEndTime + "&reserveTime=" + reserveTime + "&version=" +version+ "&" + appSecret;
+                        String sign = CommonUtil.MD5(md5Str);
+                        //sign签名
+                        jsonobject.put("sign", sign);
+
+                        //返回的结果中 code为1表示成功
+                        String result = RequestUtils.httpPost(url, jsonobject.toJSONString());
+
+                        System.out.println(result);
+
+                        if(!result.contains("预约成功")){
+                            throw new Exception("审核失败");
+                        }
+                    }
                 }
                 }
 
 
             } else if (type == eExamineStatu.Refused.getValue()) {
             } else if (type == eExamineStatu.Refused.getValue()) {
@@ -251,11 +318,11 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
             }
             }
 
 
             int result = smartVisitorService.updateSmartVisitor(visitor);
             int result = smartVisitorService.updateSmartVisitor(visitor);
-            if(result <= 0){
+            if (result <= 0) {
                 throw new Exception("审核失败");
                 throw new Exception("审核失败");
             }
             }
 
 
-        }catch (Exception e){
+        } catch (Exception e) {
             throw new Exception("审核失败");
             throw new Exception("审核失败");
         }
         }
 
 
@@ -297,7 +364,7 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
         //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
         //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
         HomeSchoolServiceSendNoteToKidResult result = seewoClient.invoke(request);
         HomeSchoolServiceSendNoteToKidResult result = seewoClient.invoke(request);
         System.out.println("出参:" + result);
         System.out.println("出参:" + result);
-        if(!result.getMessage().equals("success")){
+        if (!result.getMessage().equals("success")) {
             CommonResult.fail();
             CommonResult.fail();
         }
         }
 
 

+ 263 - 0
src/main/java/com/template/controller/WechatScanLoginController.java

@@ -0,0 +1,263 @@
+package com.template.controller;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.github.pagehelper.util.StringUtil;
+import com.template.annotation.PassToken;
+import com.template.api.WechatScanLoginControllerAPI;
+import com.template.common.constanst.Constanst;
+import com.template.common.result.ResponseStatusEnum;
+import com.template.common.utils.*;
+import com.template.model.pojo.SmartUser;
+import com.template.model.result.CommonResult;
+import com.template.model.result.PageUtils;
+import com.template.model.tongji.*;
+import com.template.model.vo.LoginVO;
+import com.template.model.weixin.AccessToken;
+import com.template.model.weixin.HttpParame;
+import com.template.model.weixin.WechatUserUnionID;
+import com.template.services.SmartUserService;
+import com.template.services.WechatScanLoginService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.text.ParseException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Title: WechatScanLoginController
+ * Description: 微信扫码登录controller
+ * 
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+@Controller
+public class WechatScanLoginController implements WechatScanLoginControllerAPI {
+
+	@Autowired
+	private WechatScanLoginService wechatScanLoginService;
+	@Autowired
+	public SmartUserService smartUserService;
+
+	/**
+	 * Title: list
+	 * Description: 重定向到微信扫码登录二维码页面
+	 * 此处显示要微信要扫描的二维码
+	 * 
+	 * @param model
+	 * @return
+	 * @throws UnsupportedEncodingException
+	 */
+	@Override
+	public String login(Model model) throws UnsupportedEncodingException {
+		Map<String, String> wechatLoginUrl = wechatScanLoginService.wechatLoginUrl();
+		String url = wechatLoginUrl.get("url");
+		System.out.println(url);
+		return "redirect:" + url;
+	}
+
+	/**
+	 * Title: callback
+	 * Description: 回调地址处理
+	 * 
+	 * @param code
+	 * @param state
+	 * @return
+	 * @return
+	 */
+	@Override
+	public String callback(String code, String state) throws UnsupportedEncodingException {
+		System.out.println(code+"====="+state);
+		if (code != null && state != null) {
+			// 验证state为了用于防止跨站请求伪造攻击
+			String decrypt = AesUtil.decrypt(AesUtil.parseHexStr2Byte(state), AesUtil.PASSWORD_SECRET_KEY, 16);
+			if (!decrypt.equals(Constanst.PWD_MD5 + DateUtils.getYYYYMMdd())) {
+				return "redirect:"+HttpParame.FRONT_URI+"/#/login?message=" + URLEncoder.encode("请勿非法进入", "UTF-8");
+			}
+			AccessToken access = wechatScanLoginService.getAccessToken(code);
+			if (access != null) {
+				String openid = access.getOpenid();
+				SmartUser user = wechatScanLoginService.selectByOpenid(openid);
+				if (user==null) {		/*不存在*/
+					return "redirect:"+HttpParame.FRONT_URI+"/#/login?message=" + URLEncoder.encode("请绑定信息", "UTF-8");
+				} else {
+					String token = JWTUtil.getToken(user);
+					return "redirect:"+HttpParame.FRONT_URI+"/#/wanzai/home?token=" + token;
+				}
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Title: bindingUserMac
+	 * Description: 跳转到绑定用户系统帐号页面
+	 * @return
+	 */
+	@Override
+	public String bindUserMac(String cardNo) throws UnsupportedEncodingException {
+		if (StringUtils.isBlank(cardNo)){
+			return "redirect:"+HttpParame.FRONT_URI+"/#/login?message=" + URLEncoder.encode("请绑定信息", "UTF-8");
+		}
+		Map<String, String> wechatLoginUrl = wechatScanLoginService.wechatBindUrl(cardNo);
+		String url = wechatLoginUrl.get("url");
+		System.out.println(url);
+		return "redirect:" + url;
+	}
+
+	@Override
+	public String bindcallback(String code, String state, String cardNo) throws UnsupportedEncodingException {
+		System.out.println(code+"==="+state+"=="+cardNo);
+		if (code != null && state != null) {
+			// 验证state为了用于防止跨站请求伪造攻击
+			String decrypt = AesUtil.decrypt(AesUtil.parseHexStr2Byte(state), AesUtil.PASSWORD_SECRET_KEY, 16);
+			if (!decrypt.equals(Constanst.PWD_MD5 + DateUtils.getYYYYMMdd())) {
+				return "redirect:"+HttpParame.FRONT_URI+"/#/login?message=" + URLEncoder.encode("请勿非法进入", "UTF-8");
+			}
+			AccessToken access = wechatScanLoginService.getAccessToken(code);
+			if (access != null) {
+				String openid = access.getOpenid();
+				/*SmartUser user = wechatScanLoginService.selectByOpenid(openid);
+				if (user!=null) {		*//*不存在*//*
+					return "redirect:"+HttpParame.FRONT_URI+"/#/login?message=" + URLEncoder.encode("该卡号已绑定其他用户", "UTF-8");
+				}*/
+				SmartUser userc = wechatScanLoginService.selectByCardNo(cardNo);
+				if (userc==null){
+					return "redirect:"+HttpParame.FRONT_URI+"/#/login?message=" + URLEncoder.encode("卡号信息错误", "UTF-8");
+				}
+				if (userc.getOpenId()!=null){
+					return "redirect:"+HttpParame.FRONT_URI+"/#/login?message=" + URLEncoder.encode("该卡号已绑定其他用户", "UTF-8");
+				}
+				userc.setOpenId(openid);
+				int m = wechatScanLoginService.updateSmartUser(userc);
+				if (m>0){
+					String token = JWTUtil.getToken(userc);
+					return "redirect:"+HttpParame.FRONT_URI+"/#/wanzai/home?token=" + token;
+				}
+			}
+		}
+		return "redirect:"+HttpParame.FRONT_URI+"/#/login?message=" + URLEncoder.encode("系统异常", "UTF-8");
+	}
+
+	@Override
+	@PassToken
+    public String insertMonthMeter(String month){
+		if (month==null){
+			month=TimeExchange2.getMonth();
+		}
+		wechatScanLoginService.insertMonthMeter(month);
+		return "插入完毕";
+	}
+
+	@Override
+	@PassToken
+	public String insertDayMeter(String day){
+		if (day==null){
+			day=TimeExchange2.getDateStr();
+		}
+		wechatScanLoginService.insertDayMeter(day);
+		return "插入完毕";
+	}
+
+	/**
+	 * Description: 用户类别统计
+	 */
+	@Override
+	@PassToken
+	public CommonResult getUserIdTj(){
+		List<Tj> list = wechatScanLoginService.getUserIdTj();
+		return CommonResult.ok(list);
+	}
+
+	/**
+	 * Description: 用户总数
+	 */
+	@Override
+	@PassToken
+	public CommonResult getUserIdTjt(){
+		All list = wechatScanLoginService.getUserIdTjt();
+		return CommonResult.ok(list);
+	}
+
+	/**
+	 * Description: 水表总计
+	 */
+	@Override
+	@PassToken
+	public CommonResult getWaterTj(){
+		DAll list = wechatScanLoginService.getWaterTj();
+		return CommonResult.ok(list);
+	}
+
+	/**
+	 * Description: 电表总计
+	 */
+	@Override
+	@PassToken
+	public CommonResult getElcTj(){
+		DAll list = wechatScanLoginService.getElcTj();
+		return CommonResult.ok(list);
+	}
+
+	/**
+	 * Description: 每月水费查询
+	 */
+	@Override
+	@PassToken
+	public CommonResult getMonWater() throws ParseException {
+		List<MonthMeterDetail> list = wechatScanLoginService.getMonWater();
+		return CommonResult.ok(list);
+	}
+
+	/**
+	 * Description: 每月电费查询
+	 */
+	@Override
+	@PassToken
+	public CommonResult getMonElc() throws ParseException {
+		List<MonthMeterDetail> list = wechatScanLoginService.getMonElc();
+		return CommonResult.ok(list);
+	}
+
+	/**
+	 * Description: 区域能耗统计
+	 */
+	@Override
+	@PassToken
+	public CommonResult getMeterMonthPage(@RequestBody MeterMonthData meterMonthData,int currentPage, int pageCount) {
+		PageHelper.startPage(currentPage, pageCount);
+		PageInfo<MeterMonthData> list = wechatScanLoginService.getMeterMonthPage(meterMonthData);
+		return CommonResult.ok(list);
+	}
+
+	/**
+	 * Description: 实时抄表
+	 */
+	@Override
+	@PassToken
+	public CommonResult getMeterDayPage(@RequestBody MeterMonthData meterMonthData, int currentPage, int pageCount) {
+		PageHelper.startPage(currentPage, pageCount);
+		PageInfo<MeterMonthData> list = wechatScanLoginService.getMeterDayPage(meterMonthData);
+		return CommonResult.ok(list);
+	}
+
+	/**
+	 * Description: 查轨迹
+	 */
+	@Override
+	@PassToken
+	public CommonResult getPosition() {
+		List<List<BigDecimal>> ld = RandomTrackAlgorithm.getPosition();
+		return CommonResult.ok(ld);
+	}
+}

+ 18 - 0
src/main/java/com/template/mapper/SmartAttendanceMapper.java

@@ -0,0 +1,18 @@
+package com.template.mapper;
+
+import com.template.model.pojo.SmartAttendance;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * <p>
+ * 楼栋表 Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@Repository
+public interface SmartAttendanceMapper extends BaseMapper<SmartAttendance> {
+
+}

+ 18 - 0
src/main/java/com/template/mapper/SmartClassMapper.java

@@ -0,0 +1,18 @@
+package com.template.mapper;
+
+import com.template.model.pojo.SmartClass;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * <p>
+ * 楼栋表 Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@Repository
+public interface SmartClassMapper extends BaseMapper<SmartClass> {
+
+}

+ 18 - 0
src/main/java/com/template/mapper/SmartGradeMapper.java

@@ -0,0 +1,18 @@
+package com.template.mapper;
+
+import com.template.model.pojo.SmartGrade;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * <p>
+ * 楼栋表 Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@Repository
+public interface SmartGradeMapper extends BaseMapper<SmartGrade> {
+
+}

+ 2 - 0
src/main/java/com/template/mapper/SmartVisitorMapper.java

@@ -18,4 +18,6 @@ import org.springframework.stereotype.Repository;
 @Repository
 @Repository
 public interface SmartVisitorMapper extends BaseMapper<SmartVisitor> {
 public interface SmartVisitorMapper extends BaseMapper<SmartVisitor> {
     IPage<VisitorPageVo> queryVisitorPage(IPage<VisitorPageVo> page, @Param("userId") Integer userId, @Param("statu") Integer statu);
     IPage<VisitorPageVo> queryVisitorPage(IPage<VisitorPageVo> page, @Param("userId") Integer userId, @Param("statu") Integer statu);
+
+    Integer queryVisitorCount(@Param("cardNo") String cardNo, @Param("startTime") String startTime, @Param("endTime") String endTime);
 }
 }

+ 63 - 0
src/main/java/com/template/mapper/WechatScanLoginMapper.java

@@ -0,0 +1,63 @@
+package com.template.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.pojo.SmartUser;
+import com.template.model.tongji.*;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface WechatScanLoginMapper extends BaseMapper<SmartUser> {
+
+    // 用户类别统计
+    public List<Tj> getUserIdTj();
+
+    // 用户总数
+    public All getUserIdTjt();
+
+    // 水表总计
+    public DAll getWaterTj();
+
+    // 电表总计
+    public DAll getElcTj();
+
+    // 每个月各水表数据统计
+    public List<EnergyTj> getWaterTjByMonAndBuild(String month);
+
+    // 每个月各电表数据统计
+    public List<EnergyTj> getElcTjByMonAndBuild(String month);
+
+    // 每个月每个楼栋查询
+    public EnergyTj getTjByMon(String name,String month,String type);
+
+    public void insertMonthMeter(EnergyTj energyTj);
+
+    public void updateMonthMeter(@Param("energyTj")EnergyTj energyTj);
+
+    // 每天各水表数据统计
+    public List<EnergyTj> getWaterTjByDayAndBuild(String day);
+
+    // 每天各电表数据统计
+    public List<EnergyTj> getElcTjByDayAndBuild(String day);
+
+    public EnergyTj getTjByDay(String name,String day,String type);
+
+    public void insertDayMeter(EnergyTj energyTj);
+
+    public void updateDayMeter(@Param("energyTj")EnergyTj energyTj);
+
+    // 每个月各水表数据
+    public List<Tj> getMonWater(@Param("month")String month);
+
+    // 每个月各电表数据
+    public List<Tj> getMonElc(@Param("month")String month);
+
+    // 区域能耗统计
+    public List<MeterMonthData> getMeterMonthPage(@Param("meterMonthData")MeterMonthData meterMonthData);
+
+    // 实时抄表
+    public List<MeterMonthData> getMeterDayPage(@Param("meterMonthData")MeterMonthData meterMonthData);
+
+}

+ 308 - 0
src/main/java/com/template/model/pojo/AttendanceRuleListSchoolAttendRuleParam.java

@@ -0,0 +1,308 @@
+package com.template.model.pojo;
+
+import java.util.*;
+import com.seewo.open.sdk.OpenApiParam;
+import com.seewo.open.sdk.ParameterPosition;
+
+/**
+ * seewo-open API: 【事件|课程】分页查询学校考勤规则信息
+ *
+ *
+ * @author auto create
+ * @since 2.0.1 2023-12-19
+ */
+public class AttendanceRuleListSchoolAttendRuleParam extends OpenApiParam {
+
+
+    /**
+     * 响应体,MimeType为 application/json
+     */
+
+    private RequestBody requestBody;
+
+
+    public RequestBody getRequestBody() {
+        return this.requestBody;
+    }
+
+    public void setRequestBody(RequestBody requestBody) {
+        this.requestBody = requestBody;
+    }
+
+    public static AttendanceRuleListSchoolAttendRuleParamBuilder builder(){
+        return new AttendanceRuleListSchoolAttendRuleParamBuilder();
+    }
+
+    public static class AttendanceRuleListSchoolAttendRuleParamBuilder{
+        private RequestBody requestBody;
+
+        public AttendanceRuleListSchoolAttendRuleParamBuilder requestBody(RequestBody requestBody){
+            this.requestBody = requestBody;
+            return this;
+        }
+
+        public AttendanceRuleListSchoolAttendRuleParam build(){
+            AttendanceRuleListSchoolAttendRuleParam param = new AttendanceRuleListSchoolAttendRuleParam();
+            param.setRequestBody(requestBody);
+            return param;
+        }
+    }
+
+    public static class RequestBody {
+        /**
+         * query
+         */
+        private Query query;
+
+        public Query getQuery() {
+            return this.query;
+        }
+
+        public void setQuery(Query query) {
+            this.query = query;
+        }
+
+
+        public static RequestBodyBuilder builder(){
+            return new RequestBodyBuilder();
+        }
+
+        public static class RequestBodyBuilder{
+            private Query query;
+
+            public RequestBodyBuilder query(Query query){
+                this.query = query;
+                return this;
+            }
+
+            public RequestBody build(){
+                RequestBody param = new RequestBody();
+                param.setQuery(query);
+                return param;
+            }
+        }
+    }
+
+    public static class Query {
+        /**
+         * appId
+         */
+        private String appId;
+        /**
+         * 学校uid
+         */
+        private String schoolUid;
+        /**
+         * 考勤日期(默认当天)
+         */
+        private String date;
+        /**
+         * 考勤类型
+1-事件(默认),2-课程
+         */
+        private Integer attendType;
+        /**
+         * 班级Uid
+         */
+        private String classUid;
+        /**
+         * 年级序号
+年级序号+班级序号唯一确定班级信息(几年级几班)
+年级序号+班级序号 与 班级Uid只取一个,以班级Uid为准
+         */
+        private Integer grade;
+        /**
+         * 班级序号
+年级序号+班级序号唯一确定班级信息(几年级几班)
+年级序号+班级序号 与 班级Uid只取一个,以班级Uid为准
+         */
+        private Integer clazz;
+        /**
+         * 场地标识
+         */
+        private String roomNum;
+        /**
+         * 场地标识类型
+0 - 第三方ID,1 - 希沃场地ID(默认),2 - 房间编号,3 - 行政班ID
+         */
+        private Integer roomNumType;
+        /**
+         * 页号,默认1
+         */
+        private Integer page;
+        /**
+         * 每页大小,默认20
+         */
+        private Integer pageSize;
+
+        public String getAppId() {
+            return this.appId;
+        }
+
+        public void setAppId(String appId) {
+            this.appId = appId;
+        }
+
+        public String getSchoolUid() {
+            return this.schoolUid;
+        }
+
+        public void setSchoolUid(String schoolUid) {
+            this.schoolUid = schoolUid;
+        }
+
+        public String getDate() {
+            return this.date;
+        }
+
+        public void setDate(String date) {
+            this.date = date;
+        }
+
+        public Integer getAttendType() {
+            return this.attendType;
+        }
+
+        public void setAttendType(Integer attendType) {
+            this.attendType = attendType;
+        }
+
+        public String getClassUid() {
+            return this.classUid;
+        }
+
+        public void setClassUid(String classUid) {
+            this.classUid = classUid;
+        }
+
+        public Integer getGrade() {
+            return this.grade;
+        }
+
+        public void setGrade(Integer grade) {
+            this.grade = grade;
+        }
+
+        public Integer getClazz() {
+            return this.clazz;
+        }
+
+        public void setClazz(Integer clazz) {
+            this.clazz = clazz;
+        }
+
+        public String getRoomNum() {
+            return this.roomNum;
+        }
+
+        public void setRoomNum(String roomNum) {
+            this.roomNum = roomNum;
+        }
+
+        public Integer getRoomNumType() {
+            return this.roomNumType;
+        }
+
+        public void setRoomNumType(Integer roomNumType) {
+            this.roomNumType = roomNumType;
+        }
+
+        public Integer getPage() {
+            return this.page;
+        }
+
+        public void setPage(Integer page) {
+            this.page = page;
+        }
+
+        public Integer getPageSize() {
+            return this.pageSize;
+        }
+
+        public void setPageSize(Integer pageSize) {
+            this.pageSize = pageSize;
+        }
+
+
+        public static QueryBuilder builder(){
+            return new QueryBuilder();
+        }
+
+        public static class QueryBuilder{
+            private String appId;
+            private String schoolUid;
+            private String date;
+            private Integer attendType;
+            private String classUid;
+            private Integer grade;
+            private Integer clazz;
+            private String roomNum;
+            private Integer roomNumType;
+            private Integer page;
+            private Integer pageSize;
+
+            public QueryBuilder appId(String appId){
+                this.appId = appId;
+                return this;
+            }
+            public QueryBuilder schoolUid(String schoolUid){
+                this.schoolUid = schoolUid;
+                return this;
+            }
+            public QueryBuilder date(String date){
+                this.date = date;
+                return this;
+            }
+            public QueryBuilder attendType(Integer attendType){
+                this.attendType = attendType;
+                return this;
+            }
+            public QueryBuilder classUid(String classUid){
+                this.classUid = classUid;
+                return this;
+            }
+            public QueryBuilder grade(Integer grade){
+                this.grade = grade;
+                return this;
+            }
+            public QueryBuilder clazz(Integer clazz){
+                this.clazz = clazz;
+                return this;
+            }
+            public QueryBuilder roomNum(String roomNum){
+                this.roomNum = roomNum;
+                return this;
+            }
+            public QueryBuilder roomNumType(Integer roomNumType){
+                this.roomNumType = roomNumType;
+                return this;
+            }
+            public QueryBuilder page(Integer page){
+                this.page = page;
+                return this;
+            }
+            public QueryBuilder pageSize(Integer pageSize){
+                this.pageSize = pageSize;
+                return this;
+            }
+
+            public Query build(){
+                Query param = new Query();
+                param.setAppId(appId);
+                param.setSchoolUid(schoolUid);
+                param.setDate(date);
+                param.setAttendType(attendType);
+                param.setClassUid(classUid);
+                param.setGrade(grade);
+                param.setClazz(clazz);
+                param.setRoomNum(roomNum);
+                param.setRoomNumType(roomNumType);
+                param.setPage(page);
+                param.setPageSize(pageSize);
+                return param;
+            }
+        }
+    }
+
+
+}

+ 35 - 0
src/main/java/com/template/model/pojo/AttendanceRuleListSchoolAttendRuleRequest.java

@@ -0,0 +1,35 @@
+package com.template.model.pojo;
+
+import java.util.*;
+import com.seewo.open.sdk.OpenApiParam;
+import com.seewo.open.sdk.OpenApiRequest;
+
+/**
+ * seewo-open API: 【事件|课程】分页查询学校考勤规则信息
+ *
+ *
+ * @author auto create
+ * @since 2.0.1 2023-12-19
+ */
+public class AttendanceRuleListSchoolAttendRuleRequest extends OpenApiRequest<AttendanceRuleListSchoolAttendRuleParam, AttendanceRuleListSchoolAttendRuleResult> {
+
+    public AttendanceRuleListSchoolAttendRuleRequest(AttendanceRuleListSchoolAttendRuleParam param) {
+        this();
+        setBizModel(param);
+    }
+
+    public AttendanceRuleListSchoolAttendRuleRequest() {
+        setServerUrl("https://openapi.seewo.com");
+        setPath("/seewo-yunban-api/attendance-rule/list-school-attend-rule");
+        setHttpMethod("POST");
+    }
+
+    public Class<AttendanceRuleListSchoolAttendRuleResult> getResponseClass() {
+        return AttendanceRuleListSchoolAttendRuleResult.class;
+    }
+
+    public Class<AttendanceRuleListSchoolAttendRuleParam> getDomainClass() {
+        return AttendanceRuleListSchoolAttendRuleParam.class;
+    }
+}
+

+ 218 - 0
src/main/java/com/template/model/pojo/AttendanceRuleListSchoolAttendRuleResult.java

@@ -0,0 +1,218 @@
+package com.template.model.pojo;
+
+import java.util.*;
+import com.seewo.open.sdk.OpenApiResult;
+import com.seewo.open.sdk.HttpResponse;
+
+/**
+ * seewo-open API: 【事件|课程】分页查询学校考勤规则信息
+ *
+ *
+ * @author auto create
+ * @since 2.0.1 2023-12-19
+ */
+public class AttendanceRuleListSchoolAttendRuleResult extends OpenApiResult {
+
+    public AttendanceRuleListSchoolAttendRuleResult(HttpResponse response) {
+        super(response);
+    }
+
+
+    /**
+     * 响应体,MimeType为 application/json
+     */
+
+    private ResponseBody responseBody;
+
+
+    public ResponseBody getResponseBody() {
+        return this.responseBody;
+    }
+
+    public void setResponseBody(ResponseBody responseBody) {
+        this.responseBody = responseBody;
+    }
+
+    public static class ResponseBody {
+        /**
+         * code
+         */
+        private String code;
+        /**
+         * message
+         */
+        private String message;
+        /**
+         * data
+         */
+        private Data data;
+
+        public String getCode() {
+            return this.code;
+        }
+
+        public void setCode(String code) {
+            this.code = code;
+        }
+
+        public String getMessage() {
+            return this.message;
+        }
+
+        public void setMessage(String message) {
+            this.message = message;
+        }
+
+        public Data getData() {
+            return this.data;
+        }
+
+        public void setData(Data data) {
+            this.data = data;
+        }
+
+    }
+
+    public static class Data {
+        /**
+         * 页号
+         */
+        private Integer page;
+        /**
+         * 每页大小
+         */
+        private Integer pageSize;
+        /**
+         * 数据总量
+         */
+        private Integer totalCount;
+        /**
+         * Result
+         */
+        private List<Result> result;
+
+        public Integer getPage() {
+            return this.page;
+        }
+
+        public void setPage(Integer page) {
+            this.page = page;
+        }
+
+        public Integer getPageSize() {
+            return this.pageSize;
+        }
+
+        public void setPageSize(Integer pageSize) {
+            this.pageSize = pageSize;
+        }
+
+        public Integer getTotalCount() {
+            return this.totalCount;
+        }
+
+        public void setTotalCount(Integer totalCount) {
+            this.totalCount = totalCount;
+        }
+
+        public List<Result> getResult() {
+            return this.result;
+        }
+
+        public void setResult(List<Result> result) {
+            this.result = result;
+        }
+
+    }
+
+    public static class Result {
+        /**
+         * 考勤规则id
+         */
+        private String ruleId;
+        /**
+         * 考勤名称
+         */
+        private String name;
+        /**
+         * 考勤类型    10-循环考勤、11-单次考勤、12-上学考勤、13-放学考勤、2-课程考勤
+         */
+        private Integer attendType;
+        /**
+         * 考勤日期
+         */
+        private String attendDate;
+        /**
+         * 考勤开始时间
+         */
+        private String attendStartTime;
+        /**
+         * 考勤迟到时间
+         */
+        private String attendLateTime;
+        /**
+         * 考勤结束时间
+         */
+        private String attendEndTime;
+
+        public String getRuleId() {
+            return this.ruleId;
+        }
+
+        public void setRuleId(String ruleId) {
+            this.ruleId = ruleId;
+        }
+
+        public String getName() {
+            return this.name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public Integer getAttendType() {
+            return this.attendType;
+        }
+
+        public void setAttendType(Integer attendType) {
+            this.attendType = attendType;
+        }
+
+        public String getAttendDate() {
+            return this.attendDate;
+        }
+
+        public void setAttendDate(String attendDate) {
+            this.attendDate = attendDate;
+        }
+
+        public String getAttendStartTime() {
+            return this.attendStartTime;
+        }
+
+        public void setAttendStartTime(String attendStartTime) {
+            this.attendStartTime = attendStartTime;
+        }
+
+        public String getAttendLateTime() {
+            return this.attendLateTime;
+        }
+
+        public void setAttendLateTime(String attendLateTime) {
+            this.attendLateTime = attendLateTime;
+        }
+
+        public String getAttendEndTime() {
+            return this.attendEndTime;
+        }
+
+        public void setAttendEndTime(String attendEndTime) {
+            this.attendEndTime = attendEndTime;
+        }
+
+    }
+
+
+}
+

+ 251 - 0
src/main/java/com/template/model/pojo/AttendanceServiceListAttendClassRecordsParam.java

@@ -0,0 +1,251 @@
+package com.template.model.pojo;
+
+import java.util.*;
+import com.seewo.open.sdk.OpenApiParam;
+import com.seewo.open.sdk.ParameterPosition;
+
+/**
+ * seewo-open API: 【事件|课程】根据规则指定日期与班级查询考勤记录
+ *
+ *
+ * @author auto create
+ * @since 2.0.1 2023-12-19
+ */
+public class AttendanceServiceListAttendClassRecordsParam extends OpenApiParam {
+
+
+    /**
+     * 响应体,MimeType为 application/json
+     */
+
+    private RequestBody requestBody;
+
+
+    public RequestBody getRequestBody() {
+        return this.requestBody;
+    }
+
+    public void setRequestBody(RequestBody requestBody) {
+        this.requestBody = requestBody;
+    }
+
+    public static AttendanceServiceListAttendClassRecordsParamBuilder builder(){
+        return new AttendanceServiceListAttendClassRecordsParamBuilder();
+    }
+
+    public static class AttendanceServiceListAttendClassRecordsParamBuilder{
+        private RequestBody requestBody;
+
+        public AttendanceServiceListAttendClassRecordsParamBuilder requestBody(RequestBody requestBody){
+            this.requestBody = requestBody;
+            return this;
+        }
+
+        public AttendanceServiceListAttendClassRecordsParam build(){
+            AttendanceServiceListAttendClassRecordsParam param = new AttendanceServiceListAttendClassRecordsParam();
+            param.setRequestBody(requestBody);
+            return param;
+        }
+    }
+
+    public static class RequestBody {
+        /**
+         * query
+         */
+        private Query query;
+
+        public Query getQuery() {
+            return this.query;
+        }
+
+        public void setQuery(Query query) {
+            this.query = query;
+        }
+
+
+        public static RequestBodyBuilder builder(){
+            return new RequestBodyBuilder();
+        }
+
+        public static class RequestBodyBuilder{
+            private Query query;
+
+            public RequestBodyBuilder query(Query query){
+                this.query = query;
+                return this;
+            }
+
+            public RequestBody build(){
+                RequestBody param = new RequestBody();
+                param.setQuery(query);
+                return param;
+            }
+        }
+    }
+
+    public static class Query {
+        /**
+         * 考勤事件ID
+         */
+        private String eventId;
+        /**
+         * 考勤日期
+         */
+        private String attendDate;
+        /**
+         * appId
+         */
+        private String appId;
+        /**
+         * 年级序号
+         */
+        private Integer grade;
+        /**
+         * 班级uid
+班级uid与年级序号、班级序号二选一确定具体的班级,如果都填以classUid为准
+         */
+        private String classUid;
+        /**
+         * 班级序号
+         */
+        private Integer clazz;
+        /**
+         * 学校uid
+         */
+        private String schoolUid;
+        /**
+         * 考勤类型
+1 - 事件考勤(默认)
+2 - 课程考勤
+         */
+        private Integer attendType;
+
+        public String getEventId() {
+            return this.eventId;
+        }
+
+        public void setEventId(String eventId) {
+            this.eventId = eventId;
+        }
+
+        public String getAttendDate() {
+            return this.attendDate;
+        }
+
+        public void setAttendDate(String attendDate) {
+            this.attendDate = attendDate;
+        }
+
+        public String getAppId() {
+            return this.appId;
+        }
+
+        public void setAppId(String appId) {
+            this.appId = appId;
+        }
+
+        public Integer getGrade() {
+            return this.grade;
+        }
+
+        public void setGrade(Integer grade) {
+            this.grade = grade;
+        }
+
+        public String getClassUid() {
+            return this.classUid;
+        }
+
+        public void setClassUid(String classUid) {
+            this.classUid = classUid;
+        }
+
+        public Integer getClazz() {
+            return this.clazz;
+        }
+
+        public void setClazz(Integer clazz) {
+            this.clazz = clazz;
+        }
+
+        public String getSchoolUid() {
+            return this.schoolUid;
+        }
+
+        public void setSchoolUid(String schoolUid) {
+            this.schoolUid = schoolUid;
+        }
+
+        public Integer getAttendType() {
+            return this.attendType;
+        }
+
+        public void setAttendType(Integer attendType) {
+            this.attendType = attendType;
+        }
+
+
+        public static QueryBuilder builder(){
+            return new QueryBuilder();
+        }
+
+        public static class QueryBuilder{
+            private String eventId;
+            private String attendDate;
+            private String appId;
+            private Integer grade;
+            private String classUid;
+            private Integer clazz;
+            private String schoolUid;
+            private Integer attendType;
+
+            public QueryBuilder eventId(String eventId){
+                this.eventId = eventId;
+                return this;
+            }
+            public QueryBuilder attendDate(String attendDate){
+                this.attendDate = attendDate;
+                return this;
+            }
+            public QueryBuilder appId(String appId){
+                this.appId = appId;
+                return this;
+            }
+            public QueryBuilder grade(Integer grade){
+                this.grade = grade;
+                return this;
+            }
+            public QueryBuilder classUid(String classUid){
+                this.classUid = classUid;
+                return this;
+            }
+            public QueryBuilder clazz(Integer clazz){
+                this.clazz = clazz;
+                return this;
+            }
+            public QueryBuilder schoolUid(String schoolUid){
+                this.schoolUid = schoolUid;
+                return this;
+            }
+            public QueryBuilder attendType(Integer attendType){
+                this.attendType = attendType;
+                return this;
+            }
+
+            public Query build(){
+                Query param = new Query();
+                param.setEventId(eventId);
+                param.setAttendDate(attendDate);
+                param.setAppId(appId);
+                param.setGrade(grade);
+                param.setClassUid(classUid);
+                param.setClazz(clazz);
+                param.setSchoolUid(schoolUid);
+                param.setAttendType(attendType);
+                return param;
+            }
+        }
+    }
+
+
+}

+ 35 - 0
src/main/java/com/template/model/pojo/AttendanceServiceListAttendClassRecordsRequest.java

@@ -0,0 +1,35 @@
+package com.template.model.pojo;
+
+import java.util.*;
+import com.seewo.open.sdk.OpenApiParam;
+import com.seewo.open.sdk.OpenApiRequest;
+
+/**
+ * seewo-open API: 【事件|课程】根据规则指定日期与班级查询考勤记录
+ *
+ *
+ * @author auto create
+ * @since 2.0.1 2023-12-19
+ */
+public class AttendanceServiceListAttendClassRecordsRequest extends OpenApiRequest<AttendanceServiceListAttendClassRecordsParam, AttendanceServiceListAttendClassRecordsResult> {
+
+    public AttendanceServiceListAttendClassRecordsRequest(AttendanceServiceListAttendClassRecordsParam param) {
+        this();
+        setBizModel(param);
+    }
+
+    public AttendanceServiceListAttendClassRecordsRequest() {
+        setServerUrl("https://openapi.seewo.com");
+        setPath("/seewo-yunban-api/attendance-service/list-attend-class-records");
+        setHttpMethod("POST");
+    }
+
+    public Class<AttendanceServiceListAttendClassRecordsResult> getResponseClass() {
+        return AttendanceServiceListAttendClassRecordsResult.class;
+    }
+
+    public Class<AttendanceServiceListAttendClassRecordsParam> getDomainClass() {
+        return AttendanceServiceListAttendClassRecordsParam.class;
+    }
+}
+

+ 182 - 0
src/main/java/com/template/model/pojo/AttendanceServiceListAttendClassRecordsResult.java

@@ -0,0 +1,182 @@
+package com.template.model.pojo;
+
+import java.util.*;
+import com.seewo.open.sdk.OpenApiResult;
+import com.seewo.open.sdk.HttpResponse;
+
+/**
+ * seewo-open API: 【事件|课程】根据规则指定日期与班级查询考勤记录
+ *
+ *
+ * @author auto create
+ * @since 2.0.1 2023-12-19
+ */
+public class AttendanceServiceListAttendClassRecordsResult extends OpenApiResult {
+
+    public AttendanceServiceListAttendClassRecordsResult(HttpResponse response) {
+        super(response);
+    }
+
+
+    /**
+     * 响应体,MimeType为 application/json
+     */
+
+    private ResponseBody responseBody;
+
+
+    public ResponseBody getResponseBody() {
+        return this.responseBody;
+    }
+
+    public void setResponseBody(ResponseBody responseBody) {
+        this.responseBody = responseBody;
+    }
+
+    public static class ResponseBody {
+        /**
+         * code
+         */
+        private String code;
+        /**
+         * message
+         */
+        private String message;
+        /**
+         * data
+         */
+        private Data data;
+
+        public String getCode() {
+            return this.code;
+        }
+
+        public void setCode(String code) {
+            this.code = code;
+        }
+
+        public String getMessage() {
+            return this.message;
+        }
+
+        public void setMessage(String message) {
+            this.message = message;
+        }
+
+        public Data getData() {
+            return this.data;
+        }
+
+        public void setData(Data data) {
+            this.data = data;
+        }
+
+    }
+
+    public static class Data {
+        /**
+         * classUid
+         */
+        private String classUid;
+        /**
+         * className
+         */
+        private String className;
+        /**
+         * records
+         */
+        private List<RecordsItem> records;
+
+        public String getClassUid() {
+            return this.classUid;
+        }
+
+        public void setClassUid(String classUid) {
+            this.classUid = classUid;
+        }
+
+        public String getClassName() {
+            return this.className;
+        }
+
+        public void setClassName(String className) {
+            this.className = className;
+        }
+
+        public List<RecordsItem> getRecords() {
+            return this.records;
+        }
+
+        public void setRecords(List<RecordsItem> records) {
+            this.records = records;
+        }
+
+    }
+
+    public static class RecordsItem {
+        /**
+         * userUid
+         */
+        private String userUid;
+        /**
+         * userName
+         */
+        private String userName;
+        /**
+         * studentCode
+         */
+        private String studentCode;
+        /**
+         * attendTime
+         */
+        private String attendTime;
+        /**
+         * status
+         */
+        private Integer status;
+
+        public String getUserUid() {
+            return this.userUid;
+        }
+
+        public void setUserUid(String userUid) {
+            this.userUid = userUid;
+        }
+
+        public String getUserName() {
+            return this.userName;
+        }
+
+        public void setUserName(String userName) {
+            this.userName = userName;
+        }
+
+        public String getStudentCode() {
+            return this.studentCode;
+        }
+
+        public void setStudentCode(String studentCode) {
+            this.studentCode = studentCode;
+        }
+
+        public String getAttendTime() {
+            return this.attendTime;
+        }
+
+        public void setAttendTime(String attendTime) {
+            this.attendTime = attendTime;
+        }
+
+        public Integer getStatus() {
+            return this.status;
+        }
+
+        public void setStatus(Integer status) {
+            this.status = status;
+        }
+
+    }
+
+
+}
+

+ 121 - 0
src/main/java/com/template/model/pojo/OrgClassOpenSeewoUcOpenV1ClassFullParam.java

@@ -0,0 +1,121 @@
+package com.template.model.pojo;
+
+import com.seewo.open.sdk.OpenApiParam;
+
+/**
+ * seewo-open API: 全量班级信息
+ * 全量班级信息
+ *
+ * @author auto create
+ * @since 2.0.1 2023-12-25
+ */
+public class OrgClassOpenSeewoUcOpenV1ClassFullParam extends OpenApiParam {
+
+
+    /**
+     * 请求体,MimeType为 application/json
+     */
+
+    private JSONRequestBody requestBody;
+
+
+    public JSONRequestBody getRequestBody() {
+        return this.requestBody;
+    }
+
+    public void setRequestBody(JSONRequestBody requestBody) {
+        this.requestBody = requestBody;
+    }
+
+    public static OrgClassOpenSeewoUcOpenV1ClassFullParamBuilder builder(){
+        return new OrgClassOpenSeewoUcOpenV1ClassFullParamBuilder();
+    }
+
+    public static class OrgClassOpenSeewoUcOpenV1ClassFullParamBuilder{
+        private JSONRequestBody requestBody;
+
+        public OrgClassOpenSeewoUcOpenV1ClassFullParamBuilder requestBody(JSONRequestBody requestBody){
+            this.requestBody = requestBody;
+            return this;
+        }
+
+        public OrgClassOpenSeewoUcOpenV1ClassFullParam build(){
+            OrgClassOpenSeewoUcOpenV1ClassFullParam param = new OrgClassOpenSeewoUcOpenV1ClassFullParam();
+            param.setRequestBody(requestBody);
+            return param;
+        }
+    }
+
+    public static class JSONRequestBody {
+        /**
+         * 学校uid
+         */
+        private String schoolUid;
+        /**
+         * 页码,默认1
+         */
+        private Integer pageNo;
+        /**
+         * 页大小,默认300
+         */
+        private Integer pageSize;
+
+        public String getSchoolUid() {
+            return this.schoolUid;
+        }
+
+        public void setSchoolUid(String schoolUid) {
+            this.schoolUid = schoolUid;
+        }
+
+        public Integer getPageNo() {
+            return this.pageNo;
+        }
+
+        public void setPageNo(Integer pageNo) {
+            this.pageNo = pageNo;
+        }
+
+        public Integer getPageSize() {
+            return this.pageSize;
+        }
+
+        public void setPageSize(Integer pageSize) {
+            this.pageSize = pageSize;
+        }
+
+
+        public static JSONRequestBodyBuilder builder(){
+            return new JSONRequestBodyBuilder();
+        }
+
+        public static class JSONRequestBodyBuilder{
+            private String schoolUid;
+            private Integer pageNo;
+            private Integer pageSize;
+
+            public JSONRequestBodyBuilder schoolUid(String schoolUid){
+                this.schoolUid = schoolUid;
+                return this;
+            }
+            public JSONRequestBodyBuilder pageNo(Integer pageNo){
+                this.pageNo = pageNo;
+                return this;
+            }
+            public JSONRequestBodyBuilder pageSize(Integer pageSize){
+                this.pageSize = pageSize;
+                return this;
+            }
+
+            public JSONRequestBody build(){
+                JSONRequestBody param = new JSONRequestBody();
+                param.setSchoolUid(schoolUid);
+                param.setPageNo(pageNo);
+                param.setPageSize(pageSize);
+                return param;
+            }
+        }
+    }
+
+
+}

+ 35 - 0
src/main/java/com/template/model/pojo/OrgClassOpenSeewoUcOpenV1ClassFullRequest.java

@@ -0,0 +1,35 @@
+package com.template.model.pojo;
+
+import java.util.*;
+import com.seewo.open.sdk.OpenApiParam;
+import com.seewo.open.sdk.OpenApiRequest;
+
+/**
+ * seewo-open API: 全量班级信息
+ * 全量班级信息
+ *
+ * @author auto create
+ * @since 2.0.1 2023-12-25
+ */
+public class OrgClassOpenSeewoUcOpenV1ClassFullRequest extends OpenApiRequest<OrgClassOpenSeewoUcOpenV1ClassFullParam, OrgClassOpenSeewoUcOpenV1ClassFullResult> {
+
+    public OrgClassOpenSeewoUcOpenV1ClassFullRequest(OrgClassOpenSeewoUcOpenV1ClassFullParam param) {
+        this();
+        setBizModel(param);
+    }
+
+    public OrgClassOpenSeewoUcOpenV1ClassFullRequest() {
+        setServerUrl("https://openapi.seewo.com");
+        setPath("/organization/org-class-open/seewo/uc/open/v1/class/full");
+        setHttpMethod("POST");
+    }
+
+    public Class<OrgClassOpenSeewoUcOpenV1ClassFullResult> getResponseClass() {
+        return OrgClassOpenSeewoUcOpenV1ClassFullResult.class;
+    }
+
+    public Class<OrgClassOpenSeewoUcOpenV1ClassFullParam> getDomainClass() {
+        return OrgClassOpenSeewoUcOpenV1ClassFullParam.class;
+    }
+}
+

+ 126 - 0
src/main/java/com/template/model/pojo/OrgClassOpenSeewoUcOpenV1ClassFullResult.java

@@ -0,0 +1,126 @@
+package com.template.model.pojo;
+
+import java.util.*;
+import com.seewo.open.sdk.OpenApiResult;
+import com.seewo.open.sdk.HttpResponse;
+
+/**
+ * seewo-open API: 全量班级信息
+ * 全量班级信息
+ *
+ * @author auto create
+ * @since 2.0.1 2023-12-25
+ */
+public class OrgClassOpenSeewoUcOpenV1ClassFullResult extends OpenApiResult {
+
+    public OrgClassOpenSeewoUcOpenV1ClassFullResult(HttpResponse response) {
+        super(response);
+    }
+
+
+    /**
+     * 响应体,MimeType为 application/json
+     */
+
+    private JSONResponseBody responseBody;
+
+
+    public JSONResponseBody getResponseBody() {
+        return this.responseBody;
+    }
+
+    public void setResponseBody(JSONResponseBody responseBody) {
+        this.responseBody = responseBody;
+    }
+
+    public static class JSONResponseBody {
+        /**
+         * 班级uid
+         */
+        private String classUid;
+        /**
+         * 班级名称
+         */
+        private String className;
+        /**
+         * 班级类型,1-行政班/2-教学班
+         */
+        private Integer classType;
+        /**
+         * 年级,如9(九年级)
+         */
+        private Integer classGrade;
+        /**
+         * 学段,如CodeSchoolStage_0(小学)
+         */
+        private String stage;
+        /**
+         * 班级,如高(一)1班中的1
+         */
+        private Integer classNum;
+        /**
+         * 第几界班级
+         */
+        private Integer gradeYear;
+
+        public String getClassUid() {
+            return this.classUid;
+        }
+
+        public void setClassUid(String classUid) {
+            this.classUid = classUid;
+        }
+
+        public String getClassName() {
+            return this.className;
+        }
+
+        public void setClassName(String className) {
+            this.className = className;
+        }
+
+        public Integer getClassType() {
+            return this.classType;
+        }
+
+        public void setClassType(Integer classType) {
+            this.classType = classType;
+        }
+
+        public Integer getClassGrade() {
+            return this.classGrade;
+        }
+
+        public void setClassGrade(Integer classGrade) {
+            this.classGrade = classGrade;
+        }
+
+        public String getStage() {
+            return this.stage;
+        }
+
+        public void setStage(String stage) {
+            this.stage = stage;
+        }
+
+        public Integer getClassNum() {
+            return this.classNum;
+        }
+
+        public void setClassNum(Integer classNum) {
+            this.classNum = classNum;
+        }
+
+        public Integer getGradeYear() {
+            return this.gradeYear;
+        }
+
+        public void setGradeYear(Integer gradeYear) {
+            this.gradeYear = gradeYear;
+        }
+
+    }
+
+
+}
+

+ 71 - 0
src/main/java/com/template/model/pojo/SmartAttendance.java

@@ -0,0 +1,71 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 楼栋表
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="SmartAttendance对象", description="楼栋表")
+public class SmartAttendance implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键ID")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "用户ID")
+    private Integer userId;
+
+    @ApiModelProperty(value = "班级ID")
+    private Integer classId;
+
+    @ApiModelProperty(value = "签到时间")
+    private Date attendTime;
+
+    @ApiModelProperty(value = "考勤状态 准时:0 迟到:1 缺卡:3 请假:6 超时打卡:7")
+    private Integer status;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleted;
+
+
+}

+ 0 - 2
src/main/java/com/template/model/pojo/SmartAuthorGroup.java

@@ -59,8 +59,6 @@ public class SmartAuthorGroup implements Serializable {
     private String updateUser;
     private String updateUser;
 
 
     @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
     @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
-    @TableField(fill = FieldFill.INSERT)
-    @TableLogic
     private Integer deleted;
     private Integer deleted;
 
 
 
 

+ 0 - 2
src/main/java/com/template/model/pojo/SmartAuthority.java

@@ -63,8 +63,6 @@ public class SmartAuthority implements Serializable {
     private String updateUser;
     private String updateUser;
 
 
     @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
     @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
-    @TableField(fill = FieldFill.INSERT)
-    @TableLogic
     private Integer deleted;
     private Integer deleted;
 
 
 
 

+ 71 - 0
src/main/java/com/template/model/pojo/SmartClass.java

@@ -0,0 +1,71 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 楼栋表
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="SmartClass对象", description="楼栋表")
+public class SmartClass implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键ID")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "年级ID")
+    private Integer gradeId;
+
+    @ApiModelProperty(value = "班级uid")
+    private String classUid;
+
+    @ApiModelProperty(value = "班级名称")
+    private String name;
+
+    @ApiModelProperty(value = "班级序号")
+    private Integer classNo;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleted;
+
+
+}

+ 65 - 0
src/main/java/com/template/model/pojo/SmartGrade.java

@@ -0,0 +1,65 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 楼栋表
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="SmartGrade对象", description="楼栋表")
+public class SmartGrade implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键ID")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "年级名称")
+    private String name;
+
+    @ApiModelProperty(value = "年级序号")
+    private Integer gradeNo;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleted;
+
+
+}

+ 30 - 0
src/main/java/com/template/model/request/insertDepartmentRequest.java

@@ -0,0 +1,30 @@
+package com.template.model.request;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-04
+ */
+@Data
+public class insertDepartmentRequest {
+
+    /**
+     * 父级ID
+     */
+    @NotNull(message = "父级ID不能为空")
+    private Integer parentId;
+
+    /**
+     * 部门名称
+     */
+    @NotBlank(message = "部门名称不能为空")
+    private String name;
+}

+ 35 - 0
src/main/java/com/template/model/request/updateDepartmentRequest.java

@@ -0,0 +1,35 @@
+package com.template.model.request;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/7 星期五 14:27
+ * @Description: com.repair.model.request
+ * @Version: 1.0
+ */
+@Data
+public class updateDepartmentRequest {
+    /**
+     * 数据ID
+     */
+    @NotNull(message = "数据ID不能为空")
+    private Integer id;
+
+    /**
+     * 父级ID
+     */
+    @NotNull(message = "父级ID不能为空")
+    private Integer parentId;
+
+    /**
+     * 部门名称
+     */
+    @NotBlank(message = "部门名称不能为空")
+    private String name;
+}

+ 14 - 0
src/main/java/com/template/model/tongji/All.java

@@ -0,0 +1,14 @@
+package com.template.model.tongji;
+
+public class All {
+
+    public Integer total;
+
+    public Integer getTotal() {
+        return total;
+    }
+
+    public void setTotal(Integer total) {
+        this.total = total;
+    }
+}

+ 16 - 0
src/main/java/com/template/model/tongji/DAll.java

@@ -0,0 +1,16 @@
+package com.template.model.tongji;
+
+import com.template.common.utils.DataBliu;
+
+public class DAll {
+
+    public Double num;
+
+    public Double getNum() {
+        return DataBliu.getTwo(num);
+    }
+
+    public void setNum(Double num) {
+        this.num = num;
+    }
+}

+ 41 - 0
src/main/java/com/template/model/tongji/DayMeterDetail.java

@@ -0,0 +1,41 @@
+package com.template.model.tongji;
+
+public class DayMeterDetail {
+
+    public Integer id;
+    public String meterName;
+    public String meterDate;
+    public String meterPower;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getMeterName() {
+        return meterName;
+    }
+
+    public void setMeterName(String meterName) {
+        this.meterName = meterName;
+    }
+
+    public String getMeterDate() {
+        return meterDate;
+    }
+
+    public void setMeterDate(String meterDate) {
+        this.meterDate = meterDate;
+    }
+
+    public String getMeterPower() {
+        return meterPower;
+    }
+
+    public void setMeterPower(String meterPower) {
+        this.meterPower = meterPower;
+    }
+}

+ 53 - 0
src/main/java/com/template/model/tongji/EnergyTj.java

@@ -0,0 +1,53 @@
+package com.template.model.tongji;
+
+import com.template.common.utils.DataBliu;
+
+public class EnergyTj {
+
+    public Integer id;
+    public String name;
+    public Integer type;
+    public String date;
+    public Double num;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public Double getNum() {
+        return DataBliu.getTwo(num);
+    }
+
+    public void setNum(Double num) {
+        this.num = num;
+    }
+
+}

+ 50 - 0
src/main/java/com/template/model/tongji/MeterMonthData.java

@@ -0,0 +1,50 @@
+package com.template.model.tongji;
+
+public class MeterMonthData {
+
+    public Integer id;
+    public String name;
+    public String date;
+    public Double wNum;
+    public Double eNum;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public Double getwNum() {
+        return wNum;
+    }
+
+    public void setwNum(Double wNum) {
+        this.wNum = wNum;
+    }
+
+    public Double geteNum() {
+        return eNum;
+    }
+
+    public void seteNum(Double eNum) {
+        this.eNum = eNum;
+    }
+}

+ 25 - 0
src/main/java/com/template/model/tongji/MonthMeterDetail.java

@@ -0,0 +1,25 @@
+package com.template.model.tongji;
+
+import java.util.List;
+
+public class MonthMeterDetail {
+
+    public String date;
+    public List<Tj> lt;
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public List<Tj> getLt() {
+        return lt;
+    }
+
+    public void setLt(List<Tj> lt) {
+        this.lt = lt;
+    }
+}

+ 24 - 0
src/main/java/com/template/model/tongji/Tj.java

@@ -0,0 +1,24 @@
+package com.template.model.tongji;
+
+public class Tj {
+
+    public String name;
+    public Integer num;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getNum() {
+        return num;
+    }
+
+    public void setNum(Integer num) {
+        this.num = num;
+    }
+
+}

+ 38 - 0
src/main/java/com/template/model/vo/DepartmentTreeVo.java

@@ -0,0 +1,38 @@
+package com.template.model.vo;
+
+import lombok.*;
+
+import java.util.List;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/12/14 星期四 9:20
+ * @Description: com.template.model.vo
+ * @Version: 1.0
+ */
+@Data
+@Builder
+@ToString
+@AllArgsConstructor
+@NoArgsConstructor
+public class DepartmentTreeVo {
+    /**
+     * 数据ID
+     */
+    private int id;
+
+    /**
+     * 父级ID
+     */
+    private int parentId;
+
+    /**
+     * 部门名称
+     */
+    private String name;
+
+    /**
+     * 子级部门
+     */
+    private List<DepartmentTreeVo> children;
+}

+ 17 - 0
src/main/java/com/template/model/vo/VisitorCountVo.java

@@ -0,0 +1,17 @@
+package com.template.model.vo;
+
+import lombok.Data;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/12/4 星期一 15:57
+ * @Description: com.template.model.vo
+ * @Version: 1.0
+ */
+@Data
+public class VisitorCountVo {
+    /**
+     * 条数
+     */
+    private Integer visitorCount;
+}

+ 89 - 0
src/main/java/com/template/model/weixin/AccessToken.java

@@ -0,0 +1,89 @@
+package com.template.model.weixin;
+
+/**
+ * <p>Title: AccessToken</p>
+ * <p>Description: 通过code获取access_token</p>
+ * @author fengyong
+ * @date 2018年9月4日
+ */
+public class AccessToken {
+	
+	/**
+	 * 接口调用凭证
+	 */
+	private String access_token;
+	
+	/**
+	 * access_token接口调用凭证超时时间,单位(秒)
+	 */
+	private Integer expires_in;
+	
+	/**
+	 * 用户刷新access_token
+	 */
+	private String refresh_token;
+	
+	/**
+	 * 授权用户唯一标识
+	 */
+	private String openid;
+	
+	/**
+	 * 用户授权的作用域,使用逗号(,)分隔
+	 */
+	private String scope;
+	
+	/**
+	 * 当且仅当该网站应用已获得该用户的userinfo授权时,才会出现该字段。
+	 */
+	private String unionid;
+
+	public String getAccess_token() {
+		return access_token;
+	}
+
+	public void setAccess_token(String access_token) {
+		this.access_token = access_token;
+	}
+
+	public Integer getExpires_in() {
+		return expires_in;
+	}
+
+	public void setExpires_in(Integer expires_in) {
+		this.expires_in = expires_in;
+	}
+
+	public String getRefresh_token() {
+		return refresh_token;
+	}
+
+	public void setRefresh_token(String refresh_token) {
+		this.refresh_token = refresh_token;
+	}
+
+	public String getOpenid() {
+		return openid;
+	}
+
+	public void setOpenid(String openid) {
+		this.openid = openid;
+	}
+
+	public String getScope() {
+		return scope;
+	}
+
+	public void setScope(String scope) {
+		this.scope = scope;
+	}
+
+	public String getUnionid() {
+		return unionid;
+	}
+
+	public void setUnionid(String unionid) {
+		this.unionid = unionid;
+	}
+
+}

+ 36 - 0
src/main/java/com/template/model/weixin/AuthorAndGroup.java

@@ -0,0 +1,36 @@
+package com.template.model.weixin;
+
+import com.template.model.pojo.SmartAuthorGroup;
+
+import java.util.Date;
+
+public class AuthorAndGroup {
+
+    public SmartAuthorGroup smartAuthorGroup;
+    public String department_view;
+    public String department_manage;
+
+    public SmartAuthorGroup getSmartAuthorGroup() {
+        return smartAuthorGroup;
+    }
+
+    public void setSmartAuthorGroup(SmartAuthorGroup smartAuthorGroup) {
+        this.smartAuthorGroup = smartAuthorGroup;
+    }
+
+    public String getDepartment_view() {
+        return department_view;
+    }
+
+    public void setDepartment_view(String department_view) {
+        this.department_view = department_view;
+    }
+
+    public String getDepartment_manage() {
+        return department_manage;
+    }
+
+    public void setDepartment_manage(String department_manage) {
+        this.department_manage = department_manage;
+    }
+}

+ 27 - 0
src/main/java/com/template/model/weixin/AuthorAndGroup2.java

@@ -0,0 +1,27 @@
+package com.template.model.weixin;
+
+import com.template.model.pojo.SmartAuthorGroup;
+
+import java.util.List;
+
+public class AuthorAndGroup2 {
+
+    public SmartAuthorGroup smartAuthorGroup;
+    public List<userAuthor> userAuthors;
+
+    public SmartAuthorGroup getSmartAuthorGroup() {
+        return smartAuthorGroup;
+    }
+
+    public void setSmartAuthorGroup(SmartAuthorGroup smartAuthorGroup) {
+        this.smartAuthorGroup = smartAuthorGroup;
+    }
+
+    public List<userAuthor> getUserAuthors() {
+        return userAuthors;
+    }
+
+    public void setUserAuthors(List<userAuthor> userAuthors) {
+        this.userAuthors = userAuthors;
+    }
+}

+ 101 - 0
src/main/java/com/template/model/weixin/AuthorListGroup.java

@@ -0,0 +1,101 @@
+package com.template.model.weixin;
+
+import lombok.Builder;
+
+import java.util.Date;
+import java.util.List;
+
+@Builder
+public class AuthorListGroup {
+
+    public Integer id;
+    public Integer parentId;
+    public String name;
+    public String userId;
+    public String applyId;
+    public Date updateTime;
+    public String createUser;
+    public String updateUser;
+    public Integer deleted;
+    public List<AuthorListGroup> authorListGroups;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getApplyId() {
+        return applyId;
+    }
+
+    public void setApplyId(String applyId) {
+        this.applyId = applyId;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getCreateUser() {
+        return createUser;
+    }
+
+    public void setCreateUser(String createUser) {
+        this.createUser = createUser;
+    }
+
+    public String getUpdateUser() {
+        return updateUser;
+    }
+
+    public void setUpdateUser(String updateUser) {
+        this.updateUser = updateUser;
+    }
+
+    public Integer getDeleted() {
+        return deleted;
+    }
+
+    public void setDeleted(Integer deleted) {
+        this.deleted = deleted;
+    }
+
+    public List<AuthorListGroup> getAuthorListGroups() {
+        return authorListGroups;
+    }
+
+    public void setAuthorListGroups(List<AuthorListGroup> authorListGroups) {
+        this.authorListGroups = authorListGroups;
+    }
+}

+ 43 - 0
src/main/java/com/template/model/weixin/HttpParame.java

@@ -0,0 +1,43 @@
+package com.template.model.weixin;
+
+/**
+ * Title: HttpParame Description: 请求参数
+ * @author fengyong
+ * @date 2018年9月3日
+ */
+public class HttpParame {
+
+	// 应用唯一标识
+	public static final String APPID = "appid";
+
+	// 密匙
+	public static final String SECRET = "secret";
+
+	// 微信用户唯一标识
+	public static final String OPENID = "openid";
+
+	// 接口调用凭证
+	public static final String ACCESS_TOKEN = "access_token";
+
+	// 回调地址
+	public static final String REDIRECT_URI = "redirect_uri";
+
+	// 回调地址
+	public static final String BIND_URI = "bind_uri";
+
+	// 前端地址
+	public static final String FRONT_URI = "https://www.campussmartlife.com/smartManage";
+
+	// 网页授权回调地址
+	public static final String AUTHORIZATION_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";
+
+	// 网页授权绑定地址
+	public static final String BIND_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";
+
+	// 通过code获取access_token
+	public static final String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
+
+	// 此接口用于获取用户个人信息 UnionID机制
+	public static final String GET_UNIONID_URL = "https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID";
+
+}

+ 65 - 0
src/main/java/com/template/model/weixin/Result.java

@@ -0,0 +1,65 @@
+package com.template.model.weixin;
+
+/**
+ * Title: Result
+ * Description: 返回结果包装对象使用
+ * @author fengyong
+ * @date 2018年9月5日
+ */
+public class Result {
+	/**
+	 * 状态
+	 */
+	private Object status;
+	/**
+	 * 结果
+	 */
+	private Object result;
+	/**
+	 * 消息
+	 */
+	private String message;
+
+	public Result() {
+	}
+
+	public Result(Object status, String message) {
+		this.status = status;
+		this.message = message;
+	}
+
+	public Result(Object status, Object result) {
+		this.status = status;
+		this.result = result;
+	}
+
+	public Result(Object status, Object result, String message) {
+		this.status = status;
+		this.result = result;
+		this.message = message;
+	}
+
+	public Object getStatus() {
+		return status;
+	}
+
+	public void setStatus(Object status) {
+		this.status = status;
+	}
+
+	public Object getResult() {
+		return result;
+	}
+
+	public void setResult(Object result) {
+		this.result = result;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+	public void setMessage(String message) {
+		this.message = message;
+	}
+}

+ 135 - 0
src/main/java/com/template/model/weixin/WechatUserUnionID.java

@@ -0,0 +1,135 @@
+package com.template.model.weixin;
+
+import java.util.List;
+
+/**
+ * Title: WechatUserUnionID
+ * Description: 获取用户个人信息(UnionID机制)
+ * @author fengyong
+ * @date 2018年9月5日
+ */
+public class WechatUserUnionID {
+
+	/**
+	 * 普通用户的标识,对当前开发者帐号唯一
+	 */
+	private String openid;
+
+	/**
+	 * 普通用户昵称
+	 */
+	private String nickname;
+
+	/**
+	 * 普通用户性别,1为男性,2为女性
+	 */
+	private Integer sex;
+
+	/**
+	 * 普通用户个人资料填写的省份
+	 */
+	private String province;
+
+	/**
+	 * 普通用户个人资料填写的城市
+	 */
+	private String city;
+
+	/**
+	 * 国家,如中国为CN
+	 */
+	private String country;
+
+	/**
+	 * 用户头像,最后一个数值代表正方形头像大小 (有0、46、64、96、132数值可选,0代表640*640正方形头像) 用户没有头像时该项为空
+	 */
+	private String headimgurl;
+
+	/**
+	 * 用户特权信息,json数组,如微信沃卡用户为(chinaunicom)
+	 */
+	private List<String> privilege;
+
+	/**
+	 * 用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的。
+	 */
+	private String unionid;
+
+	public String getOpenid() {
+		return openid;
+	}
+
+	public void setOpenid(String openid) {
+		this.openid = openid;
+	}
+
+	public String getNickname() {
+		return nickname;
+	}
+
+	public void setNickname(String nickname) {
+		this.nickname = nickname;
+	}
+
+	public Integer getSex() {
+		return sex;
+	}
+
+	public void setSex(Integer sex) {
+		this.sex = sex;
+	}
+	
+	public String getSexStr(){
+		if (getSex() != null) return getSex() == 1 ? "男" : "女";
+		return "";
+	}
+
+	public String getProvince() {
+		return province;
+	}
+
+	public void setProvince(String province) {
+		this.province = province;
+	}
+
+	public String getCity() {
+		return city;
+	}
+
+	public void setCity(String city) {
+		this.city = city;
+	}
+
+	public String getCountry() {
+		return country;
+	}
+
+	public void setCountry(String country) {
+		this.country = country;
+	}
+
+	public String getHeadimgurl() {
+		return headimgurl;
+	}
+
+	public void setHeadimgurl(String headimgurl) {
+		this.headimgurl = headimgurl;
+	}
+
+	public List<String> getPrivilege() {
+		return privilege;
+	}
+
+	public void setPrivilege(List<String> privilege) {
+		this.privilege = privilege;
+	}
+
+	public String getUnionid() {
+		return unionid;
+	}
+
+	public void setUnionid(String unionid) {
+		this.unionid = unionid;
+	}
+
+}

+ 42 - 0
src/main/java/com/template/model/weixin/userAuthor.java

@@ -0,0 +1,42 @@
+package com.template.model.weixin;
+
+public class userAuthor {
+
+    public Integer userId;
+    public String department_view;
+    public String department_manage;
+    public Integer deleted;
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public String getDepartment_view() {
+        return department_view;
+    }
+
+    public void setDepartment_view(String department_view) {
+        this.department_view = department_view;
+    }
+
+    public String getDepartment_manage() {
+        return department_manage;
+    }
+
+    public void setDepartment_manage(String department_manage) {
+        this.department_manage = department_manage;
+    }
+
+    public Integer getDeleted() {
+        return deleted;
+    }
+
+    public void setDeleted(Integer deleted) {
+        this.deleted = deleted;
+    }
+
+}

+ 16 - 0
src/main/java/com/template/services/SmartAttendanceService.java

@@ -0,0 +1,16 @@
+package com.template.services;
+
+import com.template.model.pojo.SmartAttendance;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 楼栋表 服务类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+public interface SmartAttendanceService extends IService<SmartAttendance> {
+
+}

+ 7 - 0
src/main/java/com/template/services/SmartAuthorGroupService.java

@@ -1,10 +1,13 @@
 package com.template.services;
 package com.template.services;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
 import com.template.model.result.PageUtils;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  *  服务类
  *  服务类
@@ -23,4 +26,8 @@ public interface SmartAuthorGroupService extends IService<SmartAuthorGroup> {
     int deleteSmartAuthorGroupById(int id);
     int deleteSmartAuthorGroupById(int id);
 
 
     SmartAuthorGroup getSmartById(int id);
     SmartAuthorGroup getSmartById(int id);
+
+    public List<SmartAuthorGroup> getAuthorGroupList();
+
+    public List<SmartAuthorGroup> getAuthorGroupByKey(QueryWrapper<SmartAuthorGroup> queryWrapper);
 }
 }

+ 6 - 0
src/main/java/com/template/services/SmartAuthorityService.java

@@ -1,10 +1,13 @@
 package com.template.services;
 package com.template.services;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.template.model.pojo.SmartAuthority;
 import com.template.model.pojo.SmartAuthority;
 import com.template.model.pojo.SmartAuthority;
 import com.template.model.pojo.SmartAuthority;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
 import com.template.model.result.PageUtils;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  *  服务类
  *  服务类
@@ -23,4 +26,7 @@ public interface SmartAuthorityService extends IService<SmartAuthority> {
     int deleteSmartAuthorityById(int id);
     int deleteSmartAuthorityById(int id);
 
 
     SmartAuthority getSmartById(int id);
     SmartAuthority getSmartById(int id);
+
+    public List<SmartAuthority> getAuthorByKey(QueryWrapper<SmartAuthority> queryWrapper);
+
 }
 }

+ 16 - 0
src/main/java/com/template/services/SmartClassService.java

@@ -0,0 +1,16 @@
+package com.template.services;
+
+import com.template.model.pojo.SmartClass;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 楼栋表 服务类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+public interface SmartClassService extends IService<SmartClass> {
+
+}

+ 8 - 0
src/main/java/com/template/services/SmartDepartmentService.java

@@ -5,6 +5,8 @@ import com.template.model.pojo.SmartDepartment;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
 import com.template.model.result.PageUtils;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  *  服务类
  *  服务类
@@ -23,4 +25,10 @@ public interface SmartDepartmentService extends IService<SmartDepartment> {
     int deleteSmartDepartmentById(int id);
     int deleteSmartDepartmentById(int id);
 
 
     SmartDepartment getSmartById(int id);
     SmartDepartment getSmartById(int id);
+
+    SmartDepartment getSmartByName(String name);
+
+    List<SmartDepartment> getSmartsByName(String name);
+
+    int existDataByName(String name);
 }
 }

+ 16 - 0
src/main/java/com/template/services/SmartGradeService.java

@@ -0,0 +1,16 @@
+package com.template.services;
+
+import com.template.model.pojo.SmartGrade;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 楼栋表 服务类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+public interface SmartGradeService extends IService<SmartGrade> {
+
+}

+ 3 - 0
src/main/java/com/template/services/SmartVisitorService.java

@@ -5,6 +5,7 @@ import com.template.model.pojo.SmartVisitor;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
 import com.template.model.result.PageUtils;
 import com.template.model.vo.VisitorPageVo;
 import com.template.model.vo.VisitorPageVo;
+import org.apache.ibatis.annotations.Param;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -30,4 +31,6 @@ public interface SmartVisitorService extends IService<SmartVisitor> {
     boolean insertVisitorBatch(List<SmartVisitor> visitors);
     boolean insertVisitorBatch(List<SmartVisitor> visitors);
 
 
     PageUtils<VisitorPageVo> smartVisitorPageByUserId(int currentPage, int pageCount, Integer userId, Integer statu);
     PageUtils<VisitorPageVo> smartVisitorPageByUserId(int currentPage, int pageCount, Integer userId, Integer statu);
+
+    Integer queryVisitorCount(String cardNo, String startTime, String endTime);
 }
 }

+ 63 - 0
src/main/java/com/template/services/WechatScanLoginService.java

@@ -0,0 +1,63 @@
+package com.template.services;
+
+import com.github.pagehelper.PageInfo;
+import com.template.model.pojo.SmartUser;
+import com.template.model.tongji.*;
+import com.template.model.weixin.AccessToken;
+import com.template.model.weixin.WechatUserUnionID;
+import org.apache.ibatis.annotations.Param;
+
+import java.text.ParseException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>Title: WechatScanLoginService</p>
+ * <p>Description: 业务接口 </p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+public interface WechatScanLoginService {
+	
+	Map<String,String> wechatLoginUrl();
+
+	Map<String,String> wechatBindUrl(String cardNo);
+	
+	AccessToken getAccessToken(String code);
+	
+	WechatUserUnionID getUserUnionID();
+
+	SmartUser selectByOpenid(String openid);
+
+	SmartUser selectByCardNo(String CardNo);
+
+	int updateSmartUser(SmartUser sa);
+
+	// 用户类别统计
+	public List<Tj> getUserIdTj();
+
+	// 用户总数
+	public All getUserIdTjt();
+
+	// 水表总计
+	public DAll getWaterTj();
+
+	// 电表总计
+	public DAll getElcTj();
+
+	public void insertMonthMeter(String month);
+
+	public void insertDayMeter(String day);
+
+	// 每个月各水表数据
+	public List<MonthMeterDetail> getMonWater() throws ParseException;
+
+	// 每个月各电表数据
+	public List<MonthMeterDetail> getMonElc() throws ParseException;
+
+	// 区域能耗统计
+	public PageInfo<MeterMonthData> getMeterMonthPage(@Param("meterMonthData")MeterMonthData meterMonthData);
+
+	// 实时抄表
+	public PageInfo<MeterMonthData> getMeterDayPage(@Param("meterMonthData")MeterMonthData meterMonthData);
+}

+ 20 - 0
src/main/java/com/template/services/impl/SmartAttendanceServiceImpl.java

@@ -0,0 +1,20 @@
+package com.template.services.impl;
+
+import com.template.model.pojo.SmartAttendance;
+import com.template.mapper.SmartAttendanceMapper;
+import com.template.services.SmartAttendanceService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 楼栋表 服务实现类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@Service
+public class SmartAttendanceServiceImpl extends ServiceImpl<SmartAttendanceMapper, SmartAttendance> implements SmartAttendanceService {
+
+}

+ 16 - 0
src/main/java/com/template/services/impl/SmartAuthorGroupServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.mapper.SmartAuthorGroupMapper;
 import com.template.mapper.SmartAuthorGroupMapper;
+import com.template.mapper.SmartAuthorityMapper;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.mapper.SmartAuthorGroupMapper;
 import com.template.mapper.SmartAuthorGroupMapper;
@@ -61,4 +62,19 @@ public class SmartAuthorGroupServiceImpl extends ServiceImpl<SmartAuthorGroupMap
         SmartAuthorGroup result = smartAuthorGroupMapper.selectById(id);
         SmartAuthorGroup result = smartAuthorGroupMapper.selectById(id);
         return result;
         return result;
     }
     }
+
+    @Override
+    public List<SmartAuthorGroup> getAuthorGroupList() {
+        QueryWrapper<SmartAuthorGroup> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("deleted", 0);
+        List<SmartAuthorGroup> result = smartAuthorGroupMapper.selectList(queryWrapper);
+        return result;
+    }
+
+    @Override
+    public List<SmartAuthorGroup> getAuthorGroupByKey(QueryWrapper<SmartAuthorGroup> queryWrapper) {
+        List<SmartAuthorGroup> result = smartAuthorGroupMapper.selectList(queryWrapper);
+        return result;
+    }
+
 }
 }

+ 10 - 0
src/main/java/com/template/services/impl/SmartAuthorityServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.mapper.SmartAuthorityMapper;
 import com.template.mapper.SmartAuthorityMapper;
+import com.template.model.pojo.SmartAuthorGroup;
 import com.template.model.pojo.SmartAuthority;
 import com.template.model.pojo.SmartAuthority;
 import com.template.model.pojo.SmartAuthority;
 import com.template.model.pojo.SmartAuthority;
 import com.template.mapper.SmartAuthorityMapper;
 import com.template.mapper.SmartAuthorityMapper;
@@ -14,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 import org.springframework.util.StringUtils;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  *  服务实现类
  *  服务实现类
@@ -59,4 +62,11 @@ public class SmartAuthorityServiceImpl extends ServiceImpl<SmartAuthorityMapper,
         SmartAuthority result = smartAuthorityMapper.selectById(id);
         SmartAuthority result = smartAuthorityMapper.selectById(id);
         return result;
         return result;
     }
     }
+
+    @Override
+    public List<SmartAuthority> getAuthorByKey(QueryWrapper<SmartAuthority> queryWrapper) {
+        List<SmartAuthority> result = smartAuthorityMapper.selectList(queryWrapper);
+        return result;
+    }
+
 }
 }

+ 20 - 0
src/main/java/com/template/services/impl/SmartClassServiceImpl.java

@@ -0,0 +1,20 @@
+package com.template.services.impl;
+
+import com.template.model.pojo.SmartClass;
+import com.template.mapper.SmartClassMapper;
+import com.template.services.SmartClassService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 楼栋表 服务实现类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@Service
+public class SmartClassServiceImpl extends ServiceImpl<SmartClassMapper, SmartClass> implements SmartClassService {
+
+}

+ 32 - 0
src/main/java/com/template/services/impl/SmartDepartmentServiceImpl.java

@@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 import org.springframework.util.StringUtils;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  *  服务实现类
  *  服务实现类
@@ -59,4 +61,34 @@ public class SmartDepartmentServiceImpl extends ServiceImpl<SmartDepartmentMappe
         SmartDepartment result = smartDepartmentMapper.selectById(id);
         SmartDepartment result = smartDepartmentMapper.selectById(id);
         return result;
         return result;
     }
     }
+
+    @Override
+    public SmartDepartment getSmartByName(String name) {
+        QueryWrapper<SmartDepartment> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(StringUtils.hasText(name),"name", name);
+
+        SmartDepartment result = smartDepartmentMapper.selectOne(queryWrapper);
+
+        return result;
+    }
+
+    @Override
+    public List<SmartDepartment> getSmartsByName(String name) {
+        QueryWrapper<SmartDepartment> queryWrapper = new QueryWrapper<>();
+        queryWrapper.like(StringUtils.hasText(name),"name", name);
+
+        List<SmartDepartment> result = smartDepartmentMapper.selectList(queryWrapper);
+
+        return result;
+    }
+
+    @Override
+    public int existDataByName(String name) {
+        QueryWrapper<SmartDepartment> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(StringUtils.hasText(name),"name", name);
+
+        int existCount = smartDepartmentMapper.selectCount(queryWrapper);
+
+        return existCount;
+    }
 }
 }

+ 20 - 0
src/main/java/com/template/services/impl/SmartGradeServiceImpl.java

@@ -0,0 +1,20 @@
+package com.template.services.impl;
+
+import com.template.model.pojo.SmartGrade;
+import com.template.mapper.SmartGradeMapper;
+import com.template.services.SmartGradeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 楼栋表 服务实现类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-25
+ */
+@Service
+public class SmartGradeServiceImpl extends ServiceImpl<SmartGradeMapper, SmartGrade> implements SmartGradeService {
+
+}

+ 6 - 0
src/main/java/com/template/services/impl/SmartVisitorServiceImpl.java

@@ -77,4 +77,10 @@ public class SmartVisitorServiceImpl extends ServiceImpl<SmartVisitorMapper, Sma
         IPage<VisitorPageVo> datas = smartVisitorMapper.queryVisitorPage(page, userId, statu);
         IPage<VisitorPageVo> datas = smartVisitorMapper.queryVisitorPage(page, userId, statu);
         return new PageUtils(datas);
         return new PageUtils(datas);
     }
     }
+
+    @Override
+    public Integer queryVisitorCount(String cardNo, String startTime, String endTime) {
+        Integer result = smartVisitorMapper.queryVisitorCount(cardNo, startTime, endTime);
+        return result;
+    }
 }
 }

+ 286 - 0
src/main/java/com/template/services/impl/WechatScanLoginServiceImpl.java

@@ -0,0 +1,286 @@
+package com.template.services.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageInfo;
+import com.template.common.constanst.Constanst;
+import com.template.common.utils.*;
+import com.template.mapper.SmartUserMapper;
+import com.template.mapper.WechatScanLoginMapper;
+import com.template.model.pojo.SmartUser;
+import com.template.model.tongji.*;
+import com.template.model.weixin.AccessToken;
+import com.template.model.weixin.HttpParame;
+import com.template.model.weixin.WechatUserUnionID;
+import com.template.services.WechatScanLoginService;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>Title: WechatScanLoginServiceImpl</p>
+ * <p>Description: 业务接口实现 </p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+@Service
+public class WechatScanLoginServiceImpl implements WechatScanLoginService {
+
+	@Autowired
+	public SmartUserMapper smartUserMapper;
+
+	@Autowired
+	public WechatScanLoginMapper wechatScanLoginMapper;
+
+	/**
+	 * <p>Title: wechatLoginUrl</p>
+	 * <p>Description: 网页授权回调地址处理</p>
+	 * @return
+	 * @throws UnsupportedEncodingException
+	 */
+	@Override
+	public Map<String, String> wechatLoginUrl() {
+		String content = Constanst.PWD_MD5+ DateUtils.getYYYYMMdd();
+		byte[] encrypt = AesUtil.encrypt(content, AesUtil.PASSWORD_SECRET_KEY, 16);
+		String parseByte2HexStr = AesUtil.parseByte2HexStr(encrypt);
+		Map<String,String> map = new HashMap<String,String>();
+		String url = HttpParame.AUTHORIZATION_URL;
+		url = url.replaceAll("APPID", PropertiesUtil.getValue(HttpParame.APPID));
+		try {
+			url = url.replaceAll("REDIRECT_URI", URLEncoder.encode(
+					PropertiesUtil.getValue(HttpParame.REDIRECT_URI),"UTF-8"));
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+		//url = url.replaceAll("SCOPE", "snsapi_login");
+		url = url.replaceAll("SCOPE", "snsapi_base");
+		url = url.replace("STATE", parseByte2HexStr);	//加密state进行验证 回调地址当天有效 防止恶意攻击
+		map.put("url", url);
+		return map;
+	}
+
+	@Override
+	public Map<String, String> wechatBindUrl(String cardNo) {
+		String content = Constanst.PWD_MD5+ DateUtils.getYYYYMMdd();
+		byte[] encrypt = AesUtil.encrypt(content, AesUtil.PASSWORD_SECRET_KEY, 16);
+		String parseByte2HexStr = AesUtil.parseByte2HexStr(encrypt);
+		Map<String,String> map = new HashMap<String,String>();
+		String url = HttpParame.BIND_URL;
+		url = url.replaceAll("APPID", PropertiesUtil.getValue(HttpParame.APPID));
+		try {
+			url = url.replaceAll("REDIRECT_URI", URLEncoder.encode(
+					PropertiesUtil.getValue(HttpParame.BIND_URI)+"&cardNo="+cardNo,"UTF-8"));
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+		//url = url.replaceAll("SCOPE", "snsapi_login");
+		url = url.replaceAll("SCOPE", "snsapi_base");
+		url = url.replace("STATE", parseByte2HexStr);	//加密state进行验证 回调地址当天有效 防止恶意攻击
+		map.put("url", url);
+		return map;
+	}
+	
+	/**
+	 * <p>Title: getAccessToken</p>
+	 * <p>Description: 用户授权后获取用户唯一标识 </p>
+	 * @param code
+	 * @return
+	 */
+	@Override
+	public AccessToken getAccessToken(String code) {
+		String accessTokenUrl = HttpParame.ACCESS_TOKEN_URL;
+		accessTokenUrl = accessTokenUrl.replaceAll("APPID", PropertiesUtil.getValue(HttpParame.APPID));
+		accessTokenUrl = accessTokenUrl.replaceAll("SECRET", PropertiesUtil.getValue(HttpParame.SECRET));
+		accessTokenUrl = accessTokenUrl.replaceAll("CODE", code);
+		String responseContent = HttpClientUtils.getInstance().sendHttpGet(accessTokenUrl);
+		if (responseContent == null || responseContent == "") {
+			return null;
+		}
+		JSONObject parseObject = JSONObject.parseObject(responseContent);
+		AccessToken accessToken = JSONObject.toJavaObject(parseObject, AccessToken.class);
+		return accessToken;
+	}
+
+	/**
+	 * <p>Title: getUserUnionID</p>
+	 * <p>Description: 获取用户统一标识。针对一个微信开放平台帐号下的应用,
+	 * 同一用户的unionid在多个应用中是唯一的。
+	 * 此方法不牵扯到多个应用时候可以不用。
+	 * 
+	 * 此处用到只是为了获取微信扫码用户的省份城市(此信息获取的只是微信用户所填的城市省份,
+	 * 并不是用户的实时位置信息,如果用户未填写是获取不到的。)
+	 * </p>
+	 * @return
+	 */
+	@Override
+	public WechatUserUnionID getUserUnionID() {
+		String unionIDUrl = HttpParame.GET_UNIONID_URL;
+		unionIDUrl = unionIDUrl.replace("ACCESS_TOKEN", PropertiesUtil.getValue(HttpParame.ACCESS_TOKEN));
+		unionIDUrl = unionIDUrl.replace("OPENID", PropertiesUtil.getValue(HttpParame.OPENID));
+		String responseContent = HttpClientUtils.getInstance().sendHttpGet(unionIDUrl);
+		if (responseContent == null || responseContent == "") {
+			return null;
+		}
+		JSONObject parseObject = JSONObject.parseObject(responseContent);
+		WechatUserUnionID userUnionID = JSONObject.toJavaObject(parseObject, WechatUserUnionID.class);
+		return userUnionID;
+	}
+
+	@Override
+	public SmartUser selectByOpenid(String openid){
+		QueryWrapper<SmartUser> queryWrapper = new QueryWrapper<>();
+		queryWrapper.eq( "open_id", openid);
+		List<SmartUser> users = smartUserMapper.selectList(queryWrapper);
+		if (users==null || users.size()<=0){
+			return null;
+		}
+		return users.get(0);
+	}
+
+	@Override
+	public SmartUser selectByCardNo(String CardNo){
+		QueryWrapper<SmartUser> queryWrapper = new QueryWrapper<>();
+		queryWrapper.eq( "card_no", CardNo);
+		List<SmartUser> users = smartUserMapper.selectList(queryWrapper);
+		if (users==null || users.size()<=0){
+			return null;
+		}
+		return users.get(0);
+	}
+
+	@Override
+	public int updateSmartUser(SmartUser sa) {
+		int result = smartUserMapper.updateById(sa);
+		return result;
+	}
+
+	// 用户类别统计
+	@Override
+	public List<Tj> getUserIdTj(){
+		return wechatScanLoginMapper.getUserIdTj();
+	}
+
+	// 用户总数
+	@Override
+	public All getUserIdTjt(){
+		return wechatScanLoginMapper.getUserIdTjt();
+	}
+
+	// 水表总计
+	@Override
+	public DAll getWaterTj(){
+		return wechatScanLoginMapper.getWaterTj();
+	}
+
+	// 电表总计
+	@Override
+	public DAll getElcTj(){
+		return wechatScanLoginMapper.getElcTj();
+	}
+
+	@Override
+	public void insertMonthMeter(String month){
+		List<EnergyTj> waterl = wechatScanLoginMapper.getWaterTjByMonAndBuild(month);
+		List<EnergyTj> elcl = wechatScanLoginMapper.getElcTjByMonAndBuild(month);
+		for (int i = 0; i < waterl.size(); i++) {
+			EnergyTj e = wechatScanLoginMapper.getTjByMon(waterl.get(i).getName(),month,"0");
+			if (e==null){
+				waterl.get(i).setType(0);waterl.get(i).setDate(month);
+				wechatScanLoginMapper.insertMonthMeter(waterl.get(i));
+			} else {
+				waterl.get(i).setId(e.getId());
+				wechatScanLoginMapper.updateMonthMeter(waterl.get(i));
+			}
+		}
+		for (int j = 0; j < elcl.size(); j++) {
+			EnergyTj w = wechatScanLoginMapper.getTjByMon(elcl.get(j).getName(),month,"1");
+			if (w==null){
+				elcl.get(j).setType(1);elcl.get(j).setDate(month);
+				wechatScanLoginMapper.insertMonthMeter(elcl.get(j));
+			} else {
+				elcl.get(j).setId(w.getId());
+				wechatScanLoginMapper.updateMonthMeter(elcl.get(j));
+			}
+		}
+	}
+
+	@Override
+	public void insertDayMeter(String day){
+		List<EnergyTj> waterl = wechatScanLoginMapper.getWaterTjByDayAndBuild(day);
+		List<EnergyTj> elcl = wechatScanLoginMapper.getElcTjByDayAndBuild(day);
+		for (int i = 0; i < waterl.size(); i++) {
+			EnergyTj w = wechatScanLoginMapper.getTjByDay(waterl.get(i).getName(),day,"0");
+			if (w==null){
+				waterl.get(i).setType(0);waterl.get(i).setDate(day);
+				wechatScanLoginMapper.insertDayMeter(waterl.get(i));
+			} else {
+				waterl.get(i).setId(w.getId());
+				wechatScanLoginMapper.updateDayMeter(waterl.get(i));
+			}
+		}
+		for (int j = 0; j < elcl.size(); j++) {
+			EnergyTj e = wechatScanLoginMapper.getTjByDay(elcl.get(j).getName(),day,"1");
+			if (e==null){
+				elcl.get(j).setType(1);elcl.get(j).setDate(day);
+				wechatScanLoginMapper.insertDayMeter(elcl.get(j));
+			} else {
+				elcl.get(j).setId(e.getId());
+				wechatScanLoginMapper.updateDayMeter(elcl.get(j));
+			}
+		}
+	}
+
+	// 每个月各水表数据
+	@Override
+	public List<MonthMeterDetail> getMonWater() throws ParseException {
+		List<String> dates = TimeExchange2.getLastSevenMonth();
+		List<MonthMeterDetail> lm = new ArrayList<>();
+		for (int i = 0; i < dates.size(); i++) {
+			MonthMeterDetail mm = new MonthMeterDetail();
+			List<Tj> list = wechatScanLoginMapper.getMonWater(dates.get(i));
+			mm.setDate(TimeExchange2.ToSimpleMonth(TimeExchange2.StringToDate(dates.get(i),"yyyy-MM"))+"月");
+			mm.setLt(list);
+			lm.add(mm);
+		}
+		return lm;
+	}
+
+	// 每个月各电表数据
+	@Override
+	public List<MonthMeterDetail> getMonElc() throws ParseException {
+		List<String> dates = TimeExchange2.getLastSevenMonth();
+		List<MonthMeterDetail> lm = new ArrayList<>();
+		for (int i = 0; i < dates.size(); i++) {
+			MonthMeterDetail mm = new MonthMeterDetail();
+			List<Tj> list = wechatScanLoginMapper.getMonElc(dates.get(i));
+			mm.setDate(TimeExchange2.ToSimpleMonth(TimeExchange2.StringToDate(dates.get(i),"yyyy-MM"))+"月");
+			mm.setLt(list);
+			lm.add(mm);
+		}
+		return lm;
+	}
+
+	// 区域能耗统计
+	@Override
+	public PageInfo<MeterMonthData> getMeterMonthPage(@Param("meterMonthData")MeterMonthData meterMonthData){
+		List<MeterMonthData> list = wechatScanLoginMapper.getMeterMonthPage(meterMonthData);
+		PageInfo<MeterMonthData> meterPageInfo = new PageInfo<>(list);
+		return meterPageInfo;
+	}
+
+	// 实时抄表
+	@Override
+	public PageInfo<MeterMonthData> getMeterDayPage(@Param("meterMonthData")MeterMonthData meterMonthData){
+		List<MeterMonthData> list = wechatScanLoginMapper.getMeterDayPage(meterMonthData);
+		PageInfo<MeterMonthData> meterPageInfo = new PageInfo<>(list);
+		return meterPageInfo;
+	}
+}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 14 - 0
src/main/resources/application-dev.yml


+ 6 - 0
src/main/resources/application.properties

@@ -0,0 +1,6 @@
+appid=wxa46ef222053a1047
+secret=16f74a1265c314fd79fdf90670173467
+redirect_uri=https://www.campussmartlife.com/smartApi/wanzai/api/wechat/callback
+bind_uri=https://www.campussmartlife.com/smartApi/wanzai/api/wechat/bindcallback
+openid=null
+access_token=null

+ 20 - 0
src/main/resources/mapper/template/SmartVisitorMapper.xml

@@ -26,4 +26,24 @@
     </select>
     </select>
 
 
 
 
+    <select id="queryVisitorCount" resultType="java.lang.Integer">
+        select Count(*) from smart_visitor
+        where 1=1
+        <if test="cardNo != null and cardNo != ''">
+            and user_number = #{cardNo}
+        </if>
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and (
+            <if test="startTime != null and startTime != ''">
+                (visitor_time &lt; #{startTime} and visitor_deadline &gt; #{startTime})
+            </if>
+            <if test="endTime != null and endTime != ''">
+                or (visitor_time &lt; #{endTime} and visitor_deadline &gt; #{endTime})
+            </if>
+            )
+        </if>
+        and deleted = 0 and statu != 2
+    </select>
+
+
 </mapper>
 </mapper>

+ 206 - 0
src/main/resources/mapper/template/WechatScanLoginMapper.xml

@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.template.mapper.WechatScanLoginMapper">
+
+    <resultMap id="Tj" type="com.template.model.tongji.Tj">
+        <result property="name" column="name"/>
+        <result property="num" column="num"/>
+    </resultMap>
+
+    <resultMap id="Tjt" type="com.template.model.tongji.All">
+        <result property="total" column="total"/>
+    </resultMap>
+
+    <resultMap id="Elct" type="com.template.model.tongji.DAll">
+        <result property="num" column="num"/>
+    </resultMap>
+
+    <resultMap id="Energy" type="com.template.model.tongji.EnergyTj">
+        <result property="name" column="name"/>
+        <result property="num" column="num"/>
+    </resultMap>
+
+    <resultMap id="MonthT" type="com.template.model.tongji.EnergyTj">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="type" column="type"/>
+        <result property="date" column="date"/>
+        <result property="num" column="num"/>
+    </resultMap>
+
+    <resultMap id="DayT" type="com.template.model.tongji.EnergyTj">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="type" column="type"/>
+        <result property="date" column="date"/>
+        <result property="num" column="num"/>
+    </resultMap>
+
+    <resultMap id="meterMonthData" type="com.template.model.tongji.MeterMonthData">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="date" column="date"/>
+        <result property="wNum" column="w_num"/>
+        <result property="eNum" column="e_num"/>
+    </resultMap>
+
+    <!--用户类别统计-->
+    <select id="getUserIdTj" parameterType="com.template.model.tongji.Tj" resultMap="Tj">
+        select a.name,IFNULL(b.num,0) as num from `smart_identity` a
+        left join (
+            select identity_id,COUNT(*) as num from `smart_user`
+            where is_cancel=0 and deleted=0 group by identity_id ) b
+        on a.id=b.identity_id
+    </select>
+
+    <!--用户总数-->
+    <select id="getUserIdTjt" parameterType="com.template.model.tongji.Tj" resultMap="Tjt">
+        select count(*) as total from `smart_user` where is_cancel=0 and deleted=0
+    </select>
+
+    <!--水表总计-->
+    <select id="getWaterTj" parameterType="com.template.model.tongji.Tj" resultMap="Elct">
+        select ifnull(sum(meter_power),0) as num from `smart_meter_detail` where meter_type=0 and deleted=0
+    </select>
+
+    <!--电表总计-->
+    <select id="getElcTj" parameterType="com.template.model.tongji.Tj" resultMap="Elct">
+        select ifnull(sum(meter_power),0) as num from `smart_meter_detail` where meter_type=1 and deleted=0
+    </select>
+
+    <!--每个月各水表数据统计-->
+    <select id="getWaterTjByMonAndBuild" parameterType="String" resultMap="Energy">
+        select a.name,SUM(IFNULL(b.num,0)) as num from `smart_build` a left join (
+            select a.`build_id`,IFNULL(b.num,0) as num from `smart_build_meter` a left join (
+            select meter_id,IFNULL(SUM(meter_power),0) as num from `smart_meter_detail`
+            where deleted=0 and meter_type=0 and update_time like concat(#{month}, '%')
+            group by meter_id ) b on a.`meter_id`=b.`meter_id`) b on a.id=b.build_id
+        group by a.`name`
+    </select>
+
+    <!--每个月各电表数据统计-->
+    <select id="getElcTjByMonAndBuild" parameterType="String" resultMap="Energy">
+        select a.name,SUM(IFNULL(b.num,0)) as num from `smart_build` a left join (
+            select a.`build_id`,IFNULL(b.num,0) as num from `smart_build_meter` a left join (
+                select meter_id,IFNULL(SUM(meter_power),0) as num from `smart_meter_detail`
+                where deleted=0 and meter_type=1 and update_time like concat(#{month}, '%')
+                group by meter_id ) b on a.`meter_id`=b.`meter_id`) b on a.id=b.build_id
+        group by a.`name`
+    </select>
+
+    <!--每个月每个楼栋查询-->
+    <select id="getTjByMon" parameterType="String" resultMap="MonthT">
+        select * from `month_meter_detail` where `name`=#{name} and `date`=#{month} and `type`=#{type}
+    </select>
+
+    <insert id="insertMonthMeter" parameterType="com.template.model.tongji.EnergyTj" useGeneratedKeys="true">
+        INSERT INTO `month_meter_detail`
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="name != null">`name`,</if>
+            <if test="type != null">`type`,</if>
+            <if test="date != null">`date`,</if>
+            <if test="num != null">`num`,</if>
+        </trim>
+        <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
+            <if test="name != null">#{name},</if>
+            <if test="type != null">#{type},</if>
+            <if test="date != null">#{date},</if>
+            <if test="num != null">#{num},</if>
+        </trim>
+    </insert>
+
+    <update id="updateMonthMeter">
+        UPDATE `month_meter_detail`
+        <trim prefix="SET" suffixOverrides=",">
+            num=#{energyTj.num}
+        </trim>
+        <where>
+            and id=#{energyTj.id}
+        </where>
+    </update>
+
+    <!--每天各水表数据统计-->
+    <select id="getWaterTjByDayAndBuild" parameterType="String" resultMap="Energy">
+        select a.name,SUM(IFNULL(b.num,0)) as num from `smart_build` a left join (
+            select a.`build_id`,IFNULL(b.num,0) as num from `smart_build_meter` a left join (
+                select meter_id,IFNULL(SUM(meter_power),0) as num from `smart_meter_detail`
+                where deleted=0 and meter_type=0 and update_time like concat(#{day}, '%')
+                group by meter_id ) b on a.`meter_id`=b.`meter_id`) b on a.id=b.build_id
+        group by a.`name`
+    </select>
+
+    <!--每天各电表数据统计-->
+    <select id="getElcTjByDayAndBuild" parameterType="String" resultMap="Energy">
+        select a.name,SUM(IFNULL(b.num,0)) as num from `smart_build` a left join (
+            select a.`build_id`,IFNULL(b.num,0) as num from `smart_build_meter` a left join (
+                select meter_id,IFNULL(SUM(meter_power),0) as num from `smart_meter_detail`
+                where deleted=0 and meter_type=1 and update_time like concat(#{day}, '%')
+                group by meter_id ) b on a.`meter_id`=b.`meter_id`) b on a.id=b.build_id
+        group by a.`name`
+    </select>
+
+    <select id="getTjByDay" parameterType="String" resultMap="DayT">
+        select * from `day_meter_detail` where `name`=#{name} and `date`=#{day} and `type`=#{type}
+    </select>
+
+    <insert id="insertDayMeter" parameterType="com.template.model.tongji.EnergyTj" useGeneratedKeys="true">
+        INSERT INTO `day_meter_detail`
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="name != null">`name`,</if>
+            <if test="type != null">`type`,</if>
+            <if test="date != null">`date`,</if>
+            <if test="num != null">`num`,</if>
+        </trim>
+        <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
+            <if test="name != null">#{name},</if>
+            <if test="type != null">#{type},</if>
+            <if test="date != null">#{date},</if>
+            <if test="num != null">#{num},</if>
+        </trim>
+    </insert>
+
+    <update id="updateDayMeter">
+        UPDATE `day_meter_detail`
+        <trim prefix="SET" suffixOverrides=",">
+            num=#{energyTj.num}
+        </trim>
+        <where>
+            and id=#{energyTj.id}
+        </where>
+    </update>
+
+    <!--每个月水费数据-->
+    <select id="getMonWater" parameterType="String" resultMap="Tj">
+        select * from `month_meter_detail` where type=0 and `date`=#{month}
+    </select>
+
+    <!--每个月电费数据-->
+    <select id="getMonElc" parameterType="String" resultMap="Tj">
+        select * from `month_meter_detail` where type=1 and `date`=#{month}
+    </select>
+
+    <!--区域能耗统计-->
+    <select id="getMeterMonthPage" resultMap="meterMonthData">
+        select * from (select a.id,a.`name`,a.`date`,a.`num` w_num,b.num as e_num
+           from `month_meter_detail` a,`month_meter_detail` b
+           where a.`type`=0 and b.`type`=1 and a.name=b.`name`
+             and a.`date`=b.`date` ) a
+        <where>
+            <if test="meterMonthData.date != null and meterMonthData.date != ''"> AND a.date like concat(#{meterMonthData.date}, '%')</if>
+        </where>
+        order by a.date desc
+    </select>
+
+    <!--实时抄表-->
+    <select id="getMeterDayPage" resultMap="meterMonthData">
+        select * from (select a.id,a.`name`,a.`date`,a.`num` w_num,b.num as e_num
+        from `day_meter_detail` a,`day_meter_detail` b
+        where a.`type`=0 and b.`type`=1 and a.name=b.`name`
+        and a.`date`=b.`date` ) a
+        <where>
+            <if test="meterMonthData.date != null and meterMonthData.date != ''"> AND a.date like concat(#{meterMonthData.date}, '%')</if>
+        </where>
+        order by a.date desc
+    </select>
+
+</mapper>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 14 - 0
target/classes/application-dev.yml


+ 20 - 0
target/classes/mapper/template/SmartVisitorMapper.xml

@@ -26,4 +26,24 @@
     </select>
     </select>
 
 
 
 
+    <select id="queryVisitorCount" resultType="java.lang.Integer">
+        select Count(*) from smart_visitor
+        where 1=1
+        <if test="cardNo != null and cardNo != ''">
+            and user_number = #{cardNo}
+        </if>
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and (
+            <if test="startTime != null and startTime != ''">
+                (visitor_time &lt; #{startTime} and visitor_deadline &gt; #{startTime})
+            </if>
+            <if test="endTime != null and endTime != ''">
+                or (visitor_time &lt; #{endTime} and visitor_deadline &gt; #{endTime})
+            </if>
+            )
+        </if>
+        and deleted = 0 and statu != 2
+    </select>
+
+
 </mapper>
 </mapper>

BIN=BIN
target/mybatis_plus-0.0.1-SNAPSHOT.jar.original