Browse Source

修复优化

master
zhouhaibin 10 months ago
parent
commit
691e5a44e9
  1. 54
      src/main/java/com/example/guoyan/controller/YunpingtaiController.java
  2. 4
      src/main/java/com/example/guoyan/entity/ScKpsqsp.java
  3. 1
      src/main/java/com/example/guoyan/entity/SendHt.java
  4. 9
      src/main/java/com/example/guoyan/entity/SendKpxx.java
  5. 1
      src/main/java/com/example/guoyan/entity/SendXm.java
  6. 2
      src/main/java/com/example/guoyan/mapper/OtherMapper.java
  7. 98
      src/main/java/com/example/guoyan/scheduled/ProcessScheduled.java
  8. 1
      src/main/resources/application-dev.yml
  9. 31
      src/main/resources/application-prod.yml
  10. 2
      src/main/resources/application.yml
  11. 2
      src/main/resources/mapper/OtherMapper.xml
  12. 2
      src/main/resources/mapper/SendHtMapper.xml
  13. 16
      src/main/resources/mapper/SendKpxxMapper.xml
  14. 2
      src/main/resources/mapper/SendXmMapper.xml

54
src/main/java/com/example/guoyan/controller/YunpingtaiController.java

@ -56,6 +56,55 @@ public class YunpingtaiController {
private String loginUrl;
@GetMapping()
public Result<String> upLoadFile() {
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);
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);
}
});
processScheduled.sendKpCancelToYPT(headers);
processScheduled.queryInvoicingApprovalStatus(headers);
return Result.success("成功");
}
@GetMapping("/sendxm")
@ -74,11 +123,6 @@ public class YunpingtaiController {
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("成功");
}

4
src/main/java/com/example/guoyan/entity/ScKpsqsp.java

@ -104,6 +104,10 @@ public class ScKpsqsp implements Serializable {
private String csry;
/**
* 到账编号
*/
private String accountid;
}

1
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;
}

9
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;
}

1
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;
}

2
src/main/java/com/example/guoyan/mapper/OtherMapper.java

@ -34,7 +34,7 @@ public interface OtherMapper extends BaseMapper<Object> {
HashMap<String,String> selectScKpsqsp_yptbh_Byreqid(@Param("requestid") String id);
List<HashMap<String,String>> selectProcessNo5IsSubmit(@Param("reqid") String id,@Param("setpid") String setpid);
List<HashMap<String,String>> selectSchtqxByflag();
List<HashMap<String,String>> selectSchtqxByflag( @Param("qxid") String qxid);
void updateSchtqx_Byid(@Param("id") String id);
void updateRequeststatusBack(HashMap<String,String> map);
void delPermissionuserBack(HashMap<String,String> map);

98
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<SendXm> 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<SendXm> 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<SendHt> 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<SendHt> 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<SendKpxx> 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<SendKpxx> 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<SendKpxx> 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<SendKpxx> 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<SendKpxx> 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<SendKpxx> 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<String, String> 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<SendKpxx> 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<SendKpxx> 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<HashMap<String, String>> hashMapList = otherMapper.selectSchtqxByflag();
List<HashMap<String, String>> 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<ScKpsqsp> scKpsqspLambdaQueryWrapper = new LambdaQueryWrapper<>();
scKpsqspLambdaQueryWrapper.eq(ScKpsqsp::getId, requestid);
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);
if (scKpsqspList.size() > 0) {
ScKpsqsp scKpsqsp = scKpsqspList.get(0);
String accountId = scKpsqsp.getAccountid();
sendKpxx.setAccountId(accountId);
sendKpxx.setOpFlag(1);
HttpEntity<SendKpxx> 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;
}
}

1
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"

31
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"
nextStepOperid: "2c9adae4797fd663017982c00bf301e3"
friststepid: "2c9adae478fdbe15017906f93ec90262"
processControlid: "2c9adae478e9195d0178f3300fcc0432"

2
src/main/resources/application.yml

@ -3,7 +3,7 @@ server:
spring:
application:
name: Guoyan
name: yunpingtai
profiles:
active: dev
# 是否允许定义重名的bean对象覆盖原有的bean (spring boot默认是false)

2
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'
</select>
<update id="updateSchtqx_Byid" parameterType="Map">
update sc_htqx set status =1 where id = #{id}

2
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
</select>

16
src/main/resources/mapper/SendKpxxMapper.xml

@ -30,9 +30,11 @@
<result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="operatetype" column="operatetype" jdbcType="INTEGER"/>
<result property="isReturn" column="isReturn" jdbcType="INTEGER"/>
<result property="qy" column="qy" jdbcType="VARCHAR"/>
</resultMap>
<result property="returnInvoiceNo" column="returnInvoiceNo" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="querySendKpxxByNoDel" resultMap="SendKpxxMap">
select
@ -44,7 +46,8 @@
(select zftk from sc_zfmx where id =receipt_schedule_name ) receipt_schedule_name,
(select kpdwmc from sc_fp1 where id =payer_name ) payer_name,
payer_number,
invoice_amount,
case when invoice_amount >0 then invoice_amount
else ABS(invoice_amount) end as invoice_amount,
(SELECT kpnr FROM sc_kpnr e WHERE e.id =invoice_content) invoice_content,
"非现金" as payment_mode,
(SELECT name FROM selectitem e WHERE e.id =(SELECT fplx FROM sc_fplx e WHERE e.id =invoice_type)) invoice_type,
@ -65,9 +68,14 @@
interface_type,
operatetype,
wfrequest,
qy
qy,
case when invoice_amount >0 then 0
else 1 end as isReturn,
CASE WHEN invoice_amount > 0 THEN ""
ELSE (select yptbh from sc_kpsqsp CC where CC.xmmc =A.project_no and CC.kpje = ABS(A.invoice_amount))
END AS returnInvoiceNo
from send_kpxx A
where status is null
where status is null and errormessage is null
order by createtime
</select>
<select id="querySendToYPT" resultMap="SendKpxxMap">

2
src/main/resources/mapper/SendXmMapper.xml

@ -69,7 +69,7 @@
status,
operatetype
from send_xm
where status is null and area_code ='ZJ'
where status is null and area_code ='ZJ' and errormessage is null
order by createtime
</select>
<select id="querySendXmByProjectId" resultMap="SendXmMap">

Loading…
Cancel
Save