张涛 2 年之前
父節點
當前提交
bbfbfdea4a

+ 10071
- 0
db/.back_文明创办/文明创办-backup-20230522103529.chnr.json
文件差異過大導致無法顯示
查看文件


+ 2
- 1
db/upgrade.1.1.sql 查看文件

8
 
8
 
9
 
9
 
10
 ALTER TABLE `ta_issue`
10
 ALTER TABLE `ta_issue`
11
-ADD COLUMN source_type2 varchar(32) NULL COMMENT 'PC问题来源: check 模拟测评  feedback 市民上报  inspector 督查员上报' AFTER copy_from;
11
+ADD COLUMN source_type2 varchar(32) NULL COMMENT 'PC问题来源: check 模拟测评  feedback 市民上报  inspector 督查员上报' AFTER copy_from;
12
+

+ 19
- 7
src/main/java/com/example/civilizedcity/controller/TaCheckController.java 查看文件

5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.example.civilizedcity.common.*;
6
 import com.example.civilizedcity.common.*;
7
 import com.example.civilizedcity.entity.SysUser;
7
 import com.example.civilizedcity.entity.SysUser;
8
-import com.example.civilizedcity.entity.TaCheckItem;
8
+import com.example.civilizedcity.entity.TaCheck;
9
 import com.example.civilizedcity.service.TaCheckItemService;
9
 import com.example.civilizedcity.service.TaCheckItemService;
10
+import com.example.civilizedcity.service.TaCheckService;
10
 import com.example.civilizedcity.vo.CheckLocExport;
11
 import com.example.civilizedcity.vo.CheckLocExport;
11
 import io.swagger.annotations.Api;
12
 import io.swagger.annotations.Api;
12
 import io.swagger.annotations.ApiOperation;
13
 import io.swagger.annotations.ApiOperation;
14
 import org.springframework.beans.factory.annotation.Autowired;
15
 import org.springframework.beans.factory.annotation.Autowired;
15
 import org.springframework.beans.factory.annotation.Value;
16
 import org.springframework.beans.factory.annotation.Value;
16
 import org.springframework.web.bind.annotation.*;
17
 import org.springframework.web.bind.annotation.*;
17
-import com.example.civilizedcity.entity.TaCheck;
18
-import com.example.civilizedcity.service.TaCheckService;
19
 
18
 
20
 import javax.servlet.http.HttpServletResponse;
19
 import javax.servlet.http.HttpServletResponse;
21
 import java.io.FileInputStream;
20
 import java.io.FileInputStream;
35
 @RequestMapping("/")
34
 @RequestMapping("/")
36
 public class TaCheckController extends BaseController {
35
 public class TaCheckController extends BaseController {
37
 
36
 
37
+    @Value("${yz.excel.tpl.check}")
38
+    String tplPath;
38
     @Autowired
39
     @Autowired
39
     private TaCheckService taCheckService;
40
     private TaCheckService taCheckService;
40
-
41
     @Autowired
41
     @Autowired
42
     private TaCheckItemService taCheckItemService;
42
     private TaCheckItemService taCheckItemService;
43
 
43
 
44
-    @Value("${yz.excel.tpl.check}")
45
-    String tplPath;
46
-
47
     /**
44
     /**
48
      * 通过ID查询单条数据
45
      * 通过ID查询单条数据
49
      *
46
      *
172
     private Double getVal(Double d) {
169
     private Double getVal(Double d) {
173
         return null == d ? 0.0 : d;
170
         return null == d ? 0.0 : d;
174
     }
171
     }
172
+
175
     private Integer getVal(Integer d) {
173
     private Integer getVal(Integer d) {
176
         return null == d ? 0 : d;
174
         return null == d ? 0 : d;
177
     }
175
     }
237
         taCheckService.removeLogicById(id);
235
         taCheckService.removeLogicById(id);
238
         return ResponseBean.success("success");
236
         return ResponseBean.success("success");
239
     }
237
     }
238
+
239
+    /**
240
+     * 同步点位分类
241
+     *
242
+     * @checkId
243
+     */
244
+
245
+    @ApiOperation("通过id来同步点位")
246
+    @PutMapping("/taCheck/{checkId}/sync")
247
+    public ResponseBean syncPoint(@ApiParam("对象ID") @PathVariable String checkId) {
248
+        taCheckItemService.syncLoc(checkId);
249
+        taCheckItemService.updateLoc(checkId);
250
+        return ResponseBean.success("success");
251
+    }
240
 }
252
 }

+ 4
- 0
src/main/java/com/example/civilizedcity/mapper/TaCheckItemMapper.java 查看文件

38
     int calcScore(@Param("checkId") String checkId);
38
     int calcScore(@Param("checkId") String checkId);
39
 
39
 
40
     List<CheckLocExport> getExportByCheck(@Param("checkId") String checkId, @Param("itemType") String itemType);
40
     List<CheckLocExport> getExportByCheck(@Param("checkId") String checkId, @Param("itemType") String itemType);
41
+
42
+    void updateLoc(@Param("checkId") String checkId);
43
+
44
+    void syncLoc(@Param("checkId") String checkId);
41
 }
45
 }

+ 5
- 1
src/main/java/com/example/civilizedcity/service/TaCheckItemService.java 查看文件

25
      boolean updateFullScore(String itemId);
25
      boolean updateFullScore(String itemId);
26
 
26
 
27
      List<CheckLocExport> getExportByCheck(String checkId, String itemType);
27
      List<CheckLocExport> getExportByCheck(String checkId, String itemType);
28
- }
28
+
29
+     void updateLoc(String checkId);
30
+
31
+     void syncLoc(String checkId);
32
+}

+ 12
- 1
src/main/java/com/example/civilizedcity/service/impl/TaCheckItemServiceImpl.java 查看文件

2
 
2
 
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.example.civilizedcity.common.Constants;
4
 import com.example.civilizedcity.common.Constants;
5
-import com.example.civilizedcity.common.NumberUtil;
6
 import com.example.civilizedcity.common.StringUtils;
5
 import com.example.civilizedcity.common.StringUtils;
7
 import com.example.civilizedcity.entity.*;
6
 import com.example.civilizedcity.entity.*;
8
 import com.example.civilizedcity.mapper.*;
7
 import com.example.civilizedcity.mapper.*;
123
         return baseMapper.getExportByCheck(checkId, itemType);
122
         return baseMapper.getExportByCheck(checkId, itemType);
124
     }
123
     }
125
 
124
 
125
+    @Override
126
+    public void updateLoc(String checkId){
127
+        baseMapper.updateLoc(checkId);
128
+    }
129
+    @Override
130
+    public void syncLoc(String checkId){
131
+        baseMapper.syncLoc(checkId);
132
+    }
133
+
126
     /**
134
     /**
127
      * 作答计算分数
135
      * 作答计算分数
128
      * 试卷总分 = 每一题分数求和
136
      * 试卷总分 = 每一题分数求和
284
     private TaCheckItemQu getQu(List<TaCheckItemQu> quList, String quId) {
292
     private TaCheckItemQu getQu(List<TaCheckItemQu> quList, String quId) {
285
         return quList.stream().filter(q -> q.getQuId().equals(quId)).findFirst().orElse(null);
293
         return quList.stream().filter(q -> q.getQuId().equals(quId)).findFirst().orElse(null);
286
     }
294
     }
295
+
296
+
297
+
287
 }
298
 }

+ 1
- 1
src/main/resources/application-dev.yml 查看文件

26
     prefix: http://127.0.0.1:8000
26
     prefix: http://127.0.0.1:8000
27
   excel:
27
   excel:
28
     tpl:
28
     tpl:
29
-      check: E:\work\civilized_city\service\src\main\resources\check_tpl.xlsx
29
+      check: E:\work\Java+web\07霍山\service\src\main\resources\check_tpl.xlsx
30
 
30
 
31
 wx:
31
 wx:
32
   miniapp:
32
   miniapp:

+ 104
- 80
src/main/resources/mapper/TaCheckItemMapper.xml 查看文件

5
     <insert id="createNewLocItems">
5
     <insert id="createNewLocItems">
6
         INSERT INTO ta_check_item (item_id, check_id, item_type, type_id, `name`)
6
         INSERT INTO ta_check_item (item_id, check_id, item_type, type_id, `name`)
7
         SELECT
7
         SELECT
8
-            UUID_SHORT(),
9
-            #{checkId},
10
-            'loc',
11
-            t.type_id,
12
-            t.`name`
8
+        UUID_SHORT(),
9
+        #{checkId},
10
+        'loc',
11
+        t.type_id,
12
+        t.`name`
13
         FROM
13
         FROM
14
-            td_loc_type t
14
+        td_loc_type t
15
         WHERE
15
         WHERE
16
-            t.`status` &gt; -1
16
+        t.`status` &gt; -1
17
         ORDER BY
17
         ORDER BY
18
-            t.sort_no ASC
18
+        t.sort_no ASC
19
     </insert>
19
     </insert>
20
     <insert id="copyItems">
20
     <insert id="copyItems">
21
         insert into ta_check_item (
21
         insert into ta_check_item (
22
-            `item_id`,
23
-            `copy_from`,
24
-            `check_id`,
25
-            `item_type`,
26
-            `type_id`,
27
-            `name`,
28
-            `full_score`,
29
-            `num`,
30
-            `status`,
31
-            `create_date`
22
+        `item_id`,
23
+        `copy_from`,
24
+        `check_id`,
25
+        `item_type`,
26
+        `type_id`,
27
+        `name`,
28
+        `full_score`,
29
+        `num`,
30
+        `status`,
31
+        `create_date`
32
         )
32
         )
33
         select
33
         select
34
-            UUID_SHORT(),
35
-            t.`item_id`,
36
-            #{newCheckId},
37
-            t.`item_type`,
38
-            t.`type_id`,
39
-            t.`name`,
40
-            t.`full_score`,
41
-            t.`num`,
42
-            1,
43
-            now()
34
+        UUID_SHORT(),
35
+        t.`item_id`,
36
+        #{newCheckId},
37
+        t.`item_type`,
38
+        t.`type_id`,
39
+        t.`name`,
40
+        t.`full_score`,
41
+        t.`num`,
42
+        1,
43
+        now()
44
         from ta_check_item t
44
         from ta_check_item t
45
         WHERE t.check_id = #{oldCheckId}
45
         WHERE t.check_id = #{oldCheckId}
46
-          and t.`status` = 1
46
+        and t.`status` = 1
47
     </insert>
47
     </insert>
48
+
49
+    <insert id="syncLoc">
50
+        INSERT INTO ta_check_item(`item_id`,`type_id`,`name`,`create_date`,
51
+        `status`,`num`,`full_score`,`item_type`,`copy_from`,`check_id`)
52
+        SELECT
53
+        UUID_SHORT(), s.type_id ,s.name,now(),1,null,null,'loc',null, #{checkId}
54
+        FROM
55
+        td_loc_type s
56
+        WHERE
57
+        s.`status` = 1 AND
58
+        s.type_id NOT IN ( SELECT t.type_id FROM ta_check_item t WHERE t.`status` = 1 AND t.check_id = #{checkId}
59
+        AND t.item_type = "loc" )
60
+    </insert>
61
+
62
+    <update id="updateLoc">
63
+        UPDATE ta_check_item c inner join td_loc_type l ON c.type_id = l.type_id
64
+        SET c.status = l.status
65
+        WHERE c.check_id = #{checkId}
66
+    </update>
67
+
48
     <update id="updateFullScore">
68
     <update id="updateFullScore">
49
         UPDATE ta_check_item t
69
         UPDATE ta_check_item t
50
         SET t.full_score = ( SELECT sum( s.max_score ) FROM ta_check_item_qu s WHERE s.item_id = #{itemId} )
70
         SET t.full_score = ( SELECT sum( s.max_score ) FROM ta_check_item_qu s WHERE s.item_id = #{itemId} )
51
         WHERE
71
         WHERE
52
-            t.item_id = #{itemId}
72
+        t.item_id = #{itemId}
53
     </update>
73
     </update>
54
     <update id="calcScore">
74
     <update id="calcScore">
55
         UPDATE ta_check_item t
75
         UPDATE ta_check_item t
56
         SET t.score = ( SELECT sum( s.score ) FROM ta_check_answer s WHERE s.item_id = t.item_id )
76
         SET t.score = ( SELECT sum( s.score ) FROM ta_check_answer s WHERE s.item_id = t.item_id )
57
         WHERE
77
         WHERE
58
-            t.check_id = #{checkId}
78
+        t.check_id = #{checkId}
59
     </update>
79
     </update>
60
 
80
 
81
+
82
+
61
     <select id="getPageBy" resultType="com.example.civilizedcity.entity.TaCheckItem">
83
     <select id="getPageBy" resultType="com.example.civilizedcity.entity.TaCheckItem">
62
         SELECT
84
         SELECT
63
-            IFNULL(m.num, 0) as answer_num,
64
-            t.*
85
+        IFNULL(m.num, 0) as answer_num,
86
+        t.*
65
         FROM
87
         FROM
66
-            ta_check_item t
67
-            INNER JOIN ta_check c ON c.check_id = t.check_id
68
-            <if test="itemType != null and itemType == 'loc'">
69
-                INNER JOIN td_loc_type s ON t.type_id = s.type_id
70
-            </if>
71
-            LEFT JOIN (
72
-                SELECT
73
-                    a.item_id,
74
-                    COUNT( * ) AS num
75
-                FROM
76
-                    ta_check_answer a
77
-                WHERE
78
-                    a.check_id = #{checkId}
79
-                GROUP BY
80
-                    a.item_id
81
-            ) m ON m.item_id = t.item_id
88
+        ta_check_item t
89
+        INNER JOIN ta_check c ON c.check_id = t.check_id
90
+        <if test="itemType != null and itemType == 'loc'">
91
+            INNER JOIN td_loc_type s ON t.type_id = s.type_id
92
+        </if>
93
+        LEFT JOIN (
94
+        SELECT
95
+        a.item_id,
96
+        COUNT( * ) AS num
97
+        FROM
98
+        ta_check_answer a
99
+        WHERE
100
+        a.check_id = #{checkId}
101
+        GROUP BY
102
+        a.item_id
103
+        ) m ON m.item_id = t.item_id
82
         WHERE
104
         WHERE
83
-            t.check_id = #{checkId}
84
-          AND t.item_type = #{itemType}
85
-          AND t.`status` &gt; -1
105
+        t.check_id = #{checkId}
106
+        AND t.item_type = #{itemType}
107
+        AND t.`status` &gt; -1
86
         ORDER BY
108
         ORDER BY
87
         <if test="itemType != null and itemType == 'loc'">
109
         <if test="itemType != null and itemType == 'loc'">
88
             s.sort_no ASC
110
             s.sort_no ASC
93
     </select>
115
     </select>
94
     <select id="getListBy" resultType="com.example.civilizedcity.entity.TaCheckItem">
116
     <select id="getListBy" resultType="com.example.civilizedcity.entity.TaCheckItem">
95
         SELECT
117
         SELECT
96
-            t.*
118
+        t.*
97
         FROM
119
         FROM
98
-            ta_check_item t
120
+        ta_check_item t
99
         WHERE
121
         WHERE
100
-            t.check_id = #{checkId}
101
-          AND t.item_type = #{itemType}
102
-          AND t.`status` &gt; -1
122
+        t.check_id = #{checkId}
123
+        AND t.item_type = #{itemType}
124
+        AND t.`status` &gt; -1
103
     </select>
125
     </select>
104
     <select id="sumEvlScore" resultType="java.lang.Double">
126
     <select id="sumEvlScore" resultType="java.lang.Double">
105
         SELECT
127
         SELECT
106
         IF (
128
         IF (
107
-            sum( m.cnt ) IS NULL OR sum( m.cnt ) = 0 , 0 , SUM( t.score ) / SUM( m.cnt )
108
-            ) as score
129
+        sum( m.cnt ) IS NULL OR sum( m.cnt ) = 0 , 0 , SUM( t.score ) / SUM( m.cnt )
130
+        ) as score
109
         FROM
131
         FROM
110
         ta_check_item t
132
         ta_check_item t
111
-            LEFT JOIN (
112
-                SELECT
113
-                    s.item_id,
114
-                    count(*) AS cnt
115
-                FROM
116
-                    ta_check_answer s
117
-                WHERE
118
-                    s.item_id = #{itemId}
119
-                ) m ON t.item_id = m.item_id
133
+        LEFT JOIN (
134
+        SELECT
135
+        s.item_id,
136
+        count(*) AS cnt
137
+        FROM
138
+        ta_check_answer s
139
+        WHERE
140
+        s.item_id = #{itemId}
141
+        ) m ON t.item_id = m.item_id
120
         WHERE t.item_id = #{itemId};
142
         WHERE t.item_id = #{itemId};
121
     </select>
143
     </select>
122
     <select id="sumScore" resultType="java.lang.Double">
144
     <select id="sumScore" resultType="java.lang.Double">
123
         SELECT
145
         SELECT
124
-            SUM( t.score )
146
+        SUM( t.score )
125
         FROM
147
         FROM
126
-            ta_check_item t
148
+        ta_check_item t
127
         WHERE
149
         WHERE
128
-            t.check_id = #{checkId}
129
-          AND t.item_type = #{itemType}
130
-          AND t.`status` > - 1;
131
-</select>
150
+        t.check_id = #{checkId}
151
+        AND t.item_type = #{itemType}
152
+        AND t.`status` > - 1;
153
+    </select>
132
     <select id="getExportByCheck" resultType="com.example.civilizedcity.vo.CheckLocExport">
154
     <select id="getExportByCheck" resultType="com.example.civilizedcity.vo.CheckLocExport">
133
 
155
 
134
         SELECT
156
         SELECT
135
-            t.*,
136
-            t.full_score * t.num AS subtotal
157
+        t.*,
158
+        t.full_score * t.num AS subtotal
137
         FROM
159
         FROM
138
-            ta_check_item t
160
+        ta_check_item t
139
         WHERE
161
         WHERE
140
-            t.check_id = #{checkId}
141
-          AND t.item_type = #{itemType}
142
-          AND t.`status` &gt; -1
162
+        t.check_id = #{checkId}
163
+        AND t.item_type = #{itemType}
164
+        AND t.`status` &gt; -1
143
     </select>
165
     </select>
144
 
166
 
167
+
168
+
145
 </mapper>
169
 </mapper>

+ 1
- 0
src/main/resources/mapper/TaCheckMapper.xml 查看文件

24
                 count( 1 ) AS num
24
                 count( 1 ) AS num
25
                 FROM
25
                 FROM
26
                 ta_check_item a
26
                 ta_check_item a
27
+                    INNER JOIN  ta_check_answer s ON s.item_id = a.item_id
27
                 WHERE
28
                 WHERE
28
                 a.check_id = #{checkId}
29
                 a.check_id = #{checkId}
29
                 AND a.item_type = 'survey'
30
                 AND a.item_type = 'survey'

+ 3
- 3
src/main/resources/mapper/TaIssueMapper.xml 查看文件

78
     <select id="statIssueOrg" resultType="java.util.Map">
78
     <select id="statIssueOrg" resultType="java.util.Map">
79
         SELECT
79
         SELECT
80
             UUID_SHORT( ) AS id,
80
             UUID_SHORT( ) AS id,
81
-            IFNULL( SUM( IF ( t.process_node = '03', t.process_num, 0 ) ), 0 ) AS endNum,
82
-            IFNULL( SUM( IF ( t.process_node LIKE '02%', t.process_num, 0 ) ), 0 ) AS assignedNum,
83
-            IFNULL( SUM( IF ( TO_DAYS(t.expire_date) &lt; TO_DAYS(NOW()) AND t.process_node != '03', t.process_num, 0 ) ), 0 ) AS expireNum
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
84
         FROM
84
         FROM
85
             ta_issue t
85
             ta_issue t
86
         WHERE
86
         WHERE