Browse Source

Merge branch 'master' into dev-lgl

lgl 5 months ago
parent
commit
47af36cd05

+ 63 - 0
src/main/java/com/liang/common/utils/DateUtil.java

@@ -0,0 +1,63 @@
1
+package com.liang.common.utils;
2
+
3
+import java.time.LocalDate;
4
+import java.time.format.DateTimeFormatter;
5
+import java.time.temporal.ChronoUnit;
6
+import java.util.Locale;
7
+
8
+/**
9
+ * @Author ly
10
+ * @Date 2024/6/30 17:44
11
+ * @Version 1.0
12
+ */
13
+public class DateUtil {
14
+    public String convertDate(String inputDate) {
15
+        if (inputDate == null || inputDate.isEmpty()) {
16
+            return "";
17
+        }
18
+        // 定义输入格式的日期时间格式化器
19
+        DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("dd-LLL-yyyy", Locale.CHINESE);
20
+
21
+        // 将字符串解析为 LocalDate 对象
22
+        LocalDate date = LocalDate.parse(inputDate, inputFormatter);
23
+
24
+        // 定义输出格式的日期时间格式化器
25
+        DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
26
+
27
+        // 格式化日期为所需的输出格式
28
+        String formattedDate = date.format(outputFormatter);
29
+
30
+        return formattedDate;
31
+    }
32
+    /**
33
+     * 判断两个给定日期是否相差少于三个月
34
+     * @param startDate 开始日期
35
+     * @param endDate 结束日期
36
+     * @return 如果 startDate 和 endDate 相差少于三个月返回 true,否则返回 false
37
+     */
38
+    public boolean isWithinThreeMonths(LocalDate startDate, LocalDate endDate) {
39
+        // 计算 startDate 和 endDate 之间的月份差距
40
+        long monthsApart = ChronoUnit.MONTHS.between(startDate, endDate);
41
+
42
+        // 判断绝对差距是否小于三个月
43
+        return Math.abs(monthsApart) < 3;
44
+    }
45
+    public  boolean areDatesWithinThreeMonths(String startDateStr, String endDateStr) {
46
+        if (startDateStr.isEmpty() || endDateStr.isEmpty() ){
47
+            return false;
48
+        }
49
+        // 将字符串日期转换为 LocalDate 对象
50
+        LocalDate startDate = LocalDate.parse(startDateStr, DateTimeFormatter.ISO_DATE);
51
+        LocalDate endDate = LocalDate.parse(endDateStr, DateTimeFormatter.ISO_DATE);
52
+
53
+        // 使用已有方法检查
54
+        return areDatesWithinThreeMonths(startDate, endDate);
55
+    }
56
+    public  boolean areDatesWithinThreeMonths(LocalDate startDate, LocalDate endDate) {
57
+        // 计算 startDate 和 endDate 之间的月份差距
58
+        long monthsApart = ChronoUnit.MONTHS.between(startDate, endDate);
59
+
60
+        // 判断绝对差距是否小于三个月
61
+        return Math.abs(monthsApart) < 3;
62
+    }
63
+}

+ 148 - 5
src/main/java/com/liang/controller/LsUserController.java

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5 5
 import com.liang.common.JsonTool;
6 6
 import com.liang.common.base.BaseResult;
7
+import com.liang.common.utils.DateUtil;
7 8
 import com.liang.entity.BasePerson;
8 9
 import com.liang.entity.SysLsUserEntity;
9 10
 
@@ -12,20 +13,36 @@ import com.liang.service.BaseEducationService;
12 13
 import com.liang.service.LsUserService;
13 14
 import io.swagger.annotations.ApiOperation;
14 15
 import io.swagger.models.auth.In;
16
+import org.apache.commons.io.FilenameUtils;
15 17
 import org.apache.ibatis.annotations.Delete;
18
+import org.apache.poi.ss.usermodel.Cell;
19
+import org.apache.poi.ss.usermodel.Row;
20
+import org.apache.poi.ss.usermodel.Sheet;
21
+import org.apache.poi.ss.usermodel.Workbook;
22
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
16 23
 import org.springframework.beans.factory.annotation.Autowired;
24
+import org.springframework.core.io.ClassPathResource;
25
+import org.springframework.http.HttpHeaders;
26
+import org.springframework.http.HttpStatus;
27
+import org.springframework.http.MediaType;
17 28
 import org.springframework.http.ResponseEntity;
18 29
 import org.springframework.stereotype.Controller;
19 30
 import org.springframework.ui.Model;
20 31
 import org.springframework.web.bind.annotation.*;
32
+import org.springframework.web.multipart.MultipartFile;
33
+import org.springframework.web.multipart.MultipartHttpServletRequest;
21 34
 
22 35
 import javax.annotation.Resource;
23 36
 import javax.xml.transform.Result;
37
+import java.io.IOException;
38
+import java.io.InputStream;
39
+import java.nio.file.Path;
40
+import java.nio.file.Paths;
41
+import java.text.DateFormat;
24 42
 import java.text.SimpleDateFormat;
25
-import java.util.Date;
26
-import java.util.HashMap;
27
-import java.util.List;
28
-import java.util.Map;
43
+import java.time.LocalDate;
44
+import java.time.format.DateTimeFormatter;
45
+import java.util.*;
29 46
 
30 47
 import static com.liang.common.base.BaseController.RESULT_ROWS;
31 48
 import static com.liang.common.base.BaseController.RESULT_TOTAL;
@@ -44,6 +61,10 @@ public class LsUserController {
44 61
     @Resource
45 62
     private BaseEducationService baseEducationService;
46 63
 
64
+    // 允许的表格文件扩展名列表
65
+    private final List<String> allowedExtensions = Arrays.asList("xls", "xlsx", "csv");
66
+
67
+
47 68
     @ApiOperation(value = "页面初始化", notes = "页面初始化")
48 69
     @RequestMapping(value = "/init", method = RequestMethod.GET)
49 70
     public String init( Model model) {
@@ -61,12 +82,14 @@ public class LsUserController {
61 82
                               @RequestParam("limit") Integer pageSize,
62 83
                               @RequestParam(required = false, defaultValue = "", value = "xm") String xm,
63 84
                               @RequestParam(required = false, defaultValue = "", value = "zt") Integer zt,
64
-                              @RequestParam(required = false, defaultValue = "", value = "xl") String xl){
85
+                              @RequestParam(required = false, defaultValue = "", value = "xl") String xl,
86
+                              @RequestParam(required = false, defaultValue = "", value = "sfzh") String sfzh){
65 87
         Map<String, String> paraMap = new HashMap<>();
66 88
         PageHelper.startPage(pageNum, pageSize);
67 89
         if (zt == null){
68 90
             paraMap.put("xm", xm);
69 91
             paraMap.put("xl",xl);
92
+            paraMap.put("sfzh",sfzh);
70 93
             List<SysLsUserEntity> list = lsUserService.UserAll(paraMap);
71 94
             PageInfo<SysLsUserEntity> pageinfo = new PageInfo<>(list);
72 95
             // 取出查询结果
@@ -206,5 +229,125 @@ public class LsUserController {
206 229
         return BaseResult.failure("该人员不存在");
207 230
     }
208 231
 
232
+    @PostMapping("/file")
233
+    @ResponseBody
234
+    public BaseResult handleFileUpload(@RequestParam("file") MultipartFile file) {
235
+        if (file.isEmpty()){
236
+            return BaseResult.failure("上传文件异常,上传失败!");
237
+        }
238
+        List<SysLsUserEntity> lists = new ArrayList<>();
239
+        Integer h = 0;
240
+        try{
241
+            // 验证文件类型
242
+
243
+            DateUtil dateUtil = new DateUtil();
244
+            String fileExtension = FilenameUtils.getExtension(file.getOriginalFilename());
245
+            if (!allowedExtensions.contains(fileExtension.toLowerCase())) {
246
+                return BaseResult.failure("只允许上传 Excel文件");
247
+            }
248
+            // 开始解析这个文件
249
+            List<List<String>> spreadsheetData = parseSpreadsheet(file.getInputStream(), fileExtension);
250
+            System.out.println(spreadsheetData);
251
+            spreadsheetData.remove(0);
252
+            List<SysLsUserEntity> list = new ArrayList<>();
253
+            for (List<String> row : spreadsheetData) {
254
+                SysLsUserEntity employee = new SysLsUserEntity();
255
+                // 设置员工信息
256
+                employee.setXm(row.get(0));
257
+                employee.setXb(row.get(1));
258
+                employee.setPhone(row.get(2));
259
+                employee.setSfzh(row.get(3));
260
+                employee.setXl(row.get(4));
261
+                employee.setByxy(row.get(5));
262
+                employee.setZy(row.get(6));
263
+                employee.setQpsj(dateUtil.convertDate(row.get(7)));
264
+                employee.setDqsj(dateUtil.convertDate(row.get(8)));
265
+                employee.setGznr(row.get(9));
266
+                // 将对象添加到列表中
267
+                list.add(employee);
268
+            }
269
+            System.out.println(list);
270
+
271
+            for(int i = 0; i<list.size();i++){
272
+                SysLsUserEntity sysLsUserEntity = new SysLsUserEntity();
273
+                // 校验合同起始时间和到期时间是否在三个月 内
274
+                if (dateUtil.areDatesWithinThreeMonths(list.get(i).getDqsj(), list.get(i).getQpsj()) !=true) {
275
+                    sysLsUserEntity.setXm(list.get(i).getXm());
276
+                    // xmfzr 这个字段存储未能存储原因
277
+                    sysLsUserEntity.setXmfzr("聘用日期不能大于三个月");
278
+                    sysLsUserEntity.setSfzh(list.get(i).getSfzh());
279
+                    sysLsUserEntity.setDqsj(list.get(i).getDqsj());
280
+                    sysLsUserEntity.setQpsj(list.get(i).getQpsj());
281
+                    if (list.get(i).getXm().isEmpty() && list.get(i).getSfzh().isEmpty()){
282
+                        continue;
283
+                    }
284
+                    lists.add(sysLsUserEntity);
285
+                    continue;
286
+                }
287
+                // 校验当前传入的 身份证号 是否在数据库中存在
288
+                if (lsUserService.jy(list.get(i).getSfzh()) != true){
289
+                    sysLsUserEntity.setXm(list.get(i).getXm());
290
+                    sysLsUserEntity.setSfzh(list.get(i).getSfzh());
291
+                    sysLsUserEntity.setDqsj(list.get(i).getDqsj());
292
+                    sysLsUserEntity.setQpsj(list.get(i).getQpsj());
293
+                    // xmfzr 这个字段存储未能存储原因
294
+                    sysLsUserEntity.setXmfzr("该人员身份证已存在");
295
+                    if (list.get(i).getXm().isEmpty() && list.get(i).getSfzh().isEmpty()){
296
+                        continue;
297
+                    }
298
+                    lists.add(sysLsUserEntity);
299
+
300
+                    continue;
301
+                }
302
+               Integer mum = lsUserService.saveOperLog(list.get(i));
303
+               if (mum > 0){
304
+                   h++;
305
+                   continue;
306
+               }
307
+            }
308
+        }catch (Exception a){
309
+            a.printStackTrace();
310
+        }
311
+
312
+        // 获取文件名后缀
313
+        if (h == 0){
314
+            return BaseResult.failure(43,"成员录入失败,人员已存在!");
315
+        }
316
+        return BaseResult.success("成员录入成功",lists);
317
+    }
318
+    private List<List<String>> parseSpreadsheet(InputStream inputStream, String fileExtension) throws IOException {
319
+        Workbook workbook = null;
320
+        if (fileExtension.equalsIgnoreCase("xlsx")) {
321
+            workbook = new XSSFWorkbook(inputStream);
322
+        } else if (fileExtension.equalsIgnoreCase("xls")) {
323
+            throw new IOException("上传的Excel文件格式不支持,请上传xlsx格式文件。");
324
+        } else if (fileExtension.equalsIgnoreCase("csv")) {
325
+            throw new IOException("上传的文件是CSV格式,当前不支持解析,请上传Excel文件。");
326
+        }
327
+
328
+        List<List<String>> spreadsheetData = new ArrayList<>();
329
+        if (workbook != null) {
330
+            Sheet sheet = workbook.getSheetAt(0);
331
+            Iterator<Row> iterator = sheet.iterator();
332
+
333
+            while (iterator.hasNext()) {
334
+                Row currentRow = iterator.next();
335
+                Iterator<Cell> cellIterator = currentRow.iterator();
336
+
337
+                List<String> rowData = new ArrayList<>();
338
+                while (cellIterator.hasNext()) {
339
+                    Cell currentCell = cellIterator.next();
340
+                    rowData.add(currentCell.toString());
341
+                }
342
+
343
+                spreadsheetData.add(rowData);
344
+            }
345
+
346
+            workbook.close();
347
+        }
348
+
349
+        return spreadsheetData;
350
+    }
351
+
209 352
 
210 353
 }

+ 9 - 1
src/main/java/com/liang/controller/StaSourceFeeController.java

@@ -1,6 +1,7 @@
1 1
 package com.liang.controller;
2 2
 
3 3
 import cn.hutool.core.util.StrUtil;
4
+import com.github.pagehelper.PageHelper;
4 5
 import com.github.pagehelper.PageInfo;
5 6
 import com.liang.common.JsonTool;
6 7
 import com.liang.common.base.BaseController;
@@ -178,8 +179,15 @@ public class StaSourceFeeController extends BaseController {
178 179
     //资料费用全部及条件查询
179 180
     @ResponseBody
180 181
     @RequestMapping(value = "/searchData", method = RequestMethod.POST)
181
-    public BaseResult searchData(@RequestParam(required = false, defaultValue = "", value = "MC") String mc, @RequestParam(required = false, defaultValue = "", value = "TSMC") String tsmc, @RequestParam(required = false, defaultValue = "", value = "CBS") String cbs, @RequestParam(required = false, defaultValue = "", value = "QSRQ") String qsrq, @RequestParam(required = false, defaultValue = "", value = "JZRQ") String jzrq) {
182
+    public BaseResult searchData(@RequestParam("page") Integer pageNum,
183
+                                 @RequestParam("limit") Integer pageSize,
184
+                                 @RequestParam(required = false, defaultValue = "", value = "MC") String mc,
185
+                                 @RequestParam(required = false, defaultValue = "", value = "TSMC") String tsmc,
186
+                                 @RequestParam(required = false, defaultValue = "", value = "CBS") String cbs,
187
+                                 @RequestParam(required = false, defaultValue = "", value = "QSRQ") String qsrq,
188
+                                 @RequestParam(required = false, defaultValue = "", value = "JZRQ") String jzrq) {
182 189
         List<HashMap<String, Object>> staFeasibilityreport = staSourceFeeService.searchSourceCost(mc, tsmc, cbs, qsrq, jzrq);
190
+        PageHelper.startPage(pageNum, pageSize);
183 191
         PageInfo<HashMap<String, Object>> pageinfo = new PageInfo<>(staFeasibilityreport);
184 192
         List<HashMap<String, Object>> rows = pageinfo.getList();
185 193
         int total = (int) pageinfo.getTotal();

+ 8 - 2
src/main/java/com/liang/controller/StaStatisticalSummaryController.java

@@ -76,8 +76,12 @@ public class StaStatisticalSummaryController extends BaseController {
76 76
                                      @RequestParam(required = false, defaultValue = "", value = "QS") String qs,
77 77
                                      @RequestParam(required = false, defaultValue = "", value = "WC") String wc
78 78
     ) {
79
+        Map<String, String> map = new HashMap<>();
80
+        map.put("xmmc",xmmc);
81
+        map.put("qs",qs);
82
+        map.put("wc",wc);
79 83
         PageHelper.startPage(pageNum, pageSize);
80
-        List<HashMap<String, Object>> staFeasibilityreport = staStatisticalSummaryService.projectPay(xmmc, qs, wc);
84
+        List<HashMap<String, Object>> staFeasibilityreport = staStatisticalSummaryService.projectPay(map);
81 85
         PageInfo<HashMap<String, Object>> pageinfo = new PageInfo<>(staFeasibilityreport);
82 86
         List<HashMap<String, Object>> rows = pageinfo.getList();
83 87
         int total = (int) pageinfo.getTotal();
@@ -93,7 +97,9 @@ public class StaStatisticalSummaryController extends BaseController {
93 97
     @RequestMapping(value = "/getAll",method = RequestMethod.GET)
94 98
     public BaseResult getAll(){
95 99
 
96
-        List<HashMap<String, Object>> staFeasibilityreport = staStatisticalSummaryService.projectPay("", "", "");
100
+        Map<String, String> map = new HashMap<>();
101
+
102
+        List<HashMap<String, Object>> staFeasibilityreport = staStatisticalSummaryService.projectPay(map);
97 103
         return BaseResult.success(staFeasibilityreport);
98 104
     }
99 105
 

+ 1 - 1
src/main/java/com/liang/controller/SysUserPostController.java

@@ -106,7 +106,7 @@ public class SysUserPostController extends BaseController {
106 106
 //系统当前用户
107 107
         SysUserInfo userInfo = getSysUserInfo();
108 108
         if (userInfo != null && userInfo.getDeptId().equals("52")) {
109
-            paraMap.put("postName", PostInfoEnum.FZR.postName());
109
+            paraMap.put("postName", PostInfoEnum.KJBBMZR.postName());
110 110
         } else {
111 111
             paraMap.put("postName", PostInfoEnum.KYFZR.postName());
112 112
         }

+ 1 - 1
src/main/java/com/liang/dao/PrjFeeschemeDao.java

@@ -128,6 +128,6 @@ public interface PrjFeeschemeDao {
128 128
 
129 129
     double queryByCzje(double czje);
130 130
 
131
-    double getNdFeeSchemeofDKY(Map map);
131
+    Double getNdFeeSchemeofDKY(Map map);
132 132
 }
133 133
 

+ 2 - 1
src/main/java/com/liang/dao/StaStatisticalSummaryDao.java

@@ -2,6 +2,7 @@ package com.liang.dao;
2 2
 
3 3
 import java.util.HashMap;
4 4
 import java.util.List;
5
+import java.util.Map;
5 6
 
6 7
 /**
7 8
  * 统计报表汇总表
@@ -18,5 +19,5 @@ public interface StaStatisticalSummaryDao {
18 19
      */
19 20
     List<HashMap<String, Object>> outPaySummary(String XMMC, String QSRQ, String JSRQ);
20 21
 
21
-    List<HashMap<String, Object>> projectPay(String XMMC, String QS, String WC);
22
+    List<HashMap<String, Object>> projectPay(Map map);
22 23
 }

+ 1 - 0
src/main/java/com/liang/service/LsUserService.java

@@ -52,4 +52,5 @@ public interface LsUserService {
52 52
 
53 53
 
54 54
     List<SysLsUserEntity> getZb(Integer zb);
55
+    boolean jy(String sfzh);
55 56
 }

+ 2 - 1
src/main/java/com/liang/service/StaStatisticalSummaryService.java

@@ -6,6 +6,7 @@ import org.springframework.data.domain.PageRequest;
6 6
 
7 7
 import java.util.HashMap;
8 8
 import java.util.List;
9
+import java.util.Map;
9 10
 
10 11
 /**
11 12
  * 经费预算(StaBudget)表服务接口
@@ -25,6 +26,6 @@ public interface StaStatisticalSummaryService {
25 26
      */
26 27
     List<HashMap<String, Object>> outPaySummary(String XMMC, String QSRQ, String JSRQ);
27 28
 
28
-    List<HashMap<String, Object>> projectPay(String xmmc, String qs, String wc);
29
+    List<HashMap<String, Object>> projectPay(Map map);
29 30
 
30 31
 }

+ 12 - 0
src/main/java/com/liang/service/impl/LsUserServiceImpl.java

@@ -15,6 +15,7 @@ import java.text.DateFormat;
15 15
 import java.text.DecimalFormat;
16 16
 import java.text.SimpleDateFormat;
17 17
 import java.util.Date;
18
+import java.util.HashMap;
18 19
 import java.util.List;
19 20
 import java.util.Map;
20 21
 
@@ -82,6 +83,17 @@ public class LsUserServiceImpl implements LsUserService {
82 83
         return this.lsUserDao.getZb(zb);
83 84
     }
84 85
 
86
+    @Override
87
+    public boolean jy(String sfzh) {
88
+        Map<String, String>map = new HashMap<>();
89
+        map.put("sfzh",sfzh);
90
+        List<SysLsUserEntity> sysLsUserEntity = lsUserDao.getUserxm(map);
91
+        if (sysLsUserEntity.size()>0){
92
+            return false;
93
+        }
94
+        return true;
95
+    }
96
+
85 97
     @Override
86 98
     public int batchDelete(List<Integer> idList) {
87 99
 

+ 3 - 2
src/main/java/com/liang/service/impl/StaStatisticalSummaryServiceImpl.java

@@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
7 7
 import javax.annotation.Resource;
8 8
 import java.util.HashMap;
9 9
 import java.util.List;
10
+import java.util.Map;
10 11
 
11 12
 @Service("staStatisticalSummaryService")
12 13
 public class StaStatisticalSummaryServiceImpl implements StaStatisticalSummaryService {
@@ -20,8 +21,8 @@ public class StaStatisticalSummaryServiceImpl implements StaStatisticalSummarySe
20 21
     }
21 22
 
22 23
     @Override
23
-    public List<HashMap<String, Object>> projectPay(String xmmc, String qs, String wc) {
24
-        return staStatisticalSummaryDao.projectPay(xmmc, qs, wc);
24
+    public List<HashMap<String, Object>> projectPay(Map map) {
25
+        return staStatisticalSummaryDao.projectPay(map);
25 26
     }
26 27
 
27 28
 }

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

@@ -39,6 +39,9 @@
39 39
                  <if test="zt != null and zt != ''">
40 40
                  and ZT = #{zt}
41 41
                  </if>
42
+                    <if test="sfzh != null and sfzh != ''">
43
+                        and SFZH = #{sfzh}
44
+                    </if>
42 45
                  order by cjsj DESC
43 46
 
44 47
     </select>

+ 9 - 4
src/main/resources/mapper/PrjApproverecordDao.xml

@@ -509,7 +509,7 @@
509 509
         from prj_ApproveRecord a
510 510
         left join sys_user_info u1 on a.TJR = u1.user_id
511 511
         left join sys_user_info u2 on a.SHR = u2.user_id
512
-        where a.XMID = #{xmid} and a.TABLENAME = #{tableName}
512
+        where a.XMID = #{xmid}
513 513
         <if test="spzt != null and spzt != ''">
514 514
             and a.ZT = #{spzt}
515 515
         </if>
@@ -521,13 +521,18 @@
521 521
                 order by ${sortName} ${sortOrder} DESC
522 522
             </when>
523 523
         </choose>
524
-        order by a.id DESC
524
+        order by a.id asc
525
+    </select>
526
+    <select id="getOldApproveRecord" resultType="com.liang.entity.PrjApproverecord">
527
+        SELECT TOP 1 * FROM prj_ApproveRecord WHERE XMID = #{xmid} ORDER BY ID DESC
525 528
     </select>
526 529
 
527 530
     <update id="updateRevokeRecord">
528 531
         UPDATE prj_ApproveRecord
529
-        SET WC=1
530
-        WHERE ID = (SELECT TOP 1 ID FROM prj_ApproveRecord WHERE XMID = #{xmid} ORDER BY ID DESC)
532
+        SET WC = 1,
533
+            SPCZ = '撤销审批',
534
+            SHSJ =  CURRENT_TIMESTAMP
535
+        WHERE ID = (SELECT TOP 1 ID FROM prj_ApproveRecord WHERE XMID = #{xmid} ORDER BY ID DESC);
531 536
     </update>
532 537
 
533 538
 </mapper>

+ 12 - 10
src/main/resources/templates/annualbudget/add_apply.html

@@ -440,8 +440,7 @@
440 440
                     </button>
441 441
                 </div>
442 442
             </div>
443
-        </div>
444
-            </div>
443
+
445 444
 </form>
446 445
 </div>
447 446
 <!--常规结束-->
@@ -605,7 +604,8 @@
605 604
                         console.log(ysqjeOne);
606 605
                         dataTj[0].ysqje = parseFloat($("#sqje").val()) + ysqjeOne;//此科目已申请
607 606
                         if (ybzjeOne != -1) {
608
-                            dataTj[1].ysqje = dataTj[1].ysqje - parseFloat($("#sqje").val());//此科目已报账
607
+                            // dataTj[1].ysqje = dataTj[1].ysqje - parseFloat($("#sqje").val());//此科目已报账
608
+                            dataTj[1].ysqje = dataTj[0].ysje * 10000- dataTj[0].ysqje
609 609
                         }
610 610
                     }
611 611
                     // dataTj[1].ysqje=nysje-sqls;//项目年度经费中的已申请
@@ -3492,15 +3492,17 @@
3492 3492
             var nysje = parseFloat(dataTj[1].ysje) * 10000;//年度预算金额
3493 3493
             var ysqje = parseFloat(dataTj[0].ysqje);
3494 3494
             var nysqje = parseFloat(dataTj[1].ysqje);
3495
-            if (sqje + ysqje > nysje) {
3495
+            if (ysqje > nysje || sqje>nysje) {
3496 3496
                 Message.error("费用申请的总金额,不能超过年度总预算!", 2000);
3497 3497
                 return false;
3498
-            } else if ($("#fjmc").val().indexOf("业务费") > -1) {
3499
-                if (ysqje > ysje * 1.2) {
3500
-                    Message.error("业务费申请的总金额,不能超过预算金额的20%!", 2000);
3501
-                    return false;
3502
-                }
3503
-            } else if (ysqje > ysje*1.2) {
3498
+            }
3499
+            // else if ($("#fjmc").val().indexOf("业务费") > -1) {
3500
+            //     if (ysqje > ysje * 1.2) {
3501
+            //         Message.error("业务费申请的总金额,不能超过预算金额的20%!", 2000);
3502
+            //         return false;
3503
+            //     }
3504
+            // }
3505
+           if (ysqje > ysje || sqje >ysje) {
3504 3506
                 Message.error("该科目申请的费用总金额,不能超过预算金额!", 2000);
3505 3507
                 return false;
3506 3508
             }

+ 1 - 1
src/main/resources/templates/annualbudget/view_annualbudget.html

@@ -106,7 +106,7 @@
106 106
                             <label class="layui-form-label" style="width: 90px">电科院负责人</label>
107 107
                             <div class="layui-input-inline" style="width: 370px">
108 108
                                 <input type="text" id="xmfzrxm" name="xmfzrxm" class="layui-input"
109
-                                       th:value="${annualbudget.xmfzrxm}" readonly>
109
+                                       th:value="${annualbudget.dkyfzrxm}" readonly>
110 110
                             </div>
111 111
                             <label class="layui-form-label" style="width: 65px">所属部门</label>
112 112
                             <div class="layui-input-inline" style="width: 370px">

+ 1 - 39
src/main/resources/templates/lsuserinfo/adds.html

@@ -48,8 +48,7 @@
48 48
             </div>
49 49
             <label class="layui-form-label" style="width: 80px;top: 10px">毕业学校</label>
50 50
             <div class="layui-input-inline" style="width: 250px;top: 10px">
51
-                <input type="hidden" id="byxx" name="byxy" class="layui-input">
52
-                <input type="text" id="byxxmc" name="byxxmc" class="layui-input">
51
+                <input type="text" id="byxy" name="byxy" class="layui-input" th:value="${ls.byxy}">
53 52
             </div>
54 53
 
55 54
             <label class="layui-form-label required" style="width:80px;top: 20px;">电话</label>
@@ -105,44 +104,7 @@
105 104
         laydate.render({
106 105
             elem: '#dqsj'
107 106
         });
108
-        //毕业学校
109
-        var index3 = layer.load(0, {shade: 0.1});
110
-        AjaxUtil.get({
111
-            url: AjaxUtil.ctx + 'baseSchool/list',
112
-            success: function (res) {
113
-                layer.close(index3);
114
-                var datalist = [];
115
-                for (let item of res.data) {
116
-                    item.value = item.id;
117
-                    item.label = item.name;
118
-                    datalist.push(item);
119
-                }
120
-                // 扁平数据转树
121
-                var options = arrayToTree(datalist, "0");
122
-
123
-                // 初始化cascader实例
124
-                cascader = layCascader({
125
-                    elem: '#byxxmc',
126
-                    clearable: true,
127
-                    props: {
128
-                        checkStrictly: false // 配置选择任意一级选项
129
-                    },
130
-                    options: options
131
-                });
132 107
 
133
-                // 监听cascader变化
134
-                cascader.changeEvent(function (value, node) {
135
-                    $("#byxx").val(value);
136
-                    $("#byxxmc").val(node.data.label);
137
-                    // 主动关闭面板
138
-                    cascader.close();
139
-                });
140
-            },
141
-            error: function (error) {
142
-                layer.close(index3);
143
-                Message.error('获取学校信息失败!', 1000);
144
-            }
145
-        });
146 108
         //监听专业专长
147 109
         form.on('select(zyzc)', function (data) {
148 110
             let text = data.elem.selectedOptions[0].text;

+ 73 - 58
src/main/resources/templates/lsuserinfo/list.html

@@ -35,6 +35,12 @@
35 35
                                 </div>
36 36
                             </div>
37 37
                         </div>
38
+                        <div class="layui-inline">
39
+                            <label class="layui-form-label" style="width: 80px">身份证号</label>
40
+                            <div class="layui-input-inline">
41
+                                <input type="text" name="sfzh" autocomplete="off" class="layui-input">
42
+                            </div>
43
+                        </div>
38 44
                         <div class="layui-inline">
39 45
                             <div class="layui-inline">
40 46
                                 <label class="layui-form-label " style="width: 40px;">状态</label>
@@ -67,20 +73,14 @@
67 73
                     <i class="layui-icon layui-icon-addition" style="font-size: 10px;"></i>新增
68 74
                 </button>
69 75
                 <button class="layui-btn layui-btn-sm" lay-event="export" >
70
-                    <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>全部导出
76
+                    <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>批量导出
71 77
                 </button>
72 78
                 <button class="layui-btn layui-btn-sm" lay-event="download"  style="background-color: purple">
73 79
                     <i class="layui-icon layui-icon-download-circle" style="font-size: 10px;"></i>模板下载
74 80
                 </button>
75
-            </div>
76
-            <!--文件上传的div-->
77
-            <div class="layui-upload-drag" id="excel">
78
-                <i class="layui-icon"></i>
79
-                <p>点击上传,或将文件拖拽到此处</p>
80
-                <div class="layui-hide" id="uploadDemoView">
81
-                    <hr>
82
-                    <img src="" alt="上传成功后渲染" style="max-width: 196px">
83
-                </div>
81
+                <button type="button" class="layui-btn layui-btn-sm" id="test3">
82
+                    <i class="layui-icon"></i>批量导入
83
+                </button>
84 84
             </div>
85 85
 
86 86
         </script>
@@ -109,22 +109,11 @@
109 109
 <script type="text/javascript" th:inline="javascript">
110 110
     AjaxUtil.ctx = /*[[@{/}]]*/'';
111 111
     var updateflag = 0;
112
-    layui.use(['form', 'table'], function () {
112
+    layui.use(['form', 'table','upload'], function () {
113 113
         var form = layui.form,
114 114
             table = layui.table,
115 115
             layer = layui.layer,
116
-            upload = layui.upload;
117
-        upload.render({
118
-            elem: '#excel',
119
-            url:AjaxUtil.ctx +'',
120
-            accept:'file',
121
-            done: function (res) {
122
-                layer.msg(res.msg);
123
-                console.log(res);
124
-                
125
-            }
126
-        });
127
-
116
+         upload = layui.upload;
128 117
         var currTable = table.render({
129 118
             elem: '#currentTableId',
130 119
             url: AjaxUtil.ctx + 'lsUser/all',
@@ -170,7 +159,59 @@
170 159
                 console.log(JSON.stringify(permissionSet));
171 160
             }
172 161
         });
162
+        //指定允许上传的文件类型
163
+        upload.render({
164
+            elem: '#test3'
165
+            , url: AjaxUtil.ctx + 'lsUser/file'
166
+            , method: 'post'
167
+            , accept: 'file' //普通文件
168
+            , done: function (res) {
169
+                console.log(res);
170
+                console.log(res.code);
171
+                if (res.code === 43) {
172
+                    layer.msg(res.message);
173
+                }else {
174
+                    if (res.data && Array.isArray(res.data) && res.data.length > 0) {
175
+                        // 安全访问数组元素或对象属性
176
+                        layer.msg(res.message);
177
+                        table.reload('currentTableId');
178
+                    }
179
+                    console.log(res);
180
+                    // 将 JSON 数据转换成 HTML 表格格式
181
+                    var tableHtml = '<table class="layui-table"><thead><tr>' +
182
+                        '<th>姓名</th>' +
183
+                        '<th>身份证号</th>' +
184
+                        '<th>起聘时间</th>' +
185
+                        '<th>到期时间</th>' +
186
+                        '<th>原因</th>' +
187
+                        '</tr></thead><tbody>';
188
+                    for(var i = 0; i < res.data.length; i++) {
189
+                        var xm = res.data[i].xm || 'N/A';
190
+                        var sfzh = res.data[i].sfzh || 'N/A';
191
+                        var qpsj = res.data[i].qpsj || 'N/A';
192
+                        var dqsj = res.data[i].dqsj || 'N/A';
193
+                        var xmfzr = res.data[i].xmfzr || 'N/A';
194
+
195
+                        tableHtml += '<tr>' +
196
+                            '<td>' + xm + '</td>' +
197
+                            '<td>' + sfzh + '</td>' +
198
+                            '<td>' + qpsj + '</td>' +
199
+                            '<td>' + dqsj + '</td>' +
200
+                            '<td>' + xmfzr + '</td>' +
201
+                            '</tr>';
202
+                    };
203
+                    tableHtml += '</tbody></table>';
204
+                    layer.open({
205
+                        type: 1,
206
+                        title: '问题数据', // 弹框标题
207
+                        content: tableHtml, // 弹框内容为生成的表格 HTML
208
+                        area: ['1000px', '600px'] // 设置弹框大小
209
+                    });
210
+                    table.reload('currentTableId');
211
+                }
212
+            },
173 213
 
214
+    });
174 215
         // 监听搜索操作
175 216
         form.on('submit(data-search-btn)', function (data) {
176 217
             // 执行搜索重载
@@ -243,10 +284,8 @@
243 284
                         data: JSON.stringify(data),
244 285
                         success: function (res) {
245 286
                             if (res.code === 0) {
246
-                                Message.success(1500, res.message, function () {
247
-                                    // 重载表格
248
-                                    currTable.reload();
249
-                                });
287
+                                Message.success(1500, res.message);
288
+                                table.reload('currentTableId');
250 289
                             } else {
251 290
                                 Message.error(res.message, 1000);
252 291
                             }
@@ -262,7 +301,7 @@
262 301
                 AjaxUtil.get({
263 302
                     url:AjaxUtil.ctx +'lsUser/getAll',
264 303
                     success: function(res){
265
-                        table.exportFile('currentTableId',res.data,'xls');
304
+                        table.exportFile('currentTableId',res.data,'xlsx');
266 305
                     },
267 306
                     error:function (error) {
268 307
                         Message.error(error,2000)
@@ -271,7 +310,7 @@
271 310
                 });
272 311
 
273 312
             }else if (obj.event === 'download'){
274
-                table.exportFile('currentTableId',' ','xls');
313
+                window.location.href = 'http://10.208.114.107:8082/202407/Template.xlsx';
275 314
             }
276 315
         });
277 316
 
@@ -312,29 +351,18 @@
312 351
                         url: AjaxUtil.ctx + "lsUser/delete/" + data.id,
313 352
                         success: function (res) {
314 353
                             if (res.code === 0) {
315
-                                layer.msg('删除成功', {icon: 6}, function () {
316
-                                    // 表格重载
317
-                                    table.reload('currentTableId', {
318
-                                        data: data,  // 更新后的数据源
319
-                                        page: false, // 不分页处理
320
-                                        limit: data.length // 限制数据条数,取数据源长度
321
-                                    }, true);
322
-                                })
354
+                                layer.msg(res.message);
355
+                                table.reload('currentTableId');
323 356
                             } else {
324
-                                layer.msg('删除失败', {icon: 5}, function () {
325
-                                    // 表格重载
326
-                                    table.reload('currentTableId', {
327
-                                        data: data,  // 更新后的数据源
328
-                                        page: false, // 不分页处理
329
-                                        limit: data.length // 限制数据条数,取数据源长度
330
-                                    }, true);
331
-                                });
357
+                                layer.msg(res.message);
358
+                                table.reload('currentTableId');
332 359
                             }
333 360
                         },
334 361
                         error: function (error) {
335 362
 
336 363
                             layer.alert('服务器睡着了', {icon: 5});
337 364
                             console.log(error);
365
+                            table.reload('currentTableId');
338 366
                         }
339 367
                     });
340 368
                 });
@@ -345,19 +373,6 @@
345 373
 
346 374
     });
347 375
 
348
-    function updateTable() {
349
-        // 表格重载
350
-        table.reload('currentTableId', {
351
-            data: data,  // 更新后的数据源
352
-            page: false, // 不分页处理
353
-            limit: data.length // 限制数据条数,取数据源长度
354
-        }, true);
355
-
356
-    }
357
-
358
-    function setUpdateFlag() {
359
-        updateflag = 1;
360
-    }
361 376
 </script>
362 377
 </body>
363 378
 </html>

+ 5 - 2
src/main/resources/templates/stabudgetapproval/update_apply.html

@@ -675,8 +675,11 @@
675 675
                     return false;
676 676
                 }
677 677
                 dataTj[0].ysqje = parseFloat($("#sqje").val()) + sqje1;
678
-                dataTj[0].ybzje = bzjeOne + parseFloat($("#sqje").val());
679
-                dataTj[1].ysqje = dataTj[1].ysqje - parseFloat($("#sqje").val());
678
+                // dataTj[0].ybzje = bzjeOne + parseFloat($("#sqje").val());
679
+                dataTj[0].ybzje = bzjeOne;
680
+                // dataTj[1].ysqje = dataTj[1].ysqje - parseFloat($("#sqje").val());
681
+                dataTj[1].ysqje = dataTj[0].ysje * 10000- dataTj[0].ysqje
682
+
680 683
                 if (dataTj[0].ysqje > parseFloat(ysje * 1.2).toFixed(6)) {
681 684
                     Message.error("该科目申请的费用总金额,不能超过预算金额的120%!", 2000);
682 685
                     return false;