Browse Source

任务书-新增任务书主要完成人支持模版导入

lgl 5 months ago
parent
commit
048d346fe8

+ 7 - 5
src/main/java/com/liang/common/fileupload/controller/FileUploadController.java

@@ -73,10 +73,11 @@ public class FileUploadController extends BaseController {
73 73
                         member.setZc(person.getZc());
74 74
                         member.setZcmc(person.getZcmc());
75 75
                         member.setXl(person.getXl());
76
-                        if (person.getXlmc() != null)
76
+                        if (person.getXlmc() != null) {
77 77
                             member.setXlmc(person.getXlmc());
78
-                        else
78
+                        } else {
79 79
                             member.setXlmc("");
80
+                        }
80 81
                         if (company != null) {
81 82
                             member.setDwlx(company.getLx().toString());
82 83
                             member.setDwlxmc(company.getLxmc());
@@ -100,12 +101,13 @@ public class FileUploadController extends BaseController {
100 101
                     list.set(i, member);
101 102
                 }
102 103
 
103
-                if (tipList.size() == 0 && list.size() > 0)
104
+                if (tipList.size() == 0 && list.size() > 0) {
104 105
                     xlsMap.put("code", 0);
105
-                else if (tipList.size() > 0)
106
+                } else if (tipList.size() > 0) {
106 107
                     xlsMap.put("code", 10);
107
-                else
108
+                } else {
108 109
                     xlsMap.put("code", 20);
110
+                }
109 111
                 xlsMap.put("tipList", tipList);
110 112
                 xlsMap.put("list", list);
111 113
                 xlsMap.put("fileType", fileType);

+ 17 - 7
src/main/java/com/liang/common/utils/ExcelPoiUtil.java

@@ -224,13 +224,23 @@ public class ExcelPoiUtil {
224 224
             //获取每一行数据
225 225
             row = sheet.getRow(i);
226 226
             PrjMember prjMember = new PrjMember();
227
-            prjMember.setSxbh(Double.valueOf(row.getCell(0).toString()).intValue());
228
-            prjMember.setRy(Double.valueOf(row.getCell(1).toString()).intValue());
229
-            prjMember.setRyxm(row.getCell(2).toString().trim());
230
-            prjMember.setXmjsmc(row.getCell(3).toString().trim());
231
-            prjMember.setBxmfg(row.getCell(4).toString().trim());
232
-            prjMember.setTrgzzys(Double.valueOf(row.getCell(5).toString()).intValue());
233
-            list.add(prjMember);
227
+            if (Tools.notEmpty(row) && row.getPhysicalNumberOfCells() > 1) {
228
+                String one = row.getCell(0).toString();
229
+                String two = row.getCell(1).toString();
230
+                String three = row.getCell(2).toString();
231
+                String four = row.getCell(3).toString();
232
+                String five = row.getCell(4).toString();
233
+                String six = row.getCell(5).toString();
234
+                if (Tools.notEmpty(one) && Tools.notEmpty(two) && Tools.notEmpty(three) && Tools.notEmpty(four) && Tools.notEmpty(five)&& Tools.notEmpty(six)) {
235
+                    prjMember.setSxbh(Double.valueOf(one).intValue());
236
+                    prjMember.setRy(Double.valueOf(two).intValue());
237
+                    prjMember.setRyxm(three.trim());
238
+                    prjMember.setXmjsmc(four.trim());
239
+                    prjMember.setBxmfg(five.trim());
240
+                    prjMember.setTrgzzys(Double.valueOf(five).intValue());
241
+                    list.add(prjMember);
242
+                }
243
+            }
234 244
         }
235 245
         return list;
236 246
     }

+ 9 - 144
src/main/java/com/liang/entity/PrjMember.java

@@ -1,5 +1,10 @@
1 1
 package com.liang.entity;
2 2
 
3
+import lombok.AllArgsConstructor;
4
+import lombok.Builder;
5
+import lombok.Data;
6
+import lombok.NoArgsConstructor;
7
+
3 8
 import java.io.Serializable;
4 9
 
5 10
 /**
@@ -8,6 +13,10 @@ import java.io.Serializable;
8 13
  * @author makejava
9 14
  * @since 2023-03-10 11:21:54
10 15
  */
16
+@Data
17
+@Builder
18
+@NoArgsConstructor
19
+@AllArgsConstructor
11 20
 public class PrjMember implements Serializable {
12 21
     private static final long serialVersionUID = -55947996636647050L;
13 22
 
@@ -71,149 +80,5 @@ public class PrjMember implements Serializable {
71 80
      */
72 81
     private Integer xl;
73 82
     private String xlmc;
74
-
75
-    public Integer getId() {
76
-        return id;
77
-    }
78
-
79
-    public void setId(Integer id) {
80
-        this.id = id;
81
-    }
82
-
83
-    public Integer getRy() {
84
-        return ry;
85
-    }
86
-
87
-    public void setRy(Integer ry) {
88
-        this.ry = ry;
89
-    }
90
-
91
-    public Integer getDw() {
92
-        return dw;
93
-    }
94
-
95
-    public void setDw(Integer dw) {
96
-        this.dw = dw;
97
-    }
98
-
99
-    public Integer getXm() {
100
-        return xm;
101
-    }
102
-
103
-    public void setXm(Integer xm) {
104
-        this.xm = xm;
105
-    }
106
-
107
-    public String getRyxm() {
108
-        return ryxm;
109
-    }
110
-
111
-    public void setRyxm(String ryxm) {
112
-        this.ryxm = ryxm;
113
-    }
114
-
115
-    public String getDwmc() {
116
-        return dwmc;
117
-    }
118
-
119
-    public void setDwmc(String dwmc) {
120
-        this.dwmc = dwmc;
121
-    }
122
-
123
-    public String getDwlx() {
124
-        return dwlx;
125
-    }
126
-
127
-    public void setDwlx(String dwlx) {
128
-        this.dwlx = dwlx;
129
-    }
130
-
131
-    public String getDwlxmc() {
132
-        return dwlxmc;
133
-    }
134
-
135
-    public void setDwlxmc(String dwlxmc) {
136
-        this.dwlxmc = dwlxmc;
137
-    }
138
-
139
-    public String getXmjs() {
140
-        return xmjs;
141
-    }
142
-
143
-    public void setXmjs(String xmjs) {
144
-        this.xmjs = xmjs;
145
-    }
146
-
147
-    public String getXmjsmc() {
148
-        return xmjsmc;
149
-    }
150
-
151
-    public void setXmjsmc(String xmjsmc) {
152
-        this.xmjsmc = xmjsmc;
153
-    }
154
-
155
-    public Integer getSxbh() {
156
-        return sxbh;
157
-    }
158
-
159
-    public void setSxbh(Integer sxbh) {
160
-        this.sxbh = sxbh;
161
-    }
162
-
163
-    public String getZc() {
164
-        return zc;
165
-    }
166
-
167
-    public void setZc(String zc) {
168
-        this.zc = zc;
169
-    }
170
-
171
-    public String getZcmc() {
172
-        return zcmc;
173
-    }
174
-
175
-    public void setZcmc(String zcmc) {
176
-        this.zcmc = zcmc;
177
-    }
178
-
179
-    public Integer getTrgzzys() {
180
-        return trgzzys;
181
-    }
182
-
183
-    public void setTrgzzys(Integer trgzzys) {
184
-        this.trgzzys = trgzzys;
185
-    }
186
-
187
-    public String getYhxq() {
188
-        return yhxq;
189
-    }
190
-
191
-    public void setYhxq(String yhxq) {
192
-        this.yhxq = yhxq;
193
-    }
194
-
195
-    public String getBxmfg() {
196
-        return bxmfg;
197
-    }
198
-
199
-    public void setBxmfg(String bxmfg) {
200
-        this.bxmfg = bxmfg;
201
-    }
202
-
203
-    public Integer getXl() {
204
-        return xl;
205
-    }
206
-
207
-    public void setXl(Integer xl) {
208
-        this.xl = xl;
209
-    }
210
-
211
-    public String getXlmc() {
212
-        return xlmc;
213
-    }
214
-
215
-    public void setXlmc(String xlmc) {
216
-        this.xlmc = xlmc;
217
-    }
218 83
 }
219 84
 

BIN
src/main/resources/upload/template/任务书主要完成人.xlsx


BIN
upload/template/任务书主要完成人.xlsx