浏览代码

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

ly 5 月之前
父节点
当前提交
f04d11a791

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

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

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

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

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

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

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

@@ -23,36 +23,56 @@
23 23
             <legend>搜索信息(<b>收起-展开</b>)</legend>
24 24
             <div id="search-div" style="margin: 5px 10px -10px 0px">
25 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 31
                             </div>
32 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 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 58
                             </div>
40 59
                             <div class="layui-form-mid">-</div>
41 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 62
                             </div>
45 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 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 72
                             </button>
54 73
                         </div>
55 74
                     </div>
75
+
56 76
                 </form>
57 77
             </div>
58 78
         </fieldset>