客户供应商接口分类标准处理、会计科目接口分配后版本化子公司科目
This commit is contained in:
		
							parent
							
								
									2ea5f0077d
								
							
						
					
					
						commit
						b364ddc38f
					
				|  | @ -30,7 +30,7 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem | |||
|     private static final String entityName = "bd_customer";//系统库 表名 T_BD_Customer | ||||
| 
 | ||||
|     private static final String cusTypeName = "bd_customergroup";//系统库 表名 t_bd_customergroup | ||||
| //    private static final String gdName = "bd_customergroupdetail";//系统库 客户分组 表名 t_bd_customergroupdetail | ||||
|     private static final String gdName = "bd_customergroupdetail";//系统库 客户分组 表名 t_bd_customergroupdetail | ||||
|     private static final String bebankName = "bd_bebank";//系统库 行名行号 表名 t_bd_bebank | ||||
|     private static final Log log = LogFactory.getLog(CustomerInitOperation.class); | ||||
| 
 | ||||
|  | @ -51,7 +51,7 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem | |||
|             DynamicObject custype; | ||||
|             JSONObject json_body; | ||||
|             Long currentSupId; | ||||
| //            DynamicObject custgroupdetail; | ||||
|             DynamicObject custgroupdetail; | ||||
|             OperateOption oop = OperateOption.create(); | ||||
|             DynamicObject grouporginfo = EsbUtils.getGroupOrg(); | ||||
|             OperationResult operResult; | ||||
|  | @ -150,14 +150,26 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem | |||
|                             itemInfo.put("code",cusnumber); | ||||
|                             itemInfo.put("error","客户保存失败"+operResult.getMessage()); | ||||
|                             itemsJson.add(itemInfo); | ||||
|                             continue; | ||||
|                         } | ||||
|                         //处理分类-客户只有一个分类 | ||||
|                         custgroupdetail = BusinessDataServiceHelper.loadSingle(gdName,new QFilter[]{ | ||||
|                                 new QFilter("customer.id","=",currentSupId)}); | ||||
|                         if(custgroupdetail == null){ | ||||
|                             custgroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName); | ||||
|                             custgroupdetail.set("createorg", grouporginfo);//创建组织 | ||||
|                             custgroupdetail.set("standard",EsbUtils.CUSTOMERSTAND);//客户分类标准 | ||||
|                             custgroupdetail.set("customer",currentCus);//客户 | ||||
|                         } | ||||
|                         custgroupdetail.set("group",custype);//具体分类 | ||||
|                         operResult = OperationServiceHelper.executeOperate("save", gdName, new DynamicObject[]{custgroupdetail}, oop); | ||||
|                         if(!operResult.isSuccess()){ | ||||
|                             log.error(String.format("客户分类保存失败:%s", json_body.toJSONString())); | ||||
|                             itemInfo = new JSONObject(); | ||||
|                             itemInfo.put("code",cusnumber); | ||||
|                             itemInfo.put("error","客户分类保存失败"+operResult.getMessage()); | ||||
|                             itemsJson.add(itemInfo); | ||||
|                         } | ||||
|                         //处理分类 | ||||
| //                        custgroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName); | ||||
| //                        custgroupdetail.set("createorg",JhzjUtils.GROUPID);//创建组织 | ||||
| //                        custgroupdetail.set("standard",EsbUtils.CUSTOMERSTAND);//客户分类标准 | ||||
| //                        custgroupdetail.set("group",custype.getLong("id"));//具体分类 | ||||
| //                        custgroupdetail.set("customer",currentSupId);//客户 | ||||
| //                        SaveServiceHelper.save(new DynamicObject[]{custgroupdetail}); | ||||
|                     }else{ | ||||
|                         //修改客户 名称 税务登记号 联系人 联系电话 银行信息 客户组5 | ||||
|                         currentSupId = currentCus.getLong("id"); | ||||
|  | @ -187,7 +199,6 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem | |||
|                 EsbUtils.handleAssignNew(companysJson, cusids, entityName); | ||||
|                 //处理客户取消分配--初始化时不需要用 | ||||
| //            EsbUtils.handleUnAssign(companysJson, cusids, entityName); | ||||
| 
 | ||||
|                 if(itemsJson.isEmpty()){ | ||||
|                     this.operationResult.addSuccessPkId(pzinfo.getPkValue()); | ||||
|                 }else{ | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem | |||
|     private static final String entityName = "bd_supplier";//系统库 表名 T_BD_Supplier | ||||
|     private static final String supTypeName = "bd_suppliergroup";//系统库 表名 t_bd_suppliergroup | ||||
|     private static final String bebankName = "bd_bebank";//系统库 行名行号 表名 t_bd_bebank | ||||
| //    private static final String gdName = "bd_suppliergroupdetail";//系统库 供应商分组 表名 t_bd_suppliergroupdetail | ||||
|     private static final String gdName = "bd_suppliergroupdetail";//系统库 供应商分组 表名 t_bd_suppliergroupdetail | ||||
|     private static final Log log = LogFactory.getLog(SupplierInitOperation.class); | ||||
| 
 | ||||
|     @Override | ||||
|  | @ -73,12 +73,13 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem | |||
|             DynamicObject bebankinfo; | ||||
|             JSONObject json_bank; | ||||
|             Long currentSupId; | ||||
| //            DynamicObject suppliergroupdetail; | ||||
|             DynamicObject suppliergroupdetail; | ||||
|             OperateOption oop = OperateOption.create(); | ||||
|             DynamicObject grouporginfo = EsbUtils.getGroupOrg(); | ||||
|             DynamicObject rmbinfo = EsbUtils.getRmb(); | ||||
|             OperationResult operResult; | ||||
|             Map<String, Long> cusids = new HashMap<>();//供应商编号和ID对应关系 | ||||
|             boolean isNew; | ||||
|             for (int i = 0; i < detailsJson.size(); i++) { | ||||
|                 json_body = detailsJson.getJSONObject(i); | ||||
|                 supnumber = json_body.getString("code"); | ||||
|  | @ -103,6 +104,7 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem | |||
|                     itemsJson.add(itemInfo); | ||||
|                     continue; | ||||
|                 } | ||||
|                 isNew = false; | ||||
|                 currentSup = BusinessDataServiceHelper.loadSingle(entityName,new QFilter[]{new QFilter("number","=",supnumber)}); | ||||
|                 if(currentSup == null){ | ||||
|                     //根据编号找不到供应商,则新增 | ||||
|  | @ -126,13 +128,7 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem | |||
|                     currentSupId = ID.genLongId(); | ||||
|                     currentSup.set("id", currentSupId); | ||||
|                     currentSup.set("masterid",currentSupId); | ||||
|                     //处理分类 | ||||
| //                    suppliergroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName); | ||||
| //                    suppliergroupdetail.set("createorg",JhzjUtils.GROUPID);//创建组织 | ||||
| //                    suppliergroupdetail.set("standard",EsbUtils.SUPPLIERSTAND);//供应商分类标准 | ||||
| //                    suppliergroupdetail.set("group",suptype.getLong("id"));//具体分类 | ||||
| //                    suppliergroupdetail.set("supplier",currentSupId);//供应商 | ||||
| //                    SaveServiceHelper.save(new DynamicObject[]{suppliergroupdetail}); | ||||
|                     isNew = true; | ||||
|                 } | ||||
|                 currentSup.set("name",supname);//供应商名称 | ||||
|                 currentSup.set("tx_register_no",taxno);//税务登记号 | ||||
|  | @ -194,6 +190,26 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem | |||
|                     itemInfo.put("error","供应商保存失败"+operResult.getMessage()); | ||||
|                     itemsJson.add(itemInfo); | ||||
|                 } | ||||
|                 //新增时处理分类-只有一个分类 | ||||
|                 if(isNew){ | ||||
|                     suppliergroupdetail = BusinessDataServiceHelper.loadSingle(gdName,new QFilter[]{ | ||||
|                             new QFilter("supplier.id","=",currentSup.getLong("id"))}); | ||||
|                     if(suppliergroupdetail == null){ | ||||
|                         suppliergroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName); | ||||
|                         suppliergroupdetail.set("createorg", grouporginfo);//创建组织 | ||||
|                         suppliergroupdetail.set("standard",EsbUtils.SUPPLIERSTAND);//供应商分类标准 | ||||
|                         suppliergroupdetail.set("supplier",currentSup);//供应商 | ||||
|                     } | ||||
|                     suppliergroupdetail.set("group",suptype);//具体分类 | ||||
|                     operResult = OperationServiceHelper.executeOperate("save", gdName, new DynamicObject[]{suppliergroupdetail}, oop); | ||||
|                     if(!operResult.isSuccess()){ | ||||
|                         log.error(String.format("供应商分类保存失败:%s", json_body.toJSONString())); | ||||
|                         itemInfo = new JSONObject(); | ||||
|                         itemInfo.put("code",supnumber); | ||||
|                         itemInfo.put("error","供应商分类保存失败"+operResult.getMessage()); | ||||
|                         itemsJson.add(itemInfo); | ||||
|                     } | ||||
|                 } | ||||
|                 cusids.put(supnumber,currentSup.getLong("id")); | ||||
|             } | ||||
| 
 | ||||
|  |  | |||
|  | @ -48,24 +48,26 @@ public class PersonCustomerBankTask extends AbstractTask implements Plugin { | |||
|                 //只处理新增 | ||||
|                 return; | ||||
|             } | ||||
|             String xxyh =  ups.getString("shjh_xxyh");//详细分机银行 | ||||
|             //根据详细分机银行 查找对应的行名行号 | ||||
|             DynamicObject bebankinfo = BusinessDataServiceHelper.loadSingleFromCache(bebankName,"id,number,name", | ||||
|                     new QFilter[]{new QFilter("name","=",xxyh)}); | ||||
|             if(bebankinfo == null){ | ||||
|                 return; | ||||
|             } | ||||
|             String cusname = ups.getString("name");//姓名 | ||||
| //            String skyh = ups.getString("shjh_skyh");//收款银行 | ||||
|             String xxyh =  ups.getString("shjh_xxyh");//详细分机银行 | ||||
|             DynamicObject bankinfo; | ||||
|             if(doc_bank.isEmpty()){ | ||||
|                 bankinfo = doc_bank.addNew(); | ||||
|                 bankinfo.set("isdefault_bank",true); | ||||
|             }else{ | ||||
|                 bankinfo = doc_bank.get(0); | ||||
|             } | ||||
|             bankinfo.set("bankaccount",acctnum);//银行账号 | ||||
|             bankinfo.set("accountname",cusname);//账户名称 | ||||
|             //根据详细分机银行 查找对应的行名行号 | ||||
|             DynamicObject bebankinfo = BusinessDataServiceHelper.loadSingleFromCache(bebankName,"id,name",new QFilter[]{new QFilter("name","=",xxyh)}); | ||||
|             if(bebankinfo != null){ | ||||
|                 bankinfo.set("bank",bebankinfo.getLong("id"));//开户银行-行名行号 根据入参查找 | ||||
|             } | ||||
|             bankinfo.set("bank",bebankinfo);//开户银行-行名行号 根据入参查找 | ||||
|             bankinfo.set("currency", rmbinfo);//币别 默认人民币 | ||||
|             bankinfo.set("isdefault_bank",true); | ||||
|             SaveServiceHelper.save(new DynamicObject[]{currentCus}); | ||||
|         } | ||||
|         //客户还未生成,需要在客户生成时,从人员处获取银行账号 | ||||
|  |  | |||
|  | @ -130,7 +130,7 @@ public class AspAccountControler { | |||
|                 if("0".equals(json_body.getString("status")) || !name.equals(acctInfo.getString("name"))){ | ||||
|                     acctInfo.set("enable", 0);//科目禁用处理 | ||||
|                     acctInfo.set("name", name); | ||||
|                     acctInfo.set("fullname", name); | ||||
| //                    acctInfo.set("fullname", name); | ||||
|                     OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, oop); | ||||
|                 } | ||||
|             }else{ | ||||
|  | @ -157,8 +157,8 @@ public class AspAccountControler { | |||
|                     itemsJson.add(itemInfo); | ||||
|                     continue; | ||||
|                 } | ||||
|                 acctInfo.set("longnumber", number); | ||||
|                 acctInfo.set("fullname", name); | ||||
| //                acctInfo.set("longnumber", number); | ||||
| //                acctInfo.set("fullname", name); | ||||
|                 acctInfo.set("parent", parentAcctInfo); | ||||
|                 //创建组织 | ||||
|                 acctInfo.set("createorg", grouporginfo);//创建组织 | ||||
|  | @ -211,11 +211,10 @@ public class AspAccountControler { | |||
|         } | ||||
| 
 | ||||
|         JSONArray companysJson = json_obj.getJSONArray("companys"); | ||||
|         //处理科目分配 | ||||
|         EsbUtils.handleAssignNew(companysJson, acctids, entityName); | ||||
|         //处理科目在每个公司生成 | ||||
|         Map<String, DynamicObject> companyAcctMaps = handleAccountCompany(accountMaps,companysJson); | ||||
|         //处理科目分配和反分配 | ||||
|         EsbUtils.handleAssignNew(companysJson, acctids, entityName); | ||||
|         EsbUtils.handleUnAssignNew(companysJson, acctids, entityName); | ||||
|         //处理每个公司下科目的核算维度和禁用状态 | ||||
|         JSONArray asstacttypesJson = json_obj.getJSONArray("asstacttypes"); | ||||
|         if(asstacttypesJson != null){ | ||||
|  | @ -283,6 +282,8 @@ public class AspAccountControler { | |||
|                 companyAcctMaps.put(number+companynum,acctInfo); | ||||
|             } | ||||
|         } | ||||
|         //最后处理科目的反分配 | ||||
|         EsbUtils.handleUnAssignNew(companysJson, acctids, entityName); | ||||
| 
 | ||||
|         if(itemsJson.isEmpty()){ | ||||
|             EsbUtils.saveLog(apimenthod,"ESB",json_obj.toString(),null,true,"API"); | ||||
|  | @ -365,6 +366,7 @@ public class AspAccountControler { | |||
|     } | ||||
| 
 | ||||
|     private DynamicObject copydo(DynamicObject olddo, DynamicObject hsorgInfo, JSONObject json_body){ | ||||
|         //根据集团的科目复制一份作为子公司的科目,此时需要处理一下核算维度,其他属性和集团一样 | ||||
|         DynamicObject newAcctInfo = BusinessDataServiceHelper.newDynamicObject(entityName); | ||||
|         newAcctInfo.set("accounttable", tableinfo);//TODO 科目表fid,上正式时,注意此ID | ||||
|         newAcctInfo.set("number", olddo.getString("number")); | ||||
|  | @ -470,8 +472,8 @@ public class AspAccountControler { | |||
|             acctInfo.set("accounttable", tableinfo);//科目表fid,上正式时,注意此ID | ||||
|             acctInfo.set("number", parentnumber); | ||||
|             acctInfo.set("name", parentname); | ||||
|             acctInfo.set("longnumber", parentnumber); | ||||
|             acctInfo.set("fullname", parentname); | ||||
| //            acctInfo.set("longnumber", parentnumber); | ||||
| //            acctInfo.set("fullname", parentname); | ||||
|             //创建组织 | ||||
|             acctInfo.set("createorg", grouporginfo);//创建组织 | ||||
|             acctInfo.set("org", grouporginfo);//管理组织 | ||||
|  |  | |||
|  | @ -265,7 +265,9 @@ public class PersonControler implements Serializable { | |||
|         update t_bas_immapping SET FUSERID = (select fid from t_sec_user where fphone = '用户手机号') where fid = '用户手机号'; | ||||
|         如果没有同步用户,即t_bas_immapping表中查不到数据,则会跳转到苍穹登陆界面;用户输入信息之后苍穹会自动在t_bas_immapping中获取openid并存储; | ||||
|          */ | ||||
|         DB.update(DBRoute.of("sys"), insertMmapping, new Object[]{ID.genLongId(),ups.getDataMap().get("shjh_oaid"),ups.getId()}); | ||||
|         if(!EsbUtils.isEmpty((String) ups.getDataMap().get("shjh_oaid"))){ | ||||
|             DB.update(DBRoute.of("sys"), insertMmapping, new Object[]{ID.genLongId(),ups.getDataMap().get("shjh_oaid"),ups.getId()}); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void updatePersonImmapping(UserParam ups){ | ||||
|  | @ -283,27 +285,29 @@ public class PersonControler implements Serializable { | |||
|                 return; | ||||
|             } | ||||
|             String cusname = (String) ups.getDataMap().get("name");//姓名 | ||||
|             String skyh = (String) ups.getDataMap().get("shjh_skyh");//收款银行 | ||||
| //            String skyh = (String) ups.getDataMap().get("shjh_skyh");//收款银行 | ||||
|             String xxyh = (String) ups.getDataMap().get("shjh_xxyh");//详细分机银行 | ||||
|             //根据详细分机银行 查找对应的行名行号 | ||||
|             DynamicObject bebankinfo = BusinessDataServiceHelper.loadSingleFromCache(bebankName,"id,number,name", | ||||
|                     new QFilter[]{new QFilter("name","=",xxyh)}); | ||||
|             if(bebankinfo == null){ | ||||
|                 return; | ||||
|             } | ||||
|             DynamicObjectCollection doc_bank = currentCus.getDynamicObjectCollection("entry_bank"); | ||||
|             DynamicObject bankinfo; | ||||
|             if(doc_bank.isEmpty()){ | ||||
|                 bankinfo = doc_bank.addNew(); | ||||
|                 bankinfo.set("isdefault_bank",true); | ||||
|             }else{ | ||||
|                 bankinfo = doc_bank.get(0); | ||||
|             } | ||||
|             bankinfo.set("bankaccount",acctnum);//银行账号 | ||||
|             bankinfo.set("accountname",cusname);//账户名称 | ||||
|             //根据详细分机银行 查找对应的行名行号 | ||||
|             DynamicObject bebankinfo = BusinessDataServiceHelper.loadSingleFromCache(bebankName,"id,name",new QFilter[]{new QFilter("name","=",xxyh)}); | ||||
|             if(bebankinfo != null){ | ||||
|                 bankinfo.set("bank",bebankinfo.getLong("id"));//开户银行-行名行号 根据入参查找 | ||||
|             } | ||||
| 
 | ||||
|             bankinfo.set("bank",bebankinfo);//开户银行-行名行号 根据入参查找 | ||||
|             bankinfo.set("currency", rmbinfo);//币别 默认人民币 | ||||
|             bankinfo.set("isdefault_bank",1); | ||||
|             SaveServiceHelper.save(new DynamicObject[]{currentCus}); | ||||
|         } | ||||
|         //客户还未生成,需要在客户生成时,从人员处获取银行账号 | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue