数仓接口地址https+域名,增加人员收款账户同步逻辑
This commit is contained in:
parent
d563681bac
commit
e1755ed9dd
|
@ -50,7 +50,7 @@ public class DobeDWorgTask extends AbstractTask implements Plugin {
|
||||||
try {
|
try {
|
||||||
response = client.newCall(request).execute();
|
response = client.newCall(request).execute();
|
||||||
resultData = response.body().string();
|
resultData = response.body().string();
|
||||||
// log.info("组织接口返回结果:\n{}", resultData);
|
log.info("组织接口返回结果:\n{}", resultData);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.info(String.format("组织接口异常:%s", e.getMessage()));
|
log.info(String.format("组织接口异常:%s", e.getMessage()));
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class DobeDWpersonTask extends AbstractTask implements Plugin {
|
||||||
try {
|
try {
|
||||||
response = client.newCall(request).execute();
|
response = client.newCall(request).execute();
|
||||||
resultData = response.body().string();
|
resultData = response.body().string();
|
||||||
// log.info("人员接口返回结果:\n{}", resultData);
|
log.info("人员接口返回结果:\n{}", resultData);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.info(String.format("人员接口异常:%s", e.getMessage()));
|
log.info(String.format("人员接口异常:%s", e.getMessage()));
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -110,6 +110,9 @@ public class DobeDWpersonTask extends AbstractTask implements Plugin {
|
||||||
String email = null;
|
String email = null;
|
||||||
String deptid = null;
|
String deptid = null;
|
||||||
String jobposition = null;
|
String jobposition = null;
|
||||||
|
String bank = null;
|
||||||
|
String bank_branch = null;
|
||||||
|
String bank_account = null;
|
||||||
|
|
||||||
List<UserParam> addList = new ArrayList<>();
|
List<UserParam> addList = new ArrayList<>();
|
||||||
// List<UserParam> updateList = new ArrayList<>();
|
// List<UserParam> updateList = new ArrayList<>();
|
||||||
|
@ -126,6 +129,9 @@ public class DobeDWpersonTask extends AbstractTask implements Plugin {
|
||||||
phone = json_body.getString("mobile_phone");
|
phone = json_body.getString("mobile_phone");
|
||||||
deptid = json_body.getString("department_id");//部门id
|
deptid = json_body.getString("department_id");//部门id
|
||||||
jobposition = json_body.getString("jobposition");//职位
|
jobposition = json_body.getString("jobposition");//职位
|
||||||
|
bank = json_body.getString("bank");//银行
|
||||||
|
bank_branch = json_body.getString("bank_branch");//支行
|
||||||
|
bank_account = json_body.getString("bank_account");//账号
|
||||||
if(DobeDWUtils.isEmpty(number) || DobeDWUtils.isEmpty(name)){
|
if(DobeDWUtils.isEmpty(number) || DobeDWUtils.isEmpty(name)){
|
||||||
log.info(String.format("人员入参为空异常:%s", json_body.toJSONString()));
|
log.info(String.format("人员入参为空异常:%s", json_body.toJSONString()));
|
||||||
continue;
|
continue;
|
||||||
|
@ -173,13 +179,19 @@ public class DobeDWpersonTask extends AbstractTask implements Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//处理新增人员收款银行账户
|
//处理新增人员收款银行账户
|
||||||
// personbank = BusinessDataServiceHelper.newDynamicObject(personEntityName);
|
if(DobeDWUtils.isEmpty(bank_account)){
|
||||||
// personbank.set("number",number);
|
continue;
|
||||||
// personbank.set("name",name);
|
}
|
||||||
// personbank.set("qeug_banknumber",name);//银行账户
|
personbank = BusinessDataServiceHelper.newDynamicObject(personEntityName);
|
||||||
// personbank.set("qeug_bankname",name);//开户银行
|
personbank.set("number",number);
|
||||||
// //保存数据:直接保存入库,不走操作校验
|
personbank.set("name",name);
|
||||||
// SaveServiceHelper.save(new DynamicObject[]{personbank});
|
personbank.set("qeug_banknumber",bank_account);//银行账户
|
||||||
|
personbank.set("qeug_bankname",bank_branch);//开户银行(支行)
|
||||||
|
personbank.set("qeug_bank",bank);//银行
|
||||||
|
personbank.set("status","C"); //单据状态默认为已审核
|
||||||
|
personbank.set("enable",1);//默认可用
|
||||||
|
//保存数据:直接保存入库,不走操作校验
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{personbank});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(addList.size() > 0){
|
if(addList.size() > 0){
|
||||||
|
|
|
@ -94,6 +94,9 @@ public class DobeDWpersonUpdateTask extends AbstractTask implements Plugin {
|
||||||
String email = null;
|
String email = null;
|
||||||
String deptid = null;
|
String deptid = null;
|
||||||
String jobposition = null;
|
String jobposition = null;
|
||||||
|
String bank = null;
|
||||||
|
String bank_branch = null;
|
||||||
|
String bank_account = null;
|
||||||
|
|
||||||
List<UserParam> updateList = new ArrayList<>();
|
List<UserParam> updateList = new ArrayList<>();
|
||||||
UserParam user = null;
|
UserParam user = null;
|
||||||
|
@ -110,6 +113,9 @@ public class DobeDWpersonUpdateTask extends AbstractTask implements Plugin {
|
||||||
phone = json_body.getString("mobile_phone");
|
phone = json_body.getString("mobile_phone");
|
||||||
deptid = json_body.getString("department_id");//部门id
|
deptid = json_body.getString("department_id");//部门id
|
||||||
jobposition = json_body.getString("jobposition");//职位
|
jobposition = json_body.getString("jobposition");//职位
|
||||||
|
bank = json_body.getString("bank");//银行
|
||||||
|
bank_branch = json_body.getString("bank_branch");//支行
|
||||||
|
bank_account = json_body.getString("bank_account");//账号
|
||||||
if(DobeDWUtils.isEmpty(number) || DobeDWUtils.isEmpty(name)){
|
if(DobeDWUtils.isEmpty(number) || DobeDWUtils.isEmpty(name)){
|
||||||
log.info(String.format("人员入参为空异常:%s", json_body.toJSONString()));
|
log.info(String.format("人员入参为空异常:%s", json_body.toJSONString()));
|
||||||
continue;
|
continue;
|
||||||
|
@ -147,17 +153,33 @@ public class DobeDWpersonUpdateTask extends AbstractTask implements Plugin {
|
||||||
log.info(String.format("数仓的部门在金蝶中未找到对应组织:%s", deptid));
|
log.info(String.format("数仓的部门在金蝶中未找到对应组织:%s", deptid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//处理人员收款银行账户的修改
|
//处理人员收款银行账户的修改,银行账户为空时,不处理
|
||||||
// personbank = BusinessDataServiceHelper.loadSingle(personEntityName,new QFilter[]{new QFilter("number","=",number)});
|
if(DobeDWUtils.isEmpty(bank_account)){
|
||||||
// if(personbank != null){
|
continue;
|
||||||
// if(!name.equals(personbank.getString("name"))){
|
}
|
||||||
// //姓名、银行账户、开户银行任意一个不相同则更新
|
personbank = BusinessDataServiceHelper.loadSingle(personEntityName,new QFilter[]{new QFilter("number","=",number)});
|
||||||
// personbank.set("name",name);
|
if(personbank != null){
|
||||||
// personbank.set("qeug_banknumber",name);//银行账户
|
if(isNeedUpdate(personbank,name,bank,bank_branch,bank_account)){
|
||||||
// personbank.set("qeug_bankname",name);//开户银行
|
//姓名、银行账户、开户银行任意一个不相同则更新
|
||||||
// SaveServiceHelper.update(personbank);
|
personbank.set("name",name);
|
||||||
// }
|
personbank.set("qeug_banknumber",bank_account);//银行账户
|
||||||
// }
|
personbank.set("qeug_bankname",bank_branch);//开户银行(支行)
|
||||||
|
personbank.set("qeug_bank",bank);//银行
|
||||||
|
SaveServiceHelper.update(personbank);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//新增
|
||||||
|
personbank = BusinessDataServiceHelper.newDynamicObject(personEntityName);
|
||||||
|
personbank.set("number",number);
|
||||||
|
personbank.set("name",name);
|
||||||
|
personbank.set("qeug_banknumber",bank_account);//银行账户
|
||||||
|
personbank.set("qeug_bankname",bank_branch);//开户银行(支行)
|
||||||
|
personbank.set("qeug_bank",bank);//银行
|
||||||
|
personbank.set("status","C"); //单据状态默认为已审核
|
||||||
|
personbank.set("enable",1);//默认可用
|
||||||
|
//保存数据:直接保存入库,不走操作校验
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{personbank});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(updateList.size() > 0){
|
if(updateList.size() > 0){
|
||||||
|
@ -170,4 +192,16 @@ public class DobeDWpersonUpdateTask extends AbstractTask implements Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private boolean isNeedUpdate(DynamicObject personbank,String name,String bank,String bank_branch,String bank_account){
|
||||||
|
if(!name.equals(personbank.getString("name"))){
|
||||||
|
return true;
|
||||||
|
}else if(!bank_account.equals(personbank.getString("qeug_banknumber"))){
|
||||||
|
return true;
|
||||||
|
}else if(DobeDWUtils.isEmpty(bank) || !bank.equals(personbank.getString("qeug_bank"))){
|
||||||
|
return true;
|
||||||
|
}else if(DobeDWUtils.isEmpty(bank_branch) || !bank_branch.equals(personbank.getString("qeug_bankname"))){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -28,9 +28,6 @@ import java.math.BigDecimal;
|
||||||
public class YongyouBIPOperation extends AbstractOperationServicePlugIn implements Plugin {
|
public class YongyouBIPOperation extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
private static final Log log = LogFactory.getLog(YongyouBIPOperation.class);
|
private static final Log log = LogFactory.getLog(YongyouBIPOperation.class);
|
||||||
|
|
||||||
//加密等级
|
|
||||||
// private static final String secret_level = "L0";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作执行,加载单据数据包之前,触发此事件;在单据列表上执行单据操作,传入的是单据内码;
|
* 操作执行,加载单据数据包之前,触发此事件;在单据列表上执行单据操作,传入的是单据内码;
|
||||||
* 系统需要先根据传入的单据内码,加载单据数据包,其中只包含操作要用到的字段,然后再执行操作;
|
* 系统需要先根据传入的单据内码,加载单据数据包,其中只包含操作要用到的字段,然后再执行操作;
|
||||||
|
@ -122,18 +119,15 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getAccountingOpinion(DynamicObject payrequestinfo){
|
|
||||||
//根据单据id查找审批流程中会计部的审批意见,多人时合并输出意见?
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String[] getCompanyDeptNumber(String bizDept){
|
private String[] getCompanyDeptNumber(String bizDept){
|
||||||
//根据用款部门的编号获得对应关系表中的财务公司编号和部门编号
|
//根据用款部门的编号获得对应关系表中的财务公司编号和部门编号
|
||||||
DynamicObject orginfo = BusinessDataServiceHelper.loadSingle("qeug_recon_orgrelation",new QFilter[]{new QFilter("number","=",bizDept)});
|
DynamicObject orginfo = BusinessDataServiceHelper.loadSingle("qeug_recon_orgrelation",new QFilter[]{new QFilter("number","=",bizDept)});
|
||||||
String[] result = new String[2];
|
String[] result = new String[3];
|
||||||
if(orginfo != null){
|
if(orginfo != null){
|
||||||
result[0] = orginfo.getString("qeug_companynumber");//财务公司编号
|
result[0] = orginfo.getString("qeug_companynumber");//财务公司编号
|
||||||
result[1] = orginfo.getString("qeug_deptnumber");//财务部门编号
|
result[1] = orginfo.getString("qeug_deptnumber");//财务部门编号
|
||||||
|
// result[2] = orginfo.getString("qeug_deptnumber");//财务公司付款账户
|
||||||
|
result[2] = "03002635967";
|
||||||
}else{
|
}else{
|
||||||
log.error(String.format("用友付款接口根据用款部门编号转换财务编号失败:%s", bizDept));
|
log.error(String.format("用友付款接口根据用款部门编号转换财务编号失败:%s", bizDept));
|
||||||
}
|
}
|
||||||
|
@ -159,7 +153,6 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
||||||
ap_recaccount = payrequestinfo.getString("receiveno");
|
ap_recaccount = payrequestinfo.getString("receiveno");
|
||||||
}
|
}
|
||||||
String supplierNum = payrequestinfo.getDynamicObject("receiveunit").getString("number");
|
String supplierNum = payrequestinfo.getDynamicObject("receiveunit").getString("number");
|
||||||
// payData.put("supplier",);//供应商编码 非必传
|
|
||||||
payData.put("customer",supplierNum);//客户编码 即使是供应商也传入到该字段
|
payData.put("customer",supplierNum);//客户编码 即使是供应商也传入到该字段
|
||||||
payData.put("pk_dept",companyDept[1]);//部门编码(通过公司主体明细表找部门编码)
|
payData.put("pk_dept",companyDept[1]);//部门编码(通过公司主体明细表找部门编码)
|
||||||
if(isgrdf){
|
if(isgrdf){
|
||||||
|
@ -169,8 +162,8 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
payData.put("pk_currtype","CNY");//币种,传编码CNY
|
payData.put("pk_currtype","CNY");//币种,传编码CNY
|
||||||
payData.put("pk_busitype","AP01");//业务流程,传编码 AP01(生产可能有变化)
|
payData.put("pk_busitype","AP04");//业务流程,传编码 AP01(生产可能有变化)
|
||||||
String ap_payaccount = "";//付款银行账号
|
String ap_payaccount = companyDept[2];//付款银行账号
|
||||||
//付款银行账户编码(德必),传编码例:31001562700050031883-上海德必文化创意产业发展(集团)股份有限公司
|
//付款银行账户编码(德必),传编码例:31001562700050031883-上海德必文化创意产业发展(集团)股份有限公司
|
||||||
payData.put("ap_payaccount",ap_payaccount);//如何取值?-从数仓获取的组织对应关系中获取默认付款银行账号
|
payData.put("ap_payaccount",ap_payaccount);//如何取值?-从数仓获取的组织对应关系中获取默认付款银行账号
|
||||||
payData.put("ap_recaccount",ap_recaccount);//收款银行账户编码(客商),传编码例:3101040160000098225-上海达洋消防保安工程有限公司
|
payData.put("ap_recaccount",ap_recaccount);//收款银行账户编码(客商),传编码例:3101040160000098225-上海达洋消防保安工程有限公司
|
||||||
|
@ -197,20 +190,14 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
||||||
payData.put("approvedate",DobeDWUtils.getDateString(payrequestinfo.getDate("auditDate")));//审核日期 YYYY-MM-DD
|
payData.put("approvedate",DobeDWUtils.getDateString(payrequestinfo.getDate("auditDate")));//审核日期 YYYY-MM-DD
|
||||||
// payData.put("src_syscode","ISC");//单据来源系统编码 非必传
|
// payData.put("src_syscode","ISC");//单据来源系统编码 非必传
|
||||||
if(isnotext){
|
if(isnotext){
|
||||||
payData.put("def1","无合同");//自定义项1 流程类型:有合同 无合同
|
payData.put("def11","无合同付款");//自定义项1 流程类型:有合同 无合同
|
||||||
}else{
|
}else{
|
||||||
payData.put("def1","有合同");//自定义项1 流程类型:有合同 无合同
|
payData.put("def11","合同付款");//自定义项1 流程类型:有合同 无合同
|
||||||
}
|
}
|
||||||
|
payData.put("def12",payrequestinfo.getString("billno"));//自定义项2 付款申请单的单号(全局唯一才行)
|
||||||
|
payData.put("def13","");//备注。传合同总金额及付款比例等,拼接凭证摘要
|
||||||
|
|
||||||
payData.put("def2",payrequestinfo.getString("billno"));//自定义项2 付款申请单的单号(全局唯一才行)
|
//------------------以下是表体组装--------------------
|
||||||
payData.put("def3","否");//自定义项3 是否分摊,传字符 例:是,否
|
|
||||||
payData.put("def4",getInvoiceNumber(payrequestinfo, isnotext));//自定义项4 发票号码拼接数据,传字符 数电票(增值税专用发票):24512000000077221149
|
|
||||||
payData.put("def5",null);//自定义项5 付款申请单的备注,后续作为的凭证摘要,字段长度最大为30
|
|
||||||
payData.put("def6","");//自定义项6 0A接口预留字段1
|
|
||||||
payData.put("def7","");//自定义项7 0A接口预留字段2
|
|
||||||
payData.put("def8","");//自定义项8 0A接口预留字段3
|
|
||||||
|
|
||||||
//------以下是表体组装-------------
|
|
||||||
JSONArray jas = new JSONArray();
|
JSONArray jas = new JSONArray();
|
||||||
JSONObject items = new JSONObject();
|
JSONObject items = new JSONObject();
|
||||||
// items.put("contractno",payrequestinfo.getDynamicObject("contractbill"));//合同号
|
// items.put("contractno",payrequestinfo.getDynamicObject("contractbill"));//合同号
|
||||||
|
@ -221,7 +208,6 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
||||||
}else{
|
}else{
|
||||||
items.put("objtype","0");//往来对象(0-客户 1-供应商 2-部门 3-业务员)
|
items.put("objtype","0");//往来对象(0-客户 1-供应商 2-部门 3-业务员)
|
||||||
}
|
}
|
||||||
// items.put("supplier",);//供应商编码 非必传
|
|
||||||
items.put("customer",supplierNum);//客户编码 供应商的数据也传入这里
|
items.put("customer",supplierNum);//客户编码 供应商的数据也传入这里
|
||||||
items.put("pk_dept",companyDept[1]);//部门编码(通过公司主体明细表找部门编码)
|
items.put("pk_dept",companyDept[1]);//部门编码(通过公司主体明细表找部门编码)
|
||||||
if(isgrdf){
|
if(isgrdf){
|
||||||
|
@ -259,23 +245,18 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
||||||
items.put("ap_payaccount",ap_payaccount);//付款银行账户编码 同表头
|
items.put("ap_payaccount",ap_payaccount);//付款银行账户编码 同表头
|
||||||
items.put("ap_recaccount",ap_recaccount);//收款银行账户编码
|
items.put("ap_recaccount",ap_recaccount);//收款银行账户编码
|
||||||
items.put("pk_balatype","07");//结算方式编码,传编码例:07-网银
|
items.put("pk_balatype","07");//结算方式编码,传编码例:07-网银
|
||||||
|
if(isnotext){
|
||||||
items.put("def5","");//费用类别,传编码 无抵暂支业务,先传空
|
items.put("def13","");//供应链系统合同号,无合同怎么传递?
|
||||||
items.put("def6","");//抵暂支状态,传字符,现在应该有 0 1 -1 三种状态?
|
}else{
|
||||||
items.put("def7","");//原暂支金额,xxxxx.00000000?
|
items.put("def13","");//供应链系统合同号
|
||||||
items.put("def8","");//抵暂支金额,xxxxx.00000000?
|
}
|
||||||
|
items.put("def14",payrequestinfo.getString("id"));//供应链付款单ID
|
||||||
jas.add(items);
|
jas.add(items);
|
||||||
payData.put("items",jas);//表头关联表体
|
payData.put("items",jas);//表头关联表体
|
||||||
return payData;
|
return payData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleForBIP(String eventName, DynamicObject payrequestinfo, boolean isnotext){
|
private void handleForBIP(String eventName, DynamicObject payrequestinfo, boolean isnotext){
|
||||||
// //认证接口,得到accesstoken
|
|
||||||
// Request request = new Request.Builder().url(tokenUrl)
|
|
||||||
// .post(createAccessTokenBody())
|
|
||||||
// .header("Content-Type", "application/x-www-form-urlencoded")
|
|
||||||
// .build();
|
|
||||||
String accesstoken = null;
|
String accesstoken = null;
|
||||||
APICurUtils apiutil = new APICurUtils();//处理认证接口的工具类(用友提供的第三方工具),得到accesstoken
|
APICurUtils apiutil = new APICurUtils();//处理认证接口的工具类(用友提供的第三方工具),得到accesstoken
|
||||||
apiutil.init(DobeDWUtils.yyip,DobeDWUtils.yyport,DobeDWUtils.bizcenter,DobeDWUtils.clientid,DobeDWUtils.clientsecret,DobeDWUtils.pubKey,DobeDWUtils.clientid,null);
|
apiutil.init(DobeDWUtils.yyip,DobeDWUtils.yyport,DobeDWUtils.bizcenter,DobeDWUtils.clientid,DobeDWUtils.clientsecret,DobeDWUtils.pubKey,DobeDWUtils.clientid,null);
|
||||||
|
@ -348,7 +329,6 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
private RequestBody createAccessTokenBody() {
|
private RequestBody createAccessTokenBody() {
|
||||||
|
|
||||||
FormBody.Builder builder = new FormBody.Builder();
|
FormBody.Builder builder = new FormBody.Builder();
|
||||||
//如下写法在接口调用后,用友反馈解密失败,猜测是没有给RequestBody使用指定的MediaType 以及 没有使用json格式进行RequestBody设置
|
//如下写法在接口调用后,用友反馈解密失败,猜测是没有给RequestBody使用指定的MediaType 以及 没有使用json格式进行RequestBody设置
|
||||||
// try {
|
// try {
|
||||||
|
|
|
@ -59,8 +59,17 @@ public class DobeDWaccountTask extends AbstractTask implements Plugin {
|
||||||
String projectnumber = json_body.getString("projectnumber");
|
String projectnumber = json_body.getString("projectnumber");
|
||||||
DynamicObject projectinfo = QueryServiceHelper.queryOne(projectEntity,"id,billno",new QFilter[]{new QFilter("billno","=",projectnumber)});
|
DynamicObject projectinfo = QueryServiceHelper.queryOne(projectEntity,"id,billno",new QFilter[]{new QFilter("billno","=",projectnumber)});
|
||||||
if(projectinfo == null){
|
if(projectinfo == null){
|
||||||
|
log.info(String.format("成本科目接口异常未根据项目编号找到对应项目:%s", projectnumber));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
//根据项目查找成本科目的表头信息
|
||||||
|
DynamicObject billinfo = BusinessDataServiceHelper.loadSingle(entityName,new QFilter[]{new QFilter("project","=",projectinfo.getLong("id"))});
|
||||||
|
boolean isNew = false;
|
||||||
|
if(billinfo == null){
|
||||||
|
isNew = true;
|
||||||
|
billinfo = BusinessDataServiceHelper.newDynamicObject(entityName);
|
||||||
|
}
|
||||||
|
QFilter billfilter = new QFilter("fid","=", billinfo.getLong("id"));
|
||||||
JSONArray detailsJson = json_body.getJSONArray("data");
|
JSONArray detailsJson = json_body.getJSONArray("data");
|
||||||
String acctid = null;
|
String acctid = null;
|
||||||
String number = null;
|
String number = null;
|
||||||
|
@ -86,13 +95,29 @@ public class DobeDWaccountTask extends AbstractTask implements Plugin {
|
||||||
isleaf = json_body.getString("isleaf");//是否叶子节点
|
isleaf = json_body.getString("isleaf");//是否叶子节点
|
||||||
level = json_body.getString("level");//科目级次
|
level = json_body.getString("level");//科目级次
|
||||||
if(DobeDWUtils.isEmpty(number) || DobeDWUtils.isEmpty(name) || DobeDWUtils.isEmpty(isleaf)
|
if(DobeDWUtils.isEmpty(number) || DobeDWUtils.isEmpty(name) || DobeDWUtils.isEmpty(isleaf)
|
||||||
|| DobeDWUtils.isEmpty(level)){
|
|| DobeDWUtils.isEmpty(level) || DobeDWUtils.isEmpty(acctid)){
|
||||||
//如果组织ID和组织编码 名称是空的,则跳过此记录
|
//如果组织ID和组织编码 名称是空的,则跳过此记录
|
||||||
log.info(String.format("成本科目入参为空异常:%s", json_body.toJSONString()));
|
log.info(String.format("成本科目入参为空异常:%s", json_body.toJSONString()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//根据科目id查找是否已存在
|
//整体是修改的情况下,根据科目id查找是否已存在
|
||||||
acctinfo = BusinessDataServiceHelper.loadSingle(accEntity,new QFilter[]{new QFilter("caentry_srcid","=",acctid)});
|
if(isNew){
|
||||||
|
acctinfo = BusinessDataServiceHelper.newDynamicObject(accEntity);
|
||||||
|
acctinfo.set("caentry_srcid", acctid);//源ID 用于存储数仓的科目id
|
||||||
|
acctinfo.set("caentry_number", number);
|
||||||
|
acctinfo.set("caentry_name", name);
|
||||||
|
acctinfo.set("caentry_longnumber", longnumber);
|
||||||
|
acctinfo.set("caentry_ciaccountflag", ciaccountflag);//科目类别 建安 1 非建安 0
|
||||||
|
acctinfo.set("caentry_apportionway", null);//分摊方式 基础资料
|
||||||
|
acctinfo.set("caentry_fullname", longname);
|
||||||
|
acctinfo.set("caentry_taxrate", taxrate);
|
||||||
|
acctinfo.set("caentry_isleaf", isleaf);
|
||||||
|
acctinfo.set("caentry_level", level);
|
||||||
|
acctinfo.set("caentry_project", projectinfo.getLong("id"));//项目
|
||||||
|
acctinfo.set("caentry_enable", true);//默认 启用
|
||||||
|
billinfo.getDynamicObjectCollection("costaccountentry").add(acctinfo);
|
||||||
|
}else{
|
||||||
|
acctinfo = BusinessDataServiceHelper.loadSingle(accEntity,new QFilter[]{billfilter.and(new QFilter("caentry_srcid","=",acctid))});
|
||||||
if(acctinfo == null){
|
if(acctinfo == null){
|
||||||
//不存在,做新增 根据实体名称创建动态对象
|
//不存在,做新增 根据实体名称创建动态对象
|
||||||
acctinfo = BusinessDataServiceHelper.newDynamicObject(accEntity);
|
acctinfo = BusinessDataServiceHelper.newDynamicObject(accEntity);
|
||||||
|
@ -108,8 +133,9 @@ public class DobeDWaccountTask extends AbstractTask implements Plugin {
|
||||||
acctinfo.set("caentry_level", level);
|
acctinfo.set("caentry_level", level);
|
||||||
acctinfo.set("caentry_project", projectinfo.getLong("id"));//项目
|
acctinfo.set("caentry_project", projectinfo.getLong("id"));//项目
|
||||||
acctinfo.set("caentry_enable", true);//默认 启用
|
acctinfo.set("caentry_enable", true);//默认 启用
|
||||||
acctinfo.set("caentry_isimportaccount", true);//是否导入科目
|
// acctinfo.set("caentry_isimportaccount", true);//是否导入科目
|
||||||
SaveServiceHelper.save(new DynamicObject[]{acctinfo});
|
// SaveServiceHelper.save(new DynamicObject[]{acctinfo});
|
||||||
|
billinfo.getDynamicObjectCollection("costaccountentry").add(acctinfo);
|
||||||
}else{
|
}else{
|
||||||
//已存在,做更新 编号、名称、长编号、名称、科目类别等
|
//已存在,做更新 编号、名称、长编号、名称、科目类别等
|
||||||
acctinfo.set("caentry_number", number);
|
acctinfo.set("caentry_number", number);
|
||||||
|
@ -119,8 +145,10 @@ public class DobeDWaccountTask extends AbstractTask implements Plugin {
|
||||||
acctinfo.set("caentry_taxrate", taxrate);
|
acctinfo.set("caentry_taxrate", taxrate);
|
||||||
acctinfo.set("caentry_isleaf", isleaf);
|
acctinfo.set("caentry_isleaf", isleaf);
|
||||||
acctinfo.set("caentry_level", level);
|
acctinfo.set("caentry_level", level);
|
||||||
SaveServiceHelper.update(acctinfo);
|
// SaveServiceHelper.update(acctinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// SaveServiceHelper.save(new DynamicObject[]{billinfo});
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@ public class DobeDWUtils {
|
||||||
//数仓接口的appCode 可能会更换
|
//数仓接口的appCode 可能会更换
|
||||||
public static final String appCode = "AppCode 895894e0-73de-40a9-9b1f-e87fe35a13fd";
|
public static final String appCode = "AppCode 895894e0-73de-40a9-9b1f-e87fe35a13fd";
|
||||||
//数仓接口地址基本信息
|
//数仓接口地址基本信息
|
||||||
public static final String dwUrl = "http://106.14.120.215:8080/webroot/service/publish/7e9d818c-43c0-47cf-ad4c-40c66b92bb34/";
|
public static final String dwUrl = "https://wedc.dobechina.com/webroot/service/publish/7e9d818c-43c0-47cf-ad4c-40c66b92bb34/";
|
||||||
public static final MediaType MTJSON = MediaType.get("application/json");
|
public static final MediaType MTJSON = MediaType.get("application/json");
|
||||||
|
|
||||||
//授权模式,客户端模式为client,密码模式为:password
|
//授权模式,客户端模式为client,密码模式为:password
|
||||||
|
@ -42,7 +42,7 @@ public class DobeDWUtils {
|
||||||
|
|
||||||
public static String getDateString(Date billDate){
|
public static String getDateString(Date billDate){
|
||||||
//创建一个SimpleDateFormat对象,定义目标日期格式
|
//创建一个SimpleDateFormat对象,定义目标日期格式
|
||||||
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
//格式化Date对象为新的字符串格式
|
//格式化Date对象为新的字符串格式
|
||||||
if(billDate == null){
|
if(billDate == null){
|
||||||
return targetFormat.format(new Date());
|
return targetFormat.format(new Date());
|
||||||
|
@ -125,6 +125,43 @@ public class DobeDWUtils {
|
||||||
return json_body.toJSONString();
|
return json_body.toJSONString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getTestAcct(){
|
||||||
|
JSONObject json_body = new JSONObject();
|
||||||
|
json_body.put("totalNum","1");
|
||||||
|
json_body.put("projectnumber","test0667");
|
||||||
|
JSONObject json_detail = new JSONObject();
|
||||||
|
json_detail.put("accid","100003");
|
||||||
|
json_detail.put("parentid","");
|
||||||
|
json_detail.put("number","01");
|
||||||
|
json_detail.put("name","ziji科目1");
|
||||||
|
json_detail.put("longnumber","01");
|
||||||
|
json_detail.put("longname","ziji科目1");
|
||||||
|
json_detail.put("ciaccountflag","1");
|
||||||
|
json_detail.put("taxrate","6");
|
||||||
|
json_detail.put("isleaf","1");
|
||||||
|
json_detail.put("level","2");
|
||||||
|
|
||||||
|
JSONArray array = new JSONArray();
|
||||||
|
array.add(json_detail);
|
||||||
|
|
||||||
|
json_detail = new JSONObject();
|
||||||
|
json_detail.put("accid","100004");
|
||||||
|
json_detail.put("parentid","100003");
|
||||||
|
json_detail.put("number","02");
|
||||||
|
json_detail.put("name","ziji科目2");
|
||||||
|
json_detail.put("longnumber","02");
|
||||||
|
json_detail.put("longname","ziji科目2");
|
||||||
|
json_detail.put("ciaccountflag","1");
|
||||||
|
json_detail.put("taxrate","3");
|
||||||
|
json_detail.put("isleaf","1");
|
||||||
|
json_detail.put("level","2");
|
||||||
|
|
||||||
|
array.add(json_detail);
|
||||||
|
|
||||||
|
json_body.put("data",array);
|
||||||
|
return json_body.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
public static String getTestProject(){
|
public static String getTestProject(){
|
||||||
JSONObject json_body = new JSONObject();
|
JSONObject json_body = new JSONObject();
|
||||||
json_body.put("totalNum","1");
|
json_body.put("totalNum","1");
|
||||||
|
|
Loading…
Reference in New Issue