@@ -0,0 +1,32 @@ | |||
CREATE TABLE PUBLIC."nd_purchase" ( | |||
"id" BIGSERIAL NOT NULL, | |||
"project_id" int8, | |||
"create_on" TIMESTAMP, | |||
"update_on" TIMESTAMP, | |||
"create_by" VARCHAR(128), | |||
"update_by" VARCHAR(128), | |||
"supplier" VARCHAR(256) NOT NULL, | |||
"supplier_contact" VARCHAR(256), | |||
"supplier_contact_info" VARCHAR(256), | |||
"purchase_method" INT2, | |||
"transaction_amount" NUMERIC(12,2), | |||
"transaction_time" TIMESTAMP, | |||
"agency" VARCHAR(256), | |||
"bidding_doc" TEXT, | |||
"bid_doc" TEXT, | |||
"acceptance_letter" TEXT, | |||
CONSTRAINT "nd_purchase_PK" PRIMARY KEY ("id") | |||
); | |||
comment ON COLUMN nd_purchase.id IS 'id'; | |||
comment ON COLUMN nd_purchase.project_id IS '项目ID'; | |||
comment ON COLUMN nd_purchase.supplier IS '供应商'; | |||
comment ON COLUMN nd_purchase.supplier_contact IS '供应商联系人'; | |||
comment ON COLUMN nd_purchase.supplier_contact_info IS '供应商联系方式'; | |||
comment ON COLUMN nd_purchase.purchase_method IS '采购方式'; | |||
comment ON COLUMN nd_purchase.transaction_amount IS '成交金额'; | |||
comment ON COLUMN nd_purchase.transaction_time IS '成交时间'; | |||
comment ON COLUMN nd_purchase.agency IS '代理机构'; | |||
comment ON COLUMN nd_purchase.bidding_doc IS '投标文件'; | |||
comment ON COLUMN nd_purchase.bid_doc IS '招标文件'; | |||
comment ON COLUMN nd_purchase.acceptance_letter IS '中标通知书'; |
@@ -0,0 +1,61 @@ | |||
package com.ningdatech.pmapi.projectdeclared.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
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.vo.PurchaseVO; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.servlet.http.HttpServletResponse; | |||
/** | |||
* @Classname PurchaseController | |||
* @Description 申报项目-采购结果备案 | |||
* @Date 2023/5/29 09:29 | |||
* @Author PoffyZhang | |||
*/ | |||
@Slf4j | |||
@Validated | |||
@RestController | |||
@RequestMapping("/api/v1/declared/purchase") | |||
@Api(value = "PurchaseController", tags = "申报管理-采购结果备案") | |||
@RequiredArgsConstructor | |||
public class PurchaseController { | |||
private final PurchaseManage purchaseManage; | |||
private final ProjectAdjustmentManage projectAdjustmentManage; | |||
@ApiOperation(value = "待采购结果备案列表", notes = "待采购结果备案列表") | |||
@GetMapping("/project-list") | |||
public PageVo<ProjectLibListItemVO> projectlist(@ModelAttribute ProjectListReq req) { | |||
return purchaseManage.projectLibList(req); | |||
} | |||
@ApiOperation(value = "采购结果备案详情", notes = "采购结果备案详情") | |||
@GetMapping("/detail/{ProjectId}") | |||
public PurchaseVO detailByProjectId(@PathVariable Long ProjectId) { | |||
return purchaseManage.detailByProjectId(ProjectId); | |||
} | |||
@GetMapping("/export") | |||
@ApiOperation("待采购结果备案列表导出") | |||
public void exportList(ProjectListReq req, HttpServletResponse response){ | |||
ExcelDownUtil.downXls(response,req,purchaseManage::exportList); | |||
} | |||
@ApiOperation(value = "填写采购结果", notes = "填写采购结果") | |||
@PostMapping("/submit-result") | |||
public String submitResult(@Validated @RequestBody PurchaseSaveDTO dto) { | |||
return purchaseManage.submitResult(dto); | |||
} | |||
} |
@@ -0,0 +1,185 @@ | |||
package com.ningdatech.pmapi.projectdeclared.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
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.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.enumeration.ProjectProcessStageEnum; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | |||
import com.ningdatech.pmapi.common.util.ExcelExportStyle; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.*; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; | |||
import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService; | |||
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.exception.BusinessException; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.IOException; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.concurrent.atomic.AtomicInteger; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname PurchaseManage | |||
* @Description | |||
* @Date 2023/5/29 14:48 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@Slf4j | |||
@RequiredArgsConstructor | |||
public class PurchaseManage { | |||
private final IProjectService projectService; | |||
private final UserInfoHelper userInfoHelper; | |||
private final IPurchaseService purchaseService; | |||
/** | |||
* 待采购的-项目列表 | |||
* @param req | |||
* @return | |||
*/ | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//待采购状态 | |||
query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
return PageVo.empty(); | |||
} | |||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | |||
ProjectLibListItemVO item = new ProjectLibListItemVO(); | |||
item.setId(w.getId()); | |||
item.setProjectName(w.getProjectName()); | |||
item.setCreateOn(w.getCreateOn()); | |||
item.setDeclaredAmount(w.getDeclareAmount()); | |||
item.setStage(w.getStage()); | |||
item.setStatus(w.getStatus()); | |||
item.setProjectType(w.getProjectType()); | |||
item.setProjectYear(w.getProjectYear()); | |||
item.setBuildOrg(w.getBuildOrgName()); | |||
item.setBizDomain(w.getBizDomain()); | |||
item.setProcessStatus(w.getProcessStatus()); | |||
item.setInstCode(w.getInstCode()); | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
return item; | |||
}); | |||
return PageVo.of(records, total); | |||
} | |||
public void exportList(HttpServletResponse response, ProjectListReq param) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
//待采购状态 | |||
query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
List<Project> records = projectService.list(query); | |||
AtomicInteger serialNumber = new AtomicInteger(0); | |||
List<DeclaredProjectExportDTO> collect = records.stream().map(r -> { | |||
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); | |||
BeanUtils.copyProperties(r, exportDTO); | |||
exportDTO.setProjectTypeName(ProjectTypeEnum.getDesc(r.getProjectType())); | |||
exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); | |||
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); | |||
exportDTO.setCreateOn(createOnStr); | |||
exportDTO.setSerialNumber(serialNumber.incrementAndGet()); | |||
return exportDTO; | |||
}).collect(Collectors.toList()); | |||
String fileName = "采购结果待备案项目列表"; | |||
ExcelDownUtil.setFileName(fileName,response); | |||
//数据导出处理函数 | |||
try { | |||
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) | |||
.autoCloseStream(false) | |||
.registerWriteHandler(ExcelExportStyle.formalStyle()) | |||
.sheet(fileName) | |||
.doWrite(collect); | |||
} catch (IOException e) { | |||
throw new RuntimeException(e); | |||
} | |||
} | |||
/** | |||
* 获取采购结果备案详情 | |||
* @param projectId | |||
* @return | |||
*/ | |||
public PurchaseVO detailByProjectId(Long projectId) { | |||
Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class) | |||
.eq(Purchase::getProjectId, projectId) | |||
.last(BizConst.LIMIT_1)); | |||
return BeanUtil.copyProperties(purchase,PurchaseVO.class); | |||
} | |||
/** | |||
* 填写采购结果 | |||
* @param dto | |||
* @return | |||
*/ | |||
public String submitResult(PurchaseSaveDTO 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 projectInfo = projectService.getById(projectId); | |||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | |||
//首先要判断 项目当前状态 是不是 采购结果备案 | |||
VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.getCode().equals(projectInfo.getStatus()) || | |||
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(projectInfo.getStage())) | |||
.throwMessage("提交失败 该项目不是 待采购备案状态或者已立项阶段"); | |||
Purchase purchaseEntity = new Purchase(); | |||
Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class) | |||
.eq(Purchase::getProjectId, projectId) | |||
.last(BizConst.LIMIT_1)); | |||
BeanUtil.copyProperties(dto,purchaseEntity); | |||
if(Objects.isNull(purchase)){ | |||
purchaseEntity.setCreateOn(LocalDateTime.now()); | |||
purchaseEntity.setCreateBy(employeeCode); | |||
}else{ | |||
purchaseEntity.setId(purchase.getId()); | |||
} | |||
purchaseEntity.setProjectId(projectId); | |||
purchaseService.saveOrUpdate(purchaseEntity); | |||
return "填写成功"; | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.projectdeclared.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author zpf | |||
* @since 2023-02-05 | |||
*/ | |||
public interface PurchaseMapper extends BaseMapper<Purchase> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ningdatech.pmapi.projectdeclared.mapper.PurchaseMapper"> | |||
</mapper> |
@@ -0,0 +1,57 @@ | |||
package com.ningdatech.pmapi.projectdeclared.model.dto; | |||
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 | |||
*/ | |||
@ApiModel(value = "采购对象", description = "采购对象") | |||
@Data | |||
@AllArgsConstructor | |||
public class PurchaseSaveDTO { | |||
@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("成交时间") | |||
private LocalDateTime transactionTime; | |||
@ApiModelProperty("代理机构") | |||
private String agency; | |||
@ApiModelProperty("投标文件") | |||
private String biddingDoc; | |||
@ApiModelProperty("招标文件") | |||
private String bidDoc; | |||
@ApiModelProperty("中标通知书") | |||
private String acceptanceLetter; | |||
} |
@@ -0,0 +1,78 @@ | |||
package com.ningdatech.pmapi.projectdeclared.model.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import javax.validation.constraints.NotNull; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
/** | |||
* @Classname Purchase | |||
* @Description | |||
* @Date 2023/5/29 10:00 | |||
* @Author PoffyZhang | |||
*/ | |||
@TableName("nd_purchase") | |||
@ApiModel(value = "采购对象", description = "采购对象") | |||
@Data | |||
@AllArgsConstructor | |||
@NoArgsConstructor | |||
public class Purchase { | |||
@TableId(type = IdType.AUTO) | |||
@ApiModelProperty("id") | |||
private Long id; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("创建时间") | |||
private LocalDateTime createOn; | |||
@ApiModelProperty("修改时间") | |||
private LocalDateTime updateOn; | |||
@ApiModelProperty("创建人 工号") | |||
private String createBy; | |||
@ApiModelProperty("修改人 工号") | |||
private String updateBy; | |||
@ApiModelProperty("供应商") | |||
private String supplier; | |||
@ApiModelProperty("供应商联系人") | |||
private String supplierContact; | |||
@ApiModelProperty("供应商联系方式") | |||
private String supplierContactInfo; | |||
@ApiModelProperty("采购方式 1公开招标 2自行采购") | |||
private Integer purchaseMethod; | |||
@ApiModelProperty("成交金额") | |||
private BigDecimal transactionAmount; | |||
@ApiModelProperty("成交时间") | |||
private LocalDateTime transactionTime; | |||
@ApiModelProperty("代理机构") | |||
private String agency; | |||
@ApiModelProperty("投标文件") | |||
private String biddingDoc; | |||
@ApiModelProperty("招标文件") | |||
private String bidDoc; | |||
@ApiModelProperty("中标通知书") | |||
private String acceptanceLetter; | |||
} |
@@ -0,0 +1,70 @@ | |||
package com.ningdatech.pmapi.projectdeclared.model.vo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Data; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
/** | |||
* @Classname Purchase | |||
* @Description | |||
* @Date 2023/5/29 10:00 | |||
* @Author PoffyZhang | |||
*/ | |||
@ApiModel(value = "采购对象", description = "采购对象") | |||
@Data | |||
@AllArgsConstructor | |||
public class PurchaseVO { | |||
@ApiModelProperty("id") | |||
private Long id; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("创建时间") | |||
private LocalDateTime createOn; | |||
@ApiModelProperty("修改时间") | |||
private LocalDateTime updateOn; | |||
@ApiModelProperty("创建人 工号") | |||
private String createBy; | |||
@ApiModelProperty("修改人 工号") | |||
private String updateBy; | |||
@ApiModelProperty("供应商") | |||
private String supplier; | |||
@ApiModelProperty("供应商联系人") | |||
private String supplierContact; | |||
@ApiModelProperty("供应商联系方式") | |||
private String supplierContactInfo; | |||
@ApiModelProperty("采购方式 1公开招标 2自行采购") | |||
private Integer purchaseMethod; | |||
@ApiModelProperty("成交金额") | |||
private BigDecimal transactionAmount; | |||
@ApiModelProperty("成交时间") | |||
private LocalDateTime transactionTime; | |||
@ApiModelProperty("代理机构") | |||
private String agency; | |||
@ApiModelProperty("投标文件") | |||
private String biddingDoc; | |||
@ApiModelProperty("招标文件") | |||
private String bidDoc; | |||
@ApiModelProperty("中标通知书") | |||
private String acceptanceLetter; | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.projectdeclared.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author zpf | |||
* @since 2023-05-29 | |||
*/ | |||
public interface IPurchaseService extends IService<Purchase> { | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.ningdatech.pmapi.projectdeclared.service.impl; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.ningdatech.pmapi.projectdeclared.mapper.PurchaseMapper; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; | |||
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 服务实现类 | |||
* </p> | |||
* | |||
* @author zpf | |||
* @since 2023-02-05 | |||
*/ | |||
@Service | |||
public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> | |||
implements IPurchaseService { | |||
} |
@@ -230,7 +230,9 @@ public class TodoCenterManage { | |||
} | |||
private String findSubProcessName(ProcessTaskVo d) { | |||
if(StringUtils.isBlank(d.getProcessDefId())){ | |||
return null; | |||
} | |||
BpmnModel bpmnModel = repositoryService.getBpmnModel(d.getProcessDefId()); | |||
if(Objects.nonNull(bpmnModel)){ | |||