Browse Source

20230420 11:37

wangzhuo 2 years ago
parent
commit
5973466a39

+ 43 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/agreement/TContractManagementController.java

@@ -1,7 +1,10 @@
 package com.ruoyi.web.controller.agreement;
 
-import java.util.List;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.ruoyi.anpin.domain.TContractManagement;
 import com.ruoyi.anpin.service.ITContractManagementService;
 import com.ruoyi.common.annotation.RepeatSubmit;
@@ -107,4 +110,43 @@ public class TContractManagementController extends BaseController
     {
         return toAjax(tContractManagementService.deleteTContractManagementByIds(fIds));
     }
+
+    /**
+     * 查询需要提醒的合同管理列表
+     */
+    @GetMapping("/expirationReminderDaysList")
+    public AjaxResult expirationReminderDaysList()
+    {
+        SimpleDateFormat sdf = new SimpleDateFormat();// 格式化时间
+        sdf.applyPattern("yyyy-MM-dd");
+        Date date = new Date();// 获取当前时间
+
+        Map<String, Object> map = new HashMap<>();
+        List<TContractManagement> tContractManagementList = new ArrayList<>();
+        List<TContractManagement> list = tContractManagementService.selectTContractManagementList(new TContractManagement());
+        if (ObjectUtils.isNotNull(list)){
+            list.forEach(e -> {
+                //获得到期时间
+                if (ObjectUtils.isNotNull(e.getCreationDate()) && ObjectUtils.isNotNull(e.getExpirationReminderDays())){
+                    Calendar c = Calendar.getInstance();
+                    c.setTime(e.getCreationDate());
+                    c.add(Calendar.DATE, e.getExpirationReminderDays());
+                    Date newDate = c.getTime();
+                    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+                    try {
+                        Date date1  = format.parse(format.format(date));
+                        Date date2 = format.parse(format.format(newDate));
+                        boolean before = date1.before(date2);
+                        if (!before){
+                            tContractManagementList.add(e);
+                        }
+                    } catch (ParseException parseException) {
+                        parseException.printStackTrace();
+                    }
+                }
+            });
+        }
+        map.put("tContractManagementList", tContractManagementList);
+        return AjaxResult.success("成功", map);
+    }
 }

+ 1 - 1
ruoyi-anpin/src/main/java/com/ruoyi/anpin/service/impl/TCostManagementServiceImpl.java

@@ -92,7 +92,7 @@ public class TCostManagementServiceImpl implements ITCostManagementService
         item.setBillId(tCostManagement.getfId());
         item.setActId(560L);
         List<AuditItems> auditItemsList = auditItemsMapper.selectAuditItemsUser(item);
-        if (StringUtils.isNotNull(auditItemsList)){
+        if (ObjectUtils.isNotNull(auditItemsList)){
             //提交人
             tCostManagement.setPresenterName(userMapper.selectUserById(auditItemsList.get(0).getAuditUserId()).getNickName());
             if (auditItemsList.size() >= 2){//一级审核人