Browse Source

付款计划删除校验

ly 2 weeks ago
parent
commit
8201e49276

+ 39 - 5
src/main/java/com/liang/controller/PrjPayplanController.java

@@ -6,8 +6,10 @@ import com.liang.common.base.BaseController;
6
 import com.liang.common.base.BaseResult;
6
 import com.liang.common.base.BaseResult;
7
 import com.liang.entity.PrjPayplan;
7
 import com.liang.entity.PrjPayplan;
8
 import com.liang.entity.PrjProject;
8
 import com.liang.entity.PrjProject;
9
+import com.liang.entity.StaPayapproval;
9
 import com.liang.service.PrjPayplanService;
10
 import com.liang.service.PrjPayplanService;
10
 import com.liang.service.PrjPayplannameService;
11
 import com.liang.service.PrjPayplannameService;
12
+import com.liang.service.StaPayapprovalService;
11
 import org.springframework.data.domain.Page;
13
 import org.springframework.data.domain.Page;
12
 import org.springframework.data.domain.PageRequest;
14
 import org.springframework.data.domain.PageRequest;
13
 import org.springframework.http.ResponseEntity;
15
 import org.springframework.http.ResponseEntity;
@@ -39,6 +41,8 @@ public class PrjPayplanController extends BaseController {
39
     @Resource
41
     @Resource
40
     private PrjPayplannameService prjPayplannameService;
42
     private PrjPayplannameService prjPayplannameService;
41
 
43
 
44
+    @Resource
45
+    private StaPayapprovalService staPayapprovalService;
42
     /**
46
     /**
43
      * 分页查询
47
      * 分页查询
44
      *
48
      *
@@ -197,12 +201,42 @@ public class PrjPayplanController extends BaseController {
197
         contractList.forEach(item -> {
201
         contractList.forEach(item -> {
198
             idList.add(item.getId());
202
             idList.add(item.getId());
199
         });
203
         });
204
+        List<PrjPayplan> ero = new ArrayList<>();
205
+        if (idList.size() > 1) {
206
+            for (int i = 0; i < idList.size(); i++) {
207
+                List<StaPayapproval> list = staPayapprovalService.getFkjh(idList.get(i));
208
+                if (list.size() == 0) {
209
+                    continue;
210
+                } else {
211
+                    // 查询出当前付款计划详细信息
212
+                    PrjPayplan prjPayplan = prjPayplanService.queryById(idList.get(i));
213
+                    ero.add(prjPayplan);
214
+                    idList.remove(idList.get(i));
215
+                }
216
+            }
217
+            int num = prjPayplanService.batchDelete(idList);
218
+            if (num > 0) {
219
+                if (ero.size() == 0) {
220
+                    return BaseResult.success("批量删除成功!");
221
+                } else {
222
+                    return BaseResult.success("批量部分删除成功!");
223
+                }
224
+            } else {
225
+                return BaseResult.failure("批量删除失败!");
226
+            }
227
+        }else {
228
+            List<StaPayapproval> list = staPayapprovalService.getFkjh(idList.get(0));
229
+            if (list.size() == 0){
230
+                int num = prjPayplanService.batchDelete(idList);
231
+                if (num > 0) {
232
+                    return BaseResult.success("删除成功!");
233
+                }else {
234
+                    return BaseResult.failure(1,"删除失败!");
235
+                }
236
+            }else {
237
+                return BaseResult.failure(1,"删除失败,该比付款计划已绑定付款申请,不能删除!");
238
+            }
200
 
239
 
201
-        int num = prjPayplanService.batchDelete(idList);
202
-        if (num > 0) {
203
-            return BaseResult.success("批量删除成功!");
204
-        } else {
205
-            return BaseResult.failure("批量删除失败!");
206
         }
240
         }
207
     }
241
     }
208
 }
242
 }

+ 2 - 0
src/main/java/com/liang/dao/StaPayapprovalDao.java

@@ -119,5 +119,7 @@ public interface StaPayapprovalDao {
119
     List<StaPayapproval> queryByHtId(Integer id);
119
     List<StaPayapproval> queryByHtId(Integer id);
120
 
120
 
121
     StaPayapproval getYFKJE(String fysq);
121
     StaPayapproval getYFKJE(String fysq);
122
+
123
+    List<StaPayapproval> getFkjh(Integer id);
122
 }
124
 }
123
 
125
 

+ 2 - 0
src/main/java/com/liang/service/StaPayapprovalService.java

@@ -101,5 +101,7 @@ public interface StaPayapprovalService {
101
 
101
 
102
     List<ViewFileVo> viewfile(String file);
102
     List<ViewFileVo> viewfile(String file);
103
 
103
 
104
+    List<StaPayapproval> getFkjh(Integer id);
105
+
104
 
106
 
105
 }
107
 }

+ 5 - 0
src/main/java/com/liang/service/impl/StaPayapprovalServiceImpl.java

@@ -225,4 +225,9 @@ public class StaPayapprovalServiceImpl implements StaPayapprovalService {
225
         }
225
         }
226
     }
226
     }
227
 
227
 
228
+    @Override
229
+    public List<StaPayapproval> getFkjh(Integer id) {
230
+        return this.staPayapprovalDao.getFkjh(id);
231
+    }
232
+
228
 }
233
 }

+ 7 - 0
src/main/resources/mapper/StaPayapprovalDao.xml

@@ -337,5 +337,12 @@ where
337
 
337
 
338
     </select>
338
     </select>
339
 
339
 
340
+    <select id="getFkjh" resultType="com.liang.entity.StaPayapproval">
341
+        select * from
342
+                     sta_PayApproval
343
+        where
344
+            FKJH = #{id}
345
+    </select>
346
+
340
 </mapper>
347
 </mapper>
341
 
348
 

+ 4 - 4
src/main/resources/templates/prjcontract/update.html

@@ -529,7 +529,7 @@
529
             cols: [
529
             cols: [
530
                 [
530
                 [
531
                     {type: "checkbox"},
531
                     {type: "checkbox"},
532
-                    {type: 'numbers', align: 'center'},
532
+                    {type: 'numbers', align: 'center',title: '序号'},
533
                     {field: 'jhmc', title: '计划名称', width: '15%'},
533
                     {field: 'jhmc', title: '计划名称', width: '15%'},
534
                     {field: 'fkyq', title: '付款要求', width: '20%'},
534
                     {field: 'fkyq', title: '付款要求', width: '20%'},
535
                     {field: 'zfbl', title: '支付比例(%)', width: '14%'},
535
                     {field: 'zfbl', title: '支付比例(%)', width: '14%'},
@@ -631,7 +631,6 @@
631
             var subTopics = table.cache["currentTableId3"];
631
             var subTopics = table.cache["currentTableId3"];
632
             if (subTopics.length == 0)
632
             if (subTopics.length == 0)
633
                 return;
633
                 return;
634
-
635
             var checkStatus = table.checkStatus('currentTableId3')
634
             var checkStatus = table.checkStatus('currentTableId3')
636
                 , data = checkStatus.data;
635
                 , data = checkStatus.data;
637
             if (data == null || data.length === 0) {
636
             if (data == null || data.length === 0) {
@@ -645,15 +644,16 @@
645
                         data: JSON.stringify(data),
644
                         data: JSON.stringify(data),
646
                         success: function (res) {
645
                         success: function (res) {
647
                             if (res.code === 0) {
646
                             if (res.code === 0) {
648
-                                Message.success(1000, res.message, function () {
647
+                                layer.msg(res.message,{icon:3},function () {
649
                                     // 重载表格
648
                                     // 重载表格
650
                                     currTable3.reload();
649
                                     currTable3.reload();
651
                                 });
650
                                 });
652
                             } else {
651
                             } else {
653
-                                Message.error(res.message, 1000);
652
+                                layer.msg(res.message,{icon:3});
654
                             }
653
                             }
655
                         },
654
                         },
656
                         error: function (error) {
655
                         error: function (error) {
656
+                            layer.msg(res.message,{icon:3});
657
                         }
657
                         }
658
                     });
658
                     });
659
                 });
659
                 });