From 1d9631791b7e7797af18276cc22818ab15706d5c Mon Sep 17 00:00:00 2001
From: lidongdong <1459917685@qq.com>
Date: 星期四, 13 十月 2022 11:16:22 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/huacheng_test' into huacheng_test

---
 flower_city/src/main/java/com/dg/core/util/TestDate.java                       |  113 +++++++++++++++++++++++++++++++++++++
 flower_city/src/main/resources/mapper/SysUserMapper.xml                        |    2 
 flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java |    9 ++
 flower_city/src/main/resources/mapper/TransactionEventMapper.xml               |    5 +
 flower_city/pom.xml                                                            |    8 ++
 5 files changed, 134 insertions(+), 3 deletions(-)

diff --git a/flower_city/pom.xml b/flower_city/pom.xml
index f787a19..5826be7 100644
--- a/flower_city/pom.xml
+++ b/flower_city/pom.xml
@@ -85,6 +85,14 @@
             <version>1.2.74</version>
         </dependency>
 
+        <!-- okhttp -->
+        <dependency>
+            <groupId>com.squareup.okhttp</groupId>
+            <artifactId>okhttp</artifactId>
+            <version>2.7.1</version>
+        </dependency>
+
+
         <dependency>
             <groupId>cn.afterturn</groupId>
             <artifactId>easypoi-annotation</artifactId>
diff --git a/flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java b/flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java
index 03a9ca0..3bd0c5e 100644
--- a/flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java
+++ b/flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java
@@ -305,7 +305,6 @@
     }
 
 
-
     @ApiOperation("办事指南排行榜 type 1 按浏览量   2 按办结量")
     @GetMapping("/getGuidance")
     public TableDataInfo getGuidance(@RequestParam("type") String type)
@@ -326,4 +325,12 @@
 
 
 
+
+
+
+
+
+
+
+
 }
diff --git a/flower_city/src/main/java/com/dg/core/util/TestDate.java b/flower_city/src/main/java/com/dg/core/util/TestDate.java
new file mode 100644
index 0000000..ee4f21f
--- /dev/null
+++ b/flower_city/src/main/java/com/dg/core/util/TestDate.java
@@ -0,0 +1,113 @@
+package com.dg.core.util;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.squareup.okhttp.OkHttpClient;
+import com.squareup.okhttp.Request;
+import com.squareup.okhttp.Response;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * <p>TestDate 此类用于:</p>
+ * <p>@author:hujm</p>
+ * <p>@date:2021年04月22日 17:43</p>
+ * <p>@remark:</p>
+ */
+public class TestDate {
+
+    public static void main(String[] args) {
+        System.out.println(getJjr(2021, 4));
+        System.out.println(getMonthWekDay(2021, 4));
+        System.out.println(JJR(2021, 4));
+
+    }
+
+    /**
+     * 获取周末和节假日
+     *
+     * @param year
+     * @param month
+     * @return
+     */
+    public static Set<String> JJR(int year, int month) {
+        //获取所有的周末
+        Set<String> monthWekDay = getMonthWekDay(year, month);
+        //http://timor.tech/api/holiday api文档地址
+        Map jjr = getJjr(year, month + 1);
+        Integer code = (Integer) jjr.get("code");
+        if (code != 0) {
+            return monthWekDay;
+        }
+        Map<String, Map<String, Object>> holiday = (Map<String, Map<String, Object>>) jjr.get("holiday");
+        Set<String> strings = holiday.keySet();
+        for (String str : strings) {
+            Map<String, Object> stringObjectMap = holiday.get(str);
+            Integer wage = (Integer) stringObjectMap.get("wage");
+            String date = (String) stringObjectMap.get("date");
+            //筛选掉补班
+            if (wage.equals(1)) {
+                monthWekDay.remove(date);
+            } else {
+                monthWekDay.add(date);
+            }
+        }
+        return monthWekDay;
+    }
+
+    /**
+     * 获取节假日不含周末
+     *
+     * @param year
+     * @param month
+     * @return
+     */
+    private static Map getJjr(int year, int month) {
+        String url = "http://timor.tech/api/holiday/year/";
+        OkHttpClient client = new OkHttpClient();
+        Response response;
+        //解密数据
+        String rsa = null;
+        Request request = new Request.Builder()
+                .url(url)
+                .get()
+                .addHeader("Content-Type", "application/x-www-form-urlencoded")
+                .build();
+        try {
+            response = client.newCall(request).execute();
+            rsa = response.body().string();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return JSONObject.parseObject(rsa, Map.class);
+    }
+
+    /**
+     * 获取周末  月从0开始
+     *
+     * @param year
+     * @param mouth
+     * @return
+     */
+    public static Set<String> getMonthWekDay(int year, int mouth) {
+        Set<String> dateList = new HashSet<>();
+        SimpleDateFormat simdf = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = new GregorianCalendar(year, mouth, 1);
+        Calendar endCalendar = new GregorianCalendar(year, mouth, 1);
+        endCalendar.add(Calendar.MONTH, 1);
+        while (true) {
+            int weekday = calendar.get(Calendar.DAY_OF_WEEK);
+            if (weekday == 1 || weekday == 7) {
+                dateList.add(simdf.format(calendar.getTime()));
+            }
+            calendar.add(Calendar.DATE, 1);
+            if (calendar.getTimeInMillis() >= endCalendar.getTimeInMillis()) {
+                break;
+            }
+        }
+        return dateList;
+    }
+
+}
diff --git a/flower_city/src/main/resources/mapper/SysUserMapper.xml b/flower_city/src/main/resources/mapper/SysUserMapper.xml
index 0e7f67c..cf7cb05 100644
--- a/flower_city/src/main/resources/mapper/SysUserMapper.xml
+++ b/flower_city/src/main/resources/mapper/SysUserMapper.xml
@@ -123,7 +123,7 @@
     <select id="selectListByDepartmentId"  resultMap="SysUserResult">
         <include refid="selectSysUserVo"/>
          <where>
-             user_type=2
+             user_type=2 and status=1
         <if test="list!=null">
             and  department_id in
             <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
diff --git a/flower_city/src/main/resources/mapper/TransactionEventMapper.xml b/flower_city/src/main/resources/mapper/TransactionEventMapper.xml
index c748b1e..17b91b7 100644
--- a/flower_city/src/main/resources/mapper/TransactionEventMapper.xml
+++ b/flower_city/src/main/resources/mapper/TransactionEventMapper.xml
@@ -82,7 +82,10 @@
             common_problem_url,
             common_problem_name,
             operational_guideline_video_url,
-            (select classify_name from automessage_classify_administration where automessage_classify_administration.id=automessage_transaction_event.classify_id) as classifyName,
+            (IF((select classify_grade from automessage_classify_administration where automessage_classify_administration.id=automessage_transaction_event.classify_id)='2',
+                (select classify_name from automessage_classify_administration where automessage_classify_administration.id=(select parent_id from
+                automessage_classify_administration where automessage_classify_administration.id=automessage_transaction_event.classify_id)),
+                (select classify_name from automessage_classify_administration where automessage_classify_administration.id=automessage_transaction_event.classify_id))) as classifyName,
             (select organization_name from automessage_organization_chart where automessage_organization_chart.id=automessage_transaction_event.department_id) as departmentName,
             concat(
             (select classify_name from  automessage_classify_administration  where id=(select parent_id from  automessage_classify_administration  where id=automessage_transaction_event.classify_id)),

--
Gitblit v1.7.1