材料付款单传NCC
This commit is contained in:
parent
2c6715acdb
commit
d0a4110ad2
|
@ -20,8 +20,10 @@ public class CLPayApplyEntity extends BaseEntity {
|
|||
private String field0046;//单据类型,选的是采购订单还是应付单
|
||||
private String field0047;//应付单号
|
||||
private String field0048;//采购订单号
|
||||
private String field0063;//采购订单付款计划pk
|
||||
|
||||
|
||||
// 明细表
|
||||
private String id;//明细表id
|
||||
private String formmain_id;//主表id
|
||||
private String field0022;// 序号
|
||||
|
@ -49,9 +51,8 @@ public class CLPayApplyEntity extends BaseEntity {
|
|||
private String field0057; //上层单据类型表头PK
|
||||
private String field0058; //上层单据类型表体PK
|
||||
private String field0061; //NCC采购订单/请购单表头pk
|
||||
private String field0062; //C采购订单/请购单表体pk
|
||||
|
||||
|
||||
private String field0062; //NCC采购订单/请购单表体pk
|
||||
private String field0064;//应付单组织本币余额。付款的时候传这个值
|
||||
public String getField0001() {
|
||||
return field0001;
|
||||
}
|
||||
|
@ -363,4 +364,20 @@ public class CLPayApplyEntity extends BaseEntity {
|
|||
public void setField0062(String field0062) {
|
||||
this.field0062 = field0062;
|
||||
}
|
||||
|
||||
public String getField0063() {
|
||||
return field0063;
|
||||
}
|
||||
|
||||
public void setField0063(String field0063) {
|
||||
this.field0063 = field0063;
|
||||
}
|
||||
|
||||
public String getField0064() {
|
||||
return field0064;
|
||||
}
|
||||
|
||||
public void setField0064(String field0064) {
|
||||
this.field0064 = field0064;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<result property="field0060" column="field0060" />
|
||||
<result property="field0061" column="field0061" />
|
||||
<result property="field0062" column="field0062" />
|
||||
<result property="field0064" column="field0064" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="CLPayApplyEntity_list">
|
||||
|
@ -56,6 +57,7 @@
|
|||
formmain_0266.field0046,-- 单据类型
|
||||
formmain_0266.field0047,-- 应付单号
|
||||
formmain_0266.field0048,-- 采购订单号
|
||||
formmain_0266.field0063,-- 采购订单付款计划pk
|
||||
formson_0267.id,
|
||||
formson_0267.formmain_id,
|
||||
formson_0267.field0022,-- 序号
|
||||
|
@ -82,8 +84,9 @@
|
|||
formson_0267.field0056,-- 上层单据类型
|
||||
formson_0267.field0057,-- 上层单据类型表头PK
|
||||
formson_0267.field0058,-- 上层单据类型表体PK
|
||||
formson_0267.field0061,-- NCC采购订单/请购单表头pk
|
||||
formson_0267.field0062-- NCC采购订单/请购单表体pk
|
||||
formson_0267.field0061,-- NCC采购订单/应付单表头pk
|
||||
formson_0267.field0062,-- NCC采购订单/应付单表体pk
|
||||
formson_0267.field0064-- NCC应付单单表体组织本币余额
|
||||
</sql>
|
||||
<select id="entity_list_base" resultMap="get-CLPayApplyEntity-result" parameterType="com.hzya.frame.plugin.oa.payapply.entity.CLPayApplyEntity">
|
||||
select
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description 付款单传NCC
|
||||
* @Description 材料类付款单传NCC
|
||||
* @Author xiangerlin
|
||||
* @Date 2025-06-25 11:40:50
|
||||
**/
|
||||
|
@ -61,7 +61,7 @@ public class PaybillPluginInitializer extends PluginBaseEntity {
|
|||
**/
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "付款单传NCC";
|
||||
return "材料类付款单传NCC";
|
||||
}
|
||||
|
||||
/****
|
||||
|
@ -72,7 +72,7 @@ public class PaybillPluginInitializer extends PluginBaseEntity {
|
|||
**/
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "付款单传NCC";
|
||||
return "材料类付款单传NCC";
|
||||
}
|
||||
|
||||
/***
|
||||
|
@ -96,7 +96,7 @@ public class PaybillPluginInitializer extends PluginBaseEntity {
|
|||
**/
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
logger.info("======开始执行付款单传NCC插件======");
|
||||
logger.info("======开始执行材料类付款单传NCC插件======");
|
||||
paybillPluginService.sync2ncc(requestJson);
|
||||
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||
}
|
||||
|
|
|
@ -4,13 +4,13 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
/**
|
||||
* @Description 付款单传NCC
|
||||
* @Description 材料类付款单传NCC
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/25 11:44
|
||||
**/
|
||||
public interface IPaybillPluginService {
|
||||
/**
|
||||
* 付款单传到NCC
|
||||
* 材料类付款单传到NCC
|
||||
* @param requestJson
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -51,7 +51,6 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
public JsonResultEntity sync2ncc(JSONObject requestJson) {
|
||||
//数据源编码
|
||||
String datasourceCode = requestJson.getString("sourceCode");
|
||||
String task_living_details_id = requestJson.getString("integration_task_living_details_id");
|
||||
String headersStr = requestJson.getString("headers");//请求头
|
||||
String eventType = requestJson.getString("eventType");
|
||||
JSONObject headers = requestJson.getJSONObject("headers");
|
||||
|
@ -69,7 +68,7 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
|
||||
|
||||
//流程结束
|
||||
if (ColEventTypeEnum.ONPROCESSFINISHED.getType().equals(eventType)) {
|
||||
// if (ColEventTypeEnum.ONPROCESSFINISHED.getType().equals(eventType)) {
|
||||
/**
|
||||
* 判断付款单表头的财务组织如果是002,说明是总部代项目部付款
|
||||
* 要生成对应项目部的付款单 以及 总部的 付款结算单
|
||||
|
@ -83,7 +82,7 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
if ("002".equals(orgCode)) {
|
||||
cmpPaybill(datasourceCode, formmainData, headers, forsonDataList);
|
||||
}
|
||||
}
|
||||
// }
|
||||
return BaseResult.getSuccessMessageEntity("操作成功");
|
||||
}
|
||||
|
||||
|
@ -104,38 +103,43 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
boolean flag = true;
|
||||
//结算方式编码, 10备用金、20开票、21背书、3网银
|
||||
String balaTypeCode = formmainData.getString("field0076");
|
||||
if ("20".equals(balaTypeCode)) {
|
||||
logger.info("======OA付款单传开票的方式保证金传NCC付款结算单请求参数:{}======");
|
||||
JSONObject param = getCmpPayBillVO(formmainData, forsonDataList, orgCode, billmaker, groupCode);
|
||||
String req = JSONObject.toJSONString(param);
|
||||
String result = HttpRequest.post(baseUrl)
|
||||
.header("appId", "800065")//NCC应用
|
||||
.header("apiCode", "8000650006")//NCC付款单新增保存提交
|
||||
.header("publicKey", "ZJYAbkr9+XjnDrlfQCRKXtpVvg/BjxqtxzcLgg5TIGagEKJCe7eDIk+3zDUT+v578prj")//OA公钥
|
||||
.header("secretKey", "2GR4+yrcx+Ev+pN0Q6V6wxCdvisPX7wzNKBgc5SsIYGxYI5GTISXT6GvTPfp1u2Rj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
|
||||
.body(req)//表单内容
|
||||
.timeout(30000)//超时,毫秒
|
||||
.execute().body();
|
||||
logger.info("======OA付款单传开票的方式保证金传NCC付款结算单返回参数:{}",result);
|
||||
if (StrUtil.isNotEmpty(result)){
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
flag = resultJson.getBoolean("flag");
|
||||
}
|
||||
}
|
||||
//如果有保证金的情况,保证金保存成功再保存承兑的
|
||||
if (flag){
|
||||
//付款结算单
|
||||
JSONObject param = getCmpPayBillVO(formmainData, forsonDataList, orgCode, billmaker, groupCode);
|
||||
String req = JSONObject.toJSONString(param);
|
||||
logger.info("======OA付款单传NCC付款结算单请求参数:{}======", req);
|
||||
String access_token = getAccessToken();
|
||||
String result = HttpRequest.post(baseUrl)
|
||||
.header("appId", "800065")//NCC应用
|
||||
.header("apiCode", "8000650006")//NCC付款单新增保存提交
|
||||
.header("apiCode", "8000650006")//NCC付款结算单新增
|
||||
.header("publicKey", "ZJYAbkr9+XjnDrlfQCRKXtpVvg/BjxqtxzcLgg5TIGagEKJCe7eDIk+3zDUT+v578prj")//OA公钥
|
||||
.header("secretKey", "2GR4+yrcx+Ev+pN0Q6V6wxCdvisPX7wzNKBgc5SsIYGxYI5GTISXT6GvTPfp1u2Rj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
|
||||
.header("access_token", access_token)//token
|
||||
.body(req)//表单内容
|
||||
.timeout(30000)//超时,毫秒
|
||||
.execute().body();
|
||||
logger.info("======OA付款单传NCC付款结算单响应参数:{}======",result);
|
||||
if (StrUtil.isNotEmpty(result)){
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
flag = resultJson.getBoolean("flag");
|
||||
}
|
||||
|
||||
if (flag){
|
||||
//保证金单独生成一张付款结算单
|
||||
if ("20".equals(balaTypeCode)) {
|
||||
logger.info("======OA付款单传开票的方式保证金传NCC付款结算单请求参数:{}======");
|
||||
JSONObject bzjParam = getCmpPayBillVO(formmainData, forsonDataList, orgCode, billmaker, groupCode);
|
||||
String bzjReq = JSONObject.toJSONString(bzjParam);
|
||||
String bazjResult = HttpRequest.post(baseUrl)
|
||||
.header("appId", "800065")//NCC应用
|
||||
.header("apiCode", "8000650006")//NCC付款结算单新增
|
||||
.header("publicKey", "ZJYAbkr9+XjnDrlfQCRKXtpVvg/BjxqtxzcLgg5TIGagEKJCe7eDIk+3zDUT+v578prj")//OA公钥
|
||||
.header("secretKey", "2GR4+yrcx+Ev+pN0Q6V6wxCdvisPX7wzNKBgc5SsIYGxYI5GTISXT6GvTPfp1u2Rj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
|
||||
.header("access_token", access_token)//token
|
||||
.body(bzjReq)//表单内容
|
||||
.timeout(30000)//超时,毫秒
|
||||
.execute().body();
|
||||
logger.info("======OA付款单传开票的方式保证金传NCC付款结算单返回参数:{}",bazjResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,7 +161,7 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
if (!"20".equals(balaTypeCode)) {
|
||||
head.put("primal_money", formmainData.getString("field0019"));//付款原币金额
|
||||
} else {
|
||||
head.put("primal_money", "");//付款原币金额, 这里要取保证金
|
||||
head.put("primal_money", "field0096");//付款原币金额, 这里要取保证金
|
||||
}
|
||||
|
||||
head.put("pk_currtype", formmainData.getString("field0087"));//币种名称
|
||||
|
@ -173,7 +177,7 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
if (!"20".equals(balaTypeCode)) {
|
||||
b.put("pay_primal", item.getString("field0030"));//付款原币金额
|
||||
} else {
|
||||
b.put("pay_primal", "");//这里要取保证金
|
||||
b.put("pay_primal", "field0096");//这里要取保证金
|
||||
}
|
||||
b.put("creationtime", DateUtil.now());//创建时间
|
||||
b.put("direction", "-1");//方向 :1=收;-1=付;
|
||||
|
@ -246,7 +250,7 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
head.put("effectdate", "");//生效日期
|
||||
head.put("officialprintuser", "");//正式打印人编码
|
||||
head.put("officialprintdate", "");//正式打印日期
|
||||
head.put("src_syscode", "");//单据来源系统编码
|
||||
head.put("src_syscode", "1");//单据来源系统编码
|
||||
head.put("pk_ratetype", "");//组织汇率类型
|
||||
head.put("ratedate", "");//组织汇率来源日期
|
||||
head.put("def1", formmainData.getString("field0083"));//账户属性
|
||||
|
@ -281,14 +285,14 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
payApplyJson.put("pk_psndoc", head.getString("pk_psndoc"));//业务员编码,往来对象选择业务员时必输
|
||||
payApplyJson.put("pk_recpaytype", forson.getString("field0031"));//付款业务类型名称
|
||||
payApplyJson.put("pk_currtype", payApply.getField0051());//币种编码
|
||||
payApplyJson.put("money_de", payApply.getField0042());//贷方原币金额
|
||||
payApplyJson.put("occupationmny", payApply.getField0042());//预占用核销原币余额
|
||||
payApplyJson.put("money_de", payApply.getField0064());//贷方原币金额
|
||||
payApplyJson.put("occupationmny", payApply.getField0064());//预占用核销原币余额
|
||||
payApplyJson.put("rate", "1");//组织本币汇率
|
||||
payApplyJson.put("local_money_de", payApply.getField0042());//组织本币金额
|
||||
payApplyJson.put("local_money_de", payApply.getField0064());//组织本币金额
|
||||
payApplyJson.put("grouprate", "1");//组织本币汇率
|
||||
payApplyJson.put("groupdebit", payApply.getField0042());//集团本币金额
|
||||
payApplyJson.put("groupdebit", payApply.getField0064());//集团本币金额
|
||||
payApplyJson.put("globalrate", "1");//全局本币汇率
|
||||
payApplyJson.put("globaldebit", payApply.getField0042());//全局本币金额
|
||||
payApplyJson.put("globaldebit", payApply.getField0064());//全局本币金额
|
||||
payApplyJson.put("quantity_de", payApply.getField0044());//贷方数量
|
||||
payApplyJson.put("price", payApply.getField0041());//单价
|
||||
payApplyJson.put("local_price", payApply.getField0041());//本币单价
|
||||
|
@ -328,9 +332,11 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
payApplyJson.put("src_tradetype", payApply.getField0059());//源头交易类型
|
||||
payApplyJson.put("src_billtype", payApply.getField0052());//源头单据类型
|
||||
payApplyJson.put("src_billid", payApply.getField0061());//源头单据表头id
|
||||
payApplyJson.put("src_itemid", payApply.getField0062());//源头单据表体id
|
||||
//payApplyJson.put("src_itemid", payApply.getField0062());//源头单据表体id
|
||||
payApplyJson.put("src_itemid", payApply.getField0063());//源头单据表体id
|
||||
payApplyJson.put("top_billid", payApply.getField0061());//上层单据表头id
|
||||
payApplyJson.put("top_itemid", payApply.getField0062());//上层单据表体id
|
||||
//payApplyJson.put("top_itemid", payApply.getField0062());//上层单据表体id // 这里可能是取采购付款计划的pk
|
||||
payApplyJson.put("top_itemid", payApply.getField0063());//上层单据表体id // 这里可能是取采购付款计划的pk
|
||||
payApplyJson.put("top_billtype", payApply.getField0052());//上层单据类型
|
||||
payApplyJson.put("top_tradetype", payApply.getField0059());//上层交易类型
|
||||
payApplyJson.put("purchaseorder", payApply.getField0048());//订单号
|
||||
|
@ -348,7 +354,7 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
payApplyJson.put("prepay", "0");//付款性质(0应付款、1预付款)
|
||||
}
|
||||
//累加付款总额
|
||||
money = money.add(new BigDecimal(payApply.getField0042()));
|
||||
money = money.add(new BigDecimal(payApply.getField0064()));
|
||||
itemList.add(payApplyJson);
|
||||
}
|
||||
}
|
||||
|
@ -360,11 +366,13 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
head.put("items", itemList);
|
||||
String req = JSONObject.toJSONString(head);
|
||||
logger.info("======OA付款单传NCC付款单请求参数:{}======", req);
|
||||
String access_token = getAccessToken();
|
||||
String result = HttpRequest.post(baseUrl)
|
||||
.header("appId", "800065")//NCC应用
|
||||
.header("apiCode", "8000650012")//NCC付款单新增保存提交
|
||||
.header("publicKey", "ZJYAbkr9+XjnDrlfQCRKXtpVvg/BjxqtxzcLgg5TIGagEKJCe7eDIk+3zDUT+v578prj")//OA公钥
|
||||
.header("secretKey", "2GR4+yrcx+Ev+pN0Q6V6wxCdvisPX7wzNKBgc5SsIYGxYI5GTISXT6GvTPfp1u2Rj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
|
||||
.header("access_token", access_token)//token
|
||||
.body(req)//表单内容
|
||||
.timeout(30000)//超时,毫秒
|
||||
.execute().body();
|
||||
|
@ -379,4 +387,30 @@ public class PaybillPluginServiceImpl implements IPaybillPluginService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getAccessToken(){
|
||||
try {
|
||||
String result = HttpRequest.post(baseUrl)
|
||||
.header("appId", "800065")//NCC应用
|
||||
.header("apiCode", "8000650004")//NCC付token
|
||||
.header("publicKey", "ZJYAbkr9+XjnDrlfQCRKXtpVvg/BjxqtxzcLgg5TIGagEKJCe7eDIk+3zDUT+v578prj")//OA公钥
|
||||
.header("secretKey", "2GR4+yrcx+Ev+pN0Q6V6wxCdvisPX7wzNKBgc5SsIYGxYI5GTISXT6GvTPfp1u2Rj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
|
||||
.body("")//表单内容
|
||||
.timeout(30000)//超时,毫秒
|
||||
.execute().body();
|
||||
if (StrUtil.isNotEmpty(result)){
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
JSONObject attribute = resultJson.getJSONObject("attribute");
|
||||
if (null != attribute && attribute.getBoolean("success")){
|
||||
JSONObject data = attribute.getJSONObject("data");
|
||||
if (null != data){
|
||||
return data.getString("access_token");
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error("获取NCCtoken失败:{}",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue