소스 검색

驾驶舱 项目画像接口

tags/24080901
PoffyZhang 1 년 전
부모
커밋
8afeada3d7
2개의 변경된 파일90개의 추가작업 그리고 7개의 파일을 삭제
  1. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectInfoVO.java
  2. +87
    -7
      pmapi/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest331125.java

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectInfoVO.java 파일 보기

@@ -43,6 +43,9 @@ public class ProtraitProjectInfoVO {
@ApiModelProperty("项目安全投入占比")
private String safetyInputRate;

@ApiModelProperty("项目简介")
private String projectIntroduction;

@ApiModelProperty("超期情况")
private String overdueSituation;



+ 87
- 7
pmapi/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest331125.java 파일 보기

@@ -25,7 +25,9 @@ import org.springframework.beans.factory.annotation.Autowired;

import java.io.*;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname SaveCollectionTest
@@ -57,7 +59,7 @@ public class SaveCollectionTest331125 extends AppTests {//
@Test
public void importData() throws Exception {
Workbook wb;
File f = new File("C:\\Users\\PoffyZhang\\Desktop\\丽水市项目底数清单.xlsx");
File f = new File("C:\\Users\\PoffyZhang\\Desktop\\丽水开发区(1).xlsx");
wb = readExcel(new FileInputStream(f),f.getName());
Row row = null;
if(wb != null) {
@@ -78,7 +80,7 @@ public class SaveCollectionTest331125 extends AppTests {//

GovBizProjectBaseinfoDTO baseinfoDTO = new GovBizProjectBaseinfoDTO();
//
String projName = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY;
String projName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProjName(projName);
baseinfoDTO.setBaseAreaCode(RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST);
baseinfoDTO.setBaseAreaName(RegionConst.LS_KF_NAME);
@@ -87,18 +89,16 @@ public class SaveCollectionTest331125 extends AppTests {//
baseinfoDTO.setTongTime(LocalDateTime.now());
baseinfoDTO.setBizTime(LocalDateTime.now());
baseinfoDTO.setOp("insert");
String principal = Objects.nonNull(row.getCell(5)) ? row.getCell(5).toString() : StringUtils.EMPTY;
String principal = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProjPrincipal(principal);
String contacts = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY;
String contacts = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProjContacts(contacts);
baseinfoDTO.setBaseProjType("01");
saveDTO.setBaseinfo(baseinfoDTO);

GovBizProjectApplyDTO applyDTO = new GovBizProjectApplyDTO();
String baseProjSetYear = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY;
String baseProjSetYear = Objects.nonNull(row.getCell(20)) ? row.getCell(20).toString() : StringUtils.EMPTY;
applyDTO.setBaseProjSetYear(baseProjSetYear);
String baseProjIntro = Objects.nonNull(row.getCell(9)) ? row.getCell(9).toString() : StringUtils.EMPTY;
applyDTO.setBaseProjIntro(baseProjIntro);
saveDTO.setApply(applyDTO);
//生产编号
String projId = projectCodeUtil.generateProjectCode(saveDTO);
@@ -154,6 +154,86 @@ public class SaveCollectionTest331125 extends AppTests {//
System.out.println("导入完成");
}

@Test
public void test2() throws FileNotFoundException {
//先删除 开发区的
List<GovBizProjectBaseinfo> lss = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseAreaCode, RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST));
List<String> codes = lss.stream().map(GovBizProjectBaseinfo::getBaseProjId).collect(Collectors.toList());
applyService.remove(Wrappers.lambdaQuery(GovBizProjectApply.class)
.in(GovBizProjectApply::getBaseProjId,codes));
approveService.remove(Wrappers.lambdaQuery(GovBizProjectApprove.class)
.in(GovBizProjectApprove::getBaseProjId,codes));
cimplementService.remove(Wrappers.lambdaQuery(GovBizProjectCimplement.class)
.in(GovBizProjectCimplement::getBaseProjId,codes));
mimplementService.remove(Wrappers.lambdaQuery(GovBizProjectMimplement.class)
.in(GovBizProjectMimplement::getBaseProjId,codes));
procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class)
.in(GovBizProjectProcure::getBaseProjId,codes));
baseinfoService.remove(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.in(GovBizProjectBaseinfo::getBaseProjId,codes));

Workbook wb;
File f = new File("C:\\Users\\PoffyZhang\\Desktop\\丽水开发区(1).xlsx");
wb = readExcel(new FileInputStream(f),f.getName());
Row row = null;
if(wb != null) {
//获取第一个sheet
Sheet sheet = wb.getSheetAt(0);
//获取最大行数
int rownum = sheet.getPhysicalNumberOfRows();

//获取第一行
row = sheet.getRow(0);
//获取最大列数
for (int i = 1; i < rownum; i++) {
row = sheet.getRow(i);
if (Objects.isNull(row) || Objects.isNull(row.getCell(0))) {
break;
}
GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO();

GovBizProjectBaseinfoDTO baseinfoDTO = new GovBizProjectBaseinfoDTO();
//
String projName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProjName(projName);
baseinfoDTO.setBaseAreaCode(RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST);
baseinfoDTO.setBaseAreaName(RegionConst.LS_KF_NAME);
baseinfoDTO.setAreaCode(RegionConst.RC_LS);
baseinfoDTO.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE);
baseinfoDTO.setTongTime(LocalDateTime.now());
baseinfoDTO.setBizTime(LocalDateTime.now());
baseinfoDTO.setOp("insert");
String principal = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProjPrincipal(principal);
String contacts = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProjContacts(contacts);
baseinfoDTO.setBaseProjType("01");
saveDTO.setBaseinfo(baseinfoDTO);

GovBizProjectApplyDTO applyDTO = new GovBizProjectApplyDTO();
String baseProjSetYear = Objects.nonNull(row.getCell(20)) ? row.getCell(20).toString().substring(0,4) : StringUtils.EMPTY;
applyDTO.setBaseProjSetYear(baseProjSetYear);
saveDTO.setApply(applyDTO);
//生产编号
String projId = projectCodeUtil.generateProjectCode(saveDTO);
saveDTO.setBaseProjId(projId);
saveDTO.getBaseinfo().setBaseProjId(projId);
saveDTO.getApply().setBaseProjId(projId);
UserInfoDetails user = new UserInfoDetails();
user.setRegionCode(RegionConst.LS_KF);
user.setUsername("系统导入");
String save = "";
try {
save = manage.save(saveDTO, user);
}catch (Exception e){
e.printStackTrace();
}
System.out.println(JSON.toJSONString(save));
}
}
}

//这个下面是单独函数
public static Workbook readExcel(InputStream is, String extString){
Workbook wb = null;


불러오는 중...
취소
저장