Sfoglia il codice sorgente

交易市场平台(供应商)

wwh 1 mese fa
parent
commit
6a45de0303

+ 3 - 0
baqing-admin/src/main/java/com/ruoyi/web/modules/trading/service/impl/BizDistributorServiceImpl.java

@@ -93,6 +93,9 @@ public class BizDistributorServiceImpl implements IBizDistributorService
93 93
         assertDistributorNameUnique(row.getDistributorName(), row.getId());
94 94
         assertIdentityNoUnique(row.getIdentityNo(), row.getId());
95 95
         row.setDelFlag(DistributorRules.DEL_FLAG_NORMAL);
96
+        row.setAccountAssigned(db.getAccountAssigned());
97
+        row.setSysUserId(db.getSysUserId());
98
+        row.setAssignedLoginName(db.getAssignedLoginName());
96 99
         return bizDistributorMapper.updateBizDistributor(row);
97 100
     }
98 101
 

+ 3 - 0
baqing-admin/src/main/java/com/ruoyi/web/modules/trading/service/impl/BizSupplierServiceImpl.java

@@ -94,6 +94,9 @@ public class BizSupplierServiceImpl implements IBizSupplierService
94 94
         assertSupplierNameUnique(row.getSupplierName(), row.getId());
95 95
         assertIdentityNoUnique(row.getIdentityNo(), row.getId());
96 96
         row.setDelFlag(SupplierRules.DEL_FLAG_NORMAL);
97
+        row.setAccountAssigned(db.getAccountAssigned());
98
+        row.setSysUserId(db.getSysUserId());
99
+        row.setAssignedLoginName(db.getAssignedLoginName());
97 100
         return bizSupplierMapper.updateBizSupplier(row);
98 101
     }
99 102
 

+ 25 - 0
baqing-admin/src/test/java/com/ruoyi/web/modules/trading/service/impl/BizDistributorServiceImplTest.java

@@ -73,6 +73,31 @@ class BizDistributorServiceImplTest
73 73
         verify(mapper, never()).insertBizDistributor(any());
74 74
     }
75 75
 
76
+    @Test
77
+    @DisplayName("修改保留账号分配字段")
78
+    void updatePreservesAccountFields()
79
+    {
80
+        BizDistributor db = sampleRow();
81
+        db.setId(3L);
82
+        db.setDistributorCode("03");
83
+        db.setAccountAssigned(TradePartnerAccountRules.ACCOUNT_ASSIGNED_YES);
84
+        db.setSysUserId(200L);
85
+        db.setAssignedLoginName("cxs3");
86
+        when(mapper.selectBizDistributorById(3L)).thenReturn(db);
87
+        when(mapper.countBizDistributorByNameExcludeId(any(), eq(3L))).thenReturn(0);
88
+        when(mapper.countBizDistributorByIdentityNoExcludeId(any(), eq(3L))).thenReturn(0);
89
+        when(mapper.updateBizDistributor(any())).thenReturn(1);
90
+
91
+        BizDistributor in = sampleRow();
92
+        in.setId(3L);
93
+        assertEquals(1, service.updateBizDistributor(in));
94
+
95
+        verify(mapper).updateBizDistributor(argThat(r ->
96
+                TradePartnerAccountRules.ACCOUNT_ASSIGNED_YES == r.getAccountAssigned()
97
+                        && Long.valueOf(200L).equals(r.getSysUserId())
98
+                        && "cxs3".equals(r.getAssignedLoginName())));
99
+    }
100
+
76 101
     @Test
77 102
     @DisplayName("修改禁止改编号")
78 103
     void updateCodeImmutable()

+ 26 - 0
baqing-admin/src/test/java/com/ruoyi/web/modules/trading/service/impl/BizSupplierServiceImplTest.java

@@ -78,6 +78,32 @@ class BizSupplierServiceImplTest
78 78
         verify(mapper, never()).insertBizSupplier(any());
79 79
     }
80 80
 
81
+    @Test
82
+    @DisplayName("修改保留账号分配字段")
83
+    void updatePreservesAccountFields()
84
+    {
85
+        BizSupplier db = sampleRow();
86
+        db.setId(3L);
87
+        db.setSupplierCode("03");
88
+        db.setAccountAssigned(TradePartnerAccountRules.ACCOUNT_ASSIGNED_YES);
89
+        db.setSysUserId(200L);
90
+        db.setAssignedLoginName("gys3");
91
+        when(mapper.selectBizSupplierById(3L)).thenReturn(db);
92
+        when(mapper.countBizSupplierByNameExcludeId(any(), eq(3L))).thenReturn(0);
93
+        when(mapper.countBizSupplierByIdentityNoExcludeId(any(), eq(3L))).thenReturn(0);
94
+        when(mapper.updateBizSupplier(any())).thenReturn(1);
95
+
96
+        BizSupplier in = sampleRow();
97
+        in.setId(3L);
98
+        in.setFeeMethod(SupplierRules.FEE_METHOD_PER_ACCOUNT);
99
+        assertEquals(1, service.updateBizSupplier(in));
100
+
101
+        verify(mapper).updateBizSupplier(argThat(r ->
102
+                TradePartnerAccountRules.ACCOUNT_ASSIGNED_YES == r.getAccountAssigned()
103
+                        && Long.valueOf(200L).equals(r.getSysUserId())
104
+                        && "gys3".equals(r.getAssignedLoginName())));
105
+    }
106
+
81 107
     @Test
82 108
     @DisplayName("修改禁止改编号")
83 109
     void updateCodeImmutable()