Browse Source

项目归集的草稿箱功能

master
PoffyZhang 1 year ago
parent
commit
3aae180fd6
15 changed files with 632 additions and 24 deletions
  1. +0
    -1
      pmapi/pom.xml
  2. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/contants/BizProjectContant.java
  3. +27
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java
  4. +255
    -16
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java
  5. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectDraftMapper.java
  6. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectSaveDTO.java
  7. +134
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectDraft.java
  8. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectDetailVO.java
  9. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectListVO.java
  10. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectDraftService.java
  11. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectDraftServiceImpl.java
  12. +1
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java
  13. +145
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/collection/SaveCollectionTest.java
  14. +3
    -3
      pmapi/src/test/resources/application-prod.yml
  15. +1
    -1
      pmapi/src/test/resources/application.yml

+ 0
- 1
pmapi/pom.xml View File

@@ -375,7 +375,6 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/dom4j-2.0.2.jar</systemPath>
</dependency>

</dependencies>
<!-- 打包 -->
<!--配置环境的profile-->


+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/contants/BizProjectContant.java View File

@@ -19,6 +19,10 @@ public interface BizProjectContant {
public static final String IS_EFFECTIVE = "02";
//有效
public static final String NOT_EFFECTIVE = "01";
public static final String DRAFT = "草稿";
public static final String OP_INSERT = "insert";
public static final String OP_UPDATE = "update";
public static final String OP_DELETE = "delete";
}

}

+ 27
- 1
pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java View File

@@ -62,7 +62,7 @@ public class GovProjectCollectionController {
@ApiOperation("项目归集保存")
@WebLog("项目归集保存")
public String save(@Valid @RequestBody GovBizProjectSaveDTO saveDTO) {
return collectionManage.save(saveDTO);
return collectionManage.save(saveDTO,null);
}

@PostMapping("/remove/{projId}")
@@ -72,6 +72,32 @@ public class GovProjectCollectionController {
return collectionManage.remove(projId);
}

@GetMapping("/draft-list")
@ApiOperation("项目归集草稿箱列表")
public PageVo<GovBizProjectListVO> draftList(ProjectListReq req) {
return collectionManage.draftList(req);
}

@GetMapping("/draft-detail/{draftId}")
@ApiOperation("项目归集草稿箱详情")
public GovBizProjectDetailVO draftDetail(@PathVariable Long draftId) {
return collectionManage.draftDetail(draftId);
}

@PostMapping("/draft")
@ApiOperation("项目归集暂存草稿箱")
@WebLog("项目归集暂存草稿箱")
public String draft(@Valid @RequestBody GovBizProjectSaveDTO saveDTO) {
return collectionManage.draft(saveDTO,null);
}

@PostMapping("/draft-remove/{draftId}")
@ApiOperation("项目归集草稿箱删除")
@WebLog("项目归集草稿箱删除")
public String draftRemove(@PathVariable Long draftId) {
return collectionManage.draftRemove(draftId);
}

@PostMapping("/push-task")
@ApiOperation("主动调用定时器方法")
@WebLog("主动调用定时器方法")


+ 255
- 16
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java View File

@@ -1,6 +1,7 @@
package com.ningdatech.pmapi.gov.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -71,6 +72,8 @@ public class GovProjectCollectionManage {

private final GenerateProjectCodeUtil generateProjectCodeUtil;

private final IGovBizProjectDraftService draftService;

private final RestTemplate restTemplate;

@Value("${project.push-url}")
@@ -152,6 +155,48 @@ public class GovProjectCollectionManage {
}

/**
* 草稿箱列表
* @param req
* @return
*/
public PageVo<GovBizProjectListVO> draftList(ProjectListReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
Page<GovBizProjectDraft> page = req.page();
LambdaQueryWrapper<GovBizProjectDraft> wrapper = Wrappers.lambdaQuery(GovBizProjectDraft.class)
.like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectDraft::getBaseProjName,req.getProjectName())
.like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectDraft::getBaseBuildDeprt,req.getBuildOrg())
.eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectDraft::getBaseAreaCode,req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST)
.eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectDraft::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST)
.gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectDraft::getTongTime,req.getCreateOnMin())
.le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectDraft::getTongTime,req.getCreateOnMax())
.eq(GovBizProjectDraft::getDeleted,Boolean.FALSE)
.eq(GovBizProjectDraft::getCreateId,user.getUserId())
.orderByDesc(GovBizProjectDraft::getBizTime);
draftService.page(page,wrapper);

if(CollUtil.isEmpty(page.getRecords())){
return PageVo.empty();
}

List<GovBizProjectListVO> res = page.getRecords().stream().map(p -> {
GovBizProjectListVO vo = new GovBizProjectListVO();
vo.setBaseAreaCode(p.getBaseAreaCode());
vo.setBaseAreaName(p.getBaseAreaName());
vo.setBaseBuildDeprt(p.getBaseBuildDeprt());
vo.setBaseBuildDeprtDing(p.getBaseBuildDeprtDing());
vo.setBaseProjId(p.getBaseProjId());
vo.setBaseProjName(p.getBaseProjName());
vo.setBaseProjDeclAmount(p.getBaseProjDeclAmount());
vo.setBaseProjTotalAmount(p.getBaseProjTotalAmount());
vo.setBaseProjSetYear(p.getBaseProjSetYear());
vo.setDraftId(p.getId());
return vo;
}).collect(Collectors.toList());

return PageVo.of(res,page.getTotal());
}

/**
* 数据权限
* @param wrapper
*/
@@ -250,20 +295,85 @@ public class GovProjectCollectionManage {
}

/**
* 草稿箱详情
* @param draftId
* @return
*/
public GovBizProjectDetailVO draftDetail(Long draftId) {
GovBizProjectDetailVO res = new GovBizProjectDetailVO();
//查询草稿表
GovBizProjectDraft draft = draftService.getById(draftId);

if(Objects.isNull(draft)){
return null;
}

//1.基本信息
res.setBaseProjId(draft.getBaseProjId());
res.setBaseProjName(draft.getBaseProjName());
res.setBaseinfo(BeanUtil.copyProperties(draft, GovBizProjectBaseinfoVO.class));

//2.申报信息
res.setApply(BeanUtil.copyProperties(draft, GovBizProjectApplyVO.class));

//3.再查 审批信息
res.setApprove(BeanUtil.copyProperties(draft, GovBizProjectApproveVO.class));

//4 对应查询 实施项目还是运维项目
GovBizProjectCimplementVO cimplementVo = BeanUtil.copyProperties(draft, GovBizProjectCimplementVO.class);
cimplementVo.setBaseChanFile(draft.getBaseChanFileCimplement());
cimplementVo.setBaseEstaSummFile(draft.getBaseEstaSummFileCimplement());
cimplementVo.setBaseEngineerPostpoFile(draft.getBaseEngineerPostpoFileCimplement());
cimplementVo.setBaseInforLevelFile(draft.getBaseInforLevelFileCimplement());
cimplementVo.setBasePasswAssessFile(draft.getBasePasswAssessFileCimplement());
cimplementVo.setBaseUserConsFile(draft.getBaseUserConsFileCimplement());
cimplementVo.setBaseThirdAcceptFile(draft.getBaseThirdAcceptFileCimplement());
cimplementVo.setBaseFinalExpertOpinionFile(draft.getBaseFinalExpertOpinionFileCimplement());
cimplementVo.setBaseLogAggregation(draft.getBaseLogAggregationCimplement());
cimplementVo.setBaseBusinessMetrics(draft.getBaseBusinessMetricsCimplement());
res.setCimplement(cimplementVo);
GovBizProjectMimplementVO mimplementVo = BeanUtil.copyProperties(draft, GovBizProjectMimplementVO.class);
mimplementVo.setBaseChanFile(draft.getBaseChanFileMimplement());
mimplementVo.setBaseEstaSummFile(draft.getBaseEstaSummFileMimplement());
mimplementVo.setBaseEngineerPostpoFile(draft.getBaseEngineerPostpoFileMimplement());
mimplementVo.setBaseInforLevelFile(draft.getBaseInforLevelFileMimplement());
mimplementVo.setBasePasswAssessFile(draft.getBasePasswAssessFileMimplement());
mimplementVo.setBaseUserConsFile(draft.getBaseUserConsFileMimplement());
mimplementVo.setBaseThirdAcceptFile(draft.getBaseThirdAcceptFileMimplement());
mimplementVo.setBaseFinalExpertOpinionFile(draft.getBaseFinalExpertOpinionFileMimplement());
mimplementVo.setBaseLogAggregation(draft.getBaseLogAggregationMimplement());
mimplementVo.setBaseBusinessMetrics(draft.getBaseBusinessMetricsMimplement());
res.setMimplement(mimplementVo);

//5.最后查询采购信息
if(StringUtils.isNotBlank(draft.getProcure())){
try{
res.setProcures(JSON.parseArray(draft.getProcure(),GovBizProjectProcureVO.class));
}catch (Exception e){
log.error("草稿箱采购出错:" + e.getMessage());
}
}

return res;
}

/**
* 项目归集保存
* @param saveDTO
* @return
*/
@Transactional
public String save(GovBizProjectSaveDTO saveDTO) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
public String save(GovBizProjectSaveDTO saveDTO,UserInfoDetails user) {
if(Objects.isNull(user)){
user = LoginUserUtil.loginUserDetail();
}

GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo();
String baseProjId = base.getBaseProjId();
String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST;
String baseProjName = base.getBaseProjName();
//如果是新增的话 要生成 项目编号
if(StringUtils.isBlank(baseProjId)){
if(StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)){
baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO);
}

@@ -288,11 +398,10 @@ public class GovProjectCollectionManage {
saveBase.setTongTime(LocalDateTime.now());
saveBase.setBaseAreaCode(baseAreaCode);
}
if(Objects.nonNull(saveBase.getBaseAreaCode())){
saveBase.setBaseAreaCode(saveBase.getBaseAreaCode() + BizConst.NINE_AREA_CODE_LAST);
}
saveBase.setAreaCode(RegionConst.RC_LS);
saveBase.setBizTime(LocalDateTime.now());
saveBase.setUpdateBy(user.getUsername());
saveBase.setUpdateOn(LocalDateTime.now());
baseinfoService.saveOrUpdate(saveBase);

// 2.保存 申报信息
@@ -313,6 +422,8 @@ public class GovProjectCollectionManage {
}
saveApply.setAreaCode(RegionConst.RC_LS);
saveApply.setBizTime(LocalDateTime.now());
saveApply.setUpdateBy(user.getUsername());
saveApply.setUpdateOn(LocalDateTime.now());
projectApplyService.saveOrUpdate(saveApply);
}

@@ -334,6 +445,8 @@ public class GovProjectCollectionManage {
}
saveApprove.setBizTime(LocalDateTime.now());
saveApprove.setAreaCode(RegionConst.RC_LS);
saveApprove.setUpdateBy(user.getUsername());
saveApprove.setUpdateOn(LocalDateTime.now());
approveService.saveOrUpdate(saveApprove);
}

@@ -356,6 +469,8 @@ public class GovProjectCollectionManage {
}
saveCimplement.setAreaCode(RegionConst.RC_LS);
saveCimplement.setBizTime(LocalDateTime.now());
saveCimplement.setUpdateBy(user.getUsername());
saveCimplement.setUpdateOn(LocalDateTime.now());
cimplementService.saveOrUpdate(saveCimplement);
}

@@ -382,6 +497,8 @@ public class GovProjectCollectionManage {
}
saveMimplement.setAreaCode(RegionConst.RC_LS);
saveMimplement.setBizTime(LocalDateTime.now());
saveMimplement.setUpdateBy(user.getUsername());
saveMimplement.setUpdateOn(LocalDateTime.now());
mimplementService.saveOrUpdate(saveMimplement);
}

@@ -402,6 +519,8 @@ public class GovProjectCollectionManage {
saveProcure.setAreaCode(RegionConst.RC_LS);
saveProcure.setTongTime(LocalDateTime.now());
saveProcure.setBizTime(LocalDateTime.now());
saveProcure.setUpdateBy(user.getUsername());
saveProcure.setUpdateOn(LocalDateTime.now());
procureService.save(saveProcure);
index++;
}
@@ -414,11 +533,109 @@ public class GovProjectCollectionManage {
}

/**
* 暂存草稿箱
* @param saveDTO
* @param user
* @return
*/
public String draft(GovBizProjectSaveDTO saveDTO, UserInfoDetails user) {
if(Objects.isNull(user)){
user = LoginUserUtil.loginUserDetail();
}

GovBizProjectDraft draft = new GovBizProjectDraft();
//草稿id
Long draftId = saveDTO.getDraftId();
String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST;
if(Objects.nonNull(draftId)){
GovBizProjectDraft oldDraft = draftService.getById(draftId);
VUtils.isTrue(Objects.isNull(oldDraft)).throwMessage("该草稿不存在!");
draft.setId(draftId);
}else{
draft.setTongTime(LocalDateTime.now());
draft.setBaseAreaCode(baseAreaCode);
draft.setCreateId(user.getUserId());
draft.setTongTime(LocalDateTime.now());
}

//1.保存基本信息
GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo();
String baseProjId = base.getBaseProjId();
String baseProjName = base.getBaseProjName();
//要生成 草稿的项目编号
if(StringUtils.isBlank(baseProjId)){
baseProjId = BizProjectContant.ProjectCollection.DRAFT;
}

BeanUtil.copyProperties(base, draft, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
draft.setBaseProjId(baseProjId);
draft.setBaseProjName(baseProjName);
draft.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE);
draft.setAreaCode(RegionConst.RC_LS);
draft.setBizTime(LocalDateTime.now());
draft.setUpdateBy(user.getUsername());
draft.setUpdateOn(LocalDateTime.now());
draft.setOp(BizProjectContant.ProjectCollection.OP_INSERT);

// 2.保存 申报信息
GovBizProjectApplyDTO apply = saveDTO.getApply();
BeanUtil.copyProperties(apply, draft, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));

// 3.保存 审批信息
GovBizProjectApproveDTO approve = saveDTO.getApprove();
BeanUtil.copyProperties(approve, draft, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));

// 4.保存 建设项目 实施信息
GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement();
BeanUtil.copyProperties(cimplement, draft, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
draft.setBaseBidCode(baseProjId + "-1");
draft.setBaseChanFileCimplement(cimplement.getBaseChanFile());
draft.setBaseLogAggregationCimplement(cimplement.getBaseLogAggregation());
draft.setBaseBusinessMetricsCimplement(cimplement.getBaseBusinessMetrics());
draft.setBaseEstaSummFileCimplement(cimplement.getBaseEstaSummFile());
draft.setBaseInforLevelFileCimplement(cimplement.getBaseInforLevelFile());
draft.setBaseEngineerPostpoFileCimplement(cimplement.getBaseEngineerPostpoFile());
draft.setBaseUserConsFileCimplement(cimplement.getBaseUserConsFile());
draft.setBasePasswAssessFileCimplement(cimplement.getBasePasswAssessFile());
draft.setBaseThirdAcceptFileCimplement(cimplement.getBaseThirdAcceptFile());
draft.setBaseFinalExpertOpinionFileCimplement(cimplement.getBaseFinalExpertOpinionFile());

// 5.保存 运维项目 实施信息
GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement();
BeanUtil.copyProperties(mimplement, draft, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
draft.setBaseLogAggregationMimplement(mimplement.getBaseLogAggregation());
draft.setBaseBusinessMetricsMimplement(mimplement.getBaseBusinessMetrics());
draft.setBaseChanFileMimplement(mimplement.getBaseChanFile());
draft.setBaseEstaSummFileMimplement(mimplement.getBaseEstaSummFile());
draft.setBaseInforLevelFileMimplement(mimplement.getBaseInforLevelFile());
draft.setBaseEngineerPostpoFileMimplement(mimplement.getBaseEngineerPostpoFile());
draft.setBaseThirdAcceptFileMimplement(mimplement.getBaseThirdAcceptFile());
draft.setBaseUserConsFileMimplement(mimplement.getBaseUserConsFile());
draft.setBaseFinalExpertOpinionFileCimplement(mimplement.getBaseFinalExpertOpinionFile());

// 6.保存 采购信息
List<GovBizProjectProcureDTO> procures = saveDTO.getProcures();
draft.setProcure(JSON.toJSONString(procures));

draftService.saveOrUpdate(draft);

return BizConst.SAVE_SUCCESS;
}

/**
* 删除项目归集
* @param projId
* @return
*/
public String remove(String projId) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
String username = user.getUsername();

GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjId, projId)
.last(BizConst.LIMIT_1));
@@ -430,22 +647,44 @@ public class GovProjectCollectionManage {
baseinfoService.updateById(baseinfo);
projectApplyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId,projId)
.set(GovBizProjectApply::getDeleted,Boolean.TRUE));
.set(GovBizProjectApply::getDeleted,Boolean.TRUE)
.set(GovBizProjectApply::getUpdateOn,LocalDateTime.now())
.set(GovBizProjectApply::getUpdateBy,username));
approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId,projId)
.set(GovBizProjectApprove::getDeleted,Boolean.TRUE));
.set(GovBizProjectApprove::getDeleted,Boolean.TRUE)
.set(GovBizProjectApprove::getUpdateOn,LocalDateTime.now())
.set(GovBizProjectApprove::getUpdateBy,username));
cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId,projId)
.set(GovBizProjectCimplement::getDeleted,Boolean.TRUE));
.set(GovBizProjectCimplement::getDeleted,Boolean.TRUE)
.set(GovBizProjectCimplement::getUpdateOn,LocalDateTime.now())
.set(GovBizProjectCimplement::getUpdateBy,username));
mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId,projId)
.set(GovBizProjectMimplement::getDeleted,Boolean.TRUE));
.set(GovBizProjectMimplement::getDeleted,Boolean.TRUE)
.set(GovBizProjectMimplement::getUpdateOn,LocalDateTime.now())
.set(GovBizProjectMimplement::getUpdateBy,username));
procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId,projId)
.set(GovBizProjectProcure::getDeleted,Boolean.TRUE));
.set(GovBizProjectProcure::getDeleted,Boolean.TRUE)
.set(GovBizProjectProcure::getUpdateOn,LocalDateTime.now())
.set(GovBizProjectProcure::getUpdateBy,username));
return BizConst.OP_SUCCESS;
}

/**
* 项目归集 草稿箱删除
* @param draftId
* @return
*/
public String draftRemove(Long draftId) {
if(draftService.removeById(draftId)){
return BizConst.OP_SUCCESS;
}
return BizConst.OP_FAIL;
}

private void checkName(String baseProjName, String baseProjId) {
VUtils.isTrue(baseinfoService.count(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjName,baseProjName)
@@ -514,17 +753,17 @@ public class GovProjectCollectionManage {

public void deleteAll() {
String url = deleteAllUrl;
try{
log.info("推送删除数据url {}",url);
try {
log.info("推送删除数据url {}", url);
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
headers.setContentType(type);
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity<String> formEntity = new HttpEntity<String>(null, headers);
ResponseEntity<String> response = restTemplate.postForEntity(url, formEntity, String.class);
log.info("推送删除结果 :{}",response);
}catch (Exception e){
log.info("推送删除失败,{}",e.getMessage());
log.info("推送删除结果 :{}", response);
} catch (Exception e) {
log.info("推送删除失败,{}", e.getMessage());
}
}
}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovBizProjectDraftMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.gov.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.gov.model.entity.GovBizProjectDraft;

/**
* <p>
* Mapper 接口
* </p>
*
* @author zpf
* @since 2023-08-23
*/
public interface GovBizProjectDraftMapper extends BaseMapper<GovBizProjectDraft> {

}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectSaveDTO.java View File

@@ -28,6 +28,9 @@ public class GovBizProjectSaveDTO implements Serializable {
@ApiModelProperty("基本项目名称")
private String baseProjName;

@ApiModelProperty("草稿id")
private Long draftId;

@ApiModelProperty("项目基本信息")
private GovBizProjectBaseinfoDTO baseinfo;



+ 134
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectDraft.java View File

@@ -0,0 +1,134 @@
package com.ningdatech.pmapi.gov.model.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
* @Classname GovBizProjectDraft
* @Description
* @Date 2023/9/5 11:05
* @Author PoffyZhang
*/
@Data
@TableName("gov_biz_project_draft")
@ApiModel(value = "GovBizProjectDraft", description = "草稿")
public class GovBizProjectDraft implements Serializable {
private static final long serialVersionUID = 1L;

private Long id;
private String baseProjId;
private String baseProjName;
private String baseAreaName;
private String baseAreaCode;
private String baseProjIsConfidentiality;
private String baseProjType;
private String baseConstructionType;
private String baseProjSetProg;
private String isEffective;
private String baseProvManDeprt;
private String baseProvManDeprtDing;
private String baseManDeprt;
private String baseManDeprtDing;
private String baseManDepartUsci;
private String baseBuildDeprt;
private String baseBuildDeprtDing;
private String baseBuildDepartUsci;
private String baseProjPrincipal;
private String baseProjPrincipalCall;
private String baseProjContacts;
private String baseProjContactsCall;
private Boolean deleted;

private String baseDevelopCode;
private String setProjCodeFinan;
private String baseHistorProjName;
private String baseHistorProjId;
private String baseHistorProjYear;
private String baseProjSys;
private String baseProjSysCode;
private String baseAccountAppName;
private String baseBrainName;
private String baseCoreBusiness;
private String baseCoreBusinessCode;
private LocalDateTime baseProjStartTime;
private LocalDateTime baseProjEndTime;
private LocalDateTime baseProjDuration;
private String baseProjSetYear;
private String baseProjAmountOri;
private String baseBasisAmountOri;
private BigDecimal baseProjTotalAmount;
private BigDecimal baseProjDeclAmount;
private String baseProjConsClass;
private String baseLowestLevel;
private String baseProjBasis;
private String baseBasisEstablish;
private String baseProjBasisFile;
private String baseProjIntro;
private String beseExpectedResults;
private String baseResearchReportFile;
private String baseProjApplyFile;
private String baseOperatMaintenFile;
private String baseProjOtherFile;
private String baseProjRemark;

private String baseReviewResults;
private String baseReviewOpinion;
private String baseReviewCommentsFile;
private BigDecimal baseExpertTotalMoney;
private BigDecimal baseExpertYearMoney;
private String approvalFile;
private BigDecimal baseInitialReviewTotalMoney;
private BigDecimal baseProjReplyAmount;
private String equalProtectionLevel;
private String preliminaryDesignScheme;
private String preliminaryDesignFile;
private BigDecimal releaseYearMoney;

private String baseBidCode;
private String baseBidNamet;

private String baseInitialOpinionFile;
private String baseInforLevelFileCimplement;
private String basePasswAssessFileCimplement;
private String baseThirdAcceptFileCimplement;
private String baseCheckFile;
private String baseFinanlAuditFile;
private String baseUserConsFileCimplement;
private String baseEstaSummFileCimplement;
private String baseIrsTestRunFile;
private String baseSummReportFile;
private String baseLogAggregationCimplement;
private String baseBusinessMetricsCimplement;
private String baseFinalExpertOpinionFileCimplement;
private String baseEngineerPostpoFileCimplement;
private String baseChangeFormFile;
private String baseChanFileCimplement;

private String baseInforLevelFileMimplement;
private String basePasswAssessFileMimplement;
private String baseThirdAcceptFileMimplement;
private String baseUserConsFileMimplement;
private String baseEstaSummFileMimplement;
private String baseOperatMaintenSummFile;
private String baseLogAggregationMimplement;
private String baseBusinessMetricsMimplement;
private String baseFinalExpertOpinionFileMimplement;
private String baseEngineerPostpoFileMimplement;
private String baseEngineerAlterFile;
private String baseChanFileMimplement;

private String procure;

private String areaCode;
private LocalDateTime bizTime;
private String op;
private LocalDateTime tongTime;
private boolean deleted;
private LocalDateTime updateOn;
private String updateBy;
private Long createId;
}

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

@@ -26,6 +26,9 @@ public class GovBizProjectDetailVO implements Serializable {
@ApiModelProperty("基本项目名称")
private String baseProjName;

@ApiModelProperty("草稿id")
private Long draftId;

@ApiModelProperty("项目基本信息")
private GovBizProjectBaseinfoVO baseinfo;



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

@@ -47,4 +47,7 @@ public class GovBizProjectListVO implements Serializable {

@ApiModelProperty("申报年度预算")
private BigDecimal baseProjDeclAmount;

@ApiModelProperty("草稿编号")
private Long draftId;
}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovBizProjectDraftService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.gov.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.gov.model.entity.GovBizProjectDraft;

/**
* <p>
* 服务类
* </p>
*
* @author zpf
* @since 2023-08-23
*/
public interface IGovBizProjectDraftService extends IService<GovBizProjectDraft> {

}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovBizProjectDraftServiceImpl.java View File

@@ -0,0 +1,21 @@
package com.ningdatech.pmapi.gov.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.gov.mapper.GovBizProjectDraftMapper;
import com.ningdatech.pmapi.gov.model.entity.GovBizProjectDraft;
import com.ningdatech.pmapi.gov.service.IGovBizProjectDraftService;
import org.springframework.stereotype.Service;

/**
* <p>
* 服务实现类
* </p>
*
* @author zpf
* @since 2023-08-23
*/
@Service
public class GovBizProjectDraftServiceImpl extends
ServiceImpl<GovBizProjectDraftMapper, GovBizProjectDraft> implements IGovBizProjectDraftService {

}

+ 1
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java View File

@@ -80,8 +80,7 @@ public class GenerateProjectCodeUtil {
VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!");
VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!");

String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode())?baseinfo.getBaseAreaCode(): RegionConst.RC_LS)
+ BizConst.NINE_AREA_CODE_LAST;
String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode())?baseinfo.getBaseAreaCode(): RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST);
// 获取建设年度 (10-13)
String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear()
: String.valueOf(LocalDateTime.now().getYear());


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

@@ -0,0 +1,145 @@
package com.ningdatech.pmapi.collection;

import com.alibaba.fastjson.JSON;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.gov.contants.BizProjectContant;
import com.ningdatech.pmapi.gov.manage.GovProjectCollectionManage;
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO;
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO;
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO;
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil;
import com.ningdatech.pmapi.user.security.auth.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;
}
}

+ 3
- 3
pmapi/src/test/resources/application-prod.yml View File

@@ -13,9 +13,9 @@ spring:
namespace: "spring:session"
redis:
timeout: 5000
host: 10.53.168.116
port: 6379
database: 0
host: 47.98.125.47
port: 26379
database: 4
password: Ndkj1234
jedis:
pool:


+ 1
- 1
pmapi/src/test/resources/application.yml View File

@@ -1,3 +1,3 @@
spring:
profiles:
active: dev
active: prod

Loading…
Cancel
Save