11 changed files with 329 additions and 208 deletions
@ -1,143 +0,0 @@ |
|||
package com.example.guoyan.controller; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.example.guoyan.common.Result; |
|||
import com.example.guoyan.entity.SendHt; |
|||
import com.example.guoyan.entity.SendKpxx; |
|||
import com.example.guoyan.entity.SendXm; |
|||
import com.example.guoyan.mapper.*; |
|||
import com.example.guoyan.response.ResponseBeanForBeiJing; |
|||
import com.example.guoyan.scheduled.ProcessScheduled; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.http.entity.ContentType; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
|
|||
import org.springframework.core.io.FileSystemResource; |
|||
import org.springframework.http.HttpEntity; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.util.LinkedMultiValueMap; |
|||
import org.springframework.util.MultiValueMap; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.io.File; |
|||
import java.io.FileInputStream; |
|||
import java.io.IOException; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping("/test") |
|||
@Slf4j |
|||
public class TestController { |
|||
@Resource |
|||
private RestTemplate restTemplate; |
|||
@Autowired |
|||
private SendXmMapper sendXmMapper; |
|||
@Autowired |
|||
private SendHtMapper sendHtMapper; |
|||
@Autowired |
|||
private OtherMapper otherMapper; |
|||
|
|||
@Autowired |
|||
private SendKpxxMapper sendKpxxMapper; |
|||
|
|||
@Autowired |
|||
private ProcessScheduled processScheduled; |
|||
@GetMapping() |
|||
public Result<String> upLoadFile() { |
|||
|
|||
return Result.success("成功"); |
|||
} |
|||
@GetMapping("/c") |
|||
public Result<String> test1(){ |
|||
|
|||
List<SendKpxx> sendKpxxList = sendKpxxMapper.querySendKpxxByNoDel(); |
|||
String url = "http://123.57.82.48:13310/api/auth/login"; |
|||
//提交参数设置
|
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("username", "0519999"); |
|||
map.put("password", "123456"); |
|||
|
|||
//发起请求
|
|||
ResponseBeanForBeiJing responseBean = restTemplate.postForObject(url, map, ResponseBeanForBeiJing.class); |
|||
System.out.println(responseBean.toString()); |
|||
String data = responseBean.getData().toString(); |
|||
HttpHeaders headers = new HttpHeaders(); |
|||
headers.set("Authorization", data); |
|||
|
|||
|
|||
// sendKpxxList.forEach(item->{
|
|||
// Integer interfaceType = item.getInterfaceType();//类型字段
|
|||
// if(interfaceType==0){//开票信息有关的
|
|||
// //判断是否过了节点5,通过流程id,节点
|
|||
// String requestid = item.getRequestid();
|
|||
// String kpssProcessNode5="2c9adae478fdbe15017906f93ec90265";
|
|||
// List<HashMap<String, String>> selectProcessNo5IsSubmit = otherMapper.selectProcessNo5IsSubmit(requestid, kpssProcessNode5);
|
|||
// if (selectProcessNo5IsSubmit.size()>0){//存在
|
|||
// processScheduled.senKpxxToYunPingtai(item,headers);
|
|||
// }
|
|||
// //开票确认
|
|||
// }else if (interfaceType==1){
|
|||
// processScheduled.sendKpqrToYunPingtai(item,headers);
|
|||
// //开票确认收入
|
|||
// }else if(interfaceType==2){
|
|||
// processScheduled.sendKpqrsrToYunPingtai(item,headers);
|
|||
// }else if (interfaceType==3){
|
|||
// processScheduled.sendKpqrdzToYunPingtai(item,headers);
|
|||
// }else {
|
|||
// log.info("未知编号:"+interfaceType);
|
|||
// }
|
|||
// });
|
|||
// processScheduled.sendKpCancelToYPT(headers);
|
|||
processScheduled.queryInvoicingApprovalStatus(headers); |
|||
return Result.success("成功"); |
|||
} |
|||
|
|||
@GetMapping("/a") |
|||
public Result<String> testt() { |
|||
|
|||
List<SendHt> sendHtList = sendHtMapper.querySendHtByNoDel(); |
|||
String url = "http://123.57.82.48:13310/api/auth/login"; |
|||
//提交参数设置
|
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("username", "0519999"); |
|||
map.put("password", "123456"); |
|||
|
|||
//发起请求
|
|||
ResponseBeanForBeiJing responseBean = restTemplate.postForObject(url, map, ResponseBeanForBeiJing.class); |
|||
System.out.println(responseBean.toString()); |
|||
String data = responseBean.getData().toString(); |
|||
HttpHeaders headers = new HttpHeaders(); |
|||
headers.set("Authorization", data); |
|||
processScheduled.sendHtToYunPingtai(sendHtList,headers); |
|||
return Result.success("成功"); |
|||
} |
|||
|
|||
@GetMapping("/t") |
|||
public Result<String> test() { |
|||
|
|||
List<SendXm> sendXmList = sendXmMapper.querySendXmByNoDel(); |
|||
String url = "http://123.57.82.48:13310/api/auth/login"; |
|||
//提交参数设置
|
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("username", "0519999"); |
|||
map.put("password", "123456"); |
|||
|
|||
//发起请求
|
|||
ResponseBeanForBeiJing responseBean = restTemplate.postForObject(url, map, ResponseBeanForBeiJing.class); |
|||
System.out.println(responseBean.toString()); |
|||
String data = responseBean.getData().toString(); |
|||
HttpHeaders headers = new HttpHeaders(); |
|||
headers.set("Authorization", data); |
|||
processScheduled.sendXmToYunPingtai(sendXmList, headers); |
|||
return Result.success("成功"); |
|||
} |
|||
} |
@ -0,0 +1,186 @@ |
|||
package com.example.guoyan.controller; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.example.guoyan.common.Result; |
|||
import com.example.guoyan.entity.ScKpsqsp; |
|||
import com.example.guoyan.entity.SendHt; |
|||
import com.example.guoyan.entity.SendKpxx; |
|||
import com.example.guoyan.entity.SendXm; |
|||
import com.example.guoyan.mapper.*; |
|||
import com.example.guoyan.response.ResponseBeanForBeiJing; |
|||
import com.example.guoyan.scheduled.ProcessScheduled; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
|
|||
|
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.http.HttpHeaders; |
|||
|
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping("/yunpingtai") |
|||
@Slf4j |
|||
public class YunpingtaiController { |
|||
@Resource |
|||
private RestTemplate restTemplate; |
|||
@Autowired |
|||
private SendXmMapper sendXmMapper; |
|||
@Autowired |
|||
private SendHtMapper sendHtMapper; |
|||
@Autowired |
|||
private OtherMapper otherMapper; |
|||
|
|||
@Autowired |
|||
private SendKpxxMapper sendKpxxMapper; |
|||
@Autowired |
|||
private ScKpsqspMapper scKpsqspMapper; |
|||
|
|||
@Autowired |
|||
private ProcessScheduled processScheduled; |
|||
@Value("${ypt.username}") |
|||
private String username; |
|||
@Value("${ypt.password}") |
|||
private String password; |
|||
@Value("${ypt.loginUrl}") |
|||
private String loginUrl; |
|||
@GetMapping() |
|||
public Result<String> upLoadFile() { |
|||
return Result.success("成功"); |
|||
} |
|||
@GetMapping("/sendxm") |
|||
public Result<String> test1(){ |
|||
String url = loginUrl; |
|||
//提交参数设置
|
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("username", username); |
|||
map.put("password", password); |
|||
|
|||
//发起请求
|
|||
ResponseBeanForBeiJing responseBean = restTemplate.postForObject(url, map, ResponseBeanForBeiJing.class); |
|||
System.out.println(responseBean.toString()); |
|||
String data = responseBean.getData().toString(); |
|||
HttpHeaders headers = new HttpHeaders(); |
|||
headers.set("Authorization", data); |
|||
List<SendXm> sendXmList = sendXmMapper.querySendXmByNoDel(); |
|||
processScheduled.sendXmToYunPingtai(sendXmList,headers); |
|||
List<SendHt> sendHtList = sendHtMapper.querySendHtByNoDel(); |
|||
processScheduled.sendHtToYunPingtai(sendHtList,headers); |
|||
|
|||
processScheduled.sendKpCancelToYPT(headers); |
|||
processScheduled.queryInvoicingApprovalStatus(headers); |
|||
return Result.success("成功"); |
|||
} |
|||
|
|||
@GetMapping("/sendht") |
|||
public Result<String> testt() { |
|||
String url = loginUrl; |
|||
//提交参数设置
|
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("username", username); |
|||
map.put("password", password); |
|||
|
|||
//发起请求
|
|||
ResponseBeanForBeiJing responseBean = restTemplate.postForObject(url, map, ResponseBeanForBeiJing.class); |
|||
System.out.println(responseBean.toString()); |
|||
String data = responseBean.getData().toString(); |
|||
HttpHeaders headers = new HttpHeaders(); |
|||
headers.set("Authorization", data); |
|||
List<SendHt> sendHtList = sendHtMapper.querySendHtByNoDel(); |
|||
processScheduled.sendHtToYunPingtai(sendHtList,headers); |
|||
return Result.success("成功"); |
|||
|
|||
} |
|||
|
|||
@GetMapping("/sendkpxx") |
|||
public Result<String> test() { |
|||
String url = loginUrl; |
|||
//提交参数设置
|
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("username", username); |
|||
map.put("password", password); |
|||
|
|||
//发起请求
|
|||
ResponseBeanForBeiJing responseBean = restTemplate.postForObject(url, map, ResponseBeanForBeiJing.class); |
|||
System.out.println(responseBean.toString()); |
|||
String data = responseBean.getData().toString(); |
|||
HttpHeaders headers = new HttpHeaders(); |
|||
headers.set("Authorization", data); |
|||
List<SendKpxx> sendKpxxList = sendKpxxMapper.querySendKpxxByNoDel(); |
|||
sendKpxxList.forEach(item->{ |
|||
Integer interfaceType = item.getInterfaceType();//类型字段
|
|||
if(interfaceType==0&&"ZJ".equals(item.getQy())){//开票信息有关的
|
|||
//判断是否过了节点5,通过流程id,节点
|
|||
String requestid = item.getRequestid(); |
|||
String kpssProcessNode5="2c9adae478fdbe15017906f93ec90265"; |
|||
List<HashMap<String, String>> selectProcessNo5IsSubmit = otherMapper.selectProcessNo5IsSubmit(requestid, kpssProcessNode5); |
|||
if (selectProcessNo5IsSubmit.size()>0){//存在
|
|||
processScheduled.senKpxxToYunPingtai(item,headers); |
|||
} |
|||
//开票确认
|
|||
}else if (interfaceType==1&&"ZJ".equals(item.getQy())){ |
|||
processScheduled.sendKpqrToYunPingtai(item,headers); |
|||
//开票确认收入
|
|||
}else if(interfaceType==2){ |
|||
String wfrequest = item.getWfrequest(); |
|||
LambdaQueryWrapper<ScKpsqsp> scKpsqspMapperLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|||
scKpsqspMapperLambdaQueryWrapper.eq(ScKpsqsp::getRequestid,wfrequest); |
|||
ScKpsqsp scKpsqsp = scKpsqspMapper.selectList(scKpsqspMapperLambdaQueryWrapper).get(0); |
|||
String qy = scKpsqsp.getQy(); |
|||
if ("ZJ".equals(qy)){ |
|||
processScheduled.sendKpqrsrToYunPingtai(item,headers); |
|||
} |
|||
}else if (interfaceType==3&&"ZJ".equals(item.getQy())){ |
|||
processScheduled.sendKpqrdzToYunPingtai(item,headers); |
|||
}else { |
|||
log.info("未知编号:"+interfaceType); |
|||
} |
|||
}); |
|||
return Result.success("成功"); |
|||
} |
|||
@GetMapping("/cancelht") |
|||
public Result<String> cancelht(){ |
|||
String url = loginUrl; |
|||
//提交参数设置
|
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("username", username); |
|||
map.put("password", password); |
|||
|
|||
//发起请求
|
|||
ResponseBeanForBeiJing responseBean = restTemplate.postForObject(url, map, ResponseBeanForBeiJing.class); |
|||
System.out.println(responseBean.toString()); |
|||
String data = responseBean.getData().toString(); |
|||
HttpHeaders headers = new HttpHeaders(); |
|||
headers.set("Authorization", data); |
|||
|
|||
processScheduled.sendKpCancelToYPT(headers); |
|||
return Result.success("成功"); |
|||
} |
|||
@GetMapping("/queryInvoicingApproval") |
|||
public Result<String> queryInvoicingApproval(){ |
|||
String url = loginUrl; |
|||
//提交参数设置
|
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("username", username); |
|||
map.put("password", password); |
|||
|
|||
//发起请求
|
|||
ResponseBeanForBeiJing responseBean = restTemplate.postForObject(url, map, ResponseBeanForBeiJing.class); |
|||
System.out.println(responseBean.toString()); |
|||
String data = responseBean.getData().toString(); |
|||
HttpHeaders headers = new HttpHeaders(); |
|||
headers.set("Authorization", data); |
|||
processScheduled.queryInvoicingApprovalStatus(headers); |
|||
return Result.success("成功"); |
|||
} |
|||
} |
@ -1,7 +1,9 @@ |
|||
package com.example.guoyan.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.example.guoyan.entity.ScKpsqsp; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
@Mapper |
|||
public interface ScKpsqspMapper { |
|||
public interface ScKpsqspMapper extends BaseMapper<ScKpsqsp> { |
|||
} |
|||
|
Loading…
Reference in new issue