|
|
@@ -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 "保存失败"; |
|
|
|
} |
|
|
|
} |