sjw 4 лет назад
Родитель
Сommit
1dbeac74b7

+ 0 - 202
src/p2apps/p2/application/tagents/tagents.java

@@ -1,13 +1,9 @@
 package p2.application.tagents;
 
 import baseclass.PaoCust;
-import p2.pao.PaoRemote;
 import p2.pao.PaoSet;
-import p2.pao.PaoSetRemote;
 import p2.util.P2Exception;
 
-import java.util.HashMap;
-
 public class tagents extends PaoCust {
     public tagents(PaoSet arg0) {
         super(arg0);
@@ -21,203 +17,5 @@ public class tagents extends PaoCust {
     @Override
     protected void save() throws P2Exception {
         super.save();
-        PaoRemote sysvar = getSysVars();
-        //经销商账号数量
-        int fagentaccountqty = sysvar.getInt("fagentaccountqty");
-        PaoSetRemote tenterprise_users = getPaoSet("tenterprise_users");
-        int createUserCount = 0;
-        if ((createUserCount = (fagentaccountqty - tenterprise_users.count())) > 0) {
-            for (int i = 0; i < createUserCount; i++) {
-                if (tenterprise_users.isEmpty() && i == 0) {
-                    PaoRemote tenterprise_user = tenterprise_users.addAtEnd();
-                    tenterprise_user.setValue("fisadministrator", true, 11L);
-                    tenterprise_user.setValue("frole", "管理员", 11L);
-                    tenterprise_user.setValue("fname", getString("fcontact"), 11L);
-                    tenterprise_user.setValue("fphonenumber", getString("fphonenumber"), 11L);
-                    tenterprise_user.setValue("fbirthdate", getString("fbirthdate"), 11L);
-                    tenterprise_user.setValue("femail", getString("femail"), 11L);
-                    tenterprise_user.setValue("fwechatno", getString("fwechatno"), 11L);
-                } else {
-                    tenterprise_users.addAtEnd();
-                }
-            }
-        }
-        if (getString("description").contains("复制")) {
-            String fcopyagentid = getString("description").replace("复制", "");
-            copydata(Long.parseLong(fcopyagentid));
-        }
     }
-
-    /**
-     * 经销商数据复制
-     *
-     * @return
-     * @throws P2Exception
-     */
-    public void copydata(long tagentsid) throws P2Exception {
-        //表名,老ID,新ID
-        HashMap<String, HashMap<Long, Long>> idmap = new HashMap<>();
-
-        saveid(idmap, getName(), tagentsid, getUniqueIDValue());
-        {
-            /**
-             * 复制门店
-             */
-            PaoSetRemote sourcePaoSet = getPaoSet("tstore_source", "tstore", "tagentsid=" + tagentsid);
-            PaoSetRemote newPaoset = getPaoSet("tstore_new", "tstore", "1=2");
-            sourcePaoSet.copy(newPaoset);
-            int i = 0;
-            PaoRemote newpao = null;
-            PaoRemote sourcepao = null;
-            while ((newpao = newPaoset.getPao(i)) != null && (sourcepao = sourcePaoSet.getPao(i)) != null) {
-                newpao.setValue("tagentsid", idmap.get("TAGENTS").get(sourcepao.getLong("tagentsid")));
-
-                saveid(idmap, sourcePaoSet.getName(), sourcepao.getUniqueIDValue(), newpao.getUniqueIDValue());
-                i++;
-            }
-        }
-
-        {
-            /**
-             * 复制门店改建记录
-             */
-            PaoSetRemote sourcePaoSet = getPaoSet("tstore_rebuildlog_source", "tstore_rebuildlog", "tagentsid=" + tagentsid);
-            PaoSetRemote newPaoset = getPaoSet("tstore_rebuildlog_new", "tstore_rebuildlog", "1=2");
-            sourcePaoSet.copy(newPaoset);
-            int i = 0;
-            PaoRemote newpao = null;
-            PaoRemote sourcepao = null;
-            while ((newpao = newPaoset.getPao(i)) != null && (sourcepao = sourcePaoSet.getPao(i)) != null) {
-                newpao.setValue("tagentsid", idmap.get("TAGENTS").get(sourcepao.getLong("tagentsid")));
-                newpao.setValue("tstoreid", idmap.get("TSTORE").get(sourcepao.getLong("tstoreid")));
-
-                saveid(idmap, sourcePaoSet.getName(), sourcepao.getUniqueIDValue(), newpao.getUniqueIDValue());
-                i++;
-            }
-        }
-        {
-            /**
-             * 复制客户档案
-             */
-            PaoSetRemote sourcePaoSet = getPaoSet("tcustomer_source", "tcustomer", "tagentsid=" + tagentsid);
-            PaoSetRemote newPaoset = getPaoSet("tcustomer_new", "tcustomer", "1=2");
-            sourcePaoSet.copy(newPaoset);
-            int i = 0;
-            PaoRemote newpao = null;
-            PaoRemote sourcepao = null;
-            while ((newpao = newPaoset.getPao(i)) != null && (sourcepao = sourcePaoSet.getPao(i)) != null) {
-                newpao.setValue("tagentsid", idmap.get("TAGENTS").get(sourcepao.getLong("tagentsid")));
-                newpao.setValue("tstoreid", idmap.get("TSTORE").get(sourcepao.getLong("tstoreid")));
-
-                saveid(idmap, sourcePaoSet.getName(), sourcepao.getUniqueIDValue(), newpao.getUniqueIDValue());
-                i++;
-            }
-        }
-        {
-            /**
-             * 复制销售接待记录
-             */
-            PaoSetRemote sourcePaoSet = getPaoSet("tcustomer_reception_source", "tcustomer_reception", "tagentsid=" + tagentsid);
-            PaoSetRemote newPaoset = getPaoSet("tcustomer_reception_new", "tcustomer_reception", "1=2");
-            sourcePaoSet.copy(newPaoset);
-            int i = 0;
-            PaoRemote newpao = null;
-            PaoRemote sourcepao = null;
-            while ((newpao = newPaoset.getPao(i)) != null && (sourcepao = sourcePaoSet.getPao(i)) != null) {
-                newpao.setValue("tagentsid", idmap.get("TAGENTS").get(sourcepao.getLong("tagentsid")));
-                newpao.setValue("tstoreid", idmap.get("TSTORE").get(sourcepao.getLong("tstoreid")));
-                newpao.setValue("tcustomerid", idmap.get("TCUSTOMER").get(sourcepao.getLong("tcustomerid")));
-
-                saveid(idmap, sourcePaoSet.getName(), sourcepao.getUniqueIDValue(), newpao.getUniqueIDValue());
-                i++;
-            }
-        }
-        {
-            /**
-             * 复制销售订单明细
-             */
-            PaoSetRemote sourcePaoSet = getPaoSet("tcustomer_order_source", "tcustomer_order", "tagentsid=" + tagentsid);
-            PaoSetRemote newPaoset = getPaoSet("tcustomer_order_new", "tcustomer_order", "1=2");
-            sourcePaoSet.copy(newPaoset);
-            int i = 0;
-            PaoRemote newpao = null;
-            PaoRemote sourcepao = null;
-            while ((newpao = newPaoset.getPao(i)) != null && (sourcepao = sourcePaoSet.getPao(i)) != null) {
-                newpao.setValue("tagentsid", idmap.get("TAGENTS").get(sourcepao.getLong("tagentsid")));
-                newpao.setValue("tcustomerid", idmap.get("TCUSTOMER").get(sourcepao.getLong("tcustomerid")));
-                newpao.setValue("tcustomer_receptid", idmap.get("TCUSTOMER_RECEPTION").get(sourcepao.getLong("tcustomer_receptid")));
-
-                saveid(idmap, sourcePaoSet.getName(), sourcepao.getUniqueIDValue(), newpao.getUniqueIDValue());
-                i++;
-            }
-        }
-
-        {
-            /**
-             * 复制营销事件
-             */
-            PaoSetRemote sourcePaoSet = getPaoSet("tsaleevent_source", "tsaleevent", "tagentsid=" + tagentsid);
-            PaoSetRemote newPaoset = getPaoSet("tsaleevent_new", "tsaleevent", "1=2");
-            sourcePaoSet.copy(newPaoset);
-            int i = 0;
-            PaoRemote newpao = null;
-            PaoRemote sourcepao = null;
-            while ((newpao = newPaoset.getPao(i)) != null && (sourcepao = sourcePaoSet.getPao(i)) != null) {
-                newpao.setValue("tagentsid", idmap.get("TAGENTS").get(sourcepao.getLong("tagentsid")));
-
-                saveid(idmap, sourcePaoSet.getName(), sourcepao.getUniqueIDValue(), newpao.getUniqueIDValue());
-                i++;
-            }
-        }
-
-        {
-            /**
-             * 复制费用
-             */
-            PaoSetRemote sourcePaoSet = getPaoSet("tagents_cost_source", "tagents_cost", "tagentsid=" + tagentsid);
-            PaoSetRemote newPaoset = getPaoSet("tagents_cost_new", "tagents_cost", "1=2");
-            sourcePaoSet.copy(newPaoset);
-            int i = 0;
-            PaoRemote newpao = null;
-            PaoRemote sourcepao = null;
-            while ((newpao = newPaoset.getPao(i)) != null && (sourcepao = sourcePaoSet.getPao(i)) != null) {
-                newpao.setValue("tagentsid", idmap.get("TAGENTS").get(sourcepao.getLong("tagentsid")));
-
-                saveid(idmap, sourcePaoSet.getName(), sourcepao.getUniqueIDValue(), newpao.getUniqueIDValue());
-                i++;
-            }
-        }
-        {
-            /**
-             * 复制费用明细
-             */
-            PaoSetRemote sourcePaoSet = getPaoSet("tagents_costmx_source", "tagents_costmx", "tagentsid=" + tagentsid);
-            PaoSetRemote newPaoset = getPaoSet("tagents_costmx_new", "tagents_costmx", "1=2");
-            sourcePaoSet.copy(newPaoset);
-            int i = 0;
-            PaoRemote newpao = null;
-            PaoRemote sourcepao = null;
-            while ((newpao = newPaoset.getPao(i)) != null && (sourcepao = sourcePaoSet.getPao(i)) != null) {
-                newpao.setValue("tagentsid", idmap.get("TAGENTS").get(sourcepao.getLong("tagentsid")));
-                newpao.setValue("tagents_costid", idmap.get("TAGENTS_COST").get(sourcepao.getLong("tagents_costid")));
-
-                saveid(idmap, sourcePaoSet.getName(), sourcepao.getUniqueIDValue(), newpao.getUniqueIDValue());
-                i++;
-            }
-        }
-        setValue("description", "", 11L);
-    }
-
-    public void saveid(HashMap<String, HashMap<Long, Long>> idmap, String tablename, long oldid, long newid) {
-        HashMap<Long, Long> agentidMap = null;
-        if (idmap.containsKey(tablename)) {
-            agentidMap = idmap.get(tablename);
-        } else {
-            agentidMap = new HashMap<>();
-        }
-        agentidMap.put(oldid, newid);
-        idmap.put(tablename, agentidMap);
-    }
-
-
 }

+ 0 - 84
src/p2apps/p2/application/tenterprise/tenterprise.java

@@ -17,90 +17,6 @@ public class tenterprise extends PaoCust {
     @Override
     protected void save() throws P2Exception {
         super.save();
-
-        if (!toBeAdded()) {
-            PaoRemote sysvar = getSysVars();
-            //企业账号数量
-            int fenterpriseaccountqty = sysvar.getInt("fenterpriseaccountqty");
-            int createUserCount = 0;
-            if ((createUserCount = (fenterpriseaccountqty - getPaoSet("$tenterprise_users", "tenterprise_users","siteid=:siteid and fusertype='企业'").count())) > 0) {
-                PaoSetRemote tenterprise_users = getPaoSet("tenterprise_users");
-                for (int i = 0; i < createUserCount; i++) {
-                    if (tenterprise_users.isEmpty() && i == 0) {
-                        PaoRemote tenterprise_user = tenterprise_users.addAtEnd();
-                        tenterprise_user.setValue("fisadministrator", true, 11L);
-                        tenterprise_user.setValue("fissysadministrator", true, 11L);
-                        tenterprise_user.setValue("frole", "管理员", 11L);
-                    } else {
-                        tenterprise_users.addAtEnd();
-                    }
-                }
-            }
-            //经销商账号数量
-            int fagentaccountqty = sysvar.getInt("fagentaccountqty");
-            PaoSetRemote tagents = getPaoSet("tagents");
-            int n = 0;
-            PaoRemote agentpao = null;
-            while ((agentpao = tagents.getPao(n)) != null) {
-                PaoSetRemote tagent_users = agentpao.getPaoSet("tenterprise_users");
-                int createagentUserCount = 0;
-                if ((createagentUserCount = (fagentaccountqty - tagent_users.count())) > 0) {
-                    for (int i = 0; i < createagentUserCount; i++) {
-                        if (tagent_users.isEmpty() && i == 0) {
-                            PaoRemote tenterprise_user = tagent_users.addAtEnd();
-                            tenterprise_user.setValue("fisadministrator", true, 11L);
-                            tenterprise_user.setValue("frole", "管理员", 11L);
-                            tenterprise_user.setValue("fname", agentpao.getString("fcontact"), 11L);
-                            tenterprise_user.setValue("fphonenumber", agentpao.getString("fphonenumber"), 11L);
-                            tenterprise_user.setValue("fbirthdate", agentpao.getString("fbirthdate"), 11L);
-                            tenterprise_user.setValue("femail", agentpao.getString("femail"), 11L);
-                            tenterprise_user.setValue("fwechatno", agentpao.getString("fwechatno"), 11L);
-                        } else {
-                            tagent_users.addAtEnd();
-                        }
-                    }
-                }
-                n++;
-            }
-
-            //自动复制销售动作
-            PaoSetRemote ttypedetailSet = getPaoSet("ttypedetail1", "ttypedetail", "ftype='销售动作' and siteid='" + getString("siteid") + "'");
-            if (ttypedetailSet.isEmpty()) {
-                PaoSetRemote ttypedetaildefaultSet = getPaoSet("ttypedetail2", "ttypedetail", "ftype='销售动作' and siteid is null");
-                int i = 0;
-                PaoRemote defaultpao = null;
-                while ((defaultpao = ttypedetaildefaultSet.getPao(i)) != null) {
-                    PaoRemote newpao = ttypedetailSet.addAtEnd();
-                    newpao.setValue("ftype", defaultpao.getString("ftype"));
-                    newpao.setValue("ftypemx", defaultpao.getString("ftypemx"));
-                    newpao.setValue("fvalue", defaultpao.getString("fvalue"));
-                    newpao.setValue("siteid", getString("siteid"));
-                    newpao.setValue("fisused", defaultpao.getBoolean("fisused"));
-                    newpao.setValue("sequence", defaultpao.getInt("sequence"));
-                    i++;
-                }
-            }
-
-            //自动复制标准工作模板
-            PaoSetRemote tworktemplateSet = getPaoSet("tworktemplate1", "tworktemplate", "siteid='" + getString("siteid") + "'");
-            if (tworktemplateSet.isEmpty()) {
-                PaoSetRemote tworktemplatedefaultSet = getPaoSet("tworktemplate2", "tworktemplate", "siteid is null");
-                int i = 0;
-                PaoRemote defaultpao = null;
-                while ((defaultpao = tworktemplatedefaultSet.getPao(i)) != null) {
-                    PaoRemote newpao = tworktemplateSet.addAtEnd();
-                    newpao.setValue("fdocqty", defaultpao.getInt("fdocqty"));
-                    newpao.setValue("fnotes", defaultpao.getString("fnotes"));
-                    newpao.setValue("ftype", defaultpao.getString("ftype"));
-                    newpao.setValue("fworkname", defaultpao.getString("fworkname"));
-                    newpao.setValue("siteid", getString("siteid"));
-                    newpao.setValue("fisused", defaultpao.getBoolean("fisused"));
-                    newpao.setValue("fisimage", defaultpao.getBoolean("fisimage"));
-                    newpao.setValue("fiseditnote", defaultpao.getBoolean("fiseditnote"));
-                    i++;
-                }
-            }
-        }
     }