parent
46b4aefd93
commit
0d08c351c3
|
|
@ -17,10 +17,12 @@ import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import shjh.jhzj7.fi.fi.utils.JhzjUtils;
|
import shjh.jhzj7.fi.fi.utils.JhzjUtils;
|
||||||
|
import shjh.jhzj7.fi.fi.webapi.model.ApiResultExt;
|
||||||
import shjh.jhzj7.fi.fi.webapi.model.PaybillVoucherNumModel;
|
import shjh.jhzj7.fi.fi.webapi.model.PaybillVoucherNumModel;
|
||||||
import shjh.jhzj7.fi.fi.webapi.model.PayreceiptQueryModel;
|
import shjh.jhzj7.fi.fi.webapi.model.PayreceiptQueryModel;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -37,8 +39,9 @@ public class PayreceiptQueryControler {
|
||||||
private static final String apimenthod = "/payreceipt_query";
|
private static final String apimenthod = "/payreceipt_query";
|
||||||
|
|
||||||
@ApiPostMapping(value = apimenthod, desc = "付款电子回单查询接口")
|
@ApiPostMapping(value = apimenthod, desc = "付款电子回单查询接口")
|
||||||
public CustomApiResult<ApiResult> paybill_vouchernum(@NotNull @Valid @ApiRequestBody(value = "入参json格式数据") PayreceiptQueryModel PayreceiptQuerybill) {
|
public CustomApiResult<ApiResultExt> paybill_vouchernum(@NotNull @Valid @ApiRequestBody(value = "入参json格式数据") PayreceiptQueryModel PayreceiptQuerybill) {
|
||||||
|
//返回值
|
||||||
|
ApiResultExt apiResultExt = new ApiResultExt();
|
||||||
//select * from T_CAS_PaymentBill where fbillno = 'FKZJ2025030006'; 2168985504052162560
|
//select * from T_CAS_PaymentBill where fbillno = 'FKZJ2025030006'; 2168985504052162560
|
||||||
//select * from t_org_org where fid = 2116753963226241024;
|
//select * from t_org_org where fid = 2116753963226241024;
|
||||||
JSONObject json_body;
|
JSONObject json_body;
|
||||||
|
|
@ -48,12 +51,10 @@ public class PayreceiptQueryControler {
|
||||||
json_body = (JSONObject) JSON.toJSON(PayreceiptQuerybill);
|
json_body = (JSONObject) JSON.toJSON(PayreceiptQuerybill);
|
||||||
jsonBodyString = JSON.toJSONString(json_body);
|
jsonBodyString = JSON.toJSONString(json_body);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
return handleErrorAndReturn("付款电子回单查询接口入参异常:" + e.getMessage(), Apimenthod, null);
|
return handleErrorAndReturn("付款电子回单查询接口入参异常:" + e.getMessage(), Apimenthod, null,apiResultExt);
|
||||||
}
|
}
|
||||||
//返回值
|
|
||||||
ApiResult customApiResult = new ApiResult("");
|
|
||||||
HashMap<String, String> map = new HashMap<>();
|
|
||||||
|
|
||||||
|
List<ApiResultExt.EntryBean> entryBeans = new ArrayList<>();
|
||||||
List<PayreceiptQueryModel.EntryBean> items = PayreceiptQuerybill.getItems();
|
List<PayreceiptQueryModel.EntryBean> items = PayreceiptQuerybill.getItems();
|
||||||
for (PayreceiptQueryModel.EntryBean item : items) {
|
for (PayreceiptQueryModel.EntryBean item : items) {
|
||||||
String companyNum = item.getCompanyNum();//公司编号
|
String companyNum = item.getCompanyNum();//公司编号
|
||||||
|
|
@ -64,7 +65,7 @@ public class PayreceiptQueryControler {
|
||||||
|
|
||||||
DynamicObject org = loadOrgByCompanyNum(companyNum);
|
DynamicObject org = loadOrgByCompanyNum(companyNum);
|
||||||
if (org == null) {
|
if (org == null) {
|
||||||
return handleErrorAndReturn("同步失败,费控单据编号:" + fkBillNumber + "的组织编码不存在", fkBillNumber, jsonBodyString);
|
return handleErrorAndReturn("同步失败,费控单据编号:" + fkBillNumber + "的组织编码不存在", fkBillNumber, jsonBodyString,apiResultExt);
|
||||||
}
|
}
|
||||||
|
|
||||||
QFilter q1 = new QFilter("openorg.number", QCP.equals, companyNum);
|
QFilter q1 = new QFilter("openorg.number", QCP.equals, companyNum);
|
||||||
|
|
@ -73,18 +74,17 @@ public class PayreceiptQueryControler {
|
||||||
q1 = addFilterIfNotEmpty(q1, "shjh_fkentryid", fkEntryID);
|
q1 = addFilterIfNotEmpty(q1, "shjh_fkentryid", fkEntryID);
|
||||||
DynamicObject paybill = BusinessDataServiceHelper.loadSingle("cas_paybill", new QFilter[]{q1});
|
DynamicObject paybill = BusinessDataServiceHelper.loadSingle("cas_paybill", new QFilter[]{q1});
|
||||||
if (null == paybill) {
|
if (null == paybill) {
|
||||||
return handleErrorAndReturn("同步失败:付款单不存在", fkEntryID, jsonBodyString);
|
return handleErrorAndReturn("同步失败:付款单不存在", fkEntryID, jsonBodyString,apiResultExt);
|
||||||
}
|
}
|
||||||
|
ApiResultExt.EntryBean entryBean = new ApiResultExt.EntryBean();
|
||||||
customApiResult.setHeaders(map);
|
entryBean.setCompanyNum(companyNum);
|
||||||
customApiResult.getHeaders().put("companyNum",companyNum);
|
entryBean.setKdPayBillID(String.valueOf(paybill.getPkValue()));
|
||||||
customApiResult.getHeaders().put("kdPayBillID", String.valueOf(paybill.getPkValue()));
|
entryBean.setFkBillID(paybill.getString("shjh_fkbillid"));
|
||||||
customApiResult.getHeaders().put("fkBillID",paybill.getString("shjh_fkbillid"));
|
entryBean.setFkEntryID(paybill.getString("shjh_fkentryid"));
|
||||||
customApiResult.getHeaders().put("fkEntryID",paybill.getString("shjh_fkentryid"));
|
entryBean.setReceipturl("https://fm-test.jahwa.com.cn/ierp/?formId=home_page");
|
||||||
customApiResult.getHeaders().put("receipturl","https://fm-test.jahwa.com.cn/ierp/?formId=home_page");
|
entryBeans.add(entryBean);
|
||||||
}
|
}
|
||||||
|
return handleSuccessAndReturn(apiResultExt, entryBeans);
|
||||||
return CustomApiResult.success(customApiResult);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static QFilter addFilterIfNotNull(QFilter baseFilter, String field, Long value) {
|
private static QFilter addFilterIfNotNull(QFilter baseFilter, String field, Long value) {
|
||||||
|
|
@ -111,9 +111,25 @@ public class PayreceiptQueryControler {
|
||||||
* @param jsonBodyString 入参JSON字符串
|
* @param jsonBodyString 入参JSON字符串
|
||||||
* @return 失败的CustomApiResult对象
|
* @return 失败的CustomApiResult对象
|
||||||
*/
|
*/
|
||||||
public static CustomApiResult<ApiResult> handleErrorAndReturn(String errorMessage, String fkBillNum, String jsonBodyString) {
|
public static CustomApiResult<ApiResultExt> handleErrorAndReturn(String errorMessage, String fkBillNum, String jsonBodyString,ApiResultExt apiResultExt) {
|
||||||
handleError(errorMessage, fkBillNum, jsonBodyString);
|
handleError(errorMessage, fkBillNum, jsonBodyString);
|
||||||
return CustomApiResult.fail("400", errorMessage);
|
apiResultExt.setErrorCode("400");
|
||||||
|
apiResultExt.setStatus(false);
|
||||||
|
apiResultExt.setData(null);
|
||||||
|
apiResultExt.setMessage(errorMessage);
|
||||||
|
return CustomApiResult.success(apiResultExt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理成功并返回结果
|
||||||
|
* @return 成功的CustomApiResult对象
|
||||||
|
*/
|
||||||
|
public static CustomApiResult<ApiResultExt> handleSuccessAndReturn(ApiResultExt apiResultExt, List<ApiResultExt.EntryBean> entryBeans) {
|
||||||
|
apiResultExt.setErrorCode("0");
|
||||||
|
apiResultExt.setStatus(true);
|
||||||
|
apiResultExt.setData(entryBeans);
|
||||||
|
apiResultExt.setMessage(null);
|
||||||
|
return CustomApiResult.success(apiResultExt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
package shjh.jhzj7.fi.fi.webapi.model;
|
||||||
|
|
||||||
|
import kd.bos.openapi.common.custom.annotation.ApiModel;
|
||||||
|
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApiModel
|
||||||
|
public class ApiResultExt implements Serializable {
|
||||||
|
|
||||||
|
@ApiParam("接口访问是否成功")
|
||||||
|
private Boolean status;
|
||||||
|
@ApiParam("错误码")
|
||||||
|
private String errorCode;
|
||||||
|
@ApiParam("接口调用错误信息")
|
||||||
|
private String message;
|
||||||
|
@ApiParam("明细数据集合")
|
||||||
|
private List<ApiResultExt.EntryBean> data;
|
||||||
|
@ApiModel
|
||||||
|
public static class EntryBean implements Serializable {
|
||||||
|
@ApiParam("公司编号")
|
||||||
|
private String companyNum;
|
||||||
|
@ApiParam("金蝶付款单ID")
|
||||||
|
private String kdPayBillID;
|
||||||
|
@ApiParam("费控单据主表ID")
|
||||||
|
private String fkBillID;
|
||||||
|
@ApiParam("费控单据分录ID")
|
||||||
|
private String fkEntryID;
|
||||||
|
@ApiParam("电子回单的URL,有可能为空")
|
||||||
|
private String receipturl;
|
||||||
|
|
||||||
|
public String getCompanyNum() {
|
||||||
|
return companyNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompanyNum(String companyNum) {
|
||||||
|
this.companyNum = companyNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKdPayBillID() {
|
||||||
|
return kdPayBillID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKdPayBillID(String kdPayBillID) {
|
||||||
|
this.kdPayBillID = kdPayBillID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFkBillID() {
|
||||||
|
return fkBillID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFkBillID(String fkBillID) {
|
||||||
|
this.fkBillID = fkBillID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFkEntryID() {
|
||||||
|
return fkEntryID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFkEntryID(String fkEntryID) {
|
||||||
|
this.fkEntryID = fkEntryID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReceipturl() {
|
||||||
|
return receipturl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceipturl(String receipturl) {
|
||||||
|
this.receipturl = receipturl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Boolean status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getErrorCode() {
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorCode(String errorCode) {
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EntryBean> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<EntryBean> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,11 +3,12 @@ package shjh.jhzj7.fi.fi.webapi.model;
|
||||||
import kd.bos.openapi.common.custom.annotation.ApiModel;
|
import kd.bos.openapi.common.custom.annotation.ApiModel;
|
||||||
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class ApplyAdjustBillModel {
|
public class ApplyAdjustBillModel implements Serializable {
|
||||||
|
|
||||||
@ApiParam(value = "公司编号", required = true, position = 1)
|
@ApiParam(value = "公司编号", required = true, position = 1)
|
||||||
private String companyNum;
|
private String companyNum;
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,10 @@ package shjh.jhzj7.fi.fi.webapi.model;
|
||||||
import kd.bos.openapi.common.custom.annotation.ApiModel;
|
import kd.bos.openapi.common.custom.annotation.ApiModel;
|
||||||
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class ApplyBillModel {
|
public class ApplyBillModel implements Serializable {
|
||||||
|
|
||||||
@ApiParam(value="公司编号",required=true,position=1)
|
@ApiParam(value="公司编号",required=true,position=1)
|
||||||
private String companyNum;
|
private String companyNum;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import java.sql.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class PaybillVoucherNumModel {
|
public class PaybillVoucherNumModel implements Serializable{
|
||||||
|
|
||||||
@ApiParam(value="明细数据集合",required=true,position=1)
|
@ApiParam(value="明细数据集合",required=true,position=1)
|
||||||
private List<PaybillVoucherNumModel.EntryBean> items;
|
private List<PaybillVoucherNumModel.EntryBean> items;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class PayreceiptQueryModel {
|
public class PayreceiptQueryModel implements Serializable{
|
||||||
|
|
||||||
@ApiParam(value="明细数据集合",required=true,position=1)
|
@ApiParam(value="明细数据集合",required=true,position=1)
|
||||||
private List<PayreceiptQueryModel.EntryBean> items;
|
private List<PayreceiptQueryModel.EntryBean> items;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue