Browse Source

提交正式环境应用id

qxp 4 years ago
parent
commit
ed03893be9

+ 2 - 2
suishenbang-api/src/main/resources/application-prod.yml

@@ -101,9 +101,9 @@ qiyeweixin:
   corpid: ww5444eb205d75e730
   #企业应用的凭证密钥
   #Cs9omiMVyz3cLm2D5T51i4bCDarHhIdl5uTaj__E-38  随身邦
-  corpsecret: hafspbfljYGiKEdAizhyt3jlxtmZfT9yXnZ5go3ykfw
+  corpsecret: g37wunxe43I_g-W_umTUFFGEFU6m1ordFoMLuUe4rK8
   #应用id
-  agentId: 1000079
+  agentId: 1000089
 esign:
   #  SaaS版
   #  appId: 7438822756

+ 68 - 51
suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/impl/AnalysisSysUserService.java

@@ -140,64 +140,57 @@ public class AnalysisSysUserService implements IAnalysisSysUserService {
                     userExt.setBossName(m.getBossName());
                     userExt.setSapEmployeeId(m.getSapEmployeeId());
                     userExt.setPostCode(m.getEmployeePost());
-                    userExt.setPostName(m.getEmployeePostName());
+                    String postName = m.getEmployeePostName();
+                    userExt.setPostName(postName);
                     //判断用户所处销售层级
-
-                    String fildName ="";
-                    String fildCode = "";
-                    if(m.getStext6()!=null){
-                        if(empSet.contains(m.getEmployeePostName())){
-                            userExt.setSalesLevel("emp_level");
-                            userExt.setOrgName(m.getStext6());
-                            setExtOrgCode(salesTreeMap,6,userExt);
-                            fildName = "Org6name";
-                            fildCode = "Org6code";
-                        }else if(subofficeSet.contains(m.getEmployeePostName())){
-                            userExt.setSalesLevel("suboffice_level");
-                            userExt.setOrgName(m.getStext6());
-                            setExtOrgCode(salesTreeMap,6,userExt);
-                            fildName = "Org6name";
-                            fildCode = "Org6code";
-                        }else{
-                            throw new OutOfDIYPostNameException(m,6);
-                        }
-                    }else if(m.getStext5()!=null){
-
-                        if(officeSet.contains(m.getEmployeePostName())){
-                            userExt.setSalesLevel("office_level");
-                            userExt.setOrgName(m.getStext5());
-                            setExtOrgCode(salesTreeMap,5,userExt);
-                            fildName = "Org5name";
-                            fildCode = "Org5code";
+                    //先啊判断用户所属的岗位名称确定销售部门
+                    if(companySet.contains(postName)){
+                        //先处理特殊的第三级 区公司级别
+                        userExt.setSalesLevel("company_level");
+                        userExt.setOrgName(m.getStext3());
+                        setExtOrgCodeOn3(salesTreeMap,userExt);
+                    }else {
+                        if(m.getStext6()!=null){
+                            if(empSet.contains(m.getEmployeePostName())){
+                                userExt.setSalesLevel("emp_level");
+                                userExt.setOrgName(m.getStext6());
+                                setExtOrgCode(salesTreeMap,6,userExt);
+
+                            }else if(subofficeSet.contains(m.getEmployeePostName())){
+                                userExt.setSalesLevel("suboffice_level");
+                                userExt.setOrgName(m.getStext6());
+                                setExtOrgCode(salesTreeMap,6,userExt);
+
+                            }else{
+                                throw new OutOfDIYPostNameException(m,6);
+                            }
+                        }else if(m.getStext5()!=null){
+
+                            if(officeSet.contains(m.getEmployeePostName())){
+                                userExt.setSalesLevel("office_level");
+                                userExt.setOrgName(m.getStext5());
+                                setExtOrgCode(salesTreeMap,5,userExt);
+
+                            }else{
+                                throw new OutOfDIYPostNameException(m,5);
+                            }
+                        }else if(m.getStext4()!=null){
+                            if(saledeptSet.contains(m.getEmployeePostName())){
+                                userExt.setSalesLevel("saledept_level");
+                                userExt.setOrgName(m.getStext4());
+                                setExtOrgCode(salesTreeMap,4,userExt);
+
+                            } else{
+                                throw new OutOfDIYPostNameException(m,4);
+                            }
                         }else{
-                            throw new OutOfDIYPostNameException(m,5);
-                        }
-                    }else if(m.getStext4()!=null){
-                        if(saledeptSet.contains(m.getEmployeePostName())){
-                            userExt.setSalesLevel("saledept_level");
-                            userExt.setOrgName(m.getStext4());
-                            setExtOrgCode(salesTreeMap,4,userExt);
-                            fildName = "Org4name";
-                            fildCode = "Org4code";
-                        } else{
-                            throw new OutOfDIYPostNameException(m,4);
-                        }
-                    }else if(m.getStext3()!=null){
-                        if(companySet.contains(m.getEmployeePostName())){
-                            userExt.setSalesLevel("company_level");
-                            userExt.setOrgName(m.getStext3());
-                            setExtOrgCode(salesTreeMap,3,userExt);
-                            fildName = "Org3name";
-                            fildCode = "Org3code";
-                        } else{
-                            throw new OutOfDIYPostNameException(m,3);
+                            throw new OutOfLeveLException(m);
                         }
-                    }else{
-                        throw new OutOfLeveLException(m);
                     }
 
 
 
+
 //                    if(userExt.getOrgName()!=null){
 //                        Map<String,String> map=  metaDiySalesorgtreeMapper.selectSalesorgByName(fildName,fildCode,userExt.getOrgName());
 //                        if(map!=null && map.containsKey("orgcode")){
@@ -337,6 +330,30 @@ public class AnalysisSysUserService implements IAnalysisSysUserService {
 
     }
 
+    /**
+     * 根据用户所处部门是否包含第三等级区公司名称 来获取code特殊情况针对 第三级特殊情况
+     * @param salesTree
+     * @param userExt 用户扩展信息
+     * @return
+             */
+    public boolean setExtOrgCodeOn3(Map<Integer,Map<String,Map<String,String>>> salesTree,SysUserExt userExt){
+        if(userExt.getOrgName()==null||userExt.getOrgName().trim().equals("")){
+            return false;
+        }
+        String orgname = userExt.getOrgName();
+        Map<String,Map<String,String>> temp = salesTree.get(3);
+        //遍历区公司名称
+        for (String key : temp.keySet()) {
+            if(orgname.indexOf(key)!=-1){
+                userExt.setOrgCode(temp.get(key).get("orgcode"));
+                userExt.setOrgName(key);
+                return true;
+            }
+        }
+        return false;
+
+    }
+
 
 
 }