Parcourir la source

Merge remote-tracking branch 'origin/user-customer-24821' into uat

njs il y a 2 mois
Parent
commit
27546141e1

+ 6 - 2
suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/AnalysisDiyCustomerComponent.java

@@ -907,10 +907,14 @@ public class AnalysisDiyCustomerComponent {
                             if (assRelcustomerinfoList != null && assRelcustomerinfoList.size() > 0) {
                                 assRelcustomerinfoService.deleteAssRelcustomerinfoByUserId(user.getUserId().toString(), customerCode);
                             }
-                            if (user.getSysUserExt().getOrgCode() != null && !customerCode.equals(userOld.getSysUserExt().getOrgCode())) {
+                            if (user.getSysUserExt().getOrgCode() != null && (!customerCode.equals(userOld.getSysUserExt().getOrgCode()) || !customerCode.equals(userOld.getSysUserExt().getCustomerCode()) )) {
                                     AssRelcustomerinfo info = new AssRelcustomerinfo();
                                     info.setUserId(userOld.getUserId().toString());
-                                    info.setMainkunnr(userOld.getSysUserExt().getOrgCode());
+                                    if(!customerCode.equals(userOld.getSysUserExt().getOrgCode())){
+                                        info.setMainkunnr(userOld.getSysUserExt().getOrgCode());
+                                    }else{
+                                        info.setMainkunnr(userOld.getSysUserExt().getCustomerCode());
+                                    }
                                     if (cusMap.containsKey(info.getMainkunnr())) {
                                         Customers c = cusMap.get(info.getMainkunnr());
                                         info.setMainname1(c.getChainsName());