Pārlūkot izejas kodu

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

张涛 2 gadus atpakaļ
vecāks
revīzija
85c1bfe726

db/.back_文明创办/文明创办-backup-2023323142510.pdma.json → db/.back_文明创办/文明创办-backup-202358163328.pdma.json Parādīt failu

2
   "name": "文明创办",
2
   "name": "文明创办",
3
   "describe": "文明创办",
3
   "describe": "文明创办",
4
   "avatar": "",
4
   "avatar": "",
5
-  "version": "4.1.4",
5
+  "version": "4.1.1",
6
   "createdTime": "2022-12-12 09:36:12",
6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-3-23 14:24:15",
7
+  "updatedTime": "2023-4-15 13:47:43",
8
   "dbConns": [],
8
   "dbConns": [],
9
   "profile": {
9
   "profile": {
10
     "default": {
10
     "default": {
493
         "refKey": "extProps",
493
         "refKey": "extProps",
494
         "hideInGraph": true
494
         "hideInGraph": true
495
       }
495
       }
496
-    ]
496
+    ],
497
+    "modelType": "modalGroup",
498
+    "menuWidth": "250px"
497
   },
499
   },
498
   "entities": [
500
   "entities": [
499
     {
501
     {
3911
           "refDict": "",
3913
           "refDict": "",
3912
           "uiHint": "",
3914
           "uiHint": "",
3913
           "id": "7FF626A4-AF1C-4CF5-B356-D46DB6D534B3"
3915
           "id": "7FF626A4-AF1C-4CF5-B356-D46DB6D534B3"
3916
+        },
3917
+        {
3918
+          "defKey": "copy_from",
3919
+          "defName": "复制来源",
3920
+          "comment": "",
3921
+          "type": "",
3922
+          "len": "",
3923
+          "scale": "",
3924
+          "primaryKey": false,
3925
+          "notNull": false,
3926
+          "autoIncrement": false,
3927
+          "defaultValue": "",
3928
+          "hideInGraph": false,
3929
+          "refDict": "",
3930
+          "extProps": {},
3931
+          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
3932
+          "id": "1F85BFC4-DBF4-4BA5-9BD8-DC9C2BFA1646"
3914
         }
3933
         }
3915
       ],
3934
       ],
3916
       "correlations": [],
3935
       "correlations": [],
6477
           "extProps": {},
6496
           "extProps": {},
6478
           "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
6497
           "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
6479
           "id": "A8365D64-DE0A-4F0E-9427-83DFF0ED66C6"
6498
           "id": "A8365D64-DE0A-4F0E-9427-83DFF0ED66C6"
6499
+        },
6500
+        {
6501
+          "defKey": "copy_from",
6502
+          "defName": "拷贝来源",
6503
+          "comment": "",
6504
+          "type": "",
6505
+          "len": "",
6506
+          "scale": "",
6507
+          "primaryKey": false,
6508
+          "notNull": false,
6509
+          "autoIncrement": false,
6510
+          "defaultValue": "",
6511
+          "hideInGraph": false,
6512
+          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
6513
+          "refDict": "",
6514
+          "extProps": {},
6515
+          "id": "E2BA367C-D262-43FB-A729-D26D6453D20C"
6480
         }
6516
         }
6481
       ],
6517
       ],
6482
       "correlations": [],
6518
       "correlations": [],
7702
           "refDict": "",
7738
           "refDict": "",
7703
           "extProps": {},
7739
           "extProps": {},
7704
           "id": "90218D19-7731-4AFE-8883-74944A66D6C8"
7740
           "id": "90218D19-7731-4AFE-8883-74944A66D6C8"
7741
+        },
7742
+        {
7743
+          "defKey": "copy_from",
7744
+          "defName": "拷贝来源",
7745
+          "comment": "",
7746
+          "type": "",
7747
+          "len": "",
7748
+          "scale": "",
7749
+          "primaryKey": false,
7750
+          "notNull": false,
7751
+          "autoIncrement": false,
7752
+          "defaultValue": "",
7753
+          "hideInGraph": false,
7754
+          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
7755
+          "refDict": "",
7756
+          "extProps": {},
7757
+          "id": "C0B26905-831F-4891-9B83-F84E4D111C44"
7705
         }
7758
         }
7706
       ],
7759
       ],
7707
       "correlations": [],
7760
       "correlations": [],

+ 36
- 2
db/文明创办.pdma.json Parādīt failu

2
   "name": "文明创办",
2
   "name": "文明创办",
3
   "describe": "文明创办",
3
   "describe": "文明创办",
4
   "avatar": "",
4
   "avatar": "",
5
-  "version": "4.1.1",
5
+  "version": "4.1.4",
6
   "createdTime": "2022-12-12 09:36:12",
6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-4-15 13:47:43",
7
+  "updatedTime": "2023-5-8 16:33:28",
8
   "dbConns": [],
8
   "dbConns": [],
9
   "profile": {
9
   "profile": {
10
     "default": {
10
     "default": {
4937
           "domain": "",
4937
           "domain": "",
4938
           "id": "52C74C06-CC1C-416E-B913-78B500CE30A2"
4938
           "id": "52C74C06-CC1C-416E-B913-78B500CE30A2"
4939
         },
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
+        },
4940
         {
4974
         {
4941
           "defKey": "status",
4975
           "defKey": "status",
4942
           "defName": "状态",
4976
           "defName": "状态",

+ 25
- 2
pom.xml Parādīt failu

10
     </parent>
10
     </parent>
11
     <groupId>com.example</groupId>
11
     <groupId>com.example</groupId>
12
     <artifactId>civilizedCity</artifactId>
12
     <artifactId>civilizedCity</artifactId>
13
-    <version>0.0.16</version>
13
+    <version>0.0.17</version>
14
     <name>civilizedCity</name>
14
     <name>civilizedCity</name>
15
     <description>civilizedCity</description>
15
     <description>civilizedCity</description>
16
     <properties>
16
     <properties>
76
         <dependency>
76
         <dependency>
77
             <groupId>com.alibaba</groupId>
77
             <groupId>com.alibaba</groupId>
78
             <artifactId>easyexcel</artifactId>
78
             <artifactId>easyexcel</artifactId>
79
-            <version>3.1.3</version>
79
+            <version>3.3.1</version>
80
         </dependency>
80
         </dependency>
81
 
81
 
82
         <!--mybatis-plus start-->
82
         <!--mybatis-plus start-->
158
                 </configuration>
158
                 </configuration>
159
             </plugin>
159
             </plugin>
160
 
160
 
161
+            <plugin>
162
+                <groupId>org.apache.maven.plugins</groupId>
163
+                <artifactId>maven-resources-plugin</artifactId>
164
+                <executions>
165
+                    <execution>
166
+                        <phase>package</phase>
167
+                        <goals>
168
+                            <goal>copy-resources</goal>
169
+                        </goals>
170
+                        <configuration>
171
+                            <outputDirectory>${project.build.directory}/config</outputDirectory>
172
+                            <resources>
173
+                                <resource>
174
+                                    <include>*.xlsx</include>
175
+                                    <include>application.yml</include>
176
+                                    <include>application-${profileActive}.yml</include>
177
+                                </resource>
178
+                            </resources>
179
+                        </configuration>
180
+                    </execution>
181
+                </executions>
182
+            </plugin>
183
+
161
             <plugin>
184
             <plugin>
162
                 <groupId>org.apache.maven.plugins</groupId>
185
                 <groupId>org.apache.maven.plugins</groupId>
163
                 <artifactId>maven-dependency-plugin</artifactId>
186
                 <artifactId>maven-dependency-plugin</artifactId>

+ 30
- 0
src/main/java/com/example/civilizedcity/common/ExcelUtils.java Parādīt failu

6
 import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder;
6
 import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder;
7
 import com.alibaba.excel.write.handler.WriteHandler;
7
 import com.alibaba.excel.write.handler.WriteHandler;
8
 import com.alibaba.excel.write.metadata.WriteSheet;
8
 import com.alibaba.excel.write.metadata.WriteSheet;
9
+import com.alibaba.excel.write.metadata.fill.FillConfig;
9
 
10
 
10
 import javax.servlet.http.HttpServletResponse;
11
 import javax.servlet.http.HttpServletResponse;
11
 import java.io.IOException;
12
 import java.io.IOException;
13
+import java.io.InputStream;
12
 import java.util.List;
14
 import java.util.List;
15
+import java.util.Map;
13
 
16
 
14
 public class ExcelUtils {
17
 public class ExcelUtils {
15
 
18
 
30
         EasyExcel.write(response.getOutputStream(), dataClass).sheet("sheet1").doWrite(data);
33
         EasyExcel.write(response.getOutputStream(), dataClass).sheet("sheet1").doWrite(data);
31
     }
34
     }
32
 
35
 
36
+
37
+
38
+    /**
39
+     * 发送 excel 到客户端
40
+     * 暂时只支持单 sheet 页
41
+     * @param response
42
+     * @param data
43
+     * @param fileName
44
+     * @throws IOException
45
+     */
46
+    public static void flushFile(HttpServletResponse response, InputStream tplFile, Class dataClass, List data, Map<String, Object> otherData, String fileName) throws IOException {
47
+        response.setContentType("application/vnd.ms-excel");
48
+        response.setCharacterEncoding("utf-8");
49
+        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
50
+        response.setHeader("Content-Disposition", "attachment;filename="+StringUtils.urlEncode(fileName)+".xlsx");
51
+
52
+
53
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), dataClass).withTemplate(tplFile).build();
54
+        WriteSheet writeSheet = EasyExcel.writerSheet().build();
55
+        FillConfig fillConfig1 = FillConfig.builder().forceNewRow(true).build();
56
+//        FillConfig fillConfig2 = FillConfig.builder().autoStyle(true).build();
57
+
58
+        excelWriter.fill(data, fillConfig1, writeSheet);
59
+        excelWriter.fill(otherData, writeSheet);
60
+        excelWriter.finish();
61
+    }
62
+
33
     /**
63
     /**
34
      * 导出, 支持复杂一点的自定义
64
      * 导出, 支持复杂一点的自定义
35
      * @param response
65
      * @param response

+ 65
- 0
src/main/java/com/example/civilizedcity/controller/TaCheckController.java Parādīt failu

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.TaCheckItem;
9
 import com.example.civilizedcity.service.TaCheckItemService;
9
 import com.example.civilizedcity.service.TaCheckItemService;
10
+import com.example.civilizedcity.vo.CheckLocExport;
10
 import io.swagger.annotations.Api;
11
 import io.swagger.annotations.Api;
11
 import io.swagger.annotations.ApiOperation;
12
 import io.swagger.annotations.ApiOperation;
12
 import io.swagger.annotations.ApiParam;
13
 import io.swagger.annotations.ApiParam;
13
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.beans.factory.annotation.Value;
14
 import org.springframework.web.bind.annotation.*;
16
 import org.springframework.web.bind.annotation.*;
15
 import com.example.civilizedcity.entity.TaCheck;
17
 import com.example.civilizedcity.entity.TaCheck;
16
 import com.example.civilizedcity.service.TaCheckService;
18
 import com.example.civilizedcity.service.TaCheckService;
17
 
19
 
20
+import javax.servlet.http.HttpServletResponse;
21
+import java.io.FileInputStream;
22
+import java.io.InputStream;
23
+import java.util.HashMap;
24
+import java.util.List;
25
+import java.util.Map;
26
+
18
 /**
27
 /**
19
  * 模拟测评;(ta_check)表控制层
28
  * 模拟测评;(ta_check)表控制层
20
  *
29
  *
32
     @Autowired
41
     @Autowired
33
     private TaCheckItemService taCheckItemService;
42
     private TaCheckItemService taCheckItemService;
34
 
43
 
44
+    @Value("${yz.excel.tpl.check}")
45
+    String tplPath;
46
+
35
     /**
47
     /**
36
      * 通过ID查询单条数据
48
      * 通过ID查询单条数据
37
      *
49
      *
112
     }
124
     }
113
 
125
 
114
 
126
 
127
+    /**
128
+     * 导出实地测评
129
+     *
130
+     * @param taCheck 实例对象
131
+     * @return 实例对象
132
+     */
133
+    @ApiOperation("导出实地测评")
134
+    @PostMapping("/taCheck/{id}/loc/export")
135
+    public ResponseBean exportLoc(@ApiParam("对象ID") @PathVariable String id,
136
+                                  HttpServletResponse response) throws Exception {
137
+        TaCheck taCheck = taCheckService.getById(id);
138
+        List<CheckLocExport> list = taCheckItemService.getExportByCheck(id, Constants.CHECK_OF_LOC);
139
+        if (null == list) {
140
+            return ResponseBean.error("当前测评数据不正确");
141
+        }
142
+
143
+        Double totalFullScore = 0.0;
144
+        Integer totalAnswerNum = 0;
145
+        Integer totalNum = 0;
146
+        Double totalSubtotal = 0.0;
147
+        Double totalScore = 0.0;
148
+
149
+        for (CheckLocExport item : list) {
150
+            totalFullScore += getVal(item.getFullScore());
151
+            totalAnswerNum += getVal(item.getAnswerNum());
152
+            totalNum += getVal(item.getNum());
153
+            totalSubtotal += getVal(item.getSubtotal());
154
+            totalScore += getVal(item.getScore());
155
+        }
156
+
157
+        String title = taCheck.getTitle() + " 实地测评";
158
+        Map<String, Object> map = new HashMap<>();
159
+        map.put("totalFullScore", totalFullScore);
160
+        map.put("totalAnswerNum", totalAnswerNum);
161
+        map.put("totalNum", totalNum);
162
+        map.put("totalSubtotal", totalSubtotal);
163
+        map.put("totalScore", totalScore);
164
+        map.put("title", title);
165
+
166
+        InputStream tpl = new FileInputStream(tplPath);
167
+        ExcelUtils.flushFile(response, tpl, CheckLocExport.class, list, map, title);
168
+
169
+        return null;
170
+    }
171
+
172
+    private Double getVal(Double d) {
173
+        return null == d ? 0.0 : d;
174
+    }
175
+    private Integer getVal(Integer d) {
176
+        return null == d ? 0 : d;
177
+    }
178
+
179
+
115
     /**
180
     /**
116
      * 复制
181
      * 复制
117
      *
182
      *

+ 6
- 0
src/main/java/com/example/civilizedcity/entity/TaCheck.java Parādīt failu

39
        /** 调查问卷得分 */
39
        /** 调查问卷得分 */
40
        @ApiModelProperty(name = "调查问卷得分",notes = "")
40
        @ApiModelProperty(name = "调查问卷得分",notes = "")
41
        private Double surveyScore ;
41
        private Double surveyScore ;
42
+     /** 实地测评得分 */
43
+     @ApiModelProperty(name = "实地测评份数",notes = "")
44
+     private Integer locNum ;
45
+     /** 调查问卷得分 */
46
+     @ApiModelProperty(name = "调查问卷份数",notes = "")
47
+     private Integer surveyNum ;
42
      /** 实地测评得分占比 */
48
      /** 实地测评得分占比 */
43
      @ApiModelProperty(name = "实地测评得分占比",notes = "")
49
      @ApiModelProperty(name = "实地测评得分占比",notes = "")
44
      private Double locScorePercent ;
50
      private Double locScorePercent ;

+ 4
- 1
src/main/java/com/example/civilizedcity/mapper/TaCheckItemMapper.java Parādīt failu

4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.example.civilizedcity.entity.SysUser;
5
 import com.example.civilizedcity.entity.SysUser;
6
 import com.example.civilizedcity.entity.TaCheck;
6
 import com.example.civilizedcity.entity.TaCheck;
7
+import com.example.civilizedcity.vo.CheckLocExport;
7
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Param;
9
 import org.apache.ibatis.annotations.Param;
9
 import com.example.civilizedcity.entity.TaCheckItem;
10
 import com.example.civilizedcity.entity.TaCheckItem;
28
 
29
 
29
     long copyItems(@Param("oldCheckId") String oldCheckId, @Param("newCheckId") String newCheckId);
30
     long copyItems(@Param("oldCheckId") String oldCheckId, @Param("newCheckId") String newCheckId);
30
 
31
 
31
-    double sumScore(@Param("checkId") String checkId, @Param("itemType") String itemType);
32
+    Double sumScore(@Param("checkId") String checkId, @Param("itemType") String itemType);
32
 
33
 
33
     double sumEvlScore(@Param("itemId") String itemId);
34
     double sumEvlScore(@Param("itemId") String itemId);
34
 
35
 
35
     boolean updateFullScore(@Param("itemId") String itemId);
36
     boolean updateFullScore(@Param("itemId") String itemId);
36
 
37
 
37
     int calcScore(@Param("checkId") String checkId);
38
     int calcScore(@Param("checkId") String checkId);
39
+
40
+    List<CheckLocExport> getExportByCheck(@Param("checkId") String checkId, @Param("itemType") String itemType);
38
 }
41
 }

+ 5
- 3
src/main/java/com/example/civilizedcity/mapper/TaCheckMapper.java Parādīt failu

3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import org.apache.ibatis.annotations.Mapper;
4
 import org.apache.ibatis.annotations.Mapper;
5
 import com.example.civilizedcity.entity.TaCheck;
5
 import com.example.civilizedcity.entity.TaCheck;
6
+import org.apache.ibatis.annotations.Param;
6
 
7
 
7
- /**
8
+/**
8
  * 模拟测评;(ta_mock_check)表数据库访问层
9
  * 模拟测评;(ta_mock_check)表数据库访问层
9
  * @author : http://njyunzhi.com
10
  * @author : http://njyunzhi.com
10
  * @date : 2022-12-12
11
  * @date : 2022-12-12
11
  */
12
  */
12
 @Mapper
13
 @Mapper
13
 public interface TaCheckMapper extends BaseMapper<TaCheck>{
14
 public interface TaCheckMapper extends BaseMapper<TaCheck>{
14
-    
15
-}
15
+
16
+     int updateScore(@Param("checkId") String checkId);
17
+ }

+ 6
- 1
src/main/java/com/example/civilizedcity/service/TaCheckItemService.java Parādīt failu

5
 import com.example.civilizedcity.entity.TaCheck;
5
 import com.example.civilizedcity.entity.TaCheck;
6
 import com.example.civilizedcity.entity.TaCheckAnswer;
6
 import com.example.civilizedcity.entity.TaCheckAnswer;
7
 import com.example.civilizedcity.entity.TaCheckItem;
7
 import com.example.civilizedcity.entity.TaCheckItem;
8
+import com.example.civilizedcity.vo.CheckLocExport;
8
 
9
 
9
- /**
10
+import java.util.List;
11
+
12
+/**
10
  * 测评点位;(ta_check_item)表服务接口
13
  * 测评点位;(ta_check_item)表服务接口
11
  * @author : http://njyunzhi.com
14
  * @author : http://njyunzhi.com
12
  * @date : 2022-12-13
15
  * @date : 2022-12-13
20
      void answer(TaCheckItem taCheckItem, TaCheckAnswer taCheckAnswer, SysUser sysUser) throws Exception;
23
      void answer(TaCheckItem taCheckItem, TaCheckAnswer taCheckAnswer, SysUser sysUser) throws Exception;
21
 
24
 
22
      boolean updateFullScore(String itemId);
25
      boolean updateFullScore(String itemId);
26
+
27
+     List<CheckLocExport> getExportByCheck(String checkId, String itemType);
23
  }
28
  }

+ 6
- 0
src/main/java/com/example/civilizedcity/service/impl/TaCheckItemServiceImpl.java Parādīt failu

6
 import com.example.civilizedcity.common.StringUtils;
6
 import com.example.civilizedcity.common.StringUtils;
7
 import com.example.civilizedcity.entity.*;
7
 import com.example.civilizedcity.entity.*;
8
 import com.example.civilizedcity.mapper.*;
8
 import com.example.civilizedcity.mapper.*;
9
+import com.example.civilizedcity.vo.CheckLocExport;
9
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.stereotype.Service;
11
 import org.springframework.stereotype.Service;
11
 import com.example.civilizedcity.service.TaCheckItemService;
12
 import com.example.civilizedcity.service.TaCheckItemService;
117
         return baseMapper.updateFullScore(itemId);
118
         return baseMapper.updateFullScore(itemId);
118
     }
119
     }
119
 
120
 
121
+    @Override
122
+    public List<CheckLocExport> getExportByCheck(String checkId, String itemType) {
123
+        return baseMapper.getExportByCheck(checkId, itemType);
124
+    }
125
+
120
     /**
126
     /**
121
      * 作答计算分数
127
      * 作答计算分数
122
      * 试卷总分 = 每一题分数求和
128
      * 试卷总分 = 每一题分数求和

+ 18
- 10
src/main/java/com/example/civilizedcity/service/impl/TaCheckServiceImpl.java Parādīt failu

39
 
39
 
40
         taCheckItemMapper.calcScore(taCheck.getCheckId());
40
         taCheckItemMapper.calcScore(taCheck.getCheckId());
41
 
41
 
42
-        // 调查问卷分数
43
-        double surveyScore = taCheckItemMapper.sumScore(taCheck.getCheckId(), Constants.CHECK_OF_SURVEY);
44
-
45
-        // 计算点位分数
46
-        double locScore = taCheckItemMapper.sumScore(taCheck.getCheckId(), Constants.CHECK_OF_LOC);
47
-
48
-        taCheck.setLocScore(locScore);
49
-        taCheck.setSurveyScore(surveyScore);
50
-
51
-        updateById(taCheck);
42
+        baseMapper.updateScore(taCheck.getCheckId());
43
+
44
+//        // 调查问卷分数
45
+//        Double surveyScore = taCheckItemMapper.sumScore(taCheck.getCheckId(), Constants.CHECK_OF_SURVEY);
46
+//        if (surveyScore == null) {
47
+//            surveyScore = 0.0;
48
+//        }
49
+//
50
+//        // 计算点位分数
51
+//        Double locScore = taCheckItemMapper.sumScore(taCheck.getCheckId(), Constants.CHECK_OF_LOC);
52
+//        if (locScore == null) {
53
+//            locScore = 0.0;
54
+//        }
55
+//
56
+//        taCheck.setLocScore(locScore);
57
+//        taCheck.setSurveyScore(surveyScore);
58
+//
59
+//        updateById(taCheck);
52
 
60
 
53
         return taCheck;
61
         return taCheck;
54
     }
62
     }

+ 9
- 0
src/main/java/com/example/civilizedcity/vo/CheckLocExport.java Parādīt failu

1
+package com.example.civilizedcity.vo;
2
+
3
+import com.example.civilizedcity.entity.TaCheckItem;
4
+import lombok.Data;
5
+
6
+@Data
7
+public class CheckLocExport extends TaCheckItem {
8
+    Double subtotal;
9
+}

+ 3
- 0
src/main/resources/application-dev.yml Parādīt failu

24
   upload:
24
   upload:
25
     path: E:\work\public-upload
25
     path: E:\work\public-upload
26
     prefix: http://127.0.0.1:8000
26
     prefix: http://127.0.0.1:8000
27
+  excel:
28
+    tpl:
29
+      check: E:\work\civilized_city\service\src\main\resources\check_tpl.xlsx
27
 
30
 
28
 wx:
31
 wx:
29
   miniapp:
32
   miniapp:

Binārs
src/main/resources/check_tpl.xlsx Parādīt failu


+ 12
- 0
src/main/resources/mapper/TaCheckItemMapper.xml Parādīt failu

129
           AND t.item_type = #{itemType}
129
           AND t.item_type = #{itemType}
130
           AND t.`status` > - 1;
130
           AND t.`status` > - 1;
131
 </select>
131
 </select>
132
+    <select id="getExportByCheck" resultType="com.example.civilizedcity.vo.CheckLocExport">
133
+
134
+        SELECT
135
+            t.*,
136
+            t.full_score * t.num AS subtotal
137
+        FROM
138
+            ta_check_item t
139
+        WHERE
140
+            t.check_id = #{checkId}
141
+          AND t.item_type = #{itemType}
142
+          AND t.`status` &gt; -1
143
+    </select>
132
 
144
 
133
 </mapper>
145
 </mapper>

+ 34
- 1
src/main/resources/mapper/TaCheckMapper.xml Parādīt failu

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 
3
 
4
 <mapper namespace="com.example.civilizedcity.mapper.TaCheckMapper">
4
 <mapper namespace="com.example.civilizedcity.mapper.TaCheckMapper">
5
-    
5
+
6
+    <update id="updateScore">
7
+        UPDATE ta_check t
8
+            INNER JOIN (
9
+                SELECT
10
+                a.check_id,
11
+                sum( a.score ) AS score,
12
+                count( 1 ) AS num
13
+                FROM
14
+                ta_check_item a
15
+                WHERE
16
+                a.check_id = #{checkId}
17
+                AND a.item_type = 'loc'
18
+                AND a.`status` = 1
19
+            ) m ON m.check_id = t.check_id
20
+            INNER JOIN (
21
+                SELECT
22
+                a.check_id,
23
+                sum( a.score ) AS score,
24
+                count( 1 ) AS num
25
+                FROM
26
+                ta_check_item a
27
+                WHERE
28
+                a.check_id = #{checkId}
29
+                AND a.item_type = 'survey'
30
+                AND a.`status` = 1
31
+            ) n ON n.check_id = t.check_id
32
+            SET t.loc_score = m.score,
33
+                t.loc_num = m.num,
34
+                t.survey_score = n.score,
35
+                t.survey_num = n.num
36
+        WHERE
37
+            t.check_id = #{checkId}
38
+    </update>
6
 </mapper>
39
 </mapper>