@ -1,11 +1,14 @@
package com.example.guoyan.scheduled ;
import com.baomidou.mybatisplus.core.conditions.Wrapper ;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
import com.example.guoyan.entity.* ;
import com.example.guoyan.mapper.* ;
import com.example.guoyan.response.ResponseBeanForBeiJing ;
import lombok.extern.slf4j.Slf4j ;
import org.apache.commons.lang3.StringUtils ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Value ;
import org.springframework.core.io.FileSystemResource ;
@ -19,10 +22,12 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource ;
import java.io.File ;
import java.text.SimpleDateFormat ;
import java.time.Duration ;
import java.time.LocalDate ;
import java.time.format.DateTimeFormatter ;
import java.util.* ;
import java.util.spi.CalendarDataProvider ;
@Component
@Slf4j
@ -72,8 +77,12 @@ public class ProcessScheduled {
private String uploadFileUrl ;
@Value ( "${ypt.incomeUrl}" )
private String incomeUrl ;
@Value ( "${ypt.accountUrl}" )
private String accountUrl ;
@Value ( "${ypt.InvoicingApprovalStatusUrl}" )
private String InvoicingApprovalStatusUrl ;
@Value ( "${ypt.cancelPrjetcUrl}" )
private String cancelPrjetcUrl ;
@Autowired
private KpssProcessNode6IdInfo kpssProcessNode6IdInfo ;
/ * *
@ -266,35 +275,13 @@ public class ProcessScheduled {
@Transactional ( )
public void senKpxxToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
//新增
String [ ] evidenceIds = sendKpxx . getEvidenceId ( ) . split ( "," ) ; //获取文件id组
String evidenceid = sendfpfielUpdown ( headers , evidenceIds ) ; //上传文件信息
if ( evidenceid . length ( ) > 0 ) {
evidenceid = evidenceid . substring ( 0 , evidenceid . length ( ) - 1 ) ;
}
if ( sendKpxx . getOperatetype ( ) = = 0 ) {
sendKpxx . setInvoiceNo ( null ) ;
String [ ] evidenceIds = sendKpxx . getEvidenceId ( ) . split ( "," ) ; //获取文件id组
String evidenceid = "" ;
for ( String id : evidenceIds ) {
//查询
HashMap < String , String > fileMap = otherMapper . selectFileById ( id ) ;
//String filePath = fileMap.get("filepath");
String filetype = fileMap . get ( "filetype" ) ;
String filePath = "E:\\adad.txt" ;
//filePath =fileDownPre+filePath;
File file = new File ( filePath ) ;
if ( file . exists ( ) ) {
headers . setContentType ( MediaType . MULTIPART_FORM_DATA ) ;
MultiValueMap < String , Object > body = new LinkedMultiValueMap < > ( ) ;
body . add ( "file" , new FileSystemResource ( new File ( filePath ) ) ) ;
HttpEntity < MultiValueMap < String , Object > > request = new HttpEntity < > ( body , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( uploadFileUrl , request , ResponseBeanForBeiJing . class ) ;
//文件处理
String dataString = responseData . getData ( ) . toString ( ) ;
evidenceid = evidenceid + dataString + "," ;
} else {
log . info ( "文件不存在,文件位置" + filePath ) ;
}
}
if ( evidenceid . length ( ) > 0 ) {
evidenceid = evidenceid . substring ( 0 , evidenceid . length ( ) - 1 ) ;
}
headers . setContentType ( MediaType . APPLICATION_JSON ) ;
sendKpxx . setEvidenceId ( evidenceid ) ;
HttpEntity < SendKpxx > request = new HttpEntity < > ( sendKpxx , headers ) ;
@ -317,18 +304,47 @@ public class ProcessScheduled {
log . error ( "返回的信息是" + responseData . toString ( ) ) ;
}
}
//修改 暂无修改
//修改
if ( sendKpxx . getOperatetype ( ) = = 1 ) {
if ( sendKpxx . getInvoiceNo ( ) = = null ) {
log . info ( "修改发票发票编号不能为空" ) ;
}
headers . setContentType ( MediaType . APPLICATION_JSON ) ;
sendKpxx . setEvidenceId ( evidenceid ) ;
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();
// String invoiceNo = dataMap.get("invoiceNo").toString();
// HashMap<String, String> paramMap = new HashMap<>();
// paramMap.put("yptbh", invoiceNo);
// paramMap.put("id", sendKpxx.getRequestid());
// otherMapper.updateScKpsqsp_yptbh_Byid(paramMap);//把返回的项目编号存入Sc_kssqsp
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 ( ) ) ;
}
}
}
@Transactional ( )
public void sendKpqrToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
String invoiceNo = sendKpxx . getInvoiceNo ( ) ;
HashMap < String , String > hashMap = new HashMap < > ( ) ;
hashMap . put ( "invoiceNo" , invoiceNo ) ;
HttpEntity < HashMap < String , String > > requestEntity = new HttpEntity < > ( hashMap , headers ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl , HttpMethod . GET , requestEntity , ResponseBeanForBeiJing . class ) ;
if ( StringUtils . isBlank ( invoiceNo ) ) {
return ;
}
// MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
// params.add("invoiceNo",invoiceNo);
//HttpEntity<HashMap<String,String>> StringrequestEntity = ;
HttpEntity < Object > request = new HttpEntity < > ( null , headers ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
log . info ( "返回信息错误!" + beanForBeiJing . toString ( ) ) ;
@ -336,7 +352,7 @@ public class ProcessScheduled {
}
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
Integer status = ( Integer ) dataMap . get ( "status" ) ;
if ( status ! = 4 ) {
if ( status ! = 2 ) {
log . info ( "开票申请未通过,不能进行开票确认" ) ;
return ;
}
@ -344,8 +360,8 @@ public class ProcessScheduled {
if ( sendKpxx . getOperatetype ( ) = = 0 ) {
invoiceNo = otherMapper . selectScKpsqsp_yptbh_ByPjid ( sendKpxx . getRequestid ( ) ) . get ( "yptbh" ) ;
sendKpxx . setInvoiceNo ( invoiceNo ) ;
HttpEntity < SendKpxx > request = new HttpEntity < > ( sendKpxx , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( confirmUrl , request , ResponseBeanForBeiJing . class ) ;
HttpEntity < SendKpxx > request1 = new HttpEntity < > ( sendKpxx , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( confirmUrl , request1 , ResponseBeanForBeiJing . class ) ;
if ( "200" . equals ( responseData . getCode ( ) ) ) {
LambdaUpdateWrapper < SendKpxx > sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
sendKpxxLambdaUpdateWrapper . eq ( SendKpxx : : getId , sendKpxx . getId ( ) ) ; //更新条件
@ -365,13 +381,26 @@ public class ProcessScheduled {
}
@Transactional ( )
public void sendKpqrsrToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
String invoiceNo = sendKpxx . getInvoiceNo ( ) ;
ResponseBeanForBeiJing responseData = restTemplate . getForObject ( InvoicingApprovalStatusUrl , ResponseBeanForBeiJing . class , headers , invoiceNo ) ;
if ( ! "200" . equals ( responseData . getCode ( ) ) ) {
log . info ( "返回信息错误!" + responseData . toString ( ) ) ;
HashMap < String , String > stringStringHashMap = otherMapper . selectScKpsqsp_yptbh_Byreqid ( sendKpxx . getWfrequest ( ) ) ;
if ( stringStringHashMap = = null ) {
return ;
}
String invoiceNo = stringStringHashMap . get ( "yptbh" ) ;
if ( StringUtils . isBlank ( invoiceNo ) ) {
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 ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
log . info ( "返回信息错误!" + beanForBeiJing . toString ( ) ) ;
return ;
}
Map dataMap = ( Map ) responseData . getData ( ) ;
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
Integer status = ( Integer ) dataMap . get ( "status" ) ;
if ( status ! = 4 ) {
log . info ( "开票申请未通过,不能进行开票确认" ) ;
@ -381,10 +410,9 @@ public class ProcessScheduled {
if ( sendKpxx . getOperatetype ( ) = = 0 ) {
invoiceNo = otherMapper . selectScKpsqsp_yptbh_Byreqid ( sendKpxx . getWfrequest ( ) ) . get ( "yptbh" ) ;
sendKpxx . setInvoiceNo ( invoiceNo ) ;
sendKpxx . setOpUserCode ( sendKpxx . getIncomeUserCode ( ) ) ; //操作员工编码
sendKpxx . setOpFlag ( 0 ) ;
HttpEntity < SendKpxx > request = new HttpEntity < > ( sendKpxx , headers ) ;
responseData = restTemplate . postForObject ( incomeUrl , request , ResponseBeanForBeiJing . class ) ;
HttpEntity < SendKpxx > request1 = new HttpEntity < > ( sendKpxx , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( incomeUrl , request1 , ResponseBeanForBeiJing . class ) ;
if ( "200" . equals ( responseData . getCode ( ) ) ) {
dataMap = ( Map ) responseData . getData ( ) ;
String incomeId = dataMap . get ( "incomeId" ) . toString ( ) ;
@ -405,20 +433,19 @@ public class ProcessScheduled {
}
//修改
if ( sendKpxx . getOperatetype ( ) = = 1 ) {
invoiceNo = otherMapper . selectScKpsqsp_yptbh_ByPj id ( sendKpxx . getRequestid ( ) ) . get ( "yptbh" ) ;
invoiceNo = otherMapper . selectScKpsqsp_yptbh_Byreq id ( sendKpxx . getWfrequest ( ) ) . get ( "yptbh" ) ;
sendKpxx . setInvoiceNo ( invoiceNo ) ;
sendKpxx . setOpUserCode ( sendKpxx . getIncomeUserCode ( ) ) ; //操作员工编码
sendKpxx . setOpFlag ( 1 ) ;
String incomeId = otherMapper . selectScKpcwqrsr_incomeId_Bylcid ( sendKpxx . getWfrequest ( ) ) . get ( "incomeId" ) ;
sendKpxx . setIncomeId ( incomeId ) ;
HttpEntity < SendKpxx > request = new HttpEntity < > ( sendKpxx , headers ) ;
responseData = restTemplate . postForObject ( incomeUrl , request , ResponseBeanForBeiJing . class ) ;
HttpEntity < SendKpxx > request1 = new HttpEntity < > ( sendKpxx , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( incomeUrl , request1 , ResponseBeanForBeiJing . class ) ;
//删除成功后在新增
if ( "200" . equals ( responseData . getCode ( ) ) ) {
sendKpxx . setOpFlag ( 0 ) ;
sendKpxx . setIncomeId ( null ) ;
HttpEntity < SendKpxx > request1 = new HttpEntity < > ( sendKpxx , headers ) ;
responseData = restTemplate . postForObject ( incomeUrl , request , ResponseBeanForBeiJing . class ) ;
HttpEntity < SendKpxx > request2 = new HttpEntity < > ( sendKpxx , headers ) ;
responseData = restTemplate . postForObject ( incomeUrl , request2 , ResponseBeanForBeiJing . class ) ;
if ( "200" . equals ( responseData . getCode ( ) ) ) {
dataMap = ( Map ) responseData . getData ( ) ;
incomeId = dataMap . get ( "incomeId" ) . toString ( ) ;
@ -439,26 +466,37 @@ public class ProcessScheduled {
}
@Transactional ( )
public void sendKpqrdzToYunPingtai ( SendKpxx sendKpxx , HttpHeaders headers ) {
String invoiceNo = sendKpxx . getInvoiceNo ( ) ;
ResponseBeanForBeiJing responseData = restTemplate . getForObject ( InvoicingApprovalStatusUrl , ResponseBeanForBeiJing . class , headers , invoiceNo ) ;
if ( ! "200" . equals ( responseData . getCode ( ) ) ) {
log . info ( "返回信息错误!" + responseData . toString ( ) ) ;
HashMap < String , String > stringStringHashMap = otherMapper . selectScKpsqsp_yptbh_Byreqid ( sendKpxx . getWfrequest ( ) ) ;
if ( stringStringHashMap = = null ) {
return ;
}
String invoiceNo = stringStringHashMap . get ( "yptbh" ) ;
if ( StringUtils . isBlank ( invoiceNo ) ) {
return ;
}
// MultiValueMap<String, String> par ams = new LinkedMultiValueMap<>();
// params.add("invoiceNo",invoiceNo);
// HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(params, headers);
HttpEntity < Object > request = new HttpEntity < > ( null , headers ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
log . info ( "返回信息错误!" + beanForBeiJing . toString ( ) ) ;
return ;
}
Map dataMap = ( Map ) responseData . getData ( ) ;
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
Integer status = ( Integer ) dataMap . get ( "status" ) ;
if ( status ! = 4 ) {
log . info ( "开票申请未通过,不能进行开票确认" ) ;
log . info ( "开票申请未确认 ,不能进行开票确认" ) ;
return ;
}
//新增
if ( sendKpxx . getOperatetype ( ) = = 0 ) {
invoiceNo = otherMapper . selectScKpsqsp_yptbh_ByPjid ( sendKpxx . getRequestid ( ) ) . get ( "yptbh" ) ;
sendKpxx . setInvoiceNo ( invoiceNo ) ;
sendKpxx . setOpUserCode ( sendKpxx . getIncomeUserCode ( ) ) ; //操作员工编码
sendKpxx . setOpFlag ( 0 ) ;
HttpEntity < SendKpxx > request = new HttpEntity < > ( sendKpxx , headers ) ;
responseData = restTemplate . postForObject ( incomeUrl , request , ResponseBeanForBeiJing . class ) ;
HttpEntity < SendKpxx > request1 = new HttpEntity < > ( sendKpxx , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( accountUrl , request1 , ResponseBeanForBeiJing . class ) ;
if ( "200" . equals ( responseData . getCode ( ) ) ) {
dataMap = ( Map ) responseData . getData ( ) ;
String incomeId = dataMap . get ( "accountId" ) . toString ( ) ;
@ -481,18 +519,17 @@ public class ProcessScheduled {
if ( sendKpxx . getOperatetype ( ) = = 1 ) {
invoiceNo = otherMapper . selectScKpsqsp_yptbh_ByPjid ( sendKpxx . getRequestid ( ) ) . get ( "yptbh" ) ;
sendKpxx . setInvoiceNo ( invoiceNo ) ;
sendKpxx . setOpUserCode ( sendKpxx . getIncomeUserCode ( ) ) ; //操作员工编码
sendKpxx . setOpFlag ( 1 ) ;
String accountId = otherMapper . selectScKpcwqrsr_accountId_Bylcid ( sendKpxx . getRequestid ( ) ) . get ( "accountId" ) ;
sendKpxx . setAccountId ( accountId ) ;
HttpEntity < SendKpxx > request = new HttpEntity < > ( sendKpxx , headers ) ;
responseData = restTemplate . postForObject ( income Url, request , ResponseBeanForBeiJing . class ) ;
HttpEntity < SendKpxx > request2 = new HttpEntity < > ( sendKpxx , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( account Url, request2 , ResponseBeanForBeiJing . class ) ;
//删除成功后在新增
if ( "200" . equals ( responseData . getCode ( ) ) ) {
sendKpxx . setOpFlag ( 0 ) ;
sendKpxx . setAccountId ( null ) ;
HttpEntity < SendKpxx > request1 = new HttpEntity < > ( sendKpxx , headers ) ;
responseData = restTemplate . postForObject ( income Url, request , ResponseBeanForBeiJing . class ) ;
responseData = restTemplate . postForObject ( account Url, request , ResponseBeanForBeiJing . class ) ;
if ( "200" . equals ( responseData . getCode ( ) ) ) {
dataMap = ( Map ) responseData . getData ( ) ;
accountId = dataMap . get ( "accountId" ) . toString ( ) ;
@ -516,15 +553,20 @@ public class ProcessScheduled {
List < SendKpxx > sendKpxxToYPTList = sendKpxxMapper . querySendToYPT ( ) ;
sendKpxxToYPTList . forEach ( item - > {
String invoiceNo = item . getInvoiceNo ( ) ;
HttpEntity < String > requestEntity = new HttpEntity < > ( invoiceNo , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . getForObject ( InvoicingApprovalStatusUrl , ResponseBeanForBeiJing . class , invoiceNo , headers ) ;
if ( ! "200" . equals ( responseData . getCode ( ) ) ) {
log . info ( "返回信息错误!" + responseData . toString ( ) ) ;
// 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 ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( InvoicingApprovalStatusUrl + "/" + invoiceNo , HttpMethod . GET , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
log . info ( "返回信息错误!" + beanForBeiJing . toString ( ) ) ;
return ;
}
Map dataMap = ( Map ) responseData . getData ( ) ;
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
Integer status = ( Integer ) dataMap . get ( "status" ) ;
if ( status = = 4 ) {
if ( status = = 2 | | status = = 4 ) {
//已确认
//更新这边的流程
String processId = sendKpxxMapper . selectProcessId ( item . getRequestid ( ) ) ;
@ -532,8 +574,8 @@ public class ProcessScheduled {
requestlog . setRequestid ( processId ) ;
requestlog . setStaffid ( kpssProcessNode6IdInfo . getCurrentStaffid ( ) ) ;
requestlog . setIsedit ( 1 ) ;
DateTimeFormatter dateTimeFormatter = DateTimeFormatter . ofPattern ( "yyyy-MM-dd HH:mm:ss" ) ;
requestlog . setCreatedate ( LocalDate . now ( ) . format ( dateTimeFormatter ) ) ;
SimpleDateFormat dateFormat = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ;
requestlog . setCreatedate ( dateFormat . format ( new Date ( ) ) ) ;
requestlog . setStepid ( kpssProcessNode6IdInfo . getCurrentStepid ( ) ) ;
requestlog . setNtype ( 1 ) ;
requestlog . setInfo ( "北京同意" ) ;
@ -555,7 +597,7 @@ public class ProcessScheduled {
permissionrulegroup . setStmp ( "2c9adae478fdbe15017906f93ec90266" ) ;
permissionrulegroup . setDsporder ( 0 ) ;
permissionrulegroup . setLayoutedit ( "2c9a59b681805f1301818a7047300091" ) ;
permissionrulegroup . setAdddate ( LocalDate . now ( ) . format ( dateTimeFormatter ) ) ;
permissionrulegroup . setAdddate ( dateFormat . format ( new Date ( ) ) ) ;
permissionrulegroup . setAllowstaffids ( kpssProcessNode6IdInfo . getNextAllowStaffids ( ) ) ;
permissionrulegroup . setMatrixtype ( 0 ) ;
permissionrulegroupMapper . insert ( permissionrulegroup ) ;
@ -566,13 +608,18 @@ public class ProcessScheduled {
readlog . setStaffid ( kpssProcessNode6IdInfo . getCurrentStaffid ( ) ) ;
readlog . setReadnum ( "1" ) ;
readlog . setResid ( "2c9adae478fdbe15017906f73e8a0261" ) ;
readlog . setLastaccessdate ( LocalDate . now ( ) . format ( dateTimeFormatter ) ) ;
readlog . setAdddate ( LocalDate . now ( ) . format ( dateTimeFormatter ) ) ;
readlog . setLastaccessdate ( dateFormat . format ( new Date ( ) ) ) ;
readlog . setAdddate ( dateFormat . format ( new Date ( ) ) ) ;
readlogMapper . insert ( readlog ) ;
log . info ( "readlog1111新增成功:" + readlog . toString ( ) ) ;
readlog . setId ( UUID . randomUUID ( ) . toString ( ) . replace ( "-" , "" ) ) ;
readlog . setStepid ( kpssProcessNode6IdInfo . getNextStepid ( ) ) ;
readlog . setAdddate ( LocalDate . now ( ) . plus ( Duration . ofSeconds ( 10 ) ) . format ( dateTimeFormatter ) ) ; //加10
readlog . setLastaccessdate ( LocalDate . now ( ) . plus ( Duration . ofSeconds ( 10 ) ) . format ( dateTimeFormatter ) ) ;
Calendar calendar = Calendar . getInstance ( ) ;
calendar . setTime ( new Date ( ) ) ;
calendar . add ( Calendar . SECOND , 10 ) ;
Date time = calendar . getTime ( ) ;
readlog . setAdddate ( dateFormat . format ( time ) ) ; //加10
readlog . setLastaccessdate ( dateFormat . format ( time ) ) ;
readlogMapper . insert ( readlog ) ;
log . info ( "readlog22222新增成功:" + readlog . toString ( ) ) ;
Requestoperator requestoperator = new Requestoperator ( ) ;
@ -584,7 +631,7 @@ public class ProcessScheduled {
LambdaUpdateWrapper < Requestoperator > requestoperatorLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
requestoperatorLambdaUpdateWrapper . set ( Requestoperator : : getIssubmit , 1 ) ;
requestoperatorLambdaUpdateWrapper . set ( Requestoperator : : getSubmitdate , LocalDate . now ( ) . format ( dateTimeFormatter ) ) ;
requestoperatorLambdaUpdateWrapper . set ( Requestoperator : : getSubmitdate , dateFormat . format ( new Date ( ) ) ) ;
requestoperatorLambdaUpdateWrapper . eq ( Requestoperator : : getId , requestoperatorId ) ;
requestoperatorMapper . update ( null , requestoperatorLambdaUpdateWrapper ) ;
log . info ( "requestoperatorLambdaUpdateWrapper成功:" + requestoperatorLambdaUpdateWrapper . toString ( ) ) ;
@ -594,7 +641,7 @@ public class ProcessScheduled {
requestoperator . setStepoperid ( kpssProcessNode6IdInfo . getNextStepOperid ( ) ) ;
requestoperator . setStaffid ( kpssProcessNode6IdInfo . getNextAllowStaffids ( ) ) ;
requestoperator . setIssubmit ( 0 ) ;
requestoperator . setReceivedate ( LocalDate . now ( ) . format ( dateTimeFormatter ) ) ;
requestoperator . setReceivedate ( dateFormat . format ( new Date ( ) ) ) ;
requestoperator . setOpertype ( 1 ) ;
requestoperator . setIsremind ( 0 ) ;
requestoperator . setIsorioperator ( 0 ) ;
@ -603,7 +650,7 @@ public class ProcessScheduled {
log . info ( "requestoperator新增成功:" + requestoperator . toString ( ) ) ;
LambdaUpdateWrapper < Wfrequest > wfrequestLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
wfrequestLambdaUpdateWrapper . set ( Wfrequest : : getLastmodifydate , LocalDate . now ( ) . format ( dateTimeFormatter ) ) ;
wfrequestLambdaUpdateWrapper . set ( Wfrequest : : getLastmodifydate , dateFormat . format ( new Date ( ) ) ) ;
wfrequestLambdaUpdateWrapper . set ( Wfrequest : : getLaststaffid , kpssProcessNode6IdInfo . getCurrentStaffid ( ) ) ;
wfrequestLambdaUpdateWrapper . eq ( Wfrequest : : getId , processId ) ;
wfrequestMapper . update ( null , wfrequestLambdaUpdateWrapper ) ;
@ -612,13 +659,13 @@ public class ProcessScheduled {
LambdaUpdateWrapper < Requeststatus > requeststatusLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
requeststatusLambdaUpdateWrapper . set ( Requeststatus : : getStepid , kpssProcessNode6IdInfo . getNextStepid ( ) ) ;
requeststatusLambdaUpdateWrapper . set ( Requeststatus : : getPrestepid , kpssProcessNode6IdInfo . getCurrentStepid ( ) ) ;
requeststatusLambdaUpdateWrapper . set ( Requeststatus : : getModifydate , LocalDate . now ( ) . format ( dateTimeFormatter ) ) ;
requeststatusLambdaUpdateWrapper . set ( Requeststatus : : getModifydate , dateFormat . format ( new Date ( ) ) ) ;
requeststatusLambdaUpdateWrapper . eq ( Requeststatus : : getRequestid , processId ) ;
requeststatusMapper . update ( null , requeststatusLambdaUpdateWrapper ) ;
log . info ( "requeststatusLambdaUpdateWrapper修改成功:" + requeststatusLambdaUpdateWrapper . toString ( ) ) ;
LambdaUpdateWrapper < ScXglc > scXglcLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
scXglcLambdaUpdateWrapper . set ( ScXglc : : getZhtjsj , LocalDate . now ( ) . format ( dateTimeFormatter ) ) ;
scXglcLambdaUpdateWrapper . set ( ScXglc : : getZhtjsj , dateFormat . format ( new Date ( ) ) ) ;
scXglcLambdaUpdateWrapper . set ( ScXglc : : getZhtjr , kpssProcessNode6IdInfo . getCurrentStaffid ( ) ) ;
scXglcLambdaUpdateWrapper . set ( ScXglc : : getDqjd , kpssProcessNode6IdInfo . getNextStepid ( ) ) ;
scXglcLambdaUpdateWrapper . eq ( ScXglc : : getLc , processId ) ;
@ -626,7 +673,118 @@ public class ProcessScheduled {
log . info ( "scXglcLambdaUpdateWrapper修改成功:" + scXglcLambdaUpdateWrapper . toString ( ) ) ;
log . info ( "流程数据更新成功,流程到财务开票" ) ;
}
//退回流程
if ( status = = 3 | | status = = 5 ) {
LambdaQueryWrapper < Wfrequest > wfrequestLambdaQueryWrapper = new LambdaQueryWrapper < Wfrequest > ( ) ;
wfrequestLambdaQueryWrapper . eq ( Wfrequest : : getDataid , item . getRequestid ( ) ) ;
List < Wfrequest > wfrequests = wfrequestMapper . selectList ( wfrequestLambdaQueryWrapper ) ;
Wfrequest wfrequest = wfrequests . get ( 0 ) ;
String creatorid = wfrequest . getCreatorid ( ) ;
SimpleDateFormat dateFormat = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ;
HashMap < String , String > param = new HashMap < > ( ) ;
param . put ( "reqid" , item . getRequestid ( ) ) ;
param . put ( "modifyDate" , dateFormat . format ( new Date ( ) ) ) ;
param . put ( "preStepid" , kpssProcessNode6IdInfo . getCurrentStepid ( ) ) ;
param . put ( "creatorId" , creatorid ) ;
otherMapper . updateRequeststatusBack ( param ) ;
LambdaUpdateWrapper < Requestoperator > requestoperatorLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
requestoperatorLambdaUpdateWrapper . ne ( Requestoperator : : getStepid , kpssProcessNode6IdInfo . getFriststepid ( ) ) ;
requestoperatorLambdaUpdateWrapper . eq ( Requestoperator : : getRequestid , item . getRequestid ( ) ) ;
requestoperatorMapper . delete ( requestoperatorLambdaUpdateWrapper ) ;
requestoperatorLambdaUpdateWrapper . clear ( ) ;
requestoperatorLambdaUpdateWrapper . set ( Requestoperator : : getIssubmit , 0 ) ;
requestoperatorLambdaUpdateWrapper . set ( Requestoperator : : getReceivedate , dateFormat . format ( new Date ( ) ) ) ;
requestoperatorLambdaUpdateWrapper . eq ( Requestoperator : : getStepid , kpssProcessNode6IdInfo . getFriststepid ( ) ) ;
requestoperatorLambdaUpdateWrapper . eq ( Requestoperator : : getRequestid , item . getRequestid ( ) ) ;
requestoperatorLambdaUpdateWrapper . set ( Requestoperator : : getSubmitdate , "" ) ;
Requestlog requestlog = new Requestlog ( ) ;
requestlog . setRequestid ( item . getRequestid ( ) ) ;
requestlog . setStaffid ( kpssProcessNode6IdInfo . getCurrentStaffid ( ) ) ;
requestlog . setIsedit ( 0 ) ;
requestlog . setCreatedate ( dateFormat . format ( new Date ( ) ) ) ;
requestlog . setStepid ( kpssProcessNode6IdInfo . getCurrentStepid ( ) ) ;
requestlog . setInfo ( "云平台北京退回" ) ;
requestlog . setTypeinfo ( kpssProcessNode6IdInfo . getFriststepid ( ) ) ;
requestlog . setNtype ( 4 ) ;
requestlog . setIstodo ( 1 ) ;
requestlog . setNextstepid ( kpssProcessNode6IdInfo . getFriststepid ( ) ) ;
requestlogMapper . insert ( requestlog ) ;
LambdaUpdateWrapper < Readlog > readlogLambdaUpdateWrapper = Wrappers . lambdaUpdate ( ) ;
readlogLambdaUpdateWrapper . eq ( Readlog : : getDataid , item . getRequestid ( ) ) ;
readlogLambdaUpdateWrapper . ne ( Readlog : : getStepid , kpssProcessNode6IdInfo . getFriststepid ( ) ) ;
readlogMapper . delete ( readlogLambdaUpdateWrapper ) ;
readlogLambdaUpdateWrapper . clear ( ) ;
readlogLambdaUpdateWrapper . eq ( Readlog : : getDataid , item . getRequestid ( ) ) ;
readlogLambdaUpdateWrapper . eq ( Readlog : : getStepid , kpssProcessNode6IdInfo . getFriststepid ( ) ) ;
readlogLambdaUpdateWrapper . set ( Readlog : : getLastaccessdate , dateFormat . format ( new Date ( ) ) ) ;
readlogLambdaUpdateWrapper . setSql ( "readnum=readnum+1" ) ;
readlogMapper . update ( null , readlogLambdaUpdateWrapper ) ;
param . clear ( ) ;
param . put ( "resid" , item . getRequestid ( ) ) ;
param . put ( "staffid" , kpssProcessNode6IdInfo . getFriststepid ( ) ) ;
otherMapper . delPermissionuserBack ( param ) ;
LambdaUpdateWrapper < Permissionrulegroup > permissionrulegroupLambdaUpdateWrapper = new LambdaUpdateWrapper < > ( ) ;
permissionrulegroupLambdaUpdateWrapper . eq ( Permissionrulegroup : : getResid , item . getRequestid ( ) ) ;
permissionrulegroupLambdaUpdateWrapper . ne ( Permissionrulegroup : : getTypeid , "2c9adae478e9195d0178f3300fcc0432" ) ;
permissionrulegroupMapper . delete ( permissionrulegroupLambdaUpdateWrapper ) ;
}
} ) ;
}
//发送发票文件
private String sendfpfielUpdown ( HttpHeaders headers , String [ ] evidenceIds ) {
String evidenceid = "" ;
for ( String id : evidenceIds ) {
//查询
HashMap < String , String > fileMap = otherMapper . selectFileById ( id ) ;
String filePath = fileMap . get ( "filepath" ) ;
String filetype = fileMap . get ( "filetype" ) ;
//String filePath = "E:\\adad.txt";
filePath = fileDownPre + filePath ;
File file = new File ( filePath ) ;
if ( file . exists ( ) ) {
headers . setContentType ( MediaType . MULTIPART_FORM_DATA ) ;
MultiValueMap < String , Object > body = new LinkedMultiValueMap < > ( ) ;
body . add ( "file" , new FileSystemResource ( new File ( filePath ) ) ) ;
HttpEntity < MultiValueMap < String , Object > > request = new HttpEntity < > ( body , headers ) ;
ResponseBeanForBeiJing responseData = restTemplate . postForObject ( uploadFileUrl , request , ResponseBeanForBeiJing . class ) ;
//文件处理
String dataString = responseData . getData ( ) . toString ( ) ;
evidenceid = evidenceid + dataString + "," ;
} else {
log . info ( "文件不存在,文件位置" + filePath ) ;
}
}
return evidenceid ;
}
public void sendKpCancelToYPT ( HttpHeaders headers ) {
List < HashMap < String , String > > hashMapList = otherMapper . selectSchtqxByflag ( ) ;
if ( hashMapList . size ( ) > 0 ) {
hashMapList . forEach ( item - > {
String yptbh = item . get ( "yptbh" ) ;
if ( StringUtils . isBlank ( yptbh ) ) {
return ;
}
HttpEntity < Object > request = new HttpEntity < > ( null , headers ) ;
ResponseEntity < ResponseBeanForBeiJing > exchange = restTemplate . exchange ( cancelPrjetcUrl + "/CLOSE/" + yptbh , HttpMethod . PUT , request , ResponseBeanForBeiJing . class ) ;
ResponseBeanForBeiJing beanForBeiJing = exchange . getBody ( ) ;
if ( ! "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
log . info ( "返回信息错误!" + beanForBeiJing . toString ( ) ) ;
return ;
}
if ( "200" . equals ( beanForBeiJing . getCode ( ) ) ) {
Map dataMap = ( Map ) beanForBeiJing . getData ( ) ;
String projectNo = dataMap . get ( "projectNo" ) . toString ( ) ;
HashMap < String , String > paramMap = new HashMap < > ( ) ;
otherMapper . updateSchtqx_Byid ( item . get ( "id" ) ) ; //更新状态
log . info ( "合同取消到北京到北京成功" ) ;
log . info ( beanForBeiJing . toString ( ) ) ;
} else {
log . info ( "返回的信息是" + beanForBeiJing . toString ( ) ) ;
}
} ) ;
}
}
}