Bladeren bron

优化

master
WendyYang 1 jaar geleden
bovenliggende
commit
15317e9470
3 gewijzigde bestanden met toevoegingen van 131 en 1 verwijderingen
  1. +9
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PurchaseController.java
  2. +60
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java
  3. +62
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTOV1.java

+ 9
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PurchaseController.java Bestand weergeven

@@ -6,6 +6,7 @@ import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectdeclared.manage.ProjectAdjustmentManage;
import com.ningdatech.pmapi.projectdeclared.manage.PurchaseManage;
import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTOV1;
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
@@ -55,11 +56,18 @@ public class PurchaseController {
ExcelDownUtil.downXls(response, req, purchaseManage::exportList);
}

@ApiOperation(value = "填写采购结果", notes = "填写采购结果")
/*@ApiOperation(value = "填写采购结果", notes = "填写采购结果")
@WebLog("填写采购结果")
@PostMapping("/submit-result")
public String submitResult(@Validated @RequestBody PurchaseSaveDTO dto) {
return purchaseManage.submitResult(dto);
}*/

@ApiOperation(value = "填写采购结果", notes = "填写采购结果")
@WebLog("填写采购结果")
@PostMapping("/submit-result")
public String submitResult(@Validated @RequestBody PurchaseSaveDTOV1 dto) {
return purchaseManage.submitResultV1(dto);
}




+ 60
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java Bestand weergeven

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Assert;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.ningdatech.basic.exception.BizException;
@@ -11,12 +12,14 @@ import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.common.util.ExcelExportStyle;
import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTOV1;
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase;
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO;
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService;
@@ -226,4 +229,61 @@ public class PurchaseManage {

return "保存失败";
}

/**
* 填写采购结果
*
* @param dto
* @return
*/
public String submitResultV1(PurchaseSaveDTOV1 dto) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
String employeeCode = user.getEmployeeCode();
VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!");

Long projectId = dto.getProjectId();
VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!");
Project project = projectService.getNewProject(dto.getProjectId());
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!");

//首先要判断 项目当前状态 是不是 采购结果备案
VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.eq(project.getStatus())
|| !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage()))
.throwMessage("提交失败 该项目不是 待采购备案状态或者已立项阶段");

Purchase purchase1 = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class)
.eq(Purchase::getProjectId, projectId)
.last(BizConst.LIMIT_1));
Purchase purchase = BeanUtil.copyProperties(dto, Purchase.class);
if (purchase1 == null) {
purchase.setCreateBy(employeeCode);
purchase.setCreateOn(LocalDateTime.now());
}
purchase.setProjectId(projectId);

if (purchaseService.saveOrUpdate(purchase)) {
// 如果 需要推送项目和应用管理的话 只有遂昌县才有
// String areaCode = project.getAreaCode();
// String appCode = dto.getAppCode();
// if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){
// try{
//
// }catch (Exception e){
// log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage());
// }
// }
//进入到下一状态
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());

// 获取总的成交时间及金额
project.setTransactionAmount(purchase.getTransactionAmount());
project.setTransactionTime(purchase.getTransactionTime());
projectService.updateById(project);

return "填写成功";
}

return "保存失败";
}
}

+ 62
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTOV1.java Bestand weergeven

@@ -0,0 +1,62 @@
package com.ningdatech.pmapi.projectdeclared.model.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
* @Classname Purchase
* @Description
* @Date 2023/5/29 10:00
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "采购对象", description = "采购对象")
@AllArgsConstructor
public class PurchaseSaveDTOV1 {

@ApiModelProperty("项目ID")
@NotNull(message = "请传项目ID")
private Long projectId;

@ApiModelProperty("供应商")
private String supplier;

@ApiModelProperty("供应商联系人")
private String supplierContact;

@ApiModelProperty("供应商联系方式")
private String supplierContactInfo;

@ApiModelProperty("采购方式 1公开招标 2自行采购")
private Integer purchaseMethod;

@ApiModelProperty("成交金额")
private BigDecimal transactionAmount;

@ApiModelProperty("成交时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime transactionTime;

@ApiModelProperty("代理机构")
private String agency;

@ApiModelProperty("投标文件")
private String biddingDoc;

@ApiModelProperty("招标文件")
private String bidDoc;

@ApiModelProperty("中标通知书")
private String acceptanceLetter;

@ApiModelProperty("应用编码")
private String appCode;

}

Laden…
Annuleren
Opslaan