张涛 2 years ago
parent
commit
f7a4d7965c

db/.back_文明创办/文明创办-backup-2023510115646.pdma.json → db/.back_文明创办/.back_文明创办/文明创办-backup-2023529093726.pdma.json View File


db/.back_文明创办/.back_文明创办/文明创办-backup-2023511112445.pdma.json → db/.back_文明创办/文明创办-backup-2023531102652.pdma.json View File

@@ -4,7 +4,7 @@
4 4
   "avatar": "",
5 5
   "version": "4.1.1",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-5-11 11:24:01",
7
+  "updatedTime": "2023-5-18 11:20:34",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -7186,6 +7186,23 @@
7186 7186
           "refDict": "",
7187 7187
           "uiHint": "",
7188 7188
           "id": "A836C724-F5D9-4A45-A413-209B55DDA976"
7189
+        },
7190
+        {
7191
+          "defKey": "card_title",
7192
+          "defName": "卡片名称",
7193
+          "comment": "小程序端,新建定位时显示的名称",
7194
+          "type": "",
7195
+          "len": "",
7196
+          "scale": "",
7197
+          "primaryKey": false,
7198
+          "notNull": false,
7199
+          "autoIncrement": false,
7200
+          "defaultValue": "",
7201
+          "hideInGraph": false,
7202
+          "refDict": "",
7203
+          "extProps": {},
7204
+          "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573",
7205
+          "id": "1CDF0BAA-5F46-498F-A791-FD71F33EB3D5"
7189 7206
         }
7190 7207
       ],
7191 7208
       "correlations": [],

+ 4
- 0
db/upgrade.1.3.sql View File

@@ -0,0 +1,4 @@
1
+
2
+--2023-5-25
3
+ALTER TABLE `sys_org`
4
+ADD COLUMN sms_pson varchar(255) NULL COMMENT '短信接收者' AFTER create_date;

+ 1
- 1
db/文明创办.pdma.json View File

@@ -4,7 +4,7 @@
4 4
   "avatar": "",
5 5
   "version": "4.1.1",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-5-18 11:20:34",
7
+  "updatedTime": "2023-5-31 10:26:52",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {

+ 1
- 0
src/main/java/com/example/civilizedcity/CivilizedCityApplication.java View File

@@ -2,6 +2,7 @@ package com.example.civilizedcity;
2 2
 
3 3
 import org.springframework.boot.SpringApplication;
4 4
 import org.springframework.boot.autoconfigure.SpringBootApplication;
5
+import org.springframework.context.annotation.ComponentScan;
5 6
 import org.springframework.scheduling.annotation.EnableAsync;
6 7
 import org.springframework.transaction.annotation.EnableTransactionManagement;
7 8
 

+ 0
- 46
src/main/java/com/example/civilizedcity/common/SMSUtils.java View File

@@ -60,49 +60,3 @@ public class SMSUtils implements InitializingBean {
60 60
 
61 61
 }
62 62
 
63
-//import com.alibaba.fastjson.JSONObject;
64
-//import com.aliyuncs.CommonRequest;
65
-//import com.aliyuncs.CommonResponse;
66
-//import com.aliyuncs.DefaultAcsClient;
67
-//import com.aliyuncs.IAcsClient;
68
-//import com.aliyuncs.exceptions.ClientException;
69
-//import com.aliyuncs.http.MethodType;
70
-//import com.aliyuncs.profile.DefaultProfile;
71
-//import org.springframework.stereotype.Service;
72
-//
73
-//import java.util.Map;
74
-
75
-//@Service
76
-////@EnableScheduling //开启定时任务
77
-////@EnableAsync  //开启多线程
78
-//public class SMSUtils {
79
-//    //    @Override
80
-////    @Async
81
-////    @Scheduled(cron = "0 30 8 * * ?") //时隔多少秒
82
-//    public static void smsMessage(String phoneNumber, String TemplateCode, Map code) {  //AccessKey ID 账号 AccessKey secret密码
83
-//        DefaultProfile profile = DefaultProfile.getProfile("cn-nanjing", "LTAI4G16F251gw8zRaePUPQo", "你自己的密码");
84
-//        IAcsClient client = new DefaultAcsClient(profile);
85
-//        //阿里云原有的配置信息我们不需要改动
86
-//        CommonRequest request = new CommonRequest();
87
-//        request.setSysMethod(MethodType.POST);
88
-//        request.setSysDomain("dysmsapi.aliyuncs.com");
89
-//        request.setSysVersion("2017-05-25");
90
-//        request.setSysAction("SendSms");
91
-//        //自定义短信信息
92
-//        request.putQueryParameter("phoneNumber", phoneNumber); //发送给哪个手机号
93
-//        request.putQueryParameter("SignName", "清峰小栈");  //自己配置的短信签名
94
-//        request.putQueryParameter("TemplateCode", TemplateCode); //自己配置的模板 模版CODE
95
-//
96
-//        //构建一个短信验证码
97
-////        HashMap<String, Object> map = new HashMap<>();
98
-////        map.put("code", 8456);
99
-//        request.putQueryParameter("TemplateParam", JSONObject.toJSONString(code));   //转换成json字符串
100
-//        try {
101
-//            CommonResponse response = client.getCommonResponse(request); //发送至客户端
102
-//            System.out.println(response.getData());
103
-//        } catch (ClientException e) {
104
-//            e.printStackTrace();
105
-//        }
106
-//    }
107
-//
108
-//}

+ 5
- 0
src/main/java/com/example/civilizedcity/entity/SysOrg.java View File

@@ -53,4 +53,9 @@ public class SysOrg implements Serializable,Cloneable{
53 53
     @ApiModelProperty(name = "创建时间",notes = "")
54 54
     private LocalDateTime createDate ;
55 55
 
56
+     /** 短信接收者 */
57
+     @ApiModelProperty(name = "短信接收者",notes = "")
58
+     private String smsPson ;
59
+
60
+
56 61
 }

+ 5
- 1
src/main/java/com/example/civilizedcity/mapper/SysOrgMapper.java View File

@@ -5,7 +5,9 @@ import org.apache.ibatis.annotations.Mapper;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 import com.example.civilizedcity.entity.SysOrg;
7 7
 
8
- /**
8
+import java.util.List;
9
+
10
+/**
9 11
  * 单位表;(sys_org)表数据库访问层
10 12
  * @author : http://njyunzhi.com
11 13
  * @date : 2022-12-12
@@ -16,4 +18,6 @@ public interface SysOrgMapper  extends BaseMapper<SysOrg>{
16 18
      String sysOrgService(@Param("orgPId") String orgPId);
17 19
 
18 20
      long changeOrgCode(@Param("from") String from, @Param("to") String to);
21
+
22
+     List<SysOrg> getAllList();
19 23
  }

+ 4
- 0
src/main/java/com/example/civilizedcity/mapper/TaIssueMapper.java View File

@@ -44,4 +44,8 @@ public interface TaIssueMapper  extends BaseMapper<TaIssue>{
44 44
 
45 45
     int removeByIssueId(@Param("issueId") String issueId);
46 46
 
47
+
48
+    long expectRubNum(@Param("orgId") String org_id);
49
+
50
+    long AssignedRubNum(@Param("orgId") String org_id);
47 51
 }

+ 3
- 0
src/main/java/com/example/civilizedcity/service/TaIssueService.java View File

@@ -33,4 +33,7 @@ public interface TaIssueService extends IBaseService<TaIssue> {
33 33
     void reject(TaIssue taIssue, TaIssueProcess taIssueProcess, SysUser user) throws Exception;
34 34
 
35 35
     TaIssue copyIssue(TaIssue origin, SysUser sysUser);
36
+
37
+
38
+    void issueWarning();
36 39
 }

+ 47
- 5
src/main/java/com/example/civilizedcity/service/impl/TaIssueServiceImpl.java View File

@@ -2,21 +2,19 @@ package com.example.civilizedcity.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.example.civilizedcity.common.Constants;
5
+import com.example.civilizedcity.common.SMSCaptcha;
5 6
 import com.example.civilizedcity.entity.*;
6 7
 import com.example.civilizedcity.event.MessagEvent;
7 8
 import com.example.civilizedcity.mapper.*;
9
+import com.example.civilizedcity.service.TaIssueService;
8 10
 import com.example.civilizedcity.vo.StatVo;
9 11
 import org.springframework.beans.factory.annotation.Autowired;
10 12
 import org.springframework.context.ApplicationEventPublisher;
11 13
 import org.springframework.stereotype.Service;
12
-import com.example.civilizedcity.service.TaIssueService;
13 14
 import org.springframework.transaction.annotation.Transactional;
14 15
 
15 16
 import java.time.LocalDateTime;
16
-import java.util.ArrayList;
17
-import java.util.HashMap;
18
-import java.util.List;
19
-import java.util.Map;
17
+import java.util.*;
20 18
 
21 19
 /**
22 20
  * 问题表;(ta_issue)表服务实现类
@@ -30,6 +28,12 @@ public class TaIssueServiceImpl extends BaseServiceImpl<TaIssueMapper, TaIssue>
30 28
     @Autowired
31 29
     TaOrgIssueMapper taOrgIssueMapper;
32 30
 
31
+    @Autowired
32
+    SysOrgMapper sysOrgMapper;
33
+
34
+    @Autowired
35
+    SMSCaptcha sMSCaptcha;
36
+
33 37
     @Autowired
34 38
     TaFeedbackMapper taFeedbackMapper;
35 39
 
@@ -289,6 +293,44 @@ public class TaIssueServiceImpl extends BaseServiceImpl<TaIssueMapper, TaIssue>
289 293
         return taIssue;
290 294
     }
291 295
 
296
+    @Override
297
+    public void issueWarning() {
298
+        // 1. 获取所有机构
299
+        List<SysOrg> orgList = sysOrgMapper.getAllList();
300
+
301
+
302
+        // 2. 遍历每个机构是否有未交办,逾期
303
+        for (SysOrg element : orgList) {
304
+
305
+            //已逾期
306
+            long eRubNum = baseMapper.expectRubNum(element.getOrgId());
307
+            //待交办
308
+            long aRubNum = baseMapper.AssignedRubNum(element.getOrgId());
309
+
310
+            if(eRubNum!=0){
311
+                String[] telSms = element.getSmsPson().split(",");
312
+                try {
313
+                    sMSCaptcha.send(telSms[0],"已逾期");
314
+                    sMSCaptcha.send(telSms[1],"已逾期");
315
+                } catch (Exception e) {
316
+                    e.printStackTrace();
317
+                }
318
+            }
319
+            if(aRubNum!=0){
320
+                String[] telSms = element.getSmsPson().split(",");
321
+                try {
322
+                    sMSCaptcha.send(telSms[0],"待交办");
323
+                    sMSCaptcha.send(telSms[1],"待交办");
324
+                } catch (Exception e) {
325
+                    e.printStackTrace();
326
+                }
327
+            }
328
+//                让程序停顿一秒
329
+            try{Thread.sleep(1000);}catch(Exception e){}
330
+        }
331
+
332
+    }
333
+
292 334
     Integer getStatValueBy(Object v, Integer def) {
293 335
         if (null == v) return def;
294 336
         return Integer.valueOf(v.toString());

+ 28
- 0
src/main/java/com/example/civilizedcity/task/everyDayMessage.java View File

@@ -0,0 +1,28 @@
1
+package com.example.civilizedcity.task;
2
+
3
+import com.example.civilizedcity.service.TaIssueService;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.scheduling.annotation.EnableAsync;
6
+import org.springframework.scheduling.annotation.EnableScheduling;
7
+import org.springframework.scheduling.annotation.Scheduled;
8
+import org.springframework.stereotype.Component;
9
+
10
+@Component
11
+@EnableScheduling//开启定时任务
12
+@EnableAsync  //开启多线程
13
+public class everyDayMessage {
14
+
15
+    @Autowired
16
+    TaIssueService taIssueService;
17
+
18
+//    @Async
19
+    @Scheduled(cron = "50 20 17 * * ?")
20
+    public void issueWarning() {
21
+        System.out.println("开始拉");
22
+        taIssueService.issueWarning();
23
+    }
24
+
25
+}
26
+
27
+
28
+

+ 0
- 18
src/main/java/task/everyDayMessage.java View File

@@ -1,18 +0,0 @@
1
-package task;
2
-import org.springframework.scheduling.annotation.Async;
3
-import org.springframework.scheduling.annotation.EnableAsync;
4
-import org.springframework.scheduling.annotation.EnableScheduling;
5
-import org.springframework.scheduling.annotation.Scheduled;
6
-@EnableScheduling //开启定时任务
7
-@EnableAsync  //开启多线程
8
-public class everyDayMessage {
9
-
10
-    @Async
11
-    @Scheduled(cron = "0 30 8 * * ?") //时隔多少秒
12
-    public void remind() {
13
-
14
-
15
-
16
-
17
-    }
18
-}

+ 3
- 3
src/main/resources/application.yml View File

@@ -17,7 +17,7 @@ spring:
17 17
 ###
18 18
 sms:
19 19
   captcha:
20
-    code: SMS 460785881
20
+    code: SMS_460785881
21 21
     sign: 荟居
22 22
 
23 23
 ###
@@ -35,8 +35,8 @@ yz:
35 35
       - "/ma/auth-phone"
36 36
   sms:
37 37
     ##任意命名
38
-    appid:
39
-    api:
38
+    appid: huoshan
39
+    api: http://sms.njyunzhi.com/sms
40 40
     ## 帮助文档
41 41
     help: http://sms.njyunzhi.com/help
42 42
 sa-token:

+ 8
- 0
src/main/resources/mapper/SysOrgMapper.xml View File

@@ -21,4 +21,12 @@
21 21
             t.org_code DESC
22 22
             LIMIT 1
23 23
     </select>
24
+    <select id="getAllList" resultType="com.example.civilizedcity.entity.SysOrg">
25
+        SELECT
26
+        o.org_id,
27
+        o.NAME,
28
+        o.sms_pson
29
+        FROM
30
+        `sys_org` o
31
+    </select>
24 32
 </mapper>

+ 101
- 73
src/main/resources/mapper/TaIssueMapper.xml View File

@@ -5,24 +5,24 @@
5 5
     <update id="updateApply">
6 6
         UPDATE ta_issue t
7 7
         SET t.apply_type = #{applyType},
8
-            t.apply_id = #{applyId}
8
+        t.apply_id = #{applyId}
9 9
         WHERE
10
-            t.issue_id = #{issueId}
10
+        t.issue_id = #{issueId}
11 11
     </update>
12 12
     <update id="updateValidateStatus">
13 13
         UPDATE ta_issue t
14 14
         SET t.validate_status = #{validateStatus}
15 15
         WHERE
16
-            t.issue_id = #{issueId}
16
+        t.issue_id = #{issueId}
17 17
     </update>
18 18
     <update id="updateProcess">
19 19
         UPDATE ta_issue t
20 20
         SET t.process_node = #{processNode},
21
-            t.process_status = #{processStatus},
22
-            t.update_user = #{userId},
23
-            t.update_date = now( )
21
+        t.process_status = #{processStatus},
22
+        t.update_user = #{userId},
23
+        t.update_date = now( )
24 24
         WHERE
25
-            t.issue_id = #{issueId}
25
+        t.issue_id = #{issueId}
26 26
     </update>
27 27
 
28 28
     <update id="removeByIssueId">
@@ -34,100 +34,128 @@
34 34
 
35 35
     <select id="getPageBy" resultType="com.example.civilizedcity.entity.TaIssue">
36 36
         SELECT
37
-            *
37
+        *
38 38
         FROM
39
-            ta_issue t
39
+        ta_issue t
40 40
         WHERE
41
-            EXISTS (
42
-                    SELECT
43
-                        *
44
-                    FROM
45
-                        ta_issue_process s ON s.issue_id = t.issue_id
46
-                    WHERE
47
-                    ( s.org_id = #{orgId} OR s.next_org = #{orgId} )
48
-                        AND s.`status` &gt; -1
49
-                )
50
-          AND t.`status` &gt; -1
41
+        EXISTS (
42
+        SELECT
43
+        *
44
+        FROM
45
+        ta_issue_process s ON s.issue_id = t.issue_id
46
+        WHERE
47
+        ( s.org_id = #{orgId} OR s.next_org = #{orgId} )
48
+        AND s.`status` &gt; -1
49
+        )
50
+        AND t.`status` &gt; -1
51 51
         ORDER BY
52
-            t.create_date DESC
52
+        t.create_date DESC
53 53
     </select>
54 54
     <select id="getAllBy" resultType="com.example.civilizedcity.entity.TaIssue">
55 55
         SELECT
56
-            *
56
+        *
57 57
         FROM
58
-            ta_issue t
58
+        ta_issue t
59 59
         WHERE
60
-            t.`status` &gt; -1
60
+        t.`status` &gt; -1
61 61
         ORDER BY
62
-            t.create_date DESC
62
+        t.create_date DESC
63 63
     </select>
64 64
     <select id="statMaIndex" resultType="java.util.Map">
65 65
         SELECT
66
-            count(*) as published_num,
67
-            sum(IF(t.process_node = '01', 1, 0)) as unassigned_num,
68
-            sum(IF(t.process_node LIKE '02%', 1, 0)) as assigned_num,
69
-            sum(IF(t.process_node = '03', 1, 0)) as end_num
66
+        count(*) as published_num,
67
+        sum(IF(t.process_node = '01', 1, 0)) as unassigned_num,
68
+        sum(IF(t.process_node LIKE '02%', 1, 0)) as assigned_num,
69
+        sum(IF(t.process_node = '03', 1, 0)) as end_num
70 70
         FROM
71
-            ta_issue t
71
+        ta_issue t
72 72
         WHERE 1 = 1
73
-          <if test="null != userId and userId != ''">
74
-              AND t.create_user = #{userId}
75
-          </if>
76
-          AND t.`status` > - 1
73
+        <if test="null != userId and userId != ''">
74
+            AND t.create_user = #{userId}
75
+        </if>
76
+        AND t.`status` > - 1
77 77
     </select>
78 78
     <select id="statIssueOrg" resultType="java.util.Map">
79 79
         SELECT
80
-            UUID_SHORT( ) AS id,
81
-            IFNULL( SUM( IF ( t.process_node = '03', 1, 0 ) ), 0 ) AS endNum,
82
-        IFNULL( SUM( IF ( TO_DAYS(t.expire_date) &gt;= TO_DAYS(NOW()) AND t.process_node  LIKE '02%', 1, 0 ) ), 0 )  AS assignedNum,
83
-        IFNULL( SUM( IF ( TO_DAYS(t.expire_date) &lt; TO_DAYS(NOW()) AND t.process_node  LIKE '02%', 1, 0 ) ), 0 ) AS expireNum
80
+        UUID_SHORT( ) AS id,
81
+        IFNULL( SUM( IF ( t.process_node = '03', 1, 0 ) ), 0 ) AS endNum,
82
+        IFNULL( SUM( IF ( TO_DAYS(t.expire_date) &gt;= TO_DAYS(NOW()) AND t.process_node LIKE '02%', 1, 0 ) ), 0 ) AS
83
+        assignedNum,
84
+        IFNULL( SUM( IF ( TO_DAYS(t.expire_date) &lt; TO_DAYS(NOW()) AND t.process_node LIKE '02%', 1, 0 ) ), 0 ) AS
85
+        expireNum
84 86
         FROM
85
-            ta_issue t
87
+        ta_issue t
86 88
         WHERE
87
-            t.org_id = #{orgId}
88
-            AND t.`status` &gt; -1
89
+        t.org_id = #{orgId}
90
+        AND t.`status` &gt; -1
89 91
     </select>
90 92
     <select id="statIssueType" resultType="com.example.civilizedcity.vo.StatVo">
91 93
         SELECT
92
-            *
94
+        *
93 95
         FROM
94
-            (
95
-                SELECT
96
-                    t.`name`,
97
-                    sum( IF ( s.issue_id IS NULL, 0, 1 ) ) AS `value`
98
-                FROM
99
-                    td_issue_type t
100
-                        LEFT JOIN ta_issue s ON s.type_id = t.type_id
101
-                        AND s.`status` &gt; - 1
102
-                GROUP BY
103
-                    t.type_id
104
-            ) a
96
+        (
97
+        SELECT
98
+        t.`name`,
99
+        sum( IF ( s.issue_id IS NULL, 0, 1 ) ) AS `value`
100
+        FROM
101
+        td_issue_type t
102
+        LEFT JOIN ta_issue s ON s.type_id = t.type_id
103
+        AND s.`status` &gt; - 1
104
+        GROUP BY
105
+        t.type_id
106
+        ) a
105 107
         ORDER BY
106
-            a.`value` DESC
108
+        a.`value` DESC
107 109
     </select>
108 110
     <select id="statIssueLoc" resultType="com.example.civilizedcity.vo.StatVo">
109 111
         SELECT
110
-            *
112
+        *
111 113
         FROM
112
-            (
113
-                SELECT
114
-                    t.`name`,
115
-                    ifnull( s.cnt, 0 ) AS `value`
116
-                FROM
117
-                    td_loc_type t
118
-                        LEFT JOIN (
119
-                        SELECT
120
-                            a.loc_id,
121
-                            count( 1 ) AS cnt
122
-                        FROM
123
-                            ta_issue a
124
-                        WHERE
125
-                            a.`status` > - 1
126
-                        GROUP BY
127
-                            a.loc_id
128
-                    ) s ON t.type_id = s.loc_id
129
-            ) m
114
+        (
115
+        SELECT
116
+        t.`name`,
117
+        ifnull( s.cnt, 0 ) AS `value`
118
+        FROM
119
+        td_loc_type t
120
+        LEFT JOIN (
121
+        SELECT
122
+        a.loc_id,
123
+        count( 1 ) AS cnt
124
+        FROM
125
+        ta_issue a
126
+        WHERE
127
+        a.`status` > - 1
128
+        GROUP BY
129
+        a.loc_id
130
+        ) s ON t.type_id = s.loc_id
131
+        ) m
130 132
         ORDER BY
131
-            m.`value` DESC
133
+        m.`value` DESC
134
+    </select>
135
+
136
+
137
+    <select id="expectRubNum" resultType="java.lang.Long">
138
+        SELECT
139
+        COUNT( 1 ) AS rubNum
140
+        FROM
141
+        `ta_issue` s
142
+        WHERE
143
+        s.`status` = 1
144
+        AND s.process_node != '03'
145
+        AND TO_DAYS( s.expire_date ) &lt;
146
+        TO_DAYS( NOW( ) )
147
+        AND s.org_id = #{orgId}
148
+    </select>
149
+
150
+
151
+    <select id="AssignedRubNum" resultType="java.lang.Long">
152
+        SELECT
153
+        COUNT(1) as rubNum
154
+        FROM
155
+        `ta_issue` s
156
+        WHERE
157
+        s.`status` = 1
158
+        AND s.process_node LIKE '01'
159
+        AND s.org_id = #{orgId}
132 160
     </select>
133 161
 </mapper>