wangggziwen 2 lat temu
rodzic
commit
f444f1e5c0

+ 1 - 1
master/src/main/java/com/ruoyi/project/process/controller/TMocController.java

@@ -507,7 +507,7 @@ public class TMocController extends BaseController
     @PreAuthorize("@ss.hasPermi('process:moc:edit')")
     @Log(title = "MOC管理", businessType = BusinessType.UPDATE)
     @PutMapping("/delay")
-    public AjaxResult delay(@RequestBody DelayVO delayVo) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+    public AjaxResult delay(@RequestBody DelayVO delayVo) {
 
         return toAjax(tMocService.delay(delayVo));
     }

+ 1 - 1
master/src/main/java/com/ruoyi/project/process/service/ITMocService.java

@@ -52,7 +52,7 @@ public interface ITMocService
      * @param delayVO 前台请求数据传输对象
      * @return 结果
      */
-    public int delay(DelayVO delayVO) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException;
+    public int delay(DelayVO delayVO);
 
     /**
      * 批量删除MOC管理

+ 23 - 13
master/src/main/java/com/ruoyi/project/process/service/impl/TMocServiceImpl.java

@@ -97,9 +97,8 @@ public class TMocServiceImpl implements ITMocService
      * @return 结果
      */
     @Override
-    public int delay(DelayVO delayVO) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+    public int delay(DelayVO delayVO) {
         TMoc tMoc = tMocMapper.selectTMocById(delayVO.getId());
-
         Date sealDate = tMoc.getSealDate();
         Date extention1 = tMoc.getExtention1();
         Date extention2 = tMoc.getExtention2();
@@ -110,9 +109,7 @@ public class TMocServiceImpl implements ITMocService
         Date extention7 = tMoc.getExtention7();
         Date extention8 = tMoc.getExtention8();
         Date extention9 = tMoc.getExtention9();
-
         Date extention = null;
-
         // 延期日期为空,自动延期六个月
         if (delayVO.getExtention() == null) {
             Date now = null;
@@ -137,23 +134,37 @@ public class TMocServiceImpl implements ITMocService
             } else if (sealDate != null) {
                 now = sealDate;
             }
-            int month = now.getMonth();
             int year = now.getYear();
+            int month = now.getMonth();
             int date = now.getDate();
-            if (month <= 5) {   // 延期后不跨年
-                month += 6;
-            } else {    // 延期后跨年
-                month -= 6;
-                year++;
+            // 3.31 => 9.30
+            // 5.31 => 11.30
+            // 10.31 => 4.30
+            // 12.31 => 6.30
+            if (month == 2 || month == 4 || month == 9 || month == 11) {
+                if (date == 31) {
+                    date = 30;
+                }
             }
+            // 8.31 => 2.28/29
+            if (month == 7) {
+                if ((year + 1) % 4 == 0) {  // 闰年
+                    if (date > 29) {
+                        date = 29;
+                    }
+                } else {    // 非闰年
+                    if (date > 28) {
+                        date = 28;
+                    }
+                }
+            }
+            month += 6;
             extention = new Date(year, month, date);
         } else {    // 手动延期
             extention = delayVO.getExtention();
         }
-
         // 到期时间修改为延期时间
         tMoc.setExpTime(extention);
-
         // 判断第几次延期
         if (tMoc.getExtention1() == null) {
             tMoc.setExtention1(extention);
@@ -190,7 +201,6 @@ public class TMocServiceImpl implements ITMocService
                 }
             }
         }
-
         return this.updateTMoc(tMoc);
     }
 

+ 2 - 2
ui/.env.development

@@ -2,8 +2,8 @@
 ENV = 'development'
 
 # CPMS管理系统/开发环境
-#VUE_APP_BASE_API = '/dev-api'
-VUE_APP_BASE_API = 'http://47.114.101.16:8090'
+VUE_APP_BASE_API = '/dev-api'
+#VUE_APP_BASE_API = 'http://47.114.101.16:8090'
 
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 2 - 2
ui/src/views/process/moc/aquifier/index.vue

@@ -1178,8 +1178,8 @@
       tableCellStyle( {row, column, rowIndex, columnIndex} ) {
         let today = new Date(); // 当前时间
         let expTime = new Date(row.expTime);
-        if (today.getTime() > expTime.getTime()) {
-          let difference = today.getTime() - expTime.getTime(); // 时间差
+        if (today.getTime() < expTime.getTime()) {
+          let difference = expTime.getTime() - today.getTime(); // 时间差
           if (row.status == 0) { // 移除的数据
             return "background-color: rgba(146, 208, 80, 1);";
           } else if (row.expTime != null && row.expTime != '') {

+ 2 - 2
ui/src/views/process/moc/facility/index.vue

@@ -593,8 +593,8 @@
       tableCellStyle( {row, column, rowIndex, columnIndex} ) {
         let today = new Date(); // 当前时间
         let expTime = new Date(row.expTime);
-        if (today.getTime() > expTime.getTime()) {
-          let difference = today.getTime() - expTime.getTime(); // 时间差
+        if (today.getTime() < expTime.getTime()) {
+          let difference = expTime.getTime() - today.getTime(); // 时间差
           if (row.tempState == 0) { // 移除的数据
             return "background-color: rgba(146, 208, 80, 1);";
           } else if (row.expTime != null && row.expTime != '') {

+ 2 - 2
ui/src/views/process/moc/interlock/index.vue

@@ -680,8 +680,8 @@
       tableCellStyle( {row, column, rowIndex, columnIndex} ) {
         let today = new Date(); // 当前时间
         let expTime = new Date(row.expTime);
-        if (today.getTime() > expTime.getTime()) {
-          let difference = today.getTime() - expTime.getTime(); // 时间差
+        if (today.getTime() < expTime.getTime()) {
+          let difference = expTime.getTime() - today.getTime(); // 时间差
           if (row.tempState == 0) { // 移除的数据
             return "background-color: rgba(146, 208, 80, 1);";
           } else if (row.expTime != null && row.expTime != '') {

+ 2 - 2
ui/src/views/process/moc/temporaryMoc/index.vue

@@ -937,8 +937,8 @@
       tableCellStyle( {row, column, rowIndex, columnIndex} ) {
         let today = new Date(); // 当前时间
         let expTime = new Date(row.expTime);
-        if (today.getTime() > expTime.getTime()) {
-          let difference = today.getTime() - expTime.getTime(); // 时间差
+        if (today.getTime() < expTime.getTime()) {
+          let difference = expTime.getTime() - today.getTime(); // 时间差
           if (row.status == 0 || row.tempState == 0) { // 移除的数据
             return "background-color: rgba(146, 208, 80, 1);";
           } else if (row.expTime != null && row.expTime != '') {