diff --git a/src/main/java/com/example/guoyan/controller/YunpingtaiController.java b/src/main/java/com/example/guoyan/controller/YunpingtaiController.java index f94271b..d855ed6 100644 --- a/src/main/java/com/example/guoyan/controller/YunpingtaiController.java +++ b/src/main/java/com/example/guoyan/controller/YunpingtaiController.java @@ -56,6 +56,55 @@ public class YunpingtaiController { private String loginUrl; @GetMapping() public Result upLoadFile() { + String url = loginUrl; + //提交参数设置 + HashMap 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 sendXmList = sendXmMapper.querySendXmByNoDel(); + processScheduled.sendXmToYunPingtai(sendXmList,headers); + List sendHtList = sendHtMapper.querySendHtByNoDel(); + processScheduled.sendHtToYunPingtai(sendHtList,headers); + List 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> 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 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); + } + }); + processScheduled.sendKpCancelToYPT(headers); + processScheduled.queryInvoicingApprovalStatus(headers); + return Result.success("成功"); } @GetMapping("/sendxm") @@ -74,11 +123,6 @@ public class YunpingtaiController { headers.set("Authorization", data); List sendXmList = sendXmMapper.querySendXmByNoDel(); processScheduled.sendXmToYunPingtai(sendXmList,headers); - List sendHtList = sendHtMapper.querySendHtByNoDel(); - processScheduled.sendHtToYunPingtai(sendHtList,headers); - - processScheduled.sendKpCancelToYPT(headers); - processScheduled.queryInvoicingApprovalStatus(headers); return Result.success("成功"); } diff --git a/src/main/java/com/example/guoyan/entity/ScKpsqsp.java b/src/main/java/com/example/guoyan/entity/ScKpsqsp.java index 0e1db0a..094928a 100644 --- a/src/main/java/com/example/guoyan/entity/ScKpsqsp.java +++ b/src/main/java/com/example/guoyan/entity/ScKpsqsp.java @@ -104,6 +104,10 @@ public class ScKpsqsp implements Serializable { private String csry; + /** + * 到账编号 + */ + private String accountid; } diff --git a/src/main/java/com/example/guoyan/entity/SendHt.java b/src/main/java/com/example/guoyan/entity/SendHt.java index 86166a0..5fdf700 100644 --- a/src/main/java/com/example/guoyan/entity/SendHt.java +++ b/src/main/java/com/example/guoyan/entity/SendHt.java @@ -72,6 +72,7 @@ public class SendHt implements Serializable { * 合同id */ private String contractId; + private String errormessage; } diff --git a/src/main/java/com/example/guoyan/entity/SendKpxx.java b/src/main/java/com/example/guoyan/entity/SendKpxx.java index e3ba47d..eaf32c1 100644 --- a/src/main/java/com/example/guoyan/entity/SendKpxx.java +++ b/src/main/java/com/example/guoyan/entity/SendKpxx.java @@ -136,5 +136,14 @@ public class SendKpxx implements Serializable { private String incomeId; private String accountId; private String qy; + /**是否退票 + * + */ + private Integer isReturn; + /** + * 退票编号 + */ + private String returnInvoiceNo; + private String errormessage; } diff --git a/src/main/java/com/example/guoyan/entity/SendXm.java b/src/main/java/com/example/guoyan/entity/SendXm.java index 6439430..3148aff 100644 --- a/src/main/java/com/example/guoyan/entity/SendXm.java +++ b/src/main/java/com/example/guoyan/entity/SendXm.java @@ -107,6 +107,7 @@ public class SendXm implements Serializable { private Integer operatetype; private Double fyys; + private String errormessage; } diff --git a/src/main/java/com/example/guoyan/mapper/OtherMapper.java b/src/main/java/com/example/guoyan/mapper/OtherMapper.java index 0e58b1c..0e7cded 100644 --- a/src/main/java/com/example/guoyan/mapper/OtherMapper.java +++ b/src/main/java/com/example/guoyan/mapper/OtherMapper.java @@ -34,7 +34,7 @@ public interface OtherMapper extends BaseMapper { HashMap selectScKpsqsp_yptbh_Byreqid(@Param("requestid") String id); List> selectProcessNo5IsSubmit(@Param("reqid") String id,@Param("setpid") String setpid); - List> selectSchtqxByflag(); + List> selectSchtqxByflag( @Param("qxid") String qxid); void updateSchtqx_Byid(@Param("id") String id); void updateRequeststatusBack(HashMap map); void delPermissionuserBack(HashMap map); diff --git a/src/main/java/com/example/guoyan/scheduled/ProcessScheduled.java b/src/main/java/com/example/guoyan/scheduled/ProcessScheduled.java index 043ea4d..e634b56 100644 --- a/src/main/java/com/example/guoyan/scheduled/ProcessScheduled.java +++ b/src/main/java/com/example/guoyan/scheduled/ProcessScheduled.java @@ -83,6 +83,8 @@ public class ProcessScheduled { private String cancelPrjetcUrl; @Autowired private KpssProcessNode6IdInfo kpssProcessNode6IdInfo; + @Value("${ypt.htqxid}") + private String htqxid; /** * 定时任务跑合同和项目信息的变化发给北京,五分钟一次 */ @@ -185,6 +187,12 @@ public class ProcessScheduled { } else { log.info("新增失败,projectId是" + iteam.getProjectId() + " id是" + iteam.getId()); log.info("返回的信息是" + responseData.toString()); + //记录失败原因 + LambdaUpdateWrapper sendXmLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendXmLambdaUpdateWrapper.eq(SendXm::getId,iteam.getId()); + sendXmLambdaUpdateWrapper.set(SendXm::getErrormessage,responseData.getMessage().toString()); + sendXmMapper.update(null, sendXmLambdaUpdateWrapper); + } } //修改 @@ -207,6 +215,11 @@ public class ProcessScheduled { } else { log.info("更新失败,projectId是" + iteam.getProjectId() + " id是" + iteam.getId()); log.info("返回的信息是" + responseData.toString()); + //记录失败原因 + LambdaUpdateWrapper sendXmLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendXmLambdaUpdateWrapper.eq(SendXm::getId,iteam.getId()); + sendXmLambdaUpdateWrapper.set(SendXm::getErrormessage,responseData.getMessage().toString()); + sendXmMapper.update(null, sendXmLambdaUpdateWrapper); } } }); @@ -260,6 +273,11 @@ public class ProcessScheduled { } else { log.info("新增失败,projectId是" + item.getContractId() + " id是" + item.getId()); log.info("返回的信息是" + responseData.toString()); + //记录失败原因 + LambdaUpdateWrapper sendHtLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendHtLambdaUpdateWrapper.eq(SendHt::getId, item.getId());//更新条件 + sendHtLambdaUpdateWrapper.set(SendHt::getErrormessage,responseData.getMessage().toString());//更新的值 + sendHtMapper.update(null, sendHtLambdaUpdateWrapper); } } //修改 @@ -282,6 +300,11 @@ public class ProcessScheduled { } else { log.info("更新失败,projectId是" + item.getContractId() + " id是" + item.getId()); log.info("返回的信息是" + responseData.toString()); + //记录失败原因 + LambdaUpdateWrapper sendHtLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendHtLambdaUpdateWrapper.eq(SendHt::getId, item.getId());//更新条件 + sendHtLambdaUpdateWrapper.set(SendHt::getErrormessage,responseData.getMessage().toString());//更新的值 + sendHtMapper.update(null, sendHtLambdaUpdateWrapper); } } }); @@ -326,6 +349,10 @@ public class ProcessScheduled { sendKpxx.setInvoiceNo(null); headers.setContentType(MediaType.APPLICATION_JSON); sendKpxx.setEvidenceId(evidenceid); + //退票要先删掉原来的到账信息 + if(sendKpxx.getIsReturn()==1){ + deleteFpdzrq(headers,sendKpxx); + } HttpEntity request = new HttpEntity<>(sendKpxx, headers); ResponseBeanForBeiJing responseData = restTemplate.postForObject(invoiceUrl,request, ResponseBeanForBeiJing.class); if ("200".equals(responseData.getCode())) { @@ -351,6 +378,12 @@ public class ProcessScheduled { } else { log.info("新增开票信息失败,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId()); log.error("返回的信息是" + responseData.toString()); + //记录错误信息 + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); + } } //修改 @@ -378,6 +411,11 @@ public class ProcessScheduled { } else { log.info("新增开票信息失败,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId()); log.error("返回的信息是" + responseData.toString()); + //记录错误信息 + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } } } @@ -421,6 +459,11 @@ public class ProcessScheduled { } else { log.info("新增开票确认失败,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId()); log.info("返回的信息是" + responseData.toString()); + //记录失败信息 + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } } //修改 @@ -478,6 +521,11 @@ public class ProcessScheduled { } else { log.info("新增开票确认收入失败,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId()); log.info("返回的信息是" + responseData.toString()); + //记录失败信息 + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } } //修改 @@ -508,14 +556,20 @@ public class ProcessScheduled { sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); log.info("删除后新增开票确认到云平台成功"); log.info(responseData.toString()); + return; } } - + //记录错误信息 + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } } @Transactional() public void sendKpqrdzToYunPingtai(SendKpxx sendKpxx, HttpHeaders headers){ HashMap stringStringHashMap = otherMapper.selectScKpsqsp_yptbh_ByPjid(sendKpxx.getRequestid()); + sendKpxx.setOpUserCode(sendKpxx.getApplyUserCode()); if(stringStringHashMap==null){ return; } @@ -563,6 +617,10 @@ public class ProcessScheduled { } else { log.info("新增开票确认失败,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId()); log.info("返回的信息是" + responseData.toString()); + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } } //修改 @@ -593,8 +651,13 @@ public class ProcessScheduled { sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); log.info("删除后新增开票确认到账到云平台成功"); log.info(responseData.toString()); + return; } } + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } } @@ -830,7 +893,7 @@ public class ProcessScheduled { return evidenceid; } public void sendKpCancelToYPT(HttpHeaders headers){ - List> hashMapList = otherMapper.selectSchtqxByflag(); + List> hashMapList = otherMapper.selectSchtqxByflag(htqxid); if (hashMapList.size()>0){ hashMapList.forEach(item->{ String yptbh = item.get("yptbh"); @@ -852,4 +915,35 @@ public class ProcessScheduled { }); } } + + /** + * 删除开票到账确认 + */ + private Boolean deleteFpdzrq(HttpHeaders headers,SendKpxx sendKpxx) { + String requestid = sendKpxx.getRequestid(); + sendKpxx.setOpUserCode(sendKpxx.getApplyUserCode()); + Double invoiceAmount = sendKpxx.getInvoiceAmount(); + LambdaQueryWrapper scKpsqspLambdaQueryWrapper = new LambdaQueryWrapper<>(); + scKpsqspLambdaQueryWrapper.eq(ScKpsqsp::getId, requestid); + List queryxxmclist = scKpsqspMapper.selectList(scKpsqspLambdaQueryWrapper); + String xmmc = queryxxmclist.get(0).getXmmc(); + scKpsqspLambdaQueryWrapper.clear(); + scKpsqspLambdaQueryWrapper.eq(ScKpsqsp::getXmmc,xmmc); + scKpsqspLambdaQueryWrapper.eq(ScKpsqsp::getKpje, invoiceAmount); + List scKpsqspList = scKpsqspMapper.selectList(scKpsqspLambdaQueryWrapper); + if (scKpsqspList.size() > 0) { + ScKpsqsp scKpsqsp = scKpsqspList.get(0); + String accountId = scKpsqsp.getAccountid(); + sendKpxx.setAccountId(accountId); + sendKpxx.setOpFlag(1); + HttpEntity request2 = new HttpEntity<>(sendKpxx, headers); + ResponseBeanForBeiJing responseData = restTemplate.postForObject(accountUrl, request2, ResponseBeanForBeiJing.class); + if ("200".equals(responseData.getCode())) { + return true; + } + log.info("删除到账信息失败"+responseData.toString()); + } + return false; + } + } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 83bf5a7..6928aa4 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -28,6 +28,7 @@ ypt: InvoicingApprovalStatusUrl: http://123.57.82.48:13310/api/nb/invoice/status cancelPrjetcUrl: http://123.57.82.48:13310/api/nb/project fileDownPre: '/opt/eresource_test/attachFiles/' + htqxid: 2c9a59b68b9fd59d018cfdfe5abb5e0a kpssProcessNode6IdInfo: perStepid: "2c9adae478fdbe15017906f93ec90265" currentStepid: "2c9a59b68b9fd59d018c3d22c9b54f9c" diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index f901ef6..645441c 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -10,24 +10,29 @@ spring: logging: # 配置日志文件存储位置 file: - path: F:\log + path: /opt/log ypt: username: '0519999' - password: '123456' - loginUrl: http://123.57.82.48:13310/api/auth/login - projectUrl: http://123.57.82.48:13310/api/nb/project - contractUrl: http://123.57.82.48:13310/api/nb/contract - invoiceUrl: http://123.57.82.48:13310/api/nb/invoice - confirmUrl: http://123.57.82.48:13310/api/nb/invoice/confirm - uploadFileUrl: http://123.57.82.48:13310/api/nb/invoice/uploadEvidence - incomeUrl: http://123.57.82.48:13310/api/nb/invoice/income - InvoicingApprovalStatusUrl: http://123.57.82.48:13310/api/nb/invoice/status/{invoiceNo} - fileDownPre: '/opt/eresource/attachFiles/' + password: 'gy123456' + loginUrl: http://123.57.82.48:8080/api/auth/login + projectUrl: http://123.57.82.48:8080/api/nb/project + contractUrl: http://123.57.82.48:8080/api/nb/contract + invoiceUrl: http://123.57.82.48:8080/api/nb/invoice + confirmUrl: http://123.57.82.48:8080/api/nb/invoice/confirm + uploadFileUrl: http://123.57.82.48:8080/api/nb/invoice/uploadEvidence + incomeUrl: http://123.57.82.48:8080/api/nb/invoice/income + accountUrl: http://123.57.82.48:8080/api/nb/invoice/account + InvoicingApprovalStatusUrl: http://123.57.82.48:8080/api/nb/invoice/status + cancelPrjetcUrl: http://123.57.82.48:8080/api/nb/project + fileDownPre: '/opt/eresource_test/attachFiles/' + htqxid: 2c9a59b68b9fd54b018d0c4679bd7ec9 kpssProcessNode6IdInfo: perStepid: "2c9adae478fdbe15017906f93ec90265" - currentStepid: "2c9a59b68b9fd59d018c3d22c9b54f9c" + currentStepid: "2c9a59b68b9fd54b018bea9c42c05e08" currentStaffid: "2c9a59b68aab39d5018aac42f5be04cb" nextStepid: "2c9adae478fdbe15017906f93ec90266" nextTypeid: "2c9adae4797fd663017982bd72f801dc" nextAllowStaffids: "2c908da5803abfa4018064f817070161" - nextStepOperid: "2c9adae4797fd663017982c00bf301e3" \ No newline at end of file + nextStepOperid: "2c9adae4797fd663017982c00bf301e3" + friststepid: "2c9adae478fdbe15017906f93ec90262" + processControlid: "2c9adae478e9195d0178f3300fcc0432" diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 15b544e..fc02212 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -3,7 +3,7 @@ server: spring: application: - name: Guoyan + name: yunpingtai profiles: active: dev # 是否允许定义重名的bean对象覆盖原有的bean (spring boot默认是false) diff --git a/src/main/resources/mapper/OtherMapper.xml b/src/main/resources/mapper/OtherMapper.xml index 89d949f..5f62922 100644 --- a/src/main/resources/mapper/OtherMapper.xml +++ b/src/main/resources/mapper/OtherMapper.xml @@ -51,7 +51,7 @@ (select yptbh from sc_xmkp1 b where b.id = a.xmmc ) yptbh from sc_htqx a where - sfqx='2c9a59b68b9fd59d018cfdfe5abb5e0a' and status is null and ssgs='ZJ' + sfqx= #{qxid} and status is null and ssgs='ZJ' update sc_htqx set status =1 where id = #{id} diff --git a/src/main/resources/mapper/SendHtMapper.xml b/src/main/resources/mapper/SendHtMapper.xml index 6b2837e..d34f17d 100644 --- a/src/main/resources/mapper/SendHtMapper.xml +++ b/src/main/resources/mapper/SendHtMapper.xml @@ -41,7 +41,7 @@ operatetype, contract_id from send_ht - where status is null AND ssgs = 'ZJ' + where status is null AND ssgs = 'ZJ' and errormessage is null order by addtime diff --git a/src/main/resources/mapper/SendKpxxMapper.xml b/src/main/resources/mapper/SendKpxxMapper.xml index 7214983..0ccfe45 100644 --- a/src/main/resources/mapper/SendKpxxMapper.xml +++ b/src/main/resources/mapper/SendKpxxMapper.xml @@ -30,9 +30,11 @@ + - + +