|
|
@@ -1,8 +1,14 @@ |
|
|
|
package com.ningdatech.pmapi.projectCollection; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.ningdatech.log.model.domain.OptLog; |
|
|
|
import com.ningdatech.log.service.OptLogService; |
|
|
|
import com.ningdatech.pmapi.AppTests; |
|
|
|
import com.ningdatech.pmapi.common.constant.BizConst; |
|
|
|
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; |
|
|
@@ -12,12 +18,15 @@ import com.ningdatech.pmapi.gov.model.entity.*; |
|
|
|
import com.ningdatech.pmapi.gov.service.*; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; |
|
|
|
import com.ningdatech.pmapi.scheduler.task.SynProjectCollectionTask; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.junit.Test; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
|
|
import java.net.UnknownHostException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.StringJoiner; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Classname ProjectCollectionTest |
|
|
@@ -51,6 +60,9 @@ public class ProjectCollectionTest extends AppTests { |
|
|
|
@Autowired |
|
|
|
private SynProjectCollectionTask collectionTask; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private OptLogService optLogService; |
|
|
|
|
|
|
|
@Test |
|
|
|
public void test(){ |
|
|
|
List<String> baseProjIds = Lists.newArrayList("33110000020230100061"); |
|
|
@@ -95,4 +107,55 @@ public class ProjectCollectionTest extends AppTests { |
|
|
|
public void test3() throws UnknownHostException { |
|
|
|
collectionTask.stagingConvertPdf("33112200020230100008"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 去补文件 |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
public void test4(){ |
|
|
|
List<GovBizProjectApprove> approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) |
|
|
|
.eq(GovBizProjectApprove::getApprovalFile,"null")); |
|
|
|
|
|
|
|
System.out.println("approves size :" + approves.size()); |
|
|
|
|
|
|
|
for(GovBizProjectApprove approve : approves){ |
|
|
|
//https://sjxmglxt-oss.oss-cn-hangzhou-zjzwy01-d01-a.cloud-inner.zj.gov.cn/20230912/6a5c00def2db41b199d8cc99ff04728e.pdf |
|
|
|
String baseProjId = approve.getBaseProjId(); |
|
|
|
|
|
|
|
List<OptLog> opLogs = optLogService.list(Wrappers.lambdaQuery(OptLog.class) |
|
|
|
.like(OptLog::getParams, approve.getBaseProjName()) |
|
|
|
.like(OptLog::getParams, "\"approvalFile\"") |
|
|
|
.last(BizConst.LIMIT_1)); |
|
|
|
if(CollUtil.isEmpty(opLogs)){ |
|
|
|
System.out.println("没有这个记录"); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
for(OptLog opLog : opLogs){ |
|
|
|
System.out.println(opLog.getParams()); |
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(opLog.getParams())){ |
|
|
|
StringJoiner sj = new StringJoiner(";"); |
|
|
|
JSONArray jsonArray = JSON.parseArray(opLog.getParams()); |
|
|
|
jsonArray.forEach(j -> { |
|
|
|
JSONObject json = JSON.parseObject(JSON.toJSONString(j)); |
|
|
|
JSONObject approveJson = json.getJSONObject("approve"); |
|
|
|
if(Objects.nonNull(approveJson)){ |
|
|
|
String approvalFile = approveJson.getString("approvalFile"); |
|
|
|
System.out.println("approvalFile:" + approvalFile); |
|
|
|
if(StringUtils.isBlank(approvalFile) || "null".equals(approvalFile)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
sj.add(approvalFile); |
|
|
|
} |
|
|
|
}); |
|
|
|
if(StringUtils.isNotBlank(sj.toString())){ |
|
|
|
approve.setApprovalFile(sj.toString()); |
|
|
|
approveService.updateById(approve); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |