소스 검색

Merge branch 'dev1.0' of http://git.ycjcjy.com/civilized_city/service into dev1.0

Yansen 1 년 전
부모
커밋
1e99e6d89a

db/.back_文明创办/文明创办-backup-2023510115646.pdma.json → db/.back_文明创办/文明创办-backup-20230522103529.chnr.json 파일 보기


db/.back_文明创办/文明创办-backup-2023330100554.pdma.json → db/.back_文明创办/文明创办-backup-2023518101923.pdma.json 파일 보기

@@ -2,9 +2,9 @@
2 2
   "name": "文明创办",
3 3
   "describe": "文明创办",
4 4
   "avatar": "",
5
-  "version": "4.1.4",
5
+  "version": "4.1.1",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-3-27 19:12:07",
7
+  "updatedTime": "2023-5-10 11:56:46",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -494,7 +494,8 @@
494 494
         "hideInGraph": true
495 495
       }
496 496
     ],
497
-    "modelType": "modalGroup"
497
+    "modelType": "modalGroup",
498
+    "menuWidth": "250px"
498 499
   },
499 500
   "entities": [
500 501
     {
@@ -4936,6 +4937,40 @@
4936 4937
           "domain": "",
4937 4938
           "id": "52C74C06-CC1C-416E-B913-78B500CE30A2"
4938 4939
         },
4940
+        {
4941
+          "defKey": "loc_num",
4942
+          "defName": "实地测评份数",
4943
+          "comment": "",
4944
+          "type": "",
4945
+          "len": "",
4946
+          "scale": "",
4947
+          "primaryKey": false,
4948
+          "notNull": false,
4949
+          "autoIncrement": false,
4950
+          "defaultValue": "",
4951
+          "hideInGraph": false,
4952
+          "refDict": "",
4953
+          "extProps": {},
4954
+          "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
4955
+          "id": "FC14EB4B-E1C2-411A-A051-0D3C15002B61"
4956
+        },
4957
+        {
4958
+          "defKey": "survey_num",
4959
+          "defName": "调查问卷份数",
4960
+          "comment": "",
4961
+          "type": "",
4962
+          "len": "",
4963
+          "scale": "",
4964
+          "primaryKey": false,
4965
+          "notNull": false,
4966
+          "autoIncrement": false,
4967
+          "defaultValue": "",
4968
+          "hideInGraph": false,
4969
+          "refDict": "",
4970
+          "extProps": {},
4971
+          "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
4972
+          "id": "DAA70103-78D7-46A9-98F8-87963984C229"
4973
+        },
4939 4974
         {
4940 4975
           "defKey": "status",
4941 4976
           "defName": "状态",

+ 10071
- 0
db/.back_文明创办/文明创办-backup-2023518112005.pdma.json
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


db/.back_文明创办/文明创办-backup-2023415134743.pdma.json → db/.back_文明创办/文明创办-backup-2023518112034.pdma.json 파일 보기

@@ -2,9 +2,9 @@
2 2
   "name": "文明创办",
3 3
   "describe": "文明创办",
4 4
   "avatar": "",
5
-  "version": "4.1.4",
5
+  "version": "4.1.1",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-3-30 10:05:54",
7
+  "updatedTime": "2023-5-18 11:20:05",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -494,7 +494,8 @@
494 494
         "hideInGraph": true
495 495
       }
496 496
     ],
497
-    "modelType": "modalGroup"
497
+    "modelType": "modalGroup",
498
+    "menuWidth": "250px"
498 499
   },
499 500
   "entities": [
500 501
     {
@@ -4936,6 +4937,40 @@
4936 4937
           "domain": "",
4937 4938
           "id": "52C74C06-CC1C-416E-B913-78B500CE30A2"
4938 4939
         },
4940
+        {
4941
+          "defKey": "loc_num",
4942
+          "defName": "实地测评份数",
4943
+          "comment": "",
4944
+          "type": "",
4945
+          "len": "",
4946
+          "scale": "",
4947
+          "primaryKey": false,
4948
+          "notNull": false,
4949
+          "autoIncrement": false,
4950
+          "defaultValue": "",
4951
+          "hideInGraph": false,
4952
+          "refDict": "",
4953
+          "extProps": {},
4954
+          "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
4955
+          "id": "FC14EB4B-E1C2-411A-A051-0D3C15002B61"
4956
+        },
4957
+        {
4958
+          "defKey": "survey_num",
4959
+          "defName": "调查问卷份数",
4960
+          "comment": "",
4961
+          "type": "",
4962
+          "len": "",
4963
+          "scale": "",
4964
+          "primaryKey": false,
4965
+          "notNull": false,
4966
+          "autoIncrement": false,
4967
+          "defaultValue": "",
4968
+          "hideInGraph": false,
4969
+          "refDict": "",
4970
+          "extProps": {},
4971
+          "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
4972
+          "id": "DAA70103-78D7-46A9-98F8-87963984C229"
4973
+        },
4939 4974
         {
4940 4975
           "defKey": "status",
4941 4976
           "defName": "状态",

+ 7
- 1
db/upgrade.1.1.sql 파일 보기

@@ -8,4 +8,10 @@ ALTER TABLE `sys_org`
8 8
 
9 9
 
10 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
+
13
+<<<<<<< HEAD
14
+=======
15
+ALTER TABLE `ta_check_answer`
16
+    ADD COLUMN `card_title` varchar(255) NULL COMMENT '卡片名称(小程序端,新建定位时显示的名称)' AFTER `user_name`;
17
+>>>>>>> 09c481190cc5ad63c138fc86136b4595e7934ae3

+ 18
- 1
db/文明创办.pdma.json 파일 보기

@@ -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-10 11:56:46",
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": [],

+ 7
- 0
pom.xml 파일 보기

@@ -43,6 +43,13 @@
43 43
             <scope>test</scope>
44 44
         </dependency>
45 45
 
46
+        <!--fastjson start-->
47
+        <dependency>
48
+            <groupId>com.alibaba</groupId>
49
+            <artifactId>fastjson</artifactId>
50
+            <version>1.2.56</version>
51
+        </dependency>
52
+        <!--fastjson end-->
46 53
 
47 54
         <!--oss start-->
48 55
         <dependency>

+ 87
- 0
src/main/java/com/example/civilizedcity/common/HttpUtils.java 파일 보기

@@ -0,0 +1,87 @@
1
+//package com.example.civilizedcity.common;
2
+//
3
+//import org.springframework.http.*;
4
+//import org.springframework.stereotype.Component;
5
+//import org.springframework.web.client.RestTemplate;
6
+//
7
+//import java.io.UnsupportedEncodingException;
8
+//import java.net.URLDecoder;
9
+//import java.util.*;
10
+//
11
+//@Component
12
+//public class HttpUtils {
13
+//    public String get(String url) throws Exception {
14
+//        RestTemplate restTemplate = new RestTemplate();
15
+//        HttpHeaders headers = new HttpHeaders();
16
+//        headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
17
+//        HttpEntity<String> entity = new HttpEntity<String>(headers);
18
+//
19
+//        Map<String, Object> urlAndParams = parseURL(url);
20
+//        String formatURL = (String) urlAndParams.get("url");
21
+//        Map<String, String> params = (Map<String, String>) urlAndParams.get("params");
22
+//
23
+//        ResponseEntity<String> resp = restTemplate.exchange(formatURL, HttpMethod.GET, entity, String.class, params);
24
+//        return resp.getBody();
25
+//    }
26
+//
27
+//    public String post(String url, Map<String, String> header, String body) throws Exception {
28
+//        RestTemplate restTemplate = new RestTemplate();
29
+//        HttpHeaders headers = new HttpHeaders();
30
+//        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
31
+//        headers.setContentType(type);
32
+//        headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
33
+//        headers.setAll(header);
34
+//        HttpEntity<String> entity = new HttpEntity<String>(body, headers);
35
+//
36
+//        Map<String, Object> urlAndParams = parseURL(url);
37
+//        String formatURL = (String) urlAndParams.get("url");
38
+//        Map<String, String> params = (Map<String, String>) urlAndParams.get("params");
39
+//
40
+//        ResponseEntity<String> resp = restTemplate.exchange(formatURL, HttpMethod.POST, entity, String.class, params);
41
+//        return resp.getBody();
42
+//    }
43
+//
44
+//    // RestTemplate 不能正常的处理 querystring, 必须按照约定的方式处理
45
+//    private Map<String, Object> parseURL(String url) {
46
+//        Map<String, Object> res = new HashMap<>();
47
+//
48
+//        String[] parts = url.split("\\?");
49
+//        String baseURL = parts[0];
50
+//
51
+//        if (parts.length < 2) {
52
+//            res.put("url", baseURL);
53
+//            res.put("params", new HashMap<>());
54
+//            return res;
55
+//        }
56
+//
57
+//
58
+//        String[] fields = parts[1].split("&");
59
+//        Map<String, String> params = new HashMap<>();
60
+//        List<String> searchList = new ArrayList<>();
61
+//        for (String field : fields) {
62
+//            String[] pairs = field.split("=");
63
+//            if (2 != pairs.length) {
64
+//                continue;
65
+//            }
66
+//
67
+//            try {
68
+//                String key = URLDecoder.decode(pairs[0].trim(), "UTF-8");
69
+//                String val = URLDecoder.decode(pairs[1].trim(), "UTF-8");
70
+//
71
+//                // 转化为 "foo={foo}" 这种字符串
72
+//                searchList.add(String.format("%s={%s}", key, key));
73
+//                // 把 foo 对应的值存储起来
74
+//                params.put(key, val);
75
+//            } catch (UnsupportedEncodingException e) {
76
+//                e.printStackTrace();
77
+//            }
78
+//        }
79
+//
80
+//        // url 格式类似 http://foo.org/bar?name={name}
81
+//        String formatURL = baseURL + "?" + String.join("&", searchList);
82
+//        res.put("url", formatURL);
83
+//        res.put("params", params);
84
+//
85
+//        return res;
86
+//    }
87
+//}

+ 65
- 0
src/main/java/com/example/civilizedcity/common/SMSUtils.java 파일 보기

@@ -0,0 +1,65 @@
1
+//package com.example.civilizedcity.common;
2
+//
3
+//import com.alibaba.fastjson.JSONObject;
4
+//import lombok.Data;
5
+//import lombok.experimental.Accessors;
6
+//import lombok.extern.slf4j.Slf4j;
7
+//import org.springframework.beans.factory.InitializingBean;
8
+//import org.springframework.beans.factory.annotation.Autowired;
9
+//import org.springframework.beans.factory.annotation.Value;
10
+//import org.springframework.scheduling.annotation.EnableAsync;
11
+//import org.springframework.scheduling.annotation.EnableScheduling;
12
+//import org.springframework.stereotype.Component;
13
+//
14
+//import java.util.HashMap;
15
+//import java.util.Map;
16
+//
17
+//@Slf4j
18
+//@Component
19
+//@EnableScheduling //开启定时任务
20
+//@EnableAsync  //开启多线程
21
+//public class SMSUtils implements InitializingBean {
22
+//    @Autowired
23
+//    HttpUtils httpUtils;
24
+//    @Value("${yz.sms.api}")
25
+//    String smsAPI;
26
+//
27
+//    @Value("${yz.sms.appid}")
28
+//    String appid;
29
+//
30
+//    //    @Async
31
+////    @Scheduled(cron = "0 30 8 * * ?") //时隔多少秒
32
+//    public void SendMessage(Message message) throws Exception {
33
+//        long nowMills = System.currentTimeMillis();
34
+//        String timestamp = String.valueOf(nowMills);
35
+//        String secret = appid + timestamp;
36
+//
37
+//        Map<String, String> header = new HashMap<>();
38
+//        header.put("x-appid", appid);
39
+//        header.put("x-timestamp", timestamp);
40
+//        header.put("x-sign", EncryptUtils.md5(appid + secret, timestamp));
41
+//
42
+//        Map<String, String> body = new HashMap<>();
43
+//        body.put("PhoneNumbers", message.getTel());
44
+//        body.put("SignName", message.getSign());
45
+//        body.put("TemplateCode", message.getCode());
46
+//        body.put("TemplateParam", message.getContent());
47
+//
48
+//        httpUtils.post(smsAPI, header, JSONObject.toJSONString(body, false));
49
+//
50
+//    }
51
+//
52
+//    @Override
53
+//    public void afterPropertiesSet() throws Exception {
54
+//    }
55
+//
56
+//    @Data
57
+//    @Accessors(chain = true)
58
+//    public static class Message {
59
+//        String code;
60
+//        String tel;
61
+//        String sign;
62
+//        String content;
63
+//    }
64
+//
65
+//}

+ 19
- 7
src/main/java/com/example/civilizedcity/controller/TaCheckController.java 파일 보기

@@ -5,8 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.example.civilizedcity.common.*;
7 7
 import com.example.civilizedcity.entity.SysUser;
8
-import com.example.civilizedcity.entity.TaCheckItem;
8
+import com.example.civilizedcity.entity.TaCheck;
9 9
 import com.example.civilizedcity.service.TaCheckItemService;
10
+import com.example.civilizedcity.service.TaCheckService;
10 11
 import com.example.civilizedcity.vo.CheckLocExport;
11 12
 import io.swagger.annotations.Api;
12 13
 import io.swagger.annotations.ApiOperation;
@@ -14,8 +15,6 @@ import io.swagger.annotations.ApiParam;
14 15
 import org.springframework.beans.factory.annotation.Autowired;
15 16
 import org.springframework.beans.factory.annotation.Value;
16 17
 import org.springframework.web.bind.annotation.*;
17
-import com.example.civilizedcity.entity.TaCheck;
18
-import com.example.civilizedcity.service.TaCheckService;
19 18
 
20 19
 import javax.servlet.http.HttpServletResponse;
21 20
 import java.io.FileInputStream;
@@ -35,15 +34,13 @@ import java.util.Map;
35 34
 @RequestMapping("/")
36 35
 public class TaCheckController extends BaseController {
37 36
 
37
+    @Value("${yz.excel.tpl.check}")
38
+    String tplPath;
38 39
     @Autowired
39 40
     private TaCheckService taCheckService;
40
-
41 41
     @Autowired
42 42
     private TaCheckItemService taCheckItemService;
43 43
 
44
-    @Value("${yz.excel.tpl.check}")
45
-    String tplPath;
46
-
47 44
     /**
48 45
      * 通过ID查询单条数据
49 46
      *
@@ -172,6 +169,7 @@ public class TaCheckController extends BaseController {
172 169
     private Double getVal(Double d) {
173 170
         return null == d ? 0.0 : d;
174 171
     }
172
+
175 173
     private Integer getVal(Integer d) {
176 174
         return null == d ? 0 : d;
177 175
     }
@@ -237,4 +235,18 @@ public class TaCheckController extends BaseController {
237 235
         taCheckService.removeLogicById(id);
238 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
 }

+ 5
- 0
src/main/java/com/example/civilizedcity/entity/TaCheckAnswer.java 파일 보기

@@ -87,4 +87,9 @@ public class TaCheckAnswer implements Serializable,Cloneable{
87 87
      @TableField(exist = false)
88 88
      @ApiModelProperty(name = "点位名称",notes = "")
89 89
      private String typeName ;
90
+
91
+
92
+     /** 卡片名称 */
93
+     @ApiModelProperty(name = "卡片名称",notes = "")
94
+     private String cardTitle ;
90 95
 }

+ 1
- 0
src/main/java/com/example/civilizedcity/entity/TaCheckItem.java 파일 보기

@@ -94,4 +94,5 @@ public class TaCheckItem implements Serializable, Cloneable {
94 94
     @TableField(exist = false)
95 95
     @ApiModelProperty(name = "是否只读, 只读代表不需要答题")
96 96
     private Integer answerNum;
97
+
97 98
 }

+ 4
- 0
src/main/java/com/example/civilizedcity/mapper/TaCheckItemMapper.java 파일 보기

@@ -38,4 +38,8 @@ public interface TaCheckItemMapper  extends BaseMapper<TaCheckItem>{
38 38
     int calcScore(@Param("checkId") String checkId);
39 39
 
40 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,4 +25,8 @@ public interface TaCheckItemService extends IBaseService<TaCheckItem> {
25 25
      boolean updateFullScore(String itemId);
26 26
 
27 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,7 +2,6 @@ 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.NumberUtil;
6 5
 import com.example.civilizedcity.common.StringUtils;
7 6
 import com.example.civilizedcity.entity.*;
8 7
 import com.example.civilizedcity.mapper.*;
@@ -123,6 +122,15 @@ public class TaCheckItemServiceImpl extends BaseServiceImpl<TaCheckItemMapper, T
123 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,4 +292,7 @@ public class TaCheckItemServiceImpl extends BaseServiceImpl<TaCheckItemMapper, T
284 292
     private TaCheckItemQu getQu(List<TaCheckItemQu> quList, String quId) {
285 293
         return quList.stream().filter(q -> q.getQuId().equals(quId)).findFirst().orElse(null);
286 294
     }
295
+
296
+
297
+
287 298
 }

+ 5
- 1
src/main/java/com/example/civilizedcity/service/impl/TaFeedbackServiceImpl.java 파일 보기

@@ -5,9 +5,9 @@ import com.example.civilizedcity.common.Constants;
5 5
 import com.example.civilizedcity.common.StringUtils;
6 6
 import com.example.civilizedcity.entity.*;
7 7
 import com.example.civilizedcity.mapper.*;
8
+import com.example.civilizedcity.service.TaFeedbackService;
8 9
 import org.springframework.beans.factory.annotation.Autowired;
9 10
 import org.springframework.stereotype.Service;
10
-import com.example.civilizedcity.service.TaFeedbackService;
11 11
 import org.springframework.transaction.annotation.Transactional;
12 12
 
13 13
 import java.time.LocalDateTime;
@@ -139,6 +139,10 @@ public class TaFeedbackServiceImpl extends BaseServiceImpl<TaFeedbackMapper, TaF
139 139
             processStatus = Constants.APPLY_REJECT;
140 140
         }
141 141
 
142
+        if (processList.size() == 0) {
143
+            processList = null;
144
+        }
145
+
142 146
         return baseMapper.getPageBy(pg, personId, processList, processStatus);
143 147
     }
144 148
 }

+ 1
- 1
src/main/resources/application-dev.yml 파일 보기

@@ -26,7 +26,7 @@ yz:
26 26
     prefix: http://127.0.0.1:8000
27 27
   excel:
28 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 31
 wx:
32 32
   miniapp:

+ 107
- 81
src/main/resources/mapper/TaCheckItemMapper.xml 파일 보기

@@ -5,84 +5,106 @@
5 5
     <insert id="createNewLocItems">
6 6
         INSERT INTO ta_check_item (item_id, check_id, item_type, type_id, `name`)
7 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 13
         FROM
14
-            td_loc_type t
14
+        td_loc_type t
15 15
         WHERE
16
-            t.`status` &gt; -1
16
+        t.`status` &gt; -1
17 17
         ORDER BY
18
-            t.sort_no ASC
18
+        t.sort_no ASC
19 19
     </insert>
20 20
     <insert id="copyItems">
21 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 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 44
         from ta_check_item t
45 45
         WHERE t.check_id = #{oldCheckId}
46
-          and t.`status` = 1
46
+        and t.`status` = 1
47 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 68
     <update id="updateFullScore">
49 69
         UPDATE ta_check_item t
50 70
         SET t.full_score = ( SELECT sum( s.max_score ) FROM ta_check_item_qu s WHERE s.item_id = #{itemId} )
51 71
         WHERE
52
-            t.item_id = #{itemId}
72
+        t.item_id = #{itemId}
53 73
     </update>
54 74
     <update id="calcScore">
55 75
         UPDATE ta_check_item t
56 76
         SET t.score = ( SELECT sum( s.score ) FROM ta_check_answer s WHERE s.item_id = t.item_id )
57 77
         WHERE
58
-            t.check_id = #{checkId}
78
+        t.check_id = #{checkId}
59 79
     </update>
60 80
 
81
+
82
+
61 83
     <select id="getPageBy" resultType="com.example.civilizedcity.entity.TaCheckItem">
62 84
         SELECT
63
-            IFNULL(m.num, 0) as answer_num,
64
-            t.*
85
+        IFNULL(m.num, 0) as answer_num,
86
+        t.*
87
+        FROM
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
65 97
         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
98
+        ta_check_answer a
82 99
         WHERE
83
-            t.check_id = #{checkId}
84
-          AND t.item_type = #{itemType}
85
-          AND t.`status` &gt; -1
100
+        a.check_id = #{checkId}
101
+        GROUP BY
102
+        a.item_id
103
+        ) m ON m.item_id = t.item_id
104
+        WHERE
105
+        t.check_id = #{checkId}
106
+        AND t.item_type = #{itemType}
107
+        AND t.`status` &gt; -1
86 108
         ORDER BY
87 109
         <if test="itemType != null and itemType == 'loc'">
88 110
             s.sort_no ASC
@@ -93,53 +115,57 @@
93 115
     </select>
94 116
     <select id="getListBy" resultType="com.example.civilizedcity.entity.TaCheckItem">
95 117
         SELECT
96
-            t.*
118
+        t.*
97 119
         FROM
98
-            ta_check_item t
120
+        ta_check_item t
99 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 125
     </select>
104 126
     <select id="sumEvlScore" resultType="java.lang.Double">
105 127
         SELECT
106 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 131
         FROM
110 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 142
         WHERE t.item_id = #{itemId};
121 143
     </select>
122 144
     <select id="sumScore" resultType="java.lang.Double">
123 145
         SELECT
124
-            SUM( t.score )
146
+        SUM( t.score )
125 147
         FROM
126
-            ta_check_item t
148
+        ta_check_item t
127 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 154
     <select id="getExportByCheck" resultType="com.example.civilizedcity.vo.CheckLocExport">
133
-
134 155
         SELECT
135
-            t.*,
136
-            t.full_score * t.num AS subtotal
156
+        t.*,
157
+        t.full_score * t.num AS subtotal,
158
+        l.sort_no
137 159
         FROM
138
-            ta_check_item t
160
+        ta_check_item t INNER JOIN td_loc_type l ON l.type_id=t.type_id
139 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
165
+        order by l.sort_no ASC
166
+
143 167
     </select>
144 168
 
169
+
170
+
145 171
 </mapper>

+ 1
- 0
src/main/resources/mapper/TaCheckMapper.xml 파일 보기

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

+ 3
- 3
src/main/resources/mapper/TaIssueMapper.xml 파일 보기

@@ -78,9 +78,9 @@
78 78
     <select id="statIssueOrg" resultType="java.util.Map">
79 79
         SELECT
80 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 84
         FROM
85 85
             ta_issue t
86 86
         WHERE