CMM 1 year ago
parent
commit
4462a9f0fd
9 changed files with 66 additions and 72 deletions
  1. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/ProjectCodeContant.java
  2. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java
  4. +32
    -68
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java
  5. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  6. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java
  7. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java
  8. +2
    -2
      pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java
  9. +1
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest3.java

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/ProjectCodeContant.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.projectdeclared.contants;

/**
* @Classname ProjectCodeContant
* @Description
* @Date 2023/8/10 15:20
* @Author PoffyZhang
*/
public interface ProjectCodeContant {

String REGION_LAST_3 = "000";

String PROJECT_TYPE_PREFIX = "0";

String SHUZI_5 = "%05d";
}

+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java View File

@@ -119,6 +119,8 @@ public class ConstructionManage {
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg());
item.setApprovedAmount(w.getApprovalAmount());
item.setApprovalDate(w.getApprovalDate());
item.setTransactionAmount(w.getTransactionAmount());
item.setTransactionTime(w.getTransactionTime());
return item;
});
return PageVo.of(records, total);
@@ -332,6 +334,8 @@ public class ConstructionManage {
item.setDeliveryTime(w.getDeliveryTime());
item.setContractAmount(w.getContractAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount());
item.setTransactionTime(w.getTransactionTime());
item.setTransactionAmount(w.getTransactionAmount());
return item;
});
return PageVo.of(records, total);
@@ -364,6 +368,10 @@ public class ConstructionManage {
exportDTO.setDeliveryTime(r.getDeliveryTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
exportDTO.setContractAmount(r.getContractAmount());
exportDTO.setAnnualPlanAmount(r.getAnnualPlanAmount());
if(Objects.nonNull(r.getTransactionTime())){
exportDTO.setTransactionTime(r.getTransactionTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
}
exportDTO.setTransactionAmount(r.getTransactionAmount());
return exportDTO;
}).collect(Collectors.toList());
}


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java View File

@@ -209,7 +209,7 @@ public class PurchaseManage {
// 获取总的成交时间及金额
LocalDateTime lastTransactionTime = null;
BigDecimal transactionAmountTotal = BigDecimal.ZERO;
for (Purchase purchase : purchases) {
for (Purchase purchase : purchaseEntities) {
if (lastTransactionTime == null) {
lastTransactionTime = purchase.getTransactionTime();
} else if (purchase.getTransactionTime().isAfter(lastTransactionTime)) {


+ 32
- 68
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java View File

@@ -1,13 +1,8 @@
package com.ningdatech.pmapi.projectdeclared.utils;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode;
import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService;
import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.contants.ProjectCodeContant;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection;
@@ -15,8 +10,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectCollectionService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.time.LocalDateTime;
import java.util.Objects;

/**
@@ -37,68 +31,38 @@ public class GenerateProjectCodeUtil {
private IProjectCollectionService projectCollectionService;

public String generateProjectCode(ProjectDTO project){
// 获取所属行政区划代码(6位)
String areaCode = project.getAreaCode();
// 获取建设年度后两位
String year = String.valueOf(project.getProjectYear() % DeclaredProjectContant.Project.YEAR_DRAW_SURPLUS);
// 9-12位固定
String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER;
// 获取公司的财政编码
CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(project.getBuildOrgCode());

// 从表中查出单位配置的财政编码
if (Objects.isNull(companyFiscalCode)){
throw new BizException("申报单位未配置财政编码!");
}

String fiscalCode = companyFiscalCode.getFiscalCode();
// 获取项目编号
String projectIdStr;
// 获取项目库当前最大项目序号
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class).orderByDesc(Project::getId));
Project maxProject = CollUtil.isEmpty(projectList) ? null : projectList.get(0);
Long projectId = Objects.isNull(maxProject) ? DeclaredProjectContant.Project.MIN_PROJECT_ID : maxProject.getId() + 1;
if (projectId > DeclaredProjectContant.Project.MAX_PROJECT_ID){
// 超过999的项目号从1开始 1
Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID;
projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, newProjectId);
}else {
projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, projectId);
}
// 生成21位的项目编号
return areaCode + year + fixedNumber + fiscalCode + projectIdStr;
// 获取所属行政区划代码(9位)
String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3;
// 获取建设年度 (10-13)
String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear())
: String.valueOf(LocalDateTime.now().getYear());
// 14-15 项目类型
String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType();
// 16-20 项目序号00001
Long max = projectService.count(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectYear,project.getProjectYear())
.eq(Project::getNewest,Boolean.TRUE));
Long maxCurrent = max + 1;
String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxCurrent);
// 生成20位的项目编号
return areaCode + year + projectType + serialNumber;
}

public String generateProjectCode(ProjectCollection project){
// 获取所属行政区划代码(6位)
String areaCode = project.getAreaCode();
// 获取建设年度后两位
String year = String.valueOf(project.getProjectYear() % DeclaredProjectContant.Project.YEAR_DRAW_SURPLUS);
// 9-12位固定
String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER;
// 获取公司的财政编码
CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(project.getBuildOrgCode());

// 从表中查出单位配置的财政编码
if (Objects.isNull(companyFiscalCode)){
throw new BizException("申报单位未配置财政编码!");
}

String fiscalCode = companyFiscalCode.getFiscalCode();
// 获取项目编号
String projectIdStr;
// 获取项目库当前最大项目序号
List<ProjectCollection> projectList = projectCollectionService.list(Wrappers.lambdaQuery(ProjectCollection.class).orderByDesc(ProjectCollection::getId));
ProjectCollection maxProject = CollUtil.isEmpty(projectList) ? null : projectList.get(0);
Long projectId = Objects.isNull(maxProject) ? DeclaredProjectContant.Project.MIN_PROJECT_ID : maxProject.getId() + 1;
if (projectId > DeclaredProjectContant.Project.MAX_PROJECT_ID){
// 超过999的项目号从1开始 1
Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID;
projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, newProjectId);
}else {
projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, projectId);
}
// 生成21位的项目编号
return areaCode + year + fixedNumber + fiscalCode + projectIdStr;
// 获取所属行政区划代码(9位)
String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3;
// 获取建设年度 (10-13)
String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear())
: String.valueOf(LocalDateTime.now().getYear());
// 14-15 项目类型
String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType();
// 16-20 项目序号00001
Long max = projectService.count(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectYear,project.getProjectYear())
.eq(Project::getNewest,Boolean.TRUE));
Long maxCurrent = max + 1;
String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxCurrent);
// 生成20位的项目编号
return areaCode + year + projectType + serialNumber;
}
}

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java View File

@@ -212,6 +212,8 @@ public class ProjectLibManage {
&& w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) {
item.setCanPreDeclared(Boolean.TRUE);
}
item.setApprovedAmount(w.getApprovalAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount());
item.setPrePlanProjectId(w.getPrePlanProjectId());
setTag(item,finalTagMap,finalTagNameMap);
return item;


+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java View File

@@ -99,6 +99,7 @@ public class ProjectRenewalFundManage {
vo.setStage(project.getStage());
vo.setStatus(project.getStatus());
vo.setBuildOrgName(project.getBuildOrgName());
vo.setAnnualPaymentAmount(project.getAnnualPlanAmount());
return vo;
}



+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java View File

@@ -84,4 +84,7 @@ public class ProjectRenewalFundDeclarationVO implements Serializable {

@ApiModelProperty("项目类型 1建设 2运维")
private Integer projectType;

@ApiModelProperty("审核意见")
private String auditOpinion;
}

+ 2
- 2
pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java View File

@@ -50,7 +50,7 @@ public class IrsTest extends AppTests {
public void test1() {
String method = "GET";
String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl" +
"?appCode=A331101453557202109017383";
"?appCode=A331123467587202210014168";
String appScret = "BCDSGS_4ab4235d26a9a357170a39f3a13fd68c";
String appKey = "BCDSGA_d874c8e46b541eb4e8aac6510fd3351b";

@@ -76,7 +76,7 @@ public class IrsTest extends AppTests {
String areaCode = "331123";
String appScret = "496f0f2a19994f76b4fd9dae087366c7";
String appKey = "A331101453557202109017383";
String appCode = "A331123467587202307014170";//A331123467587202307014171
String appCode = "A331123467587202307014177";//A331123467587202307014171

String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret);
String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp);


+ 1
- 1
pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest3.java View File

@@ -74,7 +74,7 @@ public class irsTest3 extends AppTests {
}else{
restTemplate = new RestTemplate();
}
String appId = "A330000100000202105005790";
String appId = "A331123467587202307014177";
String updateTime = "2023-07-26 00:00:00";
String capCode = timestamp + updateTime + appId;
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" +


Loading…
Cancel
Save