开始堆si山代码
This commit is contained in:
parent
d873dce529
commit
8aad897d67
|
@ -1,6 +1,7 @@
|
||||||
package com.hzya.frame.bip.v3.v2207.service.impl;
|
package com.hzya.frame.bip.v3.v2207.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||||
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
|
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
|
||||||
import com.hzya.frame.bip.v3.v2207.service.IBipV32207BillService;
|
import com.hzya.frame.bip.v3.v2207.service.IBipV32207BillService;
|
||||||
|
@ -33,6 +34,7 @@ public class BipV32207BillServiceImpl extends BaseService<BipTokenVo, String> im
|
||||||
public SysExtensionApiEntity getBipBill(SysExtensionApiEntity entity) {
|
public SysExtensionApiEntity getBipBill(SysExtensionApiEntity entity) {
|
||||||
try {
|
try {
|
||||||
Map<String, String> headers = entity.getHeaders();
|
Map<String, String> headers = entity.getHeaders();
|
||||||
|
logger.info("扩展方法得到的请求头:"+ JSON.toJSONString(headers));
|
||||||
String client_id = headers.get("client_id");
|
String client_id = headers.get("client_id");
|
||||||
//token信息
|
//token信息
|
||||||
String access_token = headers.get("access_token");
|
String access_token = headers.get("access_token");
|
||||||
|
|
|
@ -24,6 +24,33 @@ public class PayBillEntity extends BaseEntity {
|
||||||
private String pkOrg;//组织
|
private String pkOrg;//组织
|
||||||
private String pkCustomer;//客户
|
private String pkCustomer;//客户
|
||||||
private String pk_oppaccount;//付款账户
|
private String pk_oppaccount;//付款账户
|
||||||
|
private String pkBalatype;//结算方式
|
||||||
|
private String billCode;//单据编号
|
||||||
|
private String queryState;
|
||||||
|
|
||||||
|
public String getQueryState() {
|
||||||
|
return queryState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQueryState(String queryState) {
|
||||||
|
this.queryState = queryState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBillCode() {
|
||||||
|
return billCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBillCode(String billCode) {
|
||||||
|
this.billCode = billCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPkBalatype() {
|
||||||
|
return pkBalatype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkBalatype(String pkBalatype) {
|
||||||
|
this.pkBalatype = pkBalatype;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPkCustomer() {
|
public String getPkCustomer() {
|
||||||
return pkCustomer;
|
return pkCustomer;
|
||||||
|
|
|
@ -10,46 +10,66 @@
|
||||||
<result property="pkSupplier" column="pk_supplier" jdbcType="VARCHAR"/>
|
<result property="pkSupplier" column="pk_supplier" jdbcType="VARCHAR"/>
|
||||||
<result property="tableName" column="table_name" jdbcType="VARCHAR"/>
|
<result property="tableName" column="table_name" jdbcType="VARCHAR"/>
|
||||||
<result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
|
<result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="pkBalatype" column="pk_balatype" jdbcType="VARCHAR"/>
|
||||||
|
<result property="billCode" column="bill_code" jdbcType="VARCHAR"/>
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!--工程项目查询-->
|
<!--工程项目查询-->
|
||||||
<select id="PayBillEntity_list_base" resultMap="get-PayBillEntity-result" parameterType="com.hzya.frame.seeyon.paybill.entity.PayBillEntity">
|
<select id="PayBillEntity_list_base" resultMap="get-PayBillEntity-result" parameterType="com.hzya.frame.seeyon.paybill.entity.PayBillEntity">
|
||||||
|
select bill_code,id,bill_date,primal_money,pk_oppaccount,pk_supplier,pk_org,pk_balatype,table_name,field_name,send_state from (
|
||||||
SELECT
|
SELECT
|
||||||
body.id as id,
|
body.id as id,
|
||||||
|
field0001 as bill_code,
|
||||||
field0070 AS bill_date,
|
field0070 AS bill_date,
|
||||||
field0057 AS primal_money,
|
field0057 AS primal_money,
|
||||||
field0019 AS pk_oppaccount,
|
field0019 AS pk_oppaccount,
|
||||||
field0082 AS pk_supplier,
|
field0083 AS pk_supplier,
|
||||||
|
field0089 AS pk_org,
|
||||||
|
field0091 AS pk_balatype,
|
||||||
'formson_0222' as table_name,
|
'formson_0222' as table_name,
|
||||||
'field0084' as field_name
|
'field0084' as field_name,
|
||||||
|
field0084 as send_state
|
||||||
FROM formmain_0093 main
|
FROM formmain_0093 main
|
||||||
LEFT JOIN formson_0222 body ON main.id = body.formmain_id
|
LEFT JOIN formson_0222 body ON main.id = body.formmain_id
|
||||||
WHERE field0070 IS NOT null and field0084 is null
|
WHERE field0070 IS NOT null and finishedflag = '1'
|
||||||
union all
|
union all
|
||||||
SELECT
|
SELECT
|
||||||
body.id as id,
|
body.id as id,
|
||||||
|
field0017 as bill_code,
|
||||||
field0073 AS bill_date,
|
field0073 AS bill_date,
|
||||||
field0031 AS primal_money,
|
field0031 AS primal_money,
|
||||||
field0042 AS pk_oppaccount,
|
field0042 AS pk_oppaccount,
|
||||||
field0077 AS pk_supplier,
|
field0077 AS pk_supplier,
|
||||||
|
field0082 AS pk_org,
|
||||||
|
field0084 AS pk_balatype,
|
||||||
'formson_0210' as table_name,
|
'formson_0210' as table_name,
|
||||||
'field0078' as field_name
|
'field0078' as field_name,
|
||||||
|
field0078 as send_state
|
||||||
FROM formmain_0209 main
|
FROM formmain_0209 main
|
||||||
LEFT JOIN formson_0210 body ON main.id = body.formmain_id
|
LEFT JOIN formson_0210 body ON main.id = body.formmain_id
|
||||||
WHERE field0073 IS NOT null and field0078 is null
|
WHERE field0073 IS NOT null and finishedflag = '1'
|
||||||
union all
|
union all
|
||||||
SELECT
|
SELECT
|
||||||
body.id as id,
|
body.id as id,
|
||||||
|
field0001 as bill_code,
|
||||||
field0053 AS bill_date,
|
field0053 AS bill_date,
|
||||||
field0041 AS primal_money,
|
field0041 AS primal_money,
|
||||||
field0024 AS pk_oppaccount,
|
field0024 AS pk_oppaccount,
|
||||||
field0057 AS pk_supplier,
|
field0057 AS pk_supplier,
|
||||||
|
field0061 AS pk_org,
|
||||||
|
field0063 AS pk_balatype,
|
||||||
'formson_0223' as table_name,
|
'formson_0223' as table_name,
|
||||||
'field0058' as field_name
|
'field0058' as field_name,
|
||||||
|
field0058 as send_state
|
||||||
FROM formmain_0094 main
|
FROM formmain_0094 main
|
||||||
LEFT JOIN formson_0223 body ON main.id = body.formmain_id
|
LEFT JOIN formson_0223 body ON main.id = body.formmain_id
|
||||||
WHERE field0053 IS NOT NULL and field0058 is null
|
WHERE field0053 IS NOT NULL and finishedflag = '1'
|
||||||
|
)m1
|
||||||
|
<trim prefix="where" prefixOverrides="and">
|
||||||
|
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||||
|
<if test="queryState != null and queryState != ''"> and send_state is null</if>
|
||||||
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--通过主键修改方法-->
|
<!--通过主键修改方法-->
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.hzya.frame.seeyon.paybill.service.impl;
|
package com.hzya.frame.seeyon.paybill.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
@ -10,6 +11,9 @@ import com.hzya.frame.seeyon.paybill.dao.IPayBillDao;
|
||||||
import com.hzya.frame.seeyon.paybill.entity.PayBillEntity;
|
import com.hzya.frame.seeyon.paybill.entity.PayBillEntity;
|
||||||
import com.hzya.frame.seeyon.paybill.service.IPayBillService;
|
import com.hzya.frame.seeyon.paybill.service.IPayBillService;
|
||||||
import com.hzya.frame.seeyon.service.impl.SeeYonInterFaceImpl;
|
import com.hzya.frame.seeyon.service.impl.SeeYonInterFaceImpl;
|
||||||
|
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||||
|
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||||
|
import com.hzya.frame.u9c.itemmaster.entity.VU9cItemmasterEntity;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -18,6 +22,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +36,8 @@ import java.util.List;
|
||||||
@Service("PayBillServiceImpl")
|
@Service("PayBillServiceImpl")
|
||||||
public class PayBillServiceImpl extends BaseService<PaymentEntity,String> implements IPayBillService {
|
public class PayBillServiceImpl extends BaseService<PaymentEntity,String> implements IPayBillService {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PayBillServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(PayBillServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPayBillDao payBillDao;
|
private IPayBillDao payBillDao;
|
||||||
/**
|
/**
|
||||||
|
@ -43,59 +49,116 @@ public class PayBillServiceImpl extends BaseService<PaymentEntity,String> implem
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity sendEngineerPayBillToBip(JSONObject requestJson) {
|
public JsonResultEntity sendEngineerPayBillToBip(JSONObject requestJson) {
|
||||||
|
JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class);
|
||||||
|
String interId = requestJsonObj.getString("integration_task_living_details_id");
|
||||||
|
logger.info("付款结算单重推解析后:"+requestJsonObj.toString());
|
||||||
|
logger.info("付款结算单重推执行的任务主键:"+interId);
|
||||||
|
JsonResultEntity resultEntity = new JsonResultEntity();
|
||||||
PayBillEntity entity = new PayBillEntity();
|
PayBillEntity entity = new PayBillEntity();
|
||||||
requestJson.put("db_code","OA");
|
requestJson.put("db_code","OA");
|
||||||
entity.setDataSourceCode(requestJson.getString("db_code"));
|
entity.setDataSourceCode(requestJson.getString("db_code"));
|
||||||
|
IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
if(StrUtil.isNotEmpty(interId)){
|
||||||
|
oldMsg = taskLivingDetailsService.get(interId);
|
||||||
|
}
|
||||||
|
String rootAppPk = oldMsg.getRootAppPk();
|
||||||
|
entity.setId(rootAppPk);
|
||||||
|
if(StrUtil.isEmpty(rootAppPk)){
|
||||||
|
entity.setQueryState("查询");
|
||||||
|
}
|
||||||
List<PayBillEntity>payBillEntityList = payBillDao.getOaEngineerPay(entity);
|
List<PayBillEntity>payBillEntityList = payBillDao.getOaEngineerPay(entity);
|
||||||
if(CollectionUtils.isNotEmpty(payBillEntityList)){
|
if(CollectionUtils.isNotEmpty(payBillEntityList)){
|
||||||
for(PayBillEntity pay : payBillEntityList){
|
for(PayBillEntity pay : payBillEntityList){
|
||||||
String token = BipUtil.getBipToken("yonyou","8000230000");
|
try {
|
||||||
JSONObject main = bindingAdd(pay);
|
String token = BipUtil.getBipToken("yonyou","8000230000");
|
||||||
logger.info("工程付款单调用中台生成BIP付款结算单推送报文{}",main.toString());
|
JSONObject main = bindingAdd(pay);
|
||||||
String result = BipUtil.sendU9cTOBipEsb(main.toString(),"8000230014",token);
|
logger.info("工程付款单调用中台生成BIP付款结算单推送报文{}",main.toString());
|
||||||
logger.info("工程付款单调用中台生成BIP付款结算单返回结果{}",result);
|
String result = BipUtil.sendU9cTOBipEsb(main.toString(),"8000230014",token);
|
||||||
JSONObject resultObj = JSON.parseObject(result);
|
logger.info("工程付款单调用中台生成BIP付款结算单返回结果{}",result);
|
||||||
boolean flag = resultObj.getBoolean("success");
|
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
|
||||||
if(flag){
|
logDetails.setRootAppPk(pay.getId());
|
||||||
pay.setState("Y");
|
logDetails.setRootAppBill(pay.getBillCode());
|
||||||
}else{
|
logDetails.setNewTransmitInfo(result);
|
||||||
pay.setState("N");
|
logDetails.setNewPushDate(new Date());
|
||||||
|
logDetails.setRootAppNewData(JSON.toJSONString(pay));
|
||||||
|
//logDetails.setNewState(SysMessageManageLogStatusEnum.statusGetValue(logEntity.getStatus()));
|
||||||
|
logDetails.setPluginId("PayBillPlugin");
|
||||||
|
JSONObject resultObj = JSON.parseObject(result);
|
||||||
|
boolean flag = resultObj.getBoolean("success");
|
||||||
|
if(flag){
|
||||||
|
pay.setState("Y");
|
||||||
|
}else{
|
||||||
|
pay.setState("N");
|
||||||
|
}
|
||||||
|
pay.setDataSourceCode(requestJson.getString("db_code"));
|
||||||
|
try {
|
||||||
|
if(StrUtil.isEmpty(interId)){
|
||||||
|
if(flag){
|
||||||
|
taskLivingDetailsService.saveLogToSuccess(logDetails);
|
||||||
|
}else{
|
||||||
|
taskLivingDetailsService.saveLogToFail(logDetails);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
logDetails.setId(interId);
|
||||||
|
if(flag){
|
||||||
|
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
|
||||||
|
}else{
|
||||||
|
taskLivingDetailsService.updateLogFailToSuccess(logDetails);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.info("保存日志失败"+e.getMessage());
|
||||||
|
payBillDao.updateState(pay);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
payBillDao.updateState(pay);
|
||||||
|
// todo 后续在写吧(没字段等OA开了外网在创建),修改推送状态,避免再次查询
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.info("付款单执行失败:"+e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
pay.setDataSourceCode(requestJson.getString("db_code"));
|
|
||||||
payBillDao.updateState(pay);
|
|
||||||
// todo 后续在写吧(没字段等OA开了外网在创建),修改推送状态,避免再次查询
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return new JsonResultEntity("成功",true,resultEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private JSONObject bindingAdd(PayBillEntity pay) {
|
private JSONObject bindingAdd(PayBillEntity pay) {
|
||||||
|
String billDate = pay.getBillDate().substring(0,19);
|
||||||
|
if(billDate.length()>19){
|
||||||
|
billDate= pay.getBillDate().substring(0,19);
|
||||||
|
}
|
||||||
JSONObject head = new JSONObject();
|
JSONObject head = new JSONObject();
|
||||||
head.put("pk_org","");//所属组织
|
head.put("pk_org",pay.getPkOrg());//所属组织
|
||||||
head.put("pk_group","");//集团
|
head.put("pk_group","ycjf");//集团
|
||||||
head.put("bill_type","F5");//单据类型 默认F5
|
head.put("bill_type","F5");//单据类型 默认F5
|
||||||
head.put("trade_type","D5");//付款结算类型 默认D5
|
head.put("trade_type","D5");//付款结算类型 默认D5
|
||||||
head.put("source_flag","2");//付款结算类型 默认2
|
head.put("source_flag","2");//付款结算类型 默认2
|
||||||
head.put("bill_date",pay.getBillDate());//单据日期
|
head.put("bill_date",billDate);//单据日期
|
||||||
head.put("primal_money",pay.getPrimalMoney());//付款原币金额
|
head.put("primal_money",pay.getPrimalMoney());//付款原币金额
|
||||||
head.put("pk_currtype","CNY");//币种
|
head.put("pk_currtype","CNY");//币种
|
||||||
head.put("billmaker","");//制单人
|
head.put("billmaker","yonyou");//制单人//先临时使用管理员账户,后续在确认
|
||||||
//处理明细数据,按照明细付款 多个明细生成多个付款结算单
|
//处理明细数据,按照明细付款 多个明细生成多个付款结算单
|
||||||
JSONArray detailsArr = new JSONArray();
|
JSONArray detailsArr = new JSONArray();
|
||||||
JSONObject body = new JSONObject();
|
JSONObject body = new JSONObject();
|
||||||
body.put("pk_org","");//所属组织
|
body.put("pk_org",pay.getPkOrg());//所属组织
|
||||||
body.put("pk_group","");//集团
|
body.put("pk_balatype",pay.getPkBalatype());//结算方式
|
||||||
|
body.put("pk_group","ycjf");//集团
|
||||||
body.put("bill_type","F5");//单据类型 默认F5
|
body.put("bill_type","F5");//单据类型 默认F5
|
||||||
body.put("trade_type","D5");//付款结算类型 默认D5
|
body.put("trade_type","D5");//付款结算类型 默认D5
|
||||||
body.put("pk_currtype","CNY");//币种
|
body.put("pk_currtype","CNY");//币种
|
||||||
body.put("bill_date",pay.getBillDate());//单据日期
|
body.put("bill_date",billDate);//单据日期
|
||||||
body.put("pay_primal",pay.getPrimalMoney());//付款原币金额
|
body.put("pay_primal",pay.getPrimalMoney());//付款原币金额
|
||||||
body.put("creationtime",pay.getBillDate());//创建时间
|
body.put("creationtime",billDate);//创建时间
|
||||||
body.put("direction","-1");//方向 :1=收;-1=付;
|
body.put("direction","-1");//方向 :1=收;-1=付;
|
||||||
body.put("objecttype","0");//交易对象
|
body.put("objecttype","0");//交易对象
|
||||||
body.put("pk_customer",pay.getPkCustomer());//客户
|
body.put("pk_customer",pay.getPkSupplier());//客户
|
||||||
body.put("pk_account",pay.getPkOppaccount());//付款银行账号
|
String pkOppaccount = "";
|
||||||
|
if(StrUtil.isNotEmpty(pay.getPkOppaccount())){
|
||||||
|
pkOppaccount = pay.getPkOppaccount().replaceAll(" ","");
|
||||||
|
}
|
||||||
|
body.put("pk_oppaccount",pkOppaccount);//付款银行账号
|
||||||
detailsArr.add(body);
|
detailsArr.add(body);
|
||||||
JSONObject main = new JSONObject();
|
JSONObject main = new JSONObject();
|
||||||
main.put("head",head);//表头
|
main.put("head",head);//表头
|
||||||
|
|
|
@ -20,11 +20,11 @@ public class RecBillDaoImpl extends MybatisGenericDao implements IRecBillDao {
|
||||||
@DS("#rec.dataSourceCode")
|
@DS("#rec.dataSourceCode")
|
||||||
@Override
|
@Override
|
||||||
public List<RecBillEntity> getOaRecBill(RecBillEntity rec) {
|
public List<RecBillEntity> getOaRecBill(RecBillEntity rec) {
|
||||||
return super.selectList("com.hzya.frame.seeyon.recbill.dao.impl.RecBillDaoImpl.PayBillEntity_list_base",rec);
|
return super.selectList("com.hzya.frame.seeyon.recbill.dao.impl.RecBillDaoImpl.RecBillEntity_list_base",rec);
|
||||||
}
|
}
|
||||||
@DS("#rec.dataSourceCode")
|
@DS("#rec.dataSourceCode")
|
||||||
@Override
|
@Override
|
||||||
public int updateState(RecBillEntity rec) {
|
public int updateState(RecBillEntity rec) {
|
||||||
return super.update("com.hzya.frame.seeyon.recbill.dao.impl.RecBillDaoImpl.PayBillEntity_update",rec);
|
return super.update("com.hzya.frame.seeyon.recbill.dao.impl.RecBillDaoImpl.RecBillEntity_update",rec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,33 @@ public class RecBillEntity extends BaseEntity {
|
||||||
private String pkCustomer;//客户
|
private String pkCustomer;//客户
|
||||||
private String pkAccount;//收款账户
|
private String pkAccount;//收款账户
|
||||||
private String pkOrg;//组织
|
private String pkOrg;//组织
|
||||||
|
private String billmaker;//组织
|
||||||
|
private String billCode;//单据编号
|
||||||
|
private String queryState;
|
||||||
|
|
||||||
|
public String getQueryState() {
|
||||||
|
return queryState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQueryState(String queryState) {
|
||||||
|
this.queryState = queryState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBillCode() {
|
||||||
|
return billCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBillCode(String billCode) {
|
||||||
|
this.billCode = billCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBillmaker() {
|
||||||
|
return billmaker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBillmaker(String billmaker) {
|
||||||
|
this.billmaker = billmaker;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPkCustomer() {
|
public String getPkCustomer() {
|
||||||
return pkCustomer;
|
return pkCustomer;
|
||||||
|
|
|
@ -12,12 +12,15 @@
|
||||||
<result property="pkSupplier" column="pk_supplier" jdbcType="VARCHAR"/>
|
<result property="pkSupplier" column="pk_supplier" jdbcType="VARCHAR"/>
|
||||||
<result property="tableName" column="table_name" jdbcType="VARCHAR"/>
|
<result property="tableName" column="table_name" jdbcType="VARCHAR"/>
|
||||||
<result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
|
<result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="billCode" column="bill_code" jdbcType="VARCHAR"/>
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!--工程项目查询-->
|
<!--工程项目查询-->
|
||||||
<select id="RecBillEntity_list_base" resultMap="get-RecBillEntity-result" parameterType="com.hzya.frame.seeyon.recbill.entity.RecBillEntity">
|
<select id="RecBillEntity_list_base" resultMap="get-RecBillEntity-result" parameterType="com.hzya.frame.seeyon.recbill.entity.RecBillEntity">
|
||||||
SELECT
|
SELECT
|
||||||
|
id AS id,
|
||||||
|
field0005 AS bill_code,
|
||||||
field0002 AS pk_org,
|
field0002 AS pk_org,
|
||||||
field0006 AS bill_date,
|
field0006 AS bill_date,
|
||||||
field0009 AS primal_money,
|
field0009 AS primal_money,
|
||||||
|
@ -27,7 +30,10 @@
|
||||||
'formmain_0233' as table_name,
|
'formmain_0233' as table_name,
|
||||||
'field0016' as field_name
|
'field0016' as field_name
|
||||||
FROM formmain_0233
|
FROM formmain_0233
|
||||||
WHERE field0016 IS null
|
<trim prefix="where" prefixOverrides="and">
|
||||||
|
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||||
|
<if test="queryState != null and queryState != ''"> and field0016 IS null </if>
|
||||||
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--通过主键修改方法-->
|
<!--通过主键修改方法-->
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.hzya.frame.seeyon.recbill.service.impl;
|
package com.hzya.frame.seeyon.recbill.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
@ -9,6 +10,8 @@ import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity;
|
||||||
import com.hzya.frame.seeyon.recbill.dao.IRecBillDao;
|
import com.hzya.frame.seeyon.recbill.dao.IRecBillDao;
|
||||||
import com.hzya.frame.seeyon.recbill.entity.RecBillEntity;
|
import com.hzya.frame.seeyon.recbill.entity.RecBillEntity;
|
||||||
import com.hzya.frame.seeyon.recbill.service.IRecBillService;
|
import com.hzya.frame.seeyon.recbill.service.IRecBillService;
|
||||||
|
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||||
|
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -17,6 +20,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +34,8 @@ import java.util.List;
|
||||||
@Service("RecBillServiceImpl")
|
@Service("RecBillServiceImpl")
|
||||||
public class RecBillServiceImpl extends BaseService<PaymentEntity,String> implements IRecBillService {
|
public class RecBillServiceImpl extends BaseService<PaymentEntity,String> implements IRecBillService {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(RecBillServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(RecBillServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRecBillDao payBillDao;
|
private IRecBillDao payBillDao;
|
||||||
/**
|
/**
|
||||||
|
@ -42,49 +47,97 @@ public class RecBillServiceImpl extends BaseService<PaymentEntity,String> implem
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity sendRecBillToBip(JSONObject requestJson) {
|
public JsonResultEntity sendRecBillToBip(JSONObject requestJson) {
|
||||||
|
JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class);
|
||||||
|
String interId = requestJsonObj.getString("integration_task_living_details_id");
|
||||||
|
logger.info("付款结算单重推解析后:"+requestJsonObj.toString());
|
||||||
|
logger.info("收款结算单重推执行的任务主键:"+interId);
|
||||||
|
JsonResultEntity resultEntity = new JsonResultEntity();
|
||||||
RecBillEntity entity = new RecBillEntity();
|
RecBillEntity entity = new RecBillEntity();
|
||||||
requestJson.put("db_code","OA");
|
requestJson.put("db_code","OA");
|
||||||
entity.setDataSourceCode(requestJson.getString("db_code"));
|
entity.setDataSourceCode(requestJson.getString("db_code"));
|
||||||
|
IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
if(StrUtil.isNotEmpty(interId)){
|
||||||
|
oldMsg = taskLivingDetailsService.get(interId);
|
||||||
|
}
|
||||||
|
String rootAppPk = oldMsg.getRootAppPk();
|
||||||
|
entity.setId(rootAppPk);
|
||||||
|
if(StrUtil.isEmpty(rootAppPk)){
|
||||||
|
entity.setQueryState("查询");
|
||||||
|
}
|
||||||
List<RecBillEntity>payBillEntityList = payBillDao.getOaRecBill(entity);
|
List<RecBillEntity>payBillEntityList = payBillDao.getOaRecBill(entity);
|
||||||
if(CollectionUtils.isNotEmpty(payBillEntityList)){
|
if(CollectionUtils.isNotEmpty(payBillEntityList)){
|
||||||
for(RecBillEntity pay : payBillEntityList){
|
for(RecBillEntity pay : payBillEntityList){
|
||||||
String token = BipUtil.getBipToken("yonyou","8000230000");
|
try {
|
||||||
JSONObject main = bindingAdd(pay);
|
String token = BipUtil.getBipToken("yonyou","8000230000");
|
||||||
logger.info("银行流水收款信息数据{}",main.toString());
|
JSONObject main = bindingAdd(pay);
|
||||||
String result = BipUtil.sendU9cTOBipEsb(main.toString(),"8000230016",token);
|
logger.info("银行流水收款信息数据{}",main.toString());
|
||||||
logger.info("银行流水收款信息数据{}",result);
|
String result = BipUtil.sendU9cTOBipEsb(main.toString(),"8000230016",token);
|
||||||
JSONObject resultObj = JSON.parseObject(result);
|
logger.info("银行流水收款信息数据{}",result);
|
||||||
boolean flag = resultObj.getBoolean("success");
|
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
|
||||||
if(flag){
|
logDetails.setRootAppPk(pay.getId());
|
||||||
pay.setState("Y");
|
logDetails.setRootAppBill(pay.getBillCode());
|
||||||
}else{
|
logDetails.setNewTransmitInfo(result);
|
||||||
pay.setState("N");
|
logDetails.setNewPushDate(new Date());
|
||||||
|
logDetails.setRootAppNewData(JSON.toJSONString(pay));
|
||||||
|
//logDetails.setNewState(SysMessageManageLogStatusEnum.statusGetValue(logEntity.getStatus()));
|
||||||
|
logDetails.setPluginId("RecBillPluginInitializer");
|
||||||
|
JSONObject resultObj = JSON.parseObject(result);
|
||||||
|
boolean flag = resultObj.getBoolean("success");
|
||||||
|
if(flag){
|
||||||
|
pay.setState("Y");
|
||||||
|
}else{
|
||||||
|
pay.setState("N");
|
||||||
|
}
|
||||||
|
pay.setDataSourceCode(requestJson.getString("db_code"));
|
||||||
|
try {
|
||||||
|
if(StrUtil.isEmpty(interId)){
|
||||||
|
if(flag){
|
||||||
|
taskLivingDetailsService.saveLogToSuccess(logDetails);
|
||||||
|
}else{
|
||||||
|
taskLivingDetailsService.saveLogToFail(logDetails);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
logDetails.setId(interId);
|
||||||
|
if(flag){
|
||||||
|
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
|
||||||
|
}else{
|
||||||
|
taskLivingDetailsService.updateLogFailToSuccess(logDetails);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.info("保存日志失败"+e.getMessage());
|
||||||
|
payBillDao.updateState(pay);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
payBillDao.updateState(pay);
|
||||||
|
// todo 后续在写吧(没字段等OA开了外网在创建),修改推送状态,避免再次查询
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.info("收款单执行失败:"+e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
pay.setDataSourceCode(requestJson.getString("db_code"));
|
|
||||||
payBillDao.updateState(pay);
|
|
||||||
// todo 后续在写吧(没字段等OA开了外网在创建),修改推送状态,避免再次查询
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return new JsonResultEntity("成功",true,resultEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private JSONObject bindingAdd(RecBillEntity pay) {
|
private JSONObject bindingAdd(RecBillEntity pay) {
|
||||||
JSONObject head = new JSONObject();
|
JSONObject head = new JSONObject();
|
||||||
head.put("pk_org","");//所属组织
|
head.put("pk_org",pay.getPkOrg());//所属组织
|
||||||
head.put("pk_group","");//集团
|
head.put("pk_group","ycjf");//集团
|
||||||
head.put("bill_type","F4");//单据类型 默认F5
|
head.put("bill_type","F4");//单据类型 默认F5
|
||||||
head.put("trade_type","D4");//付款结算类型 默认D5
|
head.put("trade_type","D4");//付款结算类型 默认D5
|
||||||
head.put("source_flag","2");//付款结算类型 默认2
|
head.put("source_flag","2");//付款结算类型 默认2
|
||||||
head.put("bill_date",pay.getBillDate());//单据日期
|
head.put("bill_date",pay.getBillDate());//单据日期
|
||||||
head.put("primal_money",pay.getPrimalMoney());//付款原币金额
|
head.put("primal_money",pay.getPrimalMoney());//付款原币金额
|
||||||
head.put("pk_currtype","CNY");//币种
|
head.put("pk_currtype","CNY");//币种
|
||||||
head.put("billmaker","");//制单人
|
head.put("billmaker","yonyou");//制单人 //先临时使用管理员账户,后续在确认
|
||||||
//处理明细数据,按照明细付款 多个明细生成多个付款结算单
|
//处理明细数据,按照明细付款 多个明细生成多个付款结算单
|
||||||
JSONArray detailsArr = new JSONArray();
|
JSONArray detailsArr = new JSONArray();
|
||||||
JSONObject body = new JSONObject();
|
JSONObject body = new JSONObject();
|
||||||
body.put("pk_org","");//所属组织
|
body.put("pk_org",pay.getPkOrg());//所属组织
|
||||||
body.put("pk_group","");//集团
|
body.put("pk_group","ycjf");//集团
|
||||||
body.put("bill_type","F4");//单据类型 默认F5
|
body.put("bill_type","F4");//单据类型 默认F5
|
||||||
body.put("trade_type","D4");//付款结算类型 默认D5
|
body.put("trade_type","D4");//付款结算类型 默认D5
|
||||||
body.put("pk_currtype","CNY");//币种
|
body.put("pk_currtype","CNY");//币种
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class MasterDataDaoImpl extends BaseService<ComparisonEntity, String> imp
|
||||||
List<HashMap<String, Object>> hashMaps = execSqlService.execSelectSql(str, "");
|
List<HashMap<String, Object>> hashMaps = execSqlService.execSelectSql(str, "");
|
||||||
return hashMaps;
|
return hashMaps;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.info("U8C主数据档案用户档案没有需要同步中台的数据");
|
logger.info("主数据查询异常"+e.getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue