Browse Source

批量导入功能异常问题修改

ly 5 months ago
parent
commit
f04d11a791

+ 17 - 4
src/main/java/com/liang/controller/LsUserController.java

@@ -39,6 +39,7 @@ import java.io.InputStream;
39
 import java.nio.file.Path;
39
 import java.nio.file.Path;
40
 import java.nio.file.Paths;
40
 import java.nio.file.Paths;
41
 import java.text.DateFormat;
41
 import java.text.DateFormat;
42
+import java.text.ParseException;
42
 import java.text.SimpleDateFormat;
43
 import java.text.SimpleDateFormat;
43
 import java.time.LocalDate;
44
 import java.time.LocalDate;
44
 import java.time.format.DateTimeFormatter;
45
 import java.time.format.DateTimeFormatter;
@@ -248,6 +249,17 @@ public class LsUserController {
248
             // 开始解析这个文件
249
             // 开始解析这个文件
249
             List<List<String>> spreadsheetData = parseSpreadsheet(file.getInputStream(), fileExtension);
250
             List<List<String>> spreadsheetData = parseSpreadsheet(file.getInputStream(), fileExtension);
250
             System.out.println(spreadsheetData);
251
             System.out.println(spreadsheetData);
252
+            // 循环比较 spreadsheetData 中的 长度 是否与 各个元素相等
253
+            for (int i = 0;i<spreadsheetData.size();i++){
254
+                SysLsUserEntity sysLsUserEntity = new SysLsUserEntity();
255
+                if (spreadsheetData.get(i).size()!= spreadsheetData.get(0).size()){
256
+                    sysLsUserEntity.setXm(String.valueOf(i+1));
257
+                    sysLsUserEntity.setXmfzr("请将第"+(i+1)+"条数据补充完整");
258
+                    lists.add(sysLsUserEntity);
259
+                    spreadsheetData.remove(i);
260
+                }
261
+                continue;
262
+            }
251
             spreadsheetData.remove(0);
263
             spreadsheetData.remove(0);
252
             List<SysLsUserEntity> list = new ArrayList<>();
264
             List<SysLsUserEntity> list = new ArrayList<>();
253
             for (List<String> row : spreadsheetData) {
265
             for (List<String> row : spreadsheetData) {
@@ -262,12 +274,11 @@ public class LsUserController {
262
                 employee.setZy(row.get(6));
274
                 employee.setZy(row.get(6));
263
                 employee.setQpsj(dateUtil.convertDate(row.get(7)));
275
                 employee.setQpsj(dateUtil.convertDate(row.get(7)));
264
                 employee.setDqsj(dateUtil.convertDate(row.get(8)));
276
                 employee.setDqsj(dateUtil.convertDate(row.get(8)));
277
+                System.out.println(row.get(9));
265
                 employee.setGznr(row.get(9));
278
                 employee.setGznr(row.get(9));
266
                 // 将对象添加到列表中
279
                 // 将对象添加到列表中
267
                 list.add(employee);
280
                 list.add(employee);
268
             }
281
             }
269
-            System.out.println(list);
270
-
271
             for(int i = 0; i<list.size();i++){
282
             for(int i = 0; i<list.size();i++){
272
                 SysLsUserEntity sysLsUserEntity = new SysLsUserEntity();
283
                 SysLsUserEntity sysLsUserEntity = new SysLsUserEntity();
273
                 // 校验合同起始时间和到期时间是否在三个月 内
284
                 // 校验合同起始时间和到期时间是否在三个月 内
@@ -302,18 +313,20 @@ public class LsUserController {
302
                Integer mum = lsUserService.saveOperLog(list.get(i));
313
                Integer mum = lsUserService.saveOperLog(list.get(i));
303
                if (mum > 0){
314
                if (mum > 0){
304
                    h++;
315
                    h++;
305
-                   continue;
316
+                   // 循环比较 spreadsheetData 中的 长度 是否与 各个元素相等
306
                }
317
                }
307
             }
318
             }
308
         }catch (Exception a){
319
         }catch (Exception a){
309
             a.printStackTrace();
320
             a.printStackTrace();
321
+            h++;
310
         }
322
         }
311
-
312
         // 获取文件名后缀
323
         // 获取文件名后缀
313
         if (h == 0){
324
         if (h == 0){
314
             return BaseResult.failure(43,"成员录入失败,人员已存在!");
325
             return BaseResult.failure(43,"成员录入失败,人员已存在!");
315
         }
326
         }
316
         return BaseResult.success("成员录入成功",lists);
327
         return BaseResult.success("成员录入成功",lists);
328
+
329
+
317
     }
330
     }
318
     private List<List<String>> parseSpreadsheet(InputStream inputStream, String fileExtension) throws IOException {
331
     private List<List<String>> parseSpreadsheet(InputStream inputStream, String fileExtension) throws IOException {
319
         Workbook workbook = null;
332
         Workbook workbook = null;

+ 0 - 1
src/main/java/com/liang/controller/StaMeetingFeeController.java

@@ -4,7 +4,6 @@ import com.github.pagehelper.PageInfo;
4
 import com.liang.common.JsonTool;
4
 import com.liang.common.JsonTool;
5
 import com.liang.common.base.BaseController;
5
 import com.liang.common.base.BaseController;
6
 import com.liang.common.base.BaseResult;
6
 import com.liang.common.base.BaseResult;
7
-import com.liang.entity.StaIntellectualProperty;
8
 import com.liang.entity.StaMeetingFee;
7
 import com.liang.entity.StaMeetingFee;
9
 import com.liang.service.StaMeetingFeeService;
8
 import com.liang.service.StaMeetingFeeService;
10
 import org.springframework.data.domain.Page;
9
 import org.springframework.data.domain.Page;

+ 0 - 2
src/main/resources/mapper/LsUserDao.xml

@@ -53,7 +53,6 @@
53
                 ,XB
53
                 ,XB
54
                 ,SFZH
54
                 ,SFZH
55
                 ,PHONE
55
                 ,PHONE
56
-
57
                 ,BYXX
56
                 ,BYXX
58
                 ,ZY
57
                 ,ZY
59
                 ,XL
58
                 ,XL
@@ -75,7 +74,6 @@
75
                 ,#{xb}
74
                 ,#{xb}
76
                 ,#{sfzh}
75
                 ,#{sfzh}
77
                 ,#{phone}
76
                 ,#{phone}
78
-
79
                 ,#{byxy}
77
                 ,#{byxy}
80
                 ,#{zy}
78
                 ,#{zy}
81
                 ,#{xl}
79
                 ,#{xl}

+ 37 - 17
src/main/resources/templates/statistical/indirectCosts.html

@@ -23,36 +23,56 @@
23
             <legend>搜索信息(<b>收起-展开</b>)</legend>
23
             <legend>搜索信息(<b>收起-展开</b>)</legend>
24
             <div id="search-div" style="margin: 5px 10px -10px 0px">
24
             <div id="search-div" style="margin: 5px 10px -10px 0px">
25
                 <form class="layui-form" action="" lay-filter="search-form">
25
                 <form class="layui-form" action="" lay-filter="search-form">
26
-                    <div class="layui-form-item">
27
-                        <div class="layui-inline">
28
-                            <label class="layui-form-label" style="width: 30px">项目名称</label>
29
-                            <div class="layui-input-inline" style="width: 220px">
30
-                                <input type="text" id="XMMC" name="XMMC" autocomplete="off" class="layui-input">
26
+                    <div class="layui-form-item" style="white-space: nowrap; margin-right: -20px;">
27
+                        <div class="layui-inline" style="margin-right: 10px;">
28
+                            <label class="layui-form-label" style="width: 80px;">项目名称</label>
29
+                            <div class="layui-input-inline" style="width: 224px;">
30
+                                <input type="text" id="xmmc" name="xmmc" autocomplete="off" class="layui-input">
31
                             </div>
31
                             </div>
32
                         </div>
32
                         </div>
33
+                        <div class="layui-inline" style="margin-right: 10px;">
34
+                            <label class="layui-form-label" style="width: 80px;">erp编号</label>
35
+                            <div class="layui-input-inline" style="width: 140px;">
36
+                                <input type="text" id="erpbh" name="erpbh" autocomplete="off" class="layui-input">
37
+                            </div>
38
+                        </div>
39
+                        <div class="layui-inline" style="margin-right: 10px;">
40
+                            <label class="layui-form-label" style="width: 80px;">费用申请号</label>
41
+                            <div class="layui-input-inline" style="width: 140px;">
42
+                                <input type="text" id="fysqbh" name="fysqbh" autocomplete="off" class="layui-input">
43
+                            </div>
44
+                        </div>
45
+                        <div class="layui-inline" style="margin-right: 10px;">
46
+                            <label class="layui-form-label" style="width: 80px;">年度</label>
47
+                            <div class="layui-input-inline" style="width: 140px;">
48
+                                <input type="text" id="nf" name="nf" autocomplete="off" class="layui-input">
49
+                            </div>
50
+                        </div>
51
+                    </div>
33
 
52
 
34
-                        <div class="layui-inline">
35
-                            <label class="layui-form-label" style="width: 60px; margin-left: -10px">创建日期</label>
53
+                    <div class="layui-form-item" style="white-space: nowrap; margin-right: -20px; margin-top: 10px;">
54
+                        <div class="layui-inline" style="margin-right: 10px;">
55
+                            <label class="layui-form-label" style="width: 80px;">日期</label>
36
                             <div class="layui-input-inline" style="width: 100px;">
56
                             <div class="layui-input-inline" style="width: 100px;">
37
-                                <input type="text" name="QSRQ" id="QSRQ" placeholder="开始日期" class="layui-input"
38
-                                       readonly>
57
+                                <input type="text" name="QSRQ" id="QSRQ" placeholder="开始日期" class="layui-input" readonly>
39
                             </div>
58
                             </div>
40
                             <div class="layui-form-mid">-</div>
59
                             <div class="layui-form-mid">-</div>
41
                             <div class="layui-input-inline" style="width: 100px;">
60
                             <div class="layui-input-inline" style="width: 100px;">
42
-                                <input type="text" name="JZRQ" id="JZRQ" placeholder="结束日期" class="layui-input"
43
-                                       readonly>
61
+                                <input type="text" name="JZRQ" id="JZRQ" placeholder="结束日期" class="layui-input" readonly>
44
                             </div>
62
                             </div>
45
                         </div>
63
                         </div>
46
-
47
-                        <div class="layui-inline">
48
-                            <button type="submit" id="btn_search" class="layui-btn" lay-submit
49
-                                    lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索
64
+                        <div class="layui-inline" style="margin-right: 10px; margin-left: 10px;">
65
+                            <button type="submit" id="btn_search" class="layui-btn" lay-submit lay-filter="data-search-btn">
66
+                                <i class="layui-icon"></i> 搜 索
50
                             </button>
67
                             </button>
51
-                            <button type="submit" class="layui-btn layui-btn-primary" lay-submit
52
-                                    lay-filter="data-reset-btn"><i class="layui-icon layui-icon-refresh"></i> 重 置
68
+                        </div>
69
+                        <div class="layui-inline" style="margin-right: 10px;">
70
+                            <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-reset-btn">
71
+                                <i class="layui-icon layui-icon-refresh"></i> 重 置
53
                             </button>
72
                             </button>
54
                         </div>
73
                         </div>
55
                     </div>
74
                     </div>
75
+
56
                 </form>
76
                 </form>
57
             </div>
77
             </div>
58
         </fieldset>
78
         </fieldset>