Browse Source

无用test删除

tags/24080901
WendyYang 1 year ago
parent
commit
bda7afe506
18 changed files with 0 additions and 1901 deletions
  1. +0
    -0
      hz-pm-api/src/test/java/com/hz/pm/api/AppTests.java
  2. +0
    -34
      hz-pm-api/src/test/java/com/ningdatech/pmapi/cctask/CcTaskTest.java
  3. +0
    -145
      hz-pm-api/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest.java
  4. +0
    -256
      hz-pm-api/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest331125.java
  5. +0
    -96
      hz-pm-api/src/test/java/com/ningdatech/pmapi/employee/EmployeeTest.java
  6. +0
    -77
      hz-pm-api/src/test/java/com/ningdatech/pmapi/file/ProvinceOssTest.java
  7. +0
    -190
      hz-pm-api/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java
  8. +0
    -113
      hz-pm-api/src/test/java/com/ningdatech/pmapi/org/OrgTest.java
  9. +0
    -26
      hz-pm-api/src/test/java/com/ningdatech/pmapi/password/PasswordTest.java
  10. +0
    -161
      hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java
  11. +0
    -168
      hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection3Test.java
  12. +0
    -243
      hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java
  13. +0
    -163
      hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java
  14. +0
    -24
      hz-pm-api/src/test/java/com/ningdatech/pmapi/redis/RedisTest.java
  15. +0
    -42
      hz-pm-api/src/test/java/com/ningdatech/pmapi/refund/ProjectRefundTest.java
  16. +0
    -85
      hz-pm-api/src/test/java/com/ningdatech/pmapi/region/RegionTest.java
  17. +0
    -43
      hz-pm-api/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java
  18. +0
    -35
      hz-pm-api/src/test/java/com/ningdatech/pmapi/stream/stream.java

hz-pm-api/src/test/java/com/ningdatech/pmapi/AppTests.java → hz-pm-api/src/test/java/com/hz/pm/api/AppTests.java View File


+ 0
- 34
hz-pm-api/src/test/java/com/ningdatech/pmapi/cctask/CcTaskTest.java View File

@@ -1,34 +0,0 @@
package com.hz.pm.api.cctask;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.AppTests;
import com.wflow.bean.entity.WflowCcTasks;
import com.wflow.service.WflowCcTasksService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
* @Classname CcTaskTest
* @Description
* @Date 2023/6/30 16:52
* @Author PoffyZhang
*/
public class CcTaskTest extends AppTests {

@Autowired
private WflowCcTasksService wflowCcTasksService;

@Test
public void test(){
String nodeId = "node_649e9620711424df271ba98c";
String instanceId = "72fffd9c-1722-11ee-b7f5-02426daa406d";
List<WflowCcTasks> ccTasks = wflowCcTasksService.list(Wrappers.lambdaQuery(WflowCcTasks.class)
.eq(WflowCcTasks::getNodeId,nodeId)
.eq(WflowCcTasks::getInstanceId,instanceId));
System.out.println(JSON.toJSONString(ccTasks));
}

}

+ 0
- 145
hz-pm-api/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest.java View File

@@ -1,145 +0,0 @@
package com.hz.pm.api.collection;

import com.alibaba.fastjson.JSON;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.RegionConst;
import com.hz.pm.api.gov.contants.BizProjectContant;
import com.hz.pm.api.gov.manage.GovProjectCollectionManage;
import com.hz.pm.api.gov.model.dto.GovBizProjectApplyDTO;
import com.hz.pm.api.gov.model.dto.GovBizProjectBaseinfoDTO;
import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO;
import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.*;
import java.time.LocalDateTime;
import java.util.*;

/**
* @Classname SaveCollectionTest
* @Description
* @Date 2023/9/4 17:43
* @Author PoffyZhang
*/
public class SaveCollectionTest extends AppTests {//

@Autowired
private GovProjectCollectionManage manage;

@Autowired
private GenerateProjectCodeUtil projectCodeUtil;

@Test
public void importData() throws Exception {
Workbook wb;
File f = new File("C:\\Users\\PoffyZhang\\Desktop\\市本级组织code已核对.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(2)) ? row.getCell(2).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProjName(projName);
baseinfoDTO.setBaseAreaCode(RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST);
baseinfoDTO.setBaseAreaName("丽水市");
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(5)) ? row.getCell(5).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProjPrincipal(principal);
String contacts = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProjContacts(contacts);
String contactsCall = Objects.nonNull(row.getCell(7)) ? row.getCell(7).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProjContactsCall(contactsCall);
String baseProvManDeprt = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProvManDeprt(baseProvManDeprt);
String baseProvManDeprtDing = Objects.nonNull(row.getCell(9)) ? row.getCell(9).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProvManDeprtDing(baseProvManDeprtDing);
String baseManDeprt = Objects.nonNull(row.getCell(10)) ? row.getCell(10).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseManDeprt(baseManDeprt);
String baseManDeprtDing = Objects.nonNull(row.getCell(11)) ? row.getCell(11).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseManDeprtDing(baseManDeprtDing);
String baseProjType = Objects.nonNull(row.getCell(15)) ? row.getCell(15).toString() : StringUtils.EMPTY;
if("0".equals(baseProjType)){
baseProjType = "01";
}else if("1".equals(baseProjType)){
baseProjType = "04";
}
baseinfoDTO.setBaseProjType(baseProjType);
String baseProjSetProg = Objects.nonNull(row.getCell(17)) ? row.getCell(17).toString() : StringUtils.EMPTY;
baseinfoDTO.setBaseProjSetProg(baseProjSetProg);

saveDTO.setBaseinfo(baseinfoDTO);

GovBizProjectApplyDTO applyDTO = new GovBizProjectApplyDTO();
String baseProjSetYear = Objects.nonNull(row.getCell(22)) ? row.getCell(22).toString() : StringUtils.EMPTY;
applyDTO.setBaseProjSetYear(baseProjSetYear);
String baseProjIntro = Objects.nonNull(row.getCell(23)) ? row.getCell(23).toString() : StringUtils.EMPTY;
applyDTO.setBaseProjIntro(baseProjIntro);
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.RC_LS);
user.setUsername("系统导入");
String save = "";
try{
save = manage.save(saveDTO, user);
}catch (Exception e){
e.printStackTrace();
}
System.out.println(JSON.toJSONString(save));
}
}

System.out.println("导入完成");
}

//这个下面是单独函数
public static Workbook readExcel(InputStream is, String extString){
Workbook wb = null;
extString = extString.substring(extString.lastIndexOf("."));
try {
if(".xls".equals(extString)){
return wb = new HSSFWorkbook(is);
}else if(".xlsx".equals(extString)){
return wb = new XSSFWorkbook(is);
}else {
return wb = null;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return wb;
}
}

+ 0
- 256
hz-pm-api/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest331125.java View File

@@ -1,256 +0,0 @@
package com.hz.pm.api.collection;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.RegionConst;
import com.hz.pm.api.gov.contants.BizProjectContant;
import com.hz.pm.api.gov.manage.GovProjectCollectionManage;
import com.hz.pm.api.gov.model.dto.GovBizProjectApplyDTO;
import com.hz.pm.api.gov.model.dto.GovBizProjectBaseinfoDTO;
import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO;
import com.hz.pm.api.gov.model.entity.*;
import com.hz.pm.api.gov.service.*;
import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
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
* @Description
* @Date 2023/9/4 17:43
* @Author PoffyZhang
*/
public class SaveCollectionTest331125 extends AppTests {//

@Autowired
private GovProjectCollectionManage manage;

@Autowired
private GenerateProjectCodeUtil projectCodeUtil;

@Autowired
private IGovBizProjectBaseinfoService baseinfoService;
@Autowired
private IGovBizProjectApplyService applyService;
@Autowired
private IGovBizProjectApproveService approveService;
@Autowired
private IGovBizProjectCimplementService cimplementService;
@Autowired
private IGovBizProjectMimplementService mimplementService;
@Autowired
private IGovBizProjectProcureService procureService;

@Test
public void importData() throws Exception {
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() : 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{
GovBizProjectBaseinfo old = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjName, projName)
.last(BizConst.LIMIT_1));
if(Objects.isNull(old)){
save = manage.save(saveDTO, user);
}else{
System.out.println(projName + ",重复了 要改到经开区里");
String newProjId = old.getBaseProjId().replace("331100000","331118000");
baseinfoService.update(Wrappers.lambdaUpdate(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjName, projName)
.eq(GovBizProjectBaseinfo::getBaseProjId, old.getBaseProjId())
.set(GovBizProjectBaseinfo::getBaseAreaCode,RegionConst.LS_KF + BizConst.NINE_AREA_CODE_LAST)
.set(GovBizProjectBaseinfo::getBaseProjId,newProjId));
applyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjName, projName)
.eq(GovBizProjectApply::getBaseProjId, old.getBaseProjId())
.set(GovBizProjectApply::getBaseProjId,newProjId));
approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjName, projName)
.eq(GovBizProjectApprove::getBaseProjId, old.getBaseProjId())
.set(GovBizProjectApprove::getBaseProjId,newProjId));
cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjName, projName)
.eq(GovBizProjectCimplement::getBaseProjId, old.getBaseProjId())
.set(GovBizProjectCimplement::getBaseProjId,newProjId));
mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjName, projName)
.eq(GovBizProjectMimplement::getBaseProjId, old.getBaseProjId())
.set(GovBizProjectMimplement::getBaseProjId,newProjId));
procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjName, projName)
.eq(GovBizProjectProcure::getBaseProjId, old.getBaseProjId())
.set(GovBizProjectProcure::getBaseProjId,newProjId));
}
}catch (Exception e){
e.printStackTrace();
}
System.out.println(JSON.toJSONString(save));
}
}

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;
extString = extString.substring(extString.lastIndexOf("."));
try {
if(".xls".equals(extString)){
return wb = new HSSFWorkbook(is);
}else if(".xlsx".equals(extString)){
return wb = new XSSFWorkbook(is);
}else {
return wb = null;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return wb;
}
}

+ 0
- 96
hz-pm-api/src/test/java/com/ningdatech/pmapi/employee/EmployeeTest.java View File

@@ -1,96 +0,0 @@
package com.hz.pm.api.employee;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.RegionConst;
import com.hz.pm.api.ding.task.EmployeeBatchGetTask;
import com.hz.pm.api.ding.task.OrganizationBatchGetTask;
import com.hz.pm.api.organization.model.entity.DingEmployeeInfo;
import com.hz.pm.api.organization.model.entity.DingOrganization;
import com.hz.pm.api.organization.service.IDingEmployeeInfoService;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import com.hz.pm.api.user.entity.UserInfo;
import com.hz.pm.api.user.service.IUserInfoService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

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

/**
* @Classname EmployeeTest
* @Description
* @Date 2023/9/6 14:34
* @Author PoffyZhang
*/
public class EmployeeTest extends AppTests {

@Autowired
private IDingEmployeeInfoService dingEmployeeInfoService;

@Autowired
private IDingOrganizationService dingOrganizationService;

@Autowired
private IUserInfoService userInfoService;

@Autowired
private OrganizationBatchGetTask organizationBatchGetTask;

@Autowired
private EmployeeBatchGetTask employeeBatchGetTask;

@Test
public void test(){
List<DingEmployeeInfo> employees = dingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getEmployeeName, "吴玉斌"));

for(DingEmployeeInfo employee : employees){
UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getEmployeeCode, employee.getEmployeeCode())
.last(BizConst.LIMIT_1));

if(Objects.nonNull(user)){
DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, employee.getOrganizationCode())
.last(BizConst.LIMIT_1));
user.setRegionCode(RegionConst.LS_KF);
user.setEmpPosUnitCode(employee.getEmpPosUnitCode());
user.setEmpPosUnitName(organization.getOrganizationName());
userInfoService.updateById(user);
}else{
DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, employee.getOrganizationCode())
.last(BizConst.LIMIT_1));
UserInfo saveUser = new UserInfo();
saveUser.setRegionCode(RegionConst.LS_KF);
saveUser.setEmpPosUnitCode(employee.getEmpPosUnitCode());
saveUser.setEmpPosUnitName(organization.getOrganizationName());
saveUser.setCreateOn(LocalDateTime.now());
saveUser.setUsername("吴玉斌");
saveUser.setRealName("吴玉斌");
saveUser.setUpdateOn(LocalDateTime.now());
saveUser.setAccountId(employee.getAccountId());
saveUser.setEmployeeCode(employee.getEmployeeCode());
userInfoService.save(saveUser);
}

}
}

@Test
public void test2(){
String orgCode = "GO_4e6be07f25594df88e7bd1b7b7cdf9a8";
organizationBatchGetTask.organizationGetSubs(orgCode);
}

@Test
public void test3(){
String orgCode = "GO_1aceac0b3a664afbb31ea0d627189781";
employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode);
}


}

+ 0
- 77
hz-pm-api/src/test/java/com/ningdatech/pmapi/file/ProvinceOssTest.java View File

@@ -1,77 +0,0 @@
package com.hz.pm.api.file;

import com.hz.pm.api.common.util.CommonInputStreamResource;
import org.junit.Test;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.FileInputStream;

import org.apache.http.entity.ContentType;
import java.io.*;

/**
* @Classname ProvinceOssTest
* @Description
* @Date 2023/9/5 14:21
* @Author PoffyZhang
*/
public class ProvinceOssTest {

@Test
public void test() throws FileNotFoundException {
File f = new File("C:\\Users\\PoffyZhang\\Desktop\\市本级组织code已核对.xlsx");
String url = "https://pms.zj.gov.cn/prometheus-zhejiang_file_service/api/v1/file/uploadFile";
MultiValueMap<String,Object> params = new LinkedMultiValueMap<>();
byte[] fileBytes = getBytesByFile(f);
ByteArrayInputStream inputStream = new ByteArrayInputStream(fileBytes);
CommonInputStreamResource commonInputStreamResource = new CommonInputStreamResource(inputStream,fileBytes.length,f.getName());
params.add("file",commonInputStreamResource);
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("multipart/form-data");
headers.setContentType(type);
HttpEntity<MultiValueMap> formEntity = new HttpEntity(params, headers);
ResponseEntity<String> res = restTemplate.postForEntity(url, formEntity, String.class);
System.out.println(res.getBody());
}

public static MultipartFile getMultipartFile(File file) {
try{
FileInputStream fileInputStream = new FileInputStream(file);
MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(),ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
return multipartFile;
}catch (Exception e){
e.printStackTrace();
}
return null;
}

//将文件转换成Byte数组
public static byte[] getBytesByFile(File file) {
try {
FileInputStream fis = new FileInputStream(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);
byte[] b = new byte[1000];
int n;
while ((n = fis.read(b)) != -1) {
bos.write(b, 0, n);
}
fis.close();
byte[] data = bos.toByteArray();
bos.close();
return data;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

+ 0
- 190
hz-pm-api/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java View File

@@ -1,190 +0,0 @@
package com.hz.pm.api.instance;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.projectlib.manage.ProjectLibManage;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectInst;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.wflow.workflow.bean.dto.TodoCenterListReqDTO;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.runtime.ActivityInstance;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.*;
import java.util.stream.Collectors;

/**
* @Classname InstanceTest
* @Description
* @Date 2023/2/16 14:44
* @Author PoffyZhang
*/
@Slf4j
public class InstanceTest extends AppTests {

@Autowired
private RuntimeService runtimeService;

@Autowired
private HistoryService historyService;

@Autowired
private ProjectLibManage projectLibManage;

@Autowired
private IProjectInstService projectInstService;

@Test
public void test() {
String instanceId = "896fa188-96d8-11ed-9539-e2d4e8f16b2f";
Object user = runtimeService.getVariable(instanceId,
"owner");
System.out.println(JSON.toJSONString(user));
}

@Test
public void testHistory() {
//如果有已经被审核过的 节点
List<HistoricActivityInstance> finished = historyService.createHistoricActivityInstanceQuery()
.processInstanceId("085af7ef-d133-11ed-a3f6-02426daa406d").finished()
.activityType("userTask")
.orderByHistoricActivityInstanceEndTime().asc().list();
HistoricActivityInstance historicActivityInstance = finished.get(0);
System.out.println(finished);
}

@Test
public void testRuntime() {
//如果有已经被审核过的 节点
List<ActivityInstance> userTask = runtimeService.createActivityInstanceQuery()
.processInstanceId("1709ebe3-d148-11ed-9351-02426daa406d")
.activityType("userTask")
.orderByActivityInstanceStartTime().asc().list();
System.out.println(userTask);
}

@Test
public void testTodo() {
String employeeCode = "GE_e9d5c7917acd4eeea04ff2a9454af62e";
// 查出项目库项目
ProjectListReq projectListReq = new ProjectListReq();
List<Project> projects = projectLibManage.projectList(projectListReq);
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());
if (CollUtil.isEmpty(projectIdList)) {
System.out.println("没有项目");
return;
}
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId())));
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());

// 查出用户工作流
TodoCenterListReqDTO req = new TodoCenterListReqDTO();
req.setEmployeeCode(employeeCode);
req.setInstCodes(instCodes);

// 自定义sql查询所有已办的任务实例
String nativeSql = "SELECT ht.* FROM act_hi_taskinst ht WHERE assignee_ = '" + employeeCode +
"' and end_time_ is not NULL";
NativeHistoricTaskInstanceQuery taskInstanceQuery =
historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql);
List<HistoricTaskInstance> taskInstances = taskInstanceQuery.list();

Set<String> set = new HashSet<>();
List<HistoricTaskInstance> taskInstanceList = taskInstances.stream()
.filter(t -> instCodes.contains(t.getProcessInstanceId()))
.sorted(Comparator.comparing(HistoricTaskInstance::getEndTime)).collect(Collectors.toList())
.stream()
.filter(v -> set.add(v.getProcessInstanceId()))
.collect(Collectors.toList());

System.out.println(taskInstanceList.size());
}

@Test
public void test2() {
// 获取节点处理结果
// Map<String, ProcessHandlerEnum> varMap = historyService.createHistoricVariableInstanceQuery()
// .processInstanceId("e99fe24c-d21c-11ed-af5d-02426daa406d")
// .variableNameLike("approve_%")
// .list().stream()
// .collect(Collectors.toMap(HistoricVariableInstance::getVariableName, v -> (ProcessHandlerEnum) v.getValue()));
runtimeService.removeVariable("564102ce-d1ff-11ed-b694-02424b2b849f", "approve_7d2a191a-d1ff-11ed-b694-02424b2b849f");
System.out.println(1);
}

@Test
public void usageTimeStat() {
// 查询所有已完成的流程实例
List<HistoricProcessInstance> processInstanceList = historyService.createHistoricProcessInstanceQuery()
.orderByProcessInstanceStartTime()
.desc()
.finished()
.list();

// 统计每个流程实例的审批耗时
for (HistoricProcessInstance processInstance : processInstanceList) {
System.out.println("流程实例ID:" + processInstance.getId());
System.out.println("流程开始时间:" + processInstance.getStartTime());
System.out.println("流程结束时间:" + processInstance.getEndTime());
System.out.println("流程耗时(ms):" + processInstance.getDurationInMillis() / 1000);
System.out.println("================================================================");
}
}

@Test
public void test4(){
String nodeId = "node_64d1bc4694fc85e4dd1f1b36";

List<HistoricActivityInstance> hais = historyService.createHistoricActivityInstanceQuery()
.activityId(nodeId)
.unfinished()
.orderByHistoricActivityInstanceStartTime()
.asc()
.list();

log.info("hais :{}",JSON.toJSONString(hais));

if (CollUtil.isEmpty(hais)) {
log.info("没有查到 历史实例");
return;
}

String instanceId = hais.get(0).getProcessInstanceId();
log.info("instanceId :{}",instanceId);

//查询当前未完成的此实例
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(instanceId)
.unfinished()
.singleResult();

log.info("instance :{}",JSON.toJSONString(instance));
if (Objects.isNull(instance)) {
log.info("没有查到实例 或者 实例已经结束");
return;
}

//2.查到 此流程实例的 项目
ProjectInst pi = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getInstCode, instanceId)
.last(BizConst.LIMIT_1));
log.info("pi :{}",JSON.toJSONString(pi));
}
}

+ 0
- 113
hz-pm-api/src/test/java/com/ningdatech/pmapi/org/OrgTest.java View File

@@ -1,113 +0,0 @@
package com.hz.pm.api.org;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.SpringUtils;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.gov.entity.BelongOrg;
import com.hz.pm.api.gov.enumeration.BelongTypeEnum;
import com.hz.pm.api.gov.service.IBelongOrgService;
import com.hz.pm.api.organization.model.entity.DingOrganization;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.*;

/**
* @Classname RegionTest
* @Description
* @Date 2023/6/8 14:44
* @Author PoffyZhang
*/
public class OrgTest extends AppTests {

@Autowired
private IDingOrganizationService organizationService;
@Autowired
private IBelongOrgService belongOrgService;

@Test
public void test() {
List<DingOrganization> orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getDivisionCode, "331199"));

for (DingOrganization org : orgs) {
List<DingOrganization> inners = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getParentCode, org.getOrganizationCode()));
for (DingOrganization inner : inners) {
mergeRegionCode(inner);
}
}
}

private void mergeRegionCode(DingOrganization inner) {
inner.setDivisionCode("331199");
organizationService.updateById(inner);

List<DingOrganization> is = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getParentCode, inner.getOrganizationCode()));
if (CollUtil.isEmpty(is)) {
return;
}
for (DingOrganization i : is) {
mergeRegionCode(i);
}
}

@Test
public void businessStrip() {
String path = "/Users/wendy/Desktop/省市县条线单位梳理202303016.xlsx";
ExcelReader reader = ExcelUtil.getReader(path);
Set<String> orgCodes = new HashSet<>();
List<BelongOrg> belongOrgs = new ArrayList<>();
for (int i = 0; i < reader.getSheetCount(); i++) {
reader.setSheet(i);
List<Map<String, Object>> maps = reader.readAll();
for (Map<String, Object> map : maps) {
String cityName = MapUtil.getStr(map, "市级组织名称");
if (cityName == null || !cityName.contains("丽水")) {
continue;
}
String cityCode = MapUtil.getStr(map, "市级组织机构代码");
if (StrUtil.isBlank(cityCode)) {
continue;
}
String countyName = MapUtil.getStr(map, "区县组织名称");
if (StrUtil.isBlank(countyName)) {
continue;
}
String countyCode = MapUtil.getStr(map, "区县组织机构代码");
if (StrUtil.isBlank(countyCode)) {
continue;
}
System.out.printf("市级:%s -> %s 区县:%s -> %s\n", cityName, cityCode, countyName, countyCode);
BelongOrg county = new BelongOrg();
county.setBelongCode(cityCode);
county.setBelongName(cityName);
county.setOrgCode(countyCode);
county.setOrgName(countyName);
county.setOrgType(BelongTypeEnum.ORGANIZATION.name());
belongOrgs.add(county);
if (!orgCodes.add(cityCode)) {
continue;
}
BelongOrg city = new BelongOrg();
city.setBelongCode(cityCode);
city.setBelongName(cityName);
city.setOrgCode(cityCode);
city.setOrgName(cityName);
city.setOrgType(BelongTypeEnum.GOV_BUSINESS_STRIP.name());
belongOrgs.add(city);
}
belongOrgs.forEach(System.out::println);
}
belongOrgService.saveBatch(belongOrgs);
}

}

+ 0
- 26
hz-pm-api/src/test/java/com/ningdatech/pmapi/password/PasswordTest.java View File

@@ -1,26 +0,0 @@
package com.hz.pm.api.password;

import org.junit.Test;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
* @Classname PasswordTest
* @Description
* @Date 2023/8/2 17:39
* @Author PoffyZhang
*/
public class PasswordTest {

@Test
public void password(){
String mingwen = "ELgaCeHteZA8VJK8";

String miwen = "$2a$10$MT82RbInrIkRVL/GRS01Vew8AO6ICngOpbAGbdkWgSnYFhog5n8.q";

String encode = new BCryptPasswordEncoder().encode(mingwen);
boolean matches = new BCryptPasswordEncoder().matches(mingwen, encode);
System.out.println(encode);
System.out.println(matches);
}
}

+ 0
- 161
hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java View File

@@ -1,161 +0,0 @@
package com.hz.pm.api.projectCollection;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.gov.model.dto.GovBizProjectApplyDTO;
import com.hz.pm.api.gov.model.dto.GovBizProjectBaseinfoDTO;
import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO;
import com.hz.pm.api.gov.model.entity.*;
import com.hz.pm.api.gov.service.*;
import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.service.IProjectService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname ProjectCollectionTest
* @Description
* @Date 2023/9/7 15:08
* @Author PoffyZhang
*/
public class ProjectCollection2Test extends AppTests {

@Autowired
private IGovBizProjectBaseinfoService baseinfoService;

@Autowired
private IGovBizProjectApplyService applyService;

@Autowired
private IGovBizProjectApproveService approveService;

@Autowired
private IGovBizProjectCimplementService cimplementService;

@Autowired
private IGovBizProjectMimplementService mimplementService;

@Autowired
private IGovBizProjectProcureService procureService;

@Autowired
private GenerateProjectCodeUtil generateProjectCodeUtil;

@Autowired
private IProjectService projectService;

@Test
public void test(){
List<GovBizProjectBaseinfo> baseinfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE));

List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE));

List<String> projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList());

//查出重复的 重新去生成编号
List<String> baseProjIds = baseinfos.stream().map(GovBizProjectBaseinfo::getBaseProjId)
.filter(code -> projectCodes.contains(code))
.collect(Collectors.toList());

for(String baseProjId : baseProjIds){
GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectBaseinfo::getTongTime)
.last(BizConst.LIMIT_1));
GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectApply::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.isNull(baseinfo)){
System.out.println("项目不存在 直接下一个");
continue;
}
GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO();
saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class));
saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class));
String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO);

baseinfo.setBaseProjId(newProjId);
baseinfoService.updateById(baseinfo);
apply.setBaseProjId(newProjId);
applyService.updateById(apply);

GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectApprove::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(approve)){
approve.setBaseProjId(newProjId);
approveService.updateById(approve);
}


GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectCimplement::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(cimplement)){
cimplement.setBaseProjId(newProjId);
cimplement.setBaseBidCode(newProjId);
cimplementService.updateById(cimplement);
}

GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectMimplement::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(mimplement)){
mimplement.setBaseProjId(newProjId);
mimplement.setBaseBidCode(newProjId);
mimplementService.updateById(mimplement);
}

List<GovBizProjectProcure> procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId, baseProjId));

for(GovBizProjectProcure procure : procures){
procure.setBaseProjId(newProjId);
procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]);
procureService.updateById(procure);
}
}
}

@Test
public void test2(){
//恢复误删
String baseProjId = "33110000020220400117";

baseinfoService.update(Wrappers.lambdaUpdate(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjId,baseProjId)
.set(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE));

applyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId,baseProjId)
.set(GovBizProjectApply::getDeleted,Boolean.FALSE));

approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId,baseProjId)
.set(GovBizProjectApprove::getDeleted,Boolean.FALSE));

cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId,baseProjId)
.set(GovBizProjectCimplement::getDeleted,Boolean.FALSE));

mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId,baseProjId)
.set(GovBizProjectMimplement::getDeleted,Boolean.FALSE));

procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId,baseProjId)
.set(GovBizProjectProcure::getDeleted,Boolean.FALSE));
}
}

+ 0
- 168
hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection3Test.java View File

@@ -1,168 +0,0 @@
package com.hz.pm.api.projectCollection;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.gov.model.entity.*;
import com.hz.pm.api.gov.service.*;
import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil;
import com.hz.pm.api.projectlib.service.IProjectService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.*;
import java.util.List;
import java.util.Objects;

/**
* @Classname ProjectCollection3Test
* @Description
* @Date 2023/9/7 15:08
* @Author PoffyZhang
*/
@Slf4j
public class ProjectCollection3Test extends AppTests {

@Autowired
private IGovBizProjectBaseinfoService baseinfoService;

@Autowired
private IGovBizProjectApplyService applyService;

@Autowired
private IGovBizProjectApproveService approveService;

@Autowired
private IGovBizProjectCimplementService cimplementService;

@Autowired
private IGovBizProjectMimplementService mimplementService;

@Autowired
private IGovBizProjectProcureService procureService;

@Autowired
private GenerateProjectCodeUtil generateProjectCodeUtil;

@Autowired
private IProjectService projectService;

@Test
public void importData() throws Exception {
Workbook wb;
File f = new File("C:\\Users\\PoffyZhang\\Desktop\\恢复清单.xlsx");
wb = readExcel(new FileInputStream(f),f.getName());
Row row = null;
Integer successed = 0;
List<String> failed = Lists.newArrayList();
if(wb != null) {
//获取第一个sheet
Sheet sheet = wb.getSheetAt(0);
//获取最大行数
int rownum = sheet.getPhysicalNumberOfRows();

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

GovBizProjectBaseinfo baseinfo = new GovBizProjectBaseinfo();
//
String projName = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY;
log.info("projName :{}",projName);
GovBizProjectBaseinfo base = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjName, projName)
.last(BizConst.LIMIT_1));
if(Objects.isNull(base)){
log.info("没有匹配项目 :{}",projName);
failed.add(projName);
continue;
}
//否则 就去恢复
String baseProjId = base.getBaseProjId();
base.setDeleted(Boolean.FALSE);
baseinfoService.updateById(base);

GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(apply)){
apply.setDeleted(Boolean.FALSE);
applyService.updateById(apply);
}

GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(approve)){
approve.setDeleted(Boolean.FALSE);
approveService.updateById(approve);
}

GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(cimplement)){
cimplement.setDeleted(Boolean.FALSE);
cimplementService.updateById(cimplement);
}

GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(mimplement)){
mimplement.setDeleted(Boolean.FALSE);
mimplementService.updateById(mimplement);
}

List<GovBizProjectProcure> procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
if(CollUtil.isNotEmpty(procures)){
for(GovBizProjectProcure procure : procures){
procure.setDeleted(Boolean.FALSE);
procureService.updateById(procure);
}
}

successed ++;
}
}

log.info("导入完成 :{}个",successed);
log.info("导入失败 :{}",failed);
}

//这个下面是单独函数
public static Workbook readExcel(InputStream is, String extString){
Workbook wb = null;
extString = extString.substring(extString.lastIndexOf("."));
try {
if(".xls".equals(extString)){
return wb = new HSSFWorkbook(is);
}else if(".xlsx".equals(extString)){
return wb = new XSSFWorkbook(is);
}else {
return wb = null;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return wb;
}
}

+ 0
- 243
hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java View File

@@ -1,243 +0,0 @@
package com.hz.pm.api.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.basic.util.StrPool;
import com.ningdatech.log.model.domain.OptLog;
import com.ningdatech.log.service.OptLogService;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.gov.model.dto.GovBizProjectApplyDTO;
import com.hz.pm.api.gov.model.dto.GovBizProjectBaseinfoDTO;
import com.hz.pm.api.gov.model.dto.GovBizProjectSaveDTO;
import com.hz.pm.api.gov.model.entity.*;
import com.hz.pm.api.gov.service.*;
import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil;
import com.hz.pm.api.scheduler.task.SynProjectCollectionTask;
import com.hz.pm.api.scheduler.task.SynProjectCoreBizTask;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.net.UnknownHostException;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.time.temporal.Temporal;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

/**
* @Classname ProjectCollectionTest
* @Description
* @Date 2023/9/7 15:08
* @Author PoffyZhang
*/
public class ProjectCollectionTest extends AppTests {

@Autowired
private IGovBizProjectBaseinfoService baseinfoService;

@Autowired
private IGovBizProjectApplyService applyService;

@Autowired
private IGovBizProjectApproveService approveService;

@Autowired
private IGovBizProjectCimplementService cimplementService;

@Autowired
private IGovBizProjectMimplementService mimplementService;

@Autowired
private IGovBizProjectProcureService procureService;

@Autowired
private GenerateProjectCodeUtil generateProjectCodeUtil;

@Autowired
private SynProjectCollectionTask collectionTask;

@Autowired
private OptLogService optLogService;

@Autowired
private SynProjectCoreBizTask projectCoreBizTask;

@Test
public void test(){
List<String> baseProjIds = Lists.newArrayList("33118100020200100002");
for(String baseProjId : baseProjIds){
GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectBaseinfo::getTongTime)
.last(BizConst.LIMIT_1));
GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectApply::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.isNull(baseinfo)){
System.out.println("项目不存在 直接下一个");
continue;
}
GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO();
saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class));
saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class));
String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO);

baseinfo.setBaseProjId(newProjId);
baseinfoService.updateById(baseinfo);
apply.setBaseProjId(newProjId);
applyService.updateById(apply);

GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectApprove::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(approve)){
approve.setBaseProjId(newProjId);
approveService.updateById(approve);
}


GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectCimplement::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(cimplement)){
cimplement.setBaseProjId(newProjId);
cimplement.setBaseBidCode(newProjId);
cimplementService.updateById(cimplement);
}

GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId, baseProjId)
.orderByDesc(GovBizProjectMimplement::getTongTime)
.last(BizConst.LIMIT_1));
if(Objects.nonNull(mimplement)){
mimplement.setBaseProjId(newProjId);
mimplement.setBaseBidCode(newProjId);
mimplementService.updateById(mimplement);
}

List<GovBizProjectProcure> procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId, baseProjId));

for(GovBizProjectProcure procure : procures){
procure.setBaseProjId(newProjId);
procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]);
procureService.updateById(procure);
}
}
}

@Test
public void test2() throws UnknownHostException {
collectionTask.doTask();
}

@Test
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;
}
}
}
}
}

@Test
public void test5(){
List<GovBizProjectApply> list = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class)
.isNotNull(GovBizProjectApply::getBaseProjStartTime)
.isNotNull(GovBizProjectApply::getBaseProjEndTime)
.isNull(GovBizProjectApply::getBaseProjDuration));

for(GovBizProjectApply apply : list){
apply.setBaseProjDuration(convertMonth(apply.getBaseProjStartTime(),apply.getBaseProjEndTime()));
applyService.updateById(apply);
}
}

public static String convertMonth(LocalDateTime baseProjStartTime, LocalDateTime baseProjEndTime) {
Temporal temporal1 = baseProjStartTime.toLocalDate();
Temporal temporal2 = baseProjEndTime.toLocalDate();
// 方法返回为相差月份
Long ll = ChronoUnit.MONTHS.between(temporal1, temporal2);
return ll.toString();
}

@Test
public void test6(){
List<GovBizProjectProcure> list = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getDeleted,Boolean.FALSE));

for(GovBizProjectProcure procure : list){
try{
String index = procure.getBaseBidCode().split("-")[1];
procure.setBaseBidCode(procure.getBaseProjId() + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,Integer.parseInt(index)));
procureService.updateById(procure);
}catch (Exception e){
e.printStackTrace();
}
}
}

@Test
public void test7() throws UnknownHostException {
String orgCode = "GO_5f1f6f28a6f7484ea3b9991d8d02599f";
projectCoreBizTask.doTask(orgCode);
}
}

+ 0
- 163
hz-pm-api/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectRemoveTest.java View File

@@ -1,163 +0,0 @@
package com.hz.pm.api.projectCollection;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.portrait.model.entity.ProjectTag;
import com.hz.pm.api.portrait.service.IProjectTagService;
import com.hz.pm.api.projectdeclared.model.entity.Operation;
import com.hz.pm.api.projectdeclared.model.entity.PreInsAcceptancePerson;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.service.IOperationService;
import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService;
import com.hz.pm.api.projectdeclared.service.IPurchaseService;
import com.hz.pm.api.projectlib.model.entity.*;
import com.hz.pm.api.projectlib.service.*;
import com.hz.pm.api.safety.model.entity.PersonSafetyInfo;
import com.hz.pm.api.safety.model.entity.SupplierSafetyQualification;
import com.hz.pm.api.safety.service.IPersonSafetyInfoService;
import com.hz.pm.api.safety.service.ISupplierSafetyQualificationService;
import com.hz.pm.api.staging.model.entity.ProjectStaging;
import com.hz.pm.api.staging.service.IProjectStagingService;
import com.wflow.bean.entity.WflowCcTasks;
import com.wflow.service.WflowCcTasksService;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.stream.Collectors;

/**
* @Classname ProjectCollectionTest
* @Description
* @Date 2023/9/7 15:08
* @Author PoffyZhang
*/
public class ProjectRemoveTest extends AppTests {

@Autowired
private IProjectService projectService;

@Autowired
private IProjectApplicationService applicationService;

@Autowired
private IProjectInstService projectInstService;

@Autowired
private IProjectStagingService stagingService;

@Autowired
private INdProjectStatusChangeService statusChangeService;

@Autowired
private ISupplierSafetyQualificationService supplierSafetyQualificationService;

@Autowired
private IPersonSafetyInfoService personService;

@Autowired
private IOperationService operationService;

@Autowired
private IPurchaseService purchaseService;

@Autowired
private IProjectTagService projectTagService;

@Autowired
private IPreInsAcceptancePersonService preInsAcceptancePersonService;

@Autowired
private IProjectRenewalFundDeclarationService renewalFundDeclarationService;

@Autowired
private HistoryService historyService;

@Autowired
private RuntimeService runtimeService;

@Autowired
private WflowCcTasksService ccTasksService;

@Test
public void test(){
List<String> projectCodes = Lists.newArrayList("33110000020230100078","33110000020230100077");

for(String projectCode : projectCodes){
//项目
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, projectCode));

List<Long> projectIds = projects.stream().map(Project::getId).collect(Collectors.toList());

//1.删除应用
applicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,projectCode));

//2.删除相关流程
List<ProjectInst> projectInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIds));
for(ProjectInst projectInst : projectInsts){
//实例
try{
runtimeService.deleteProcessInstance(projectInst.getInstCode(),"删除");
}catch (Exception e){

}
try{
historyService.deleteHistoricProcessInstance(projectInst.getInstCode());
}catch (Exception e){

}
//抄送
ccTasksService.remove(Wrappers.lambdaQuery(WflowCcTasks.class)
.eq(WflowCcTasks::getInstanceId,projectInst.getInstCode()));
}
projectInstService.removeByIds(projectInsts.stream().map(ProjectInst::getId).collect(Collectors.toList()));

//3.删除实施表
operationService.remove(Wrappers.lambdaQuery(Operation.class)
.eq(Operation::getProjectCode,projectCode));

//4.删除续建项目资金表
renewalFundDeclarationService.remove(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.eq(ProjectRenewalFundDeclaration::getProjectCode,projectCode));

//5.暂存表
stagingService.remove(Wrappers.lambdaQuery(ProjectStaging.class)
.in(ProjectStaging::getProjectId,projectIds));

//6.状态变更表
statusChangeService.remove(Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getProjectId,projectIds));

//7.采购表
purchaseService.remove(Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId,projectIds));

//8.标签
projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class)
.eq(ProjectTag::getProjectCode,projectCode));

//9.初验人员
preInsAcceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class)
.in(PreInsAcceptancePerson::getProjectId,projectIds));

//10.供应商安全质量
supplierSafetyQualificationService.remove(Wrappers.lambdaQuery(SupplierSafetyQualification.class)
.eq(SupplierSafetyQualification::getProjectCode,projectCode));

//11.安全人员
personService.remove(Wrappers.lambdaQuery(PersonSafetyInfo.class)
.eq(PersonSafetyInfo::getProjectCode,projectCode));

//12.最后删除项目
projectService.remove(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, projectCode));
}
}

}

+ 0
- 24
hz-pm-api/src/test/java/com/ningdatech/pmapi/redis/RedisTest.java View File

@@ -1,24 +0,0 @@
package com.hz.pm.api.redis;

import com.ningdatech.cache.repository.CachePlusOps;
import com.hz.pm.api.AppTests;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

/**
* @Classname RedisTest
* @Description
* @Date 2023/8/31 17:45
* @Author PoffyZhang
*/
public class RedisTest extends AppTests {

@Autowired
private CachePlusOps cachePlusOps;

@Test
public void test1(){
Object o = cachePlusOps.get("irs:A331101453557202109017383:Fc3re2cq7r64Qfa7:refresh");
System.out.println(o.toString());
}
}

+ 0
- 42
hz-pm-api/src/test/java/com/ningdatech/pmapi/refund/ProjectRefundTest.java View File

@@ -1,42 +0,0 @@
package com.hz.pm.api.refund;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration;
import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService;
import com.hz.pm.api.projectlib.service.IProjectService;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Objects;

/**
* @Classname ProjectRefundTest
* @Description
* @Date 2023/9/7 15:08
* @Author PoffyZhang
*/
public class ProjectRefundTest extends AppTests {

@Autowired
private IProjectRenewalFundDeclarationService renewalFundDeclarationService;

@Autowired
private IProjectService projectService;

@Test
public void test(){
List<ProjectRenewalFundDeclaration> funds = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class));
for(ProjectRenewalFundDeclaration fund : funds){
if(StringUtils.isBlank(fund.getProjectCode())){
Project project = projectService.getById(fund.getProjectId());
if(Objects.nonNull(project)){
fund.setProjectCode(project.getProjectCode());
renewalFundDeclarationService.updateById(fund);
}
}
}
}
}

+ 0
- 85
hz-pm-api/src/test/java/com/ningdatech/pmapi/region/RegionTest.java View File

@@ -1,85 +0,0 @@
package com.hz.pm.api.region;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.helper.RegionCacheHelper;
import com.hz.pm.api.common.util.ExpertRegisterUtil;
import com.hz.pm.api.expert.constant.ExpertApplyStatusEnum;
import com.hz.pm.api.expert.constant.ExpertApplyTypeEnum;
import com.hz.pm.api.expert.controller.ExpertController;
import com.hz.pm.api.expert.entity.ExpertIntentionWorkRegion;
import com.hz.pm.api.expert.entity.ExpertMetaApply;
import com.hz.pm.api.expert.service.IExpertIntentionWorkRegionService;
import com.hz.pm.api.expert.service.IExpertMetaApplyService;
import com.hz.pm.api.meta.helper.DictionaryCache;
import com.hz.pm.api.meta.helper.TagCache;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import com.hz.pm.api.sys.model.entity.Region;
import com.hz.pm.api.sys.service.IRegionService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

/**
* @Classname RegionTest
* @Description
* @Date 2023/6/8 14:44
* @Author PoffyZhang
*/
public class RegionTest extends AppTests {

@Autowired
private IRegionService regionService;

@Test
public void test() {
Set<Region> set = regionService.list().stream().collect(Collectors.toSet());

Set<Long> ids = set.stream().map(Region::getId).collect(Collectors.toSet());

regionService.removeByIds(ids);

regionService.saveBatch(set);
}

@Autowired
private RegionCacheHelper regionCacheHelper;
@Autowired
private IDingOrganizationService organizationService;
@Autowired
private DictionaryCache dictionaryCache;
@Autowired
private TagCache tagCache;
@Autowired
private ExpertController expertController;

@Test
public void test1() {
System.out.println(regionCacheHelper.getByRegionName("浙江省-杭州市-滨江区"));
}

@Test
public void test2() {
String[] paths = {"/Users/wendy/Desktop/景宁县专家(1).xlsx",
"/Users/wendy/Desktop/专家基础信息归集表(遂昌县).xlsx",
"/Users/wendy/Desktop/专家基础信息归集表-缙云县.xlsx",
"/Users/wendy/Desktop/松阳专家汇总.xlsx",
"/Users/wendy/Desktop/青田县---专家基础信息归集表.xlsx"};
ExpertRegisterUtil.regionCacheHelper = regionCacheHelper;
ExpertRegisterUtil.tagCache = tagCache;
ExpertRegisterUtil.dictionaryCache = dictionaryCache;
ExpertRegisterUtil.organizationService = organizationService;
ExpertRegisterUtil.expertController = expertController;
for (String path : paths) {
ExpertRegisterUtil.registerExpertBatch(path);
}
}

}

+ 0
- 43
hz-pm-api/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java View File

@@ -1,43 +0,0 @@
package com.hz.pm.api.statemachine;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.statemachine.util.StateMachineUtils;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.service.IProjectService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

/**
* 状态机测试
*
* @author CMM
* @since 2023/02/08 11:46
*/

public class StateMachineTest extends AppTests {
@Autowired
private StateMachineUtils stateMachineUtils;

@Autowired
private IProjectService projectService;

@Test
public void stateMachineTest() {
Project project = projectService.getById(485);
stateMachineUtils.pass(project);
System.out.println(String.format("project:%s", JSON.toJSONString(project)));
projectService.updateById(project);
}

@Test
public void yyyyyy(){
Project project = projectService.getById(400);
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest,Boolean.FALSE)
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));
System.out.println(project);
}
}

+ 0
- 35
hz-pm-api/src/test/java/com/ningdatech/pmapi/stream/stream.java View File

@@ -1,35 +0,0 @@
package com.hz.pm.api.stream;

import org.flowable.task.api.history.HistoricTaskInstance;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
* @Classname stream
* @Description
* @Date 2023/4/3 14:52
* @Author PoffyZhang
*/
public class stream {

@Test
public void test(){
List<Integer> list = new ArrayList<>();
list.add(1);
list.add(2);
list.add(2);
list.add(3);
list.add(3);
list.add(1);
list.add(1);
list.add(1);

Set<Integer> set = list.stream().collect(Collectors.toSet());
System.out.println(set);
}

}

Loading…
Cancel
Save