@ -2,12 +2,15 @@ package com.example.guoyan.scheduled;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper ;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper ;
import com.baomidou.mybatisplus.core.toolkit.StringUtils ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
import com.example.guoyan.entity.* ;
import com.example.guoyan.entity.* ;
import com.example.guoyan.mapper.* ;
import com.example.guoyan.mapper.* ;
import com.example.guoyan.response.ResponseBeanForBeiJing ;
import com.example.guoyan.response.ResponseBeanForBeiJing ;
import com.jcraft.jsch.ChannelSftp ;
import com.jcraft.jsch.JSch ;
import com.jcraft.jsch.Session ;
import lombok.extern.slf4j.Slf4j ;
import lombok.extern.slf4j.Slf4j ;
import org.apache.commons.lang3.StringUtils ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Value ;
import org.springframework.beans.factory.annotation.Value ;
import org.springframework.core.io.FileSystemResource ;
import org.springframework.core.io.FileSystemResource ;
@ -21,6 +24,7 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource ;
import javax.annotation.Resource ;
import java.io.File ;
import java.io.File ;
import java.io.FileOutputStream ;
import java.text.SimpleDateFormat ;
import java.text.SimpleDateFormat ;
import java.util.* ;
import java.util.* ;
@ -57,6 +61,8 @@ public class ProcessScheduled {
private PermissionrulegroupMapper permissionrulegroupMapper ;
private PermissionrulegroupMapper permissionrulegroupMapper ;
@Value ( "${ypt.username}" )
@Value ( "${ypt.username}" )
private String username ;
private String username ;
@Value ( "${ypt.xmhtusername}" )
private String xmhtusername ;
@Value ( "${ypt.password}" )
@Value ( "${ypt.password}" )
private String password ;
private String password ;
@Value ( "${ypt.loginUrl}" )
@Value ( "${ypt.loginUrl}" )
@ -85,6 +91,8 @@ public class ProcessScheduled {
private KpssProcessNode6IdInfo kpssProcessNode6IdInfo ;
private KpssProcessNode6IdInfo kpssProcessNode6IdInfo ;
@Value ( "${ypt.htqxid}" )
@Value ( "${ypt.htqxid}" )
private String htqxid ;
private String htqxid ;
private String [ ] industry = { "政党机关" , "公检法司" , "交通运输" , "医疗卫生" , "文体教育" , "农林牧渔" ,
"通信电信" , "水利水电" , "航空航天" , "石油化工" , "环保绿化" , "海洋气象" , "金融保险" , "科研技术" , "商业服务" , "军队" } ;
/ * *
/ * *
* 定时任务跑合同和项目信息的变化发给北京 , 五分钟一次
* 定时任务跑合同和项目信息的变化发给北京 , 五分钟一次
* /
* /
@ -100,7 +108,7 @@ public class ProcessScheduled {
//发起请求 获取权限token
//发起请求 获取权限token
log . info ( map . toString ( ) ) ;
log . info ( map . toString ( ) ) ;
ResponseBeanForBeiJing responseBean = restTemplate . postForObject ( loginUrl , map , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing responseBean = restTemplate . postForObject ( loginUrl , map , ResponseBeanForBeiJing . class ) ;
log . info ( "登录返回的信息:" + responseBean . toString ( ) ) ;
log . info ( "xmht 登录返回的信息:" + responseBean . toString ( ) ) ;
if ( "200" . equals ( responseBean . getCode ( ) ) ) {
if ( "200" . equals ( responseBean . getCode ( ) ) ) {
String data = responseBean . getData ( ) . toString ( ) ;
String data = responseBean . getData ( ) . toString ( ) ;
HttpHeaders headers = new HttpHeaders ( ) ;
HttpHeaders headers = new HttpHeaders ( ) ;
@ -110,6 +118,8 @@ public class ProcessScheduled {
List < SendHt > sendHtList = sendHtMapper . querySendHtByNoDel ( ) ;
List < SendHt > sendHtList = sendHtMapper . querySendHtByNoDel ( ) ;
sendHtToYunPingtai ( sendHtList , headers ) ;
sendHtToYunPingtai ( sendHtList , headers ) ;
//处理开票信息
//处理开票信息
//
List < SendKpxx > sendKpxxList = sendKpxxMapper . querySendKpxxByNoDel ( ) ;
List < SendKpxx > sendKpxxList = sendKpxxMapper . querySendKpxxByNoDel ( ) ;
sendKpxxList . forEach ( item - > {
sendKpxxList . forEach ( item - > {
Integer interfaceType = item . getInterfaceType ( ) ; //类型字段
Integer interfaceType = item . getInterfaceType ( ) ; //类型字段
@ -124,7 +134,7 @@ public class ProcessScheduled {
}
}
//开票确认
//开票确认
} else if ( interfaceType = = 1 & & "ZJ" . equals ( item . getQy ( ) ) ) {
} else if ( interfaceType = = 1 & & "ZJ" . equals ( item . getQy ( ) ) ) {
sendKpqrToYunPingtai ( item , headers ) ;
// sendKpqrToYunPingtai(item,headers);
//开票确认收入
//开票确认收入
} else if ( interfaceType = = 2 ) {
} else if ( interfaceType = = 2 ) {
String wfrequest = item . getWfrequest ( ) ;
String wfrequest = item . getWfrequest ( ) ;
@ -140,14 +150,15 @@ public class ProcessScheduled {
} else if ( interfaceType = = 3 & & "ZJ" . equals ( item . getQy ( ) ) ) {
} else if ( interfaceType = = 3 & & "ZJ" . equals ( item . getQy ( ) ) ) {
sendKpqrdzToYunPingtai ( item , headers ) ;
sendKpqrdzToYunPingtai ( item , headers ) ;
} else {
} else {
log . info ( "未知编号:" + interfaceType ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , item . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , "不是ZJ+0-3的类型" ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
}
}
} ) ;
} ) ;
//处理云平台开票信息更新流程
//处理云平台开票信息更新流程
queryInvoicingApprovalStatus ( headers ) ;
queryInvoicingApprovalStatus ( headers ) ;
sendKpCancelToYPT ( headers ) ; //开票取消
sendKpCancelToYPT ( headers ) ; //开票取消
//
} else {
} else {
log . info ( "登录失败!" ) ;
log . info ( "登录失败!" ) ;
}
}
@ -164,8 +175,16 @@ public class ProcessScheduled {
public void sendXmToYunPingtai ( List < SendXm > sendXmList , HttpHeaders headers ) {
public void sendXmToYunPingtai ( List < SendXm > sendXmList , HttpHeaders headers ) {
//把查到的数据按次序更新或新增到北京
//把查到的数据按次序更新或新增到北京
sendXmList . forEach ( iteam - > {
sendXmList . forEach ( iteam - > {
iteam . setProjectDescription ( null ) ; //项目描述非必填项
List < String > list = Arrays . asList ( industry ) ;
String projectIndustry = iteam . getProjectIndustry ( ) ;
if ( ! list . contains ( projectIndustry ) ) {
iteam . setProjectIndustry ( "科研技术" ) ;
}
//0表示新增,要传到北京
//0表示新增,要传到北京
if ( iteam . getOperatetype ( ) = = 0 ) {
if ( iteam . getOperatetype ( ) = = 0 ) {
String name = iteam . getProjectNo ( ) + "*" + iteam . getProjectName ( ) ;
iteam . setProjectName ( name ) ;
iteam . setProjectNo ( null ) ;
iteam . setProjectNo ( null ) ;
//传到北京的接口
//传到北京的接口
// 组装请求体
// 组装请求体
@ -199,7 +218,19 @@ public class ProcessScheduled {
if ( iteam . getOperatetype ( ) = = 1 ) {
if ( iteam . getOperatetype ( ) = = 1 ) {
// 组装请求体
// 组装请求体
HashMap < String , String > getdata = otherMapper . selectScXMkp1_yptbh_ByPjid ( iteam . getProjectId ( ) ) ;
HashMap < String , String > getdata = otherMapper . selectScXMkp1_yptbh_ByPjid ( iteam . getProjectId ( ) ) ;
String yptbh = getdata . get ( "yptbh" ) . toString ( ) ; //云平台编号
String yptbh = getdata . get ( "yptbh" ) ;
if ( yptbh = = null ) {
log . info ( "更新失败,projectId是" + iteam . getProjectId ( ) + " id是" + iteam . getId ( ) ) ;
log . info ( "云平台编号为空" ) ;
//记录失败原因
LambdaUpdateWrapper < SendXm > sendXmLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendXmLambdaUpdateWrapper . eq ( SendXm : : getId , iteam . getId ( ) ) ;
sendXmLambdaUpdateWrapper . set ( SendXm : : getErrormessage , "云平台编号为空" ) ;
sendXmMapper . update ( null , sendXmLambdaUpdateWrapper ) ;
return ;
}
String name = iteam . getProjectNo ( ) + "*" + iteam . getProjectName ( ) ;
iteam . setProjectName ( name ) ;
iteam . setProjectNo ( yptbh ) ;
iteam . setProjectNo ( yptbh ) ;
HttpEntity < SendXm > request = new HttpEntity < > ( iteam , headers ) ;
HttpEntity < SendXm > request = new HttpEntity < > ( iteam , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( projectUrl , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( projectUrl , request , ResponseBeanForBeiJing . class ) ;
@ -227,7 +258,27 @@ public class ProcessScheduled {
@Transactional ( )
@Transactional ( )
public void sendHtToYunPingtai ( List < SendHt > sendHtList , HttpHeaders headers ) {
public void sendHtToYunPingtai ( List < SendHt > sendHtList , HttpHeaders headers ) {
sendHtList . forEach ( item - > {
sendHtList . forEach ( item - > {
String winningBidWay = item . getWinningBidWay ( ) ;
if ( "邀请招标" . equals ( winningBidWay ) ) {
item . setWinningBidWay ( "内部邀请" ) ;
}
//用项目id 查询项目金额
//用项目id 查询项目金额
HashMap < String , String > hashMap = new HashMap < > ( ) ;
String requestid = item . getRequestid ( ) ;
if ( item . getZxm ( ) ! = null ) {
LambdaUpdateWrapper < SendHt > sendHtLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendHtLambdaUpdateWrapper . eq ( SendHt : : getId , item . getId ( ) ) ; //更新条件
sendHtLambdaUpdateWrapper . set ( SendHt : : getErrormessage , "是子合同不做处理" ) ; //更新的值
sendHtMapper . update ( null , sendHtLambdaUpdateWrapper ) ;
return ;
}
String contraProcessnode05 = kpssProcessNode6IdInfo . getContraProcessnode05 ( ) ;
List < HashMap < String , String > > selectProcessNo5 = otherMapper . selectHtProcess ( requestid , contraProcessnode05 ) ;
if ( selectProcessNo5 . size ( ) = = 0 ) {
//未到审批节点,不忘北京发送
log . info ( item . getId ( ) + "未到审批节点,不忘北京发送" ) ;
return ;
}
String xmAmount = otherMapper . selectXmAmount ( item . getProjectId ( ) ) ;
String xmAmount = otherMapper . selectXmAmount ( item . getProjectId ( ) ) ;
Double contractAmount = item . getContractAmount ( ) ;
Double contractAmount = item . getContractAmount ( ) ;
Double amt = Double . valueOf ( xmAmount ) ;
Double amt = Double . valueOf ( xmAmount ) ;
@ -284,7 +335,16 @@ public class ProcessScheduled {
if ( "1" . equals ( item . getOperatetype ( ) ) ) {
if ( "1" . equals ( item . getOperatetype ( ) ) ) {
// 组装请求体
// 组装请求体
HashMap < String , String > getdata = otherMapper . selectScHTLC_yptbh_ByPjid ( item . getContractId ( ) ) ;
HashMap < String , String > getdata = otherMapper . selectScHTLC_yptbh_ByPjid ( item . getContractId ( ) ) ;
String yptbh = getdata . get ( "yptbh" ) . toString ( ) ; //云平台编号
if ( getdata = = null ) {
//记录失败原因
LambdaUpdateWrapper < SendHt > sendHtLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendHtLambdaUpdateWrapper . eq ( SendHt : : getId , item . getId ( ) ) ; //更新条件
sendHtLambdaUpdateWrapper . set ( SendHt : : getErrormessage , "云平台编号为空" ) ; //更新的值
sendHtMapper . update ( null , sendHtLambdaUpdateWrapper ) ;
return ;
}
String yptbh = getdata . get ( "yptbh" ) ; //云平台编号
item . setContractCode ( yptbh ) ;
item . setContractCode ( yptbh ) ;
HttpEntity < SendHt > request = new HttpEntity < > ( item , headers ) ;
HttpEntity < SendHt > request = new HttpEntity < > ( item , headers ) ;
log . info ( item . toString ( ) ) ;
log . info ( item . toString ( ) ) ;
@ -311,6 +371,30 @@ public class ProcessScheduled {
}
}
@Transactional ( )
@Transactional ( )
public void senKpxxToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
public void senKpxxToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
LambdaQueryWrapper < SendKpxx > sendKpxxLambdaQueryWrapper1 = new LambdaQueryWrapper < > ( ) ;
sendKpxxLambdaQueryWrapper1 . select ( SendKpxx : : getId , SendKpxx : : getRequestid ) ;
sendKpxxLambdaQueryWrapper1 . eq ( SendKpxx : : getRequestid , sendKpxx . getRequestid ( ) ) ;
sendKpxxLambdaQueryWrapper1 . eq ( SendKpxx : : getInterfaceType , "0" ) ;
sendKpxxLambdaQueryWrapper1 . isNotNull ( SendKpxx : : getStatus ) ;
sendKpxxLambdaQueryWrapper1 . ne ( SendKpxx : : getStatus , "3" ) ;
List < SendKpxx > sendKpxxes1 = sendKpxxMapper . selectList ( sendKpxxLambdaQueryWrapper1 ) ;
if ( sendKpxxes1 . size ( ) > 0 & & sendKpxx . getIsReturn ( ) = = 0 ) {
log . info ( "新增开票信息失败,已开票,projectId是" + sendKpxx . getProjectNo ( ) + " id是" + sendKpxx . getId ( ) ) ;
//记录错误信息
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , "错误信息:已开票" ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
return ;
}
if ( "信息技术咨询监理服务费" . equals ( sendKpxx . getInvoiceContent ( ) ) ) {
sendKpxx . setInvoiceContent ( "监理咨询服务费" ) ;
}
if ( StringUtils . isBlank ( sendKpxx . getPayerNumber ( ) ) ) {
sendKpxx . setPayerNumber ( "/" ) ;
}
sendKpxx . setReceiptScheduleName ( null ) ;
//新增
//新增
String [ ] evidenceIds = sendKpxx . getEvidenceId ( ) . split ( "," ) ; //获取文件id组
String [ ] evidenceIds = sendKpxx . getEvidenceId ( ) . split ( "," ) ; //获取文件id组
String evidenceid = sendfpfielUpdown ( headers , evidenceIds ) ; //上传文件信息
String evidenceid = sendfpfielUpdown ( headers , evidenceIds ) ; //上传文件信息
@ -345,13 +429,92 @@ public class ProcessScheduled {
}
}
}
}
}
}
if ( sendKpxx . getOperatetype ( ) = = 0 ) {
if ( sendKpxx . getOperatetype ( ) = = 0 | | sendKpxx . getOperatetype ( ) = = 1 ) {
if ( sendKpxx . getIsReturn ( ) = = 0 ) {
sendKpxx . setInvoiceNo ( null ) ;
sendKpxx . setInvoiceNo ( null ) ;
}
HashMap < String , String > hashMapScKpsqsp = otherMapper . selectScKpsqsp_yptbh_ByPjid ( sendKpxx . getRequestid ( ) ) ;
String fplx = hashMapScKpsqsp . get ( "fplx" ) ;
String fpzl = hashMapScKpsqsp . get ( "fpzl" ) ;
//发票种类如果是电子发票
if ( "2c9a59b680e0190f0181224a7a76045a" . equals ( fpzl ) ) {
sendKpxx . setInvoiceType ( "增值税电子普通发票" ) ;
}
if ( "2c9adae478fdbe15017906eca5710259" . equals ( fplx ) ) {
String dz = hashMapScKpsqsp . get ( "dz" ) ;
String dh = hashMapScKpsqsp . get ( "dh" ) ;
String zh = hashMapScKpsqsp . get ( "zh" ) ;
String khx = hashMapScKpsqsp . get ( "khx" ) ;
String specialInfo = "开户行:" + khx + " ,账号:" + zh + " ,地址及电话:" + dz + dh ;
sendKpxx . setSpecialInfo ( specialInfo ) ;
}
headers . setContentType ( MediaType . APPLICATION_JSON ) ;
headers . setContentType ( MediaType . APPLICATION_JSON ) ;
sendKpxx . setEvidenceId ( evidenceid ) ;
sendKpxx . setEvidenceId ( evidenceid ) ;
String xsfzr = "" ;
//退票要先删掉原来的到账信息
//退票要先删掉原来的到账信息
String projectid = sendKpxx . getProjectNo ( ) ; //项目编号,其他的是云平台编号
List < SendXm > sendXms = sendXmMapper . getscxmkp1ByProjectId ( projectid ) ;
if ( sendXms . size ( ) > 0 ) {
SendXm iteam = sendXms . get ( 0 ) ;
iteam . setProjectDescription ( null ) ; //项目描述非必填项
List < String > list = Arrays . asList ( industry ) ;
String projectIndustry = iteam . getProjectIndustry ( ) ;
if ( ! list . contains ( projectIndustry ) ) {
iteam . setProjectIndustry ( "科研技术" ) ;
}
HashMap < String , String > getdata = otherMapper . selectScXMkp1_yptbh_ByPjid ( iteam . getProjectId ( ) ) ;
String yptbh = getdata . get ( "yptbh" ) ;
sendKpxx . setProjectNo ( yptbh ) ;
if ( yptbh = = null ) {
log . info ( "开票申请更新项目西悉尼更新失败,projectId是" + iteam . getProjectId ( ) ) ;
log . info ( "云平台编号为空" ) ;
return ;
}
String name = iteam . getProjectNo ( ) + "*" + iteam . getProjectName ( ) ;
iteam . setProjectName ( name ) ;
iteam . setProjectNo ( yptbh ) ;
HttpEntity < SendXm > request = new HttpEntity < > ( iteam , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( projectUrl , request , ResponseBeanForBeiJing . class ) ;
if ( "200" . equals ( responseData . getCode ( ) ) ) {
xsfzr = iteam . getSalesLeaderCode ( ) ;
sendKpxx . setApplyUserCode ( xsfzr ) ;
log . info ( "开票申请更新项目西悉尼更新成功" ) ;
} else {
log . info ( responseData . getMessage ( ) . toString ( ) ) ;
}
}
if ( sendKpxx . getIsReturn ( ) = = 1 ) {
if ( sendKpxx . getIsReturn ( ) = = 1 ) {
deleteFpdzrq ( headers , sendKpxx ) ;
deleteFpdzrq ( headers , sendKpxx ) ;
if ( sendKpxx . getInvoiceNo ( ) = = null ) {
log . info ( "退票发票发票编号不能为空" ) ;
log . info ( "新增退票开票信息失败,projectId是" + sendKpxx . getProjectNo ( ) + " id是" + sendKpxx . getId ( ) ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , "退票发票发票编号不能为空" ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
}
headers . setContentType ( MediaType . APPLICATION_JSON ) ;
sendKpxx . setEvidenceId ( evidenceid ) ;
sendKpxx . setReturnInvoiceNo ( sendKpxx . getInvoiceNo ( ) ) ;
HttpEntity < SendKpxx > request = new HttpEntity < > ( sendKpxx , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( invoiceUrl , request , ResponseBeanForBeiJing . class ) ;
if ( "200" . equals ( responseData . getCode ( ) ) ) {
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , 1 ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
log . info ( "新增退票开票信息到云平台成功" ) ;
log . info ( responseData . toString ( ) ) ;
} else {
log . info ( "新增退票开票信息失败,projectId是" + sendKpxx . getProjectNo ( ) + " id是" + sendKpxx . getId ( ) ) ;
log . error ( "返回的信息是" + responseData . toString ( ) ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
}
return ;
}
}
HttpEntity < SendKpxx > request = new HttpEntity < > ( sendKpxx , headers ) ;
HttpEntity < SendKpxx > request = new HttpEntity < > ( sendKpxx , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( invoiceUrl , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( invoiceUrl , request , ResponseBeanForBeiJing . class ) ;
@ -363,7 +526,7 @@ public class ProcessScheduled {
paramMap . put ( "id" , sendKpxx . getRequestid ( ) ) ;
paramMap . put ( "id" , sendKpxx . getRequestid ( ) ) ;
otherMapper . updateScKpsqsp_yptbh_Byid ( paramMap ) ; //把返回的项目编号存入Sc_kssqsp
otherMapper . updateScKpsqsp_yptbh_Byid ( paramMap ) ; //把返回的项目编号存入Sc_kssqsp
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getI d , sendKpxx . getI d ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getRequesti d , sendKpxx . getRequesti d ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , 1 ) ; //更新的值
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , 1 ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
log . info ( "新增开票信息到云平台成功" ) ;
log . info ( "新增开票信息到云平台成功" ) ;
@ -380,67 +543,91 @@ public class ProcessScheduled {
log . error ( "返回的信息是" + responseData . toString ( ) ) ;
log . error ( "返回的信息是" + responseData . toString ( ) ) ;
//记录错误信息
//记录错误信息
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getI d , sendKpxx . getI d ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getRequesti d , sendKpxx . getRequesti d ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
}
}
}
}
//修改
// //修改
if ( sendKpxx . getOperatetype ( ) = = 1 ) {
// if (sendKpxx.getOperatetype()==1){
if ( sendKpxx . getInvoiceNo ( ) = = null ) {
// sendKpxx.setInvoiceNo(null);
log . info ( "修改发票发票编号不能为空" ) ;
// headers.setContentType(MediaType.APPLICATION_JSON);
}
// sendKpxx.setEvidenceId(evidenceid);
headers . setContentType ( MediaType . APPLICATION_JSON ) ;
// //退票要先删掉原来的到账信息
sendKpxx . setEvidenceId ( evidenceid ) ;
// if(sendKpxx.getIsReturn()==1){
HttpEntity < SendKpxx > request = new HttpEntity < > ( sendKpxx , headers ) ;
// deleteFpdzrq(headers,sendKpxx);
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( invoiceUrl , request , ResponseBeanForBeiJing . class ) ;
// }
if ( "200" . equals ( responseData . getCode ( ) ) ) {
// HttpEntity<SendKpxx> request = new HttpEntity<>(sendKpxx, headers);
// ResponseBeanForBeiJing responseData = restTemplate.postForObject(invoiceUrl,request, ResponseBeanForBeiJing.class);
// if ("200".equals(responseData.getCode())) {
// Map dataMap = (Map) responseData.getData();
// Map dataMap = (Map) responseData.getData();
// String invoiceNo = dataMap.get("invoiceNo").toString();
// String invoiceNo = dataMap.get("invoiceNo").toString();
// HashMap<String, String> paramMap = new HashMap<>();
// HashMap<String, String> paramMap = new HashMap<>();
// paramMap.put("yptbh", invoiceNo);
// paramMap.put("yptbh", invoiceNo);
// paramMap.put("id", sendKpxx.getRequestid());
// paramMap.put("id", sendKpxx.getRequestid());
// otherMapper.updateScKpsqsp_yptbh_Byid(paramMap);//把返回的项目编号存入Sc_kssqsp
// otherMapper.updateScKpsqsp_yptbh_Byid(paramMap);//把返回的项目编号存入Sc_kssqsp
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
// LambdaUpdateWrapper<SendKpxx> sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getRequestid, sendKpxx.getRequestid());//更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , 1 ) ; //更新的值
// sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, 1);//更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
// sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper);
log . info ( "新增开票信息到云平台成功" ) ;
// log.info("修改开票信息后新增开票信息到云平台成功");
log . info ( responseData . toString ( ) ) ;
// log.info(responseData.toString());
} else {
// //因为更新云平台编号,会导致多一个无用的更新数据,所以要删除
log . info ( "新增开票信息失败,projectId是" + sendKpxx . getProjectNo ( ) + " id是" + sendKpxx . getId ( ) ) ;
// //要删除他
log . error ( "返回的信息是" + responseData . toString ( ) ) ;
// sendKpxxLambdaUpdateWrapper.clear();
//记录错误信息
// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getRequestid,sendKpxx.getRequestid());
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getOperatetype,1);
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
// sendKpxxLambdaUpdateWrapper.isNull(SendKpxx::getStatus);
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
// sendKpxxMapper.delete(sendKpxxLambdaUpdateWrapper);
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
// } else {
}
// log.info("修改开票信息后新增开票信息失败,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId());
}
// log.error("修改开票信息后返回的信息是" + responseData.toString());
// //记录错误信息
// LambdaUpdateWrapper<SendKpxx> sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getRequestid, sendKpxx.getRequestid());//更新条件
// sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, responseData.getMessage().toString());//更新的值
// sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper);
//
// }
// }
}
}
@Transactional ( )
@Transactional ( )
public void sendKpqrToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
public void sendKpqrToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
String invoiceNo = sendKpxx . getInvoiceNo ( ) ;
String invoiceNo = sendKpxx . getInvoiceNo ( ) ;
if ( StringUtils . isBlank ( invoiceNo ) ) {
if ( StringUtils . isBlank ( invoiceNo ) ) {
//记录错误信息
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , "发票发票编号不能为空" ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
return ;
return ;
}
}
// MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
// params.add("invoiceNo",invoiceNo);
//HttpEntity<HashMap<String,String>> StringrequestEntity = ;
HttpEntity < Object > request = new HttpEntity < > ( null , headers ) ;
HttpEntity < Object > request = new HttpEntity < > ( null , headers ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
log . info ( "返回信息错误!" + beanForBeiJing . toString ( ) ) ;
//记录错误信息
log . info ( "返回信息错误!" + beanForBeiJing . getMessage ( ) . toString ( ) + sendKpxx . getId ( ) ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , beanForBeiJing . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
return ;
return ;
}
}
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
Integer status = ( Integer ) dataMap . get ( "status" ) ;
Integer status = ( Integer ) dataMap . get ( "status" ) ;
if ( status = = 4 ) {
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , "开票已确认" ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
log . info ( sendKpxx . getId ( ) + "开票已确认,不能进行开票确认" ) ;
return ;
}
if ( status ! = 2 ) {
if ( status ! = 2 ) {
log . info ( "开票申请未通过,不能进行开票确认" ) ;
log . info ( sendKpxx . getId ( ) + "开票申请未通过,不能进行开票确认" ) ;
return ;
return ;
}
}
//新增
//新增
@ -462,7 +649,7 @@ public class ProcessScheduled {
//记录失败信息
//记录失败信息
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
}
}
}
}
@ -475,27 +662,36 @@ public class ProcessScheduled {
public void sendKpqrsrToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
public void sendKpqrsrToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
HashMap < String , String > stringStringHashMap = otherMapper . selectScKpsqsp_yptbh_Byreqid ( sendKpxx . getWfrequest ( ) ) ;
HashMap < String , String > stringStringHashMap = otherMapper . selectScKpsqsp_yptbh_Byreqid ( sendKpxx . getWfrequest ( ) ) ;
if ( stringStringHashMap = = null ) {
if ( stringStringHashMap = = null ) {
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , "invoiceNo发票发票编号不能为空" ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
return ;
return ;
}
}
String invoiceNo = stringStringHashMap . get ( "yptbh" ) ;
String invoiceNo = stringStringHashMap . get ( "yptbh" ) ;
if ( StringUtils . isBlank ( invoiceNo ) ) {
// if(StringUtils.isBlank(invoiceNo)){
return ;
// LambdaUpdateWrapper<SendKpxx> sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
}
// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件
// sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "invoiceNo发票发票编号不能为空");//更新的值
// sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper);
// return;
// }
// MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
// params.add("invoiceNo",invoiceNo);
// HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(params, headers);
HttpEntity < Object > request = new HttpEntity < > ( null , headers ) ;
HttpEntity < Object > request = new HttpEntity < > ( null , headers ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
log . info ( "返回信息错误!" + beanForBeiJing . toString ( ) ) ;
log . info ( "返回信息错误!" + beanForBeiJing . getMessage ( ) . toString ( ) + sendKpxx . getId ( ) ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , beanForBeiJing . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
return ;
return ;
}
}
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
Integer status = ( Integer ) dataMap . get ( "status" ) ;
Integer status = ( Integer ) dataMap . get ( "status" ) ;
if ( status ! = 4 ) {
if ( status ! = 4 ) {
log . info ( "开票申请未通过,不能进行开票确认" ) ;
log . info ( sendKpxx . getId ( ) + "开票申请未通过,不能进行开票确认" ) ;
return ;
return ;
}
}
//新增
//新增
@ -524,12 +720,12 @@ public class ProcessScheduled {
//记录失败信息
//记录失败信息
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
}
}
}
}
//修改
//修改
if ( sendKpxx . getOperatetype ( ) = = 1 ) {
else if ( sendKpxx . getOperatetype ( ) = = 1 ) {
invoiceNo = otherMapper . selectScKpsqsp_yptbh_Byreqid ( sendKpxx . getWfrequest ( ) ) . get ( "yptbh" ) ;
invoiceNo = otherMapper . selectScKpsqsp_yptbh_Byreqid ( sendKpxx . getWfrequest ( ) ) . get ( "yptbh" ) ;
sendKpxx . setInvoiceNo ( invoiceNo ) ;
sendKpxx . setInvoiceNo ( invoiceNo ) ;
sendKpxx . setOpFlag ( 1 ) ;
sendKpxx . setOpFlag ( 1 ) ;
@ -564,33 +760,70 @@ public class ProcessScheduled {
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
} else if ( sendKpxx . getOperatetype ( ) = = 2 ) {
invoiceNo = otherMapper . selectScKpsqsp_yptbh_Byreqid ( sendKpxx . getWfrequest ( ) ) . get ( "yptbh" ) ;
sendKpxx . setInvoiceNo ( invoiceNo ) ;
sendKpxx . setOpFlag ( 1 ) ;
String incomeId = otherMapper . selectScKpcwqrsr_incomeId_Bylcid ( sendKpxx . getWfrequest ( ) ) . get ( "incomeId" ) ;
sendKpxx . setIncomeId ( incomeId ) ;
HttpEntity < SendKpxx > request1 = new HttpEntity < > ( sendKpxx , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( incomeUrl , request1 , ResponseBeanForBeiJing . class ) ;
//删除成功后在新增
if ( "200" . equals ( responseData . getCode ( ) ) ) {
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , 1 ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
log . info ( "删除后新增开票确认收入" ) ;
log . info ( responseData . toString ( ) ) ;
} else {
log . info ( "删除开票确认收入失败,projectId是" + sendKpxx . getProjectNo ( ) + " id是" + sendKpxx . getId ( ) ) ;
log . info ( "返回的信息是" + responseData . toString ( ) ) ;
//记录失败信息
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
}
}
}
}
}
@Transactional ( )
@Transactional ( )
public void sendKpqrdzToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
public void sendKpqrdzToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
HashMap < String , String > stringStringHashMap = otherMapper . selectScKpsqsp_yptbh_ByPjid ( sendKpxx . getRequestid ( ) ) ;
HashMap < String , String > stringStringHashMap = otherMapper . selectScKpsqsp_yptbh_ByPjid ( sendKpxx . getRequestid ( ) ) ;
if ( sendKpxx . getOpUserCode ( ) = = null ) {
sendKpxx . setOpUserCode ( sendKpxx . getApplyUserCode ( ) ) ;
sendKpxx . setOpUserCode ( sendKpxx . getApplyUserCode ( ) ) ;
if ( stringStringHashMap = = null ) {
return ;
}
}
String invoiceNo = stringStringHashMap . get ( "yptbh" ) ;
if ( stringStringHashMap . get ( "yptbh" ) = = null ) {
if ( StringUtils . isBlank ( invoiceNo ) ) {
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , "invoiceNo发票发票编号不能为空" ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
return ;
return ;
}
}
// MultiValueMap<String, String> par ams = new LinkedMultiValueMap<>();
String invoiceNo = stringStringHashMap . get ( "yptbh" ) ;
// params.add("invoiceNo",invoiceNo);
// if(StringUtils.isBlank(invoiceNo)){
// HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(params, headers);
// LambdaUpdateWrapper<SendKpxx> sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件
// sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "invoiceNo发票发票编号不能为空");//更新的值
// sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper);
// return;
// }
HttpEntity < Object > request = new HttpEntity < > ( null , headers ) ;
HttpEntity < Object > request = new HttpEntity < > ( null , headers ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
log . info ( "返回信息错误!" + beanForBeiJing . toString ( ) ) ;
log . info ( "返回信息错误!" + beanForBeiJing . getMessage ( ) . toString ( ) + sendKpxx . getId ( ) ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , beanForBeiJing . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
return ;
return ;
}
}
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
Integer status = ( Integer ) dataMap . get ( "status" ) ;
Integer status = ( Integer ) dataMap . get ( "status" ) ;
if ( status ! = 4 ) {
if ( status ! = 4 ) {
log . info ( "开票申请未确认,不能进行开票确认" ) ;
log . info ( sendKpxx . getId ( ) + "开票申请未确认,不能进行开票确认" ) ;
return ;
return ;
}
}
//新增
//新增
@ -619,7 +852,7 @@ public class ProcessScheduled {
log . info ( "返回的信息是" + responseData . toString ( ) ) ;
log . info ( "返回的信息是" + responseData . toString ( ) ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
}
}
}
}
@ -656,7 +889,7 @@ public class ProcessScheduled {
}
}
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getStatus , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
}
}
@ -666,15 +899,15 @@ public class ProcessScheduled {
List < SendKpxx > sendKpxxToYPTList = sendKpxxMapper . querySendToYPT ( ) ;
List < SendKpxx > sendKpxxToYPTList = sendKpxxMapper . querySendToYPT ( ) ;
sendKpxxToYPTList . forEach ( item - > {
sendKpxxToYPTList . forEach ( item - > {
String invoiceNo = item . getInvoiceNo ( ) ;
String invoiceNo = item . getInvoiceNo ( ) ;
// MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
// params.add("invoiceNo",invoiceNo);
// HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(params, headers);
HttpEntity < Object > request = new HttpEntity < > ( null , headers ) ;
HttpEntity < Object > request = new HttpEntity < > ( null , headers ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
log . info ( "返回信息错误!" + beanForBeiJing . toString ( ) ) ;
log . info ( "返回信息错误!" + beanForBeiJing . getMessage ( ) . toString ( ) + item . getId ( ) ) ;
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , item . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , beanForBeiJing . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
return ;
return ;
}
}
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
@ -867,20 +1100,26 @@ public class ProcessScheduled {
} ) ;
} ) ;
}
}
//发送发票文件
//发送发票文件
private String sendfpfielUpdown ( HttpHeaders headers , String [ ] evidenceIds ) {
public String sendfpfielUpdown ( HttpHeaders headers , String [ ] evidenceIds ) {
String evidenceid = "" ;
String evidenceid = "" ;
for ( String id : evidenceIds ) {
for ( String id : evidenceIds ) {
//查询
//查询
HashMap < String , String > fileMap = otherMapper . selectFileById ( id ) ;
HashMap < String , String > fileMap = otherMapper . selectFileById ( id ) ;
String filePath = fileMap . get ( "filepath" ) ;
String filePath = fileMap . get ( "filepath" ) ;
String filetype = fileMap . get ( "filetype" ) ;
String originalName = fileMap . get ( "originalName" ) ;
//String filePath = "E:\\adad.txt";
filePath = fileDownPre + filePath ;
filePath = fileDownPre + filePath ;
File file = new File ( filePath ) ;
File file1 = new File ( filePath ) ;
//文件不存在 创建文件夹
if ( ! file1 . exists ( ) ) {
file1 . mkdirs ( ) ;
}
String newfilepath = filePath + File . separator + originalName ;
downloadFileFromSshServer ( filePath , newfilepath ) ;
File file = new File ( newfilepath ) ;
if ( file . exists ( ) ) {
if ( file . exists ( ) ) {
headers . setContentType ( MediaType . MULTIPART_FORM_DATA ) ;
headers . setContentType ( MediaType . MULTIPART_FORM_DATA ) ;
MultiValueMap < String , Object > body = new LinkedMultiValueMap < > ( ) ;
MultiValueMap < String , Object > body = new LinkedMultiValueMap < > ( ) ;
body . add ( "file" , new FileSystemResource ( new File ( filePath ) ) ) ;
body . add ( "file" , new FileSystemResource ( new File ( newfilep ath) ) ) ;
HttpEntity < MultiValueMap < String , Object > > request = new HttpEntity < > ( body , headers ) ;
HttpEntity < MultiValueMap < String , Object > > request = new HttpEntity < > ( body , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( uploadFileUrl , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( uploadFileUrl , request , ResponseBeanForBeiJing . class ) ;
//文件处理
//文件处理
@ -905,6 +1144,7 @@ public class ProcessScheduled {
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
log . info ( "合同取消到北京云平台失败返回信息错误!" + beanForBeiJing . toString ( ) ) ;
log . info ( "合同取消到北京云平台失败返回信息错误!" + beanForBeiJing . toString ( ) ) ;
return ;
return ;
}
}
if ( "200" . equals ( beanForBeiJing . getCode ( ) ) & & ( Boolean ) beanForBeiJing . getData ( ) = = true ) {
if ( "200" . equals ( beanForBeiJing . getCode ( ) ) & & ( Boolean ) beanForBeiJing . getData ( ) = = true ) {
@ -924,12 +1164,7 @@ public class ProcessScheduled {
sendKpxx . setOpUserCode ( sendKpxx . getApplyUserCode ( ) ) ;
sendKpxx . setOpUserCode ( sendKpxx . getApplyUserCode ( ) ) ;
Double invoiceAmount = sendKpxx . getInvoiceAmount ( ) ;
Double invoiceAmount = sendKpxx . getInvoiceAmount ( ) ;
LambdaQueryWrapper < ScKpsqsp > scKpsqspLambdaQueryWrapper = new LambdaQueryWrapper < > ( ) ;
LambdaQueryWrapper < ScKpsqsp > scKpsqspLambdaQueryWrapper = new LambdaQueryWrapper < > ( ) ;
scKpsqspLambdaQueryWrapper . eq ( ScKpsqsp : : getId , requestid ) ;
scKpsqspLambdaQueryWrapper . eq ( ScKpsqsp : : getId , sendKpxx . getYkpid ( ) ) ;
List < ScKpsqsp > queryxxmclist = scKpsqspMapper . selectList ( scKpsqspLambdaQueryWrapper ) ;
String xmmc = queryxxmclist . get ( 0 ) . getXmmc ( ) ;
scKpsqspLambdaQueryWrapper . clear ( ) ;
scKpsqspLambdaQueryWrapper . eq ( ScKpsqsp : : getXmmc , xmmc ) ;
scKpsqspLambdaQueryWrapper . eq ( ScKpsqsp : : getKpje , invoiceAmount ) ;
List < ScKpsqsp > scKpsqspList = scKpsqspMapper . selectList ( scKpsqspLambdaQueryWrapper ) ;
List < ScKpsqsp > scKpsqspList = scKpsqspMapper . selectList ( scKpsqspLambdaQueryWrapper ) ;
if ( scKpsqspList . size ( ) > 0 ) {
if ( scKpsqspList . size ( ) > 0 ) {
ScKpsqsp scKpsqsp = scKpsqspList . get ( 0 ) ;
ScKpsqsp scKpsqsp = scKpsqspList . get ( 0 ) ;
@ -941,9 +1176,41 @@ public class ProcessScheduled {
if ( "200" . equals ( responseData . getCode ( ) ) ) {
if ( "200" . equals ( responseData . getCode ( ) ) ) {
return true ;
return true ;
}
}
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
sendKpxxLambdaUpdateWrapper . set ( SendKpxx : : getErrormessage , responseData . getMessage ( ) . toString ( ) ) ; //更新的值
sendKpxxMapper . update ( null , sendKpxxLambdaUpdateWrapper ) ;
log . info ( "删除到账信息失败" + responseData . toString ( ) ) ;
log . info ( "删除到账信息失败" + responseData . toString ( ) ) ;
}
}
return false ;
return false ;
}
}
public void downloadFileFromSshServer ( String remoteFilePath , String localFilePath ) {
String host = "116.62.210.190" ;
String username = "root" ;
String password = "Guoyan83086775" ;
int port = 22 ;
JSch jsch = new JSch ( ) ;
Session session = null ;
try {
session = jsch . getSession ( username , host , port ) ;
session . setConfig ( "StrictHostKeyChecking" , "no" ) ;
session . setPassword ( password ) ;
session . connect ( ) ;
ChannelSftp channelSftp = ( ChannelSftp ) session . openChannel ( "sftp" ) ;
channelSftp . connect ( ) ;
channelSftp . get ( remoteFilePath , new FileOutputStream ( localFilePath ) ) ;
channelSftp . exit ( ) ;
session . disconnect ( ) ;
} catch ( Exception e ) {
if ( session ! = null & & session . isConnected ( ) ) {
session . disconnect ( ) ;
}
System . out . println ( "文件获取失败:" + e . getMessage ( ) ) ;
}
}
}
}