-报价流程

new
Agoni 1 year ago
parent b8c337de51
commit 2fdff9e477

@ -1,8 +1,14 @@
package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet; package cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet;
import cn.iocoder.yudao.module.bs.service.materiel.MaterielService; import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.module.bs.service.suppliercompany.SupplierCompanyService; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.alibaba.fastjson.JSON; import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.*;
import cn.iocoder.yudao.module.bpm.service.expenseapplytrip.ExpenseApplyTripService;
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO;
import cn.iocoder.yudao.module.bs.enums.QuotationSheetEnum;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -11,7 +17,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*; import javax.validation.*;
import javax.servlet.http.*; import javax.servlet.http.*;
import java.util.*; import java.util.*;
@ -26,10 +31,10 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo.*;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO;
import cn.iocoder.yudao.module.bs.convert.quotationsheet.QuotationSheetConvert; import cn.iocoder.yudao.module.bpm.convert.quotationsheet.QuotationSheetConvert;
import cn.iocoder.yudao.module.bs.service.quotationsheet.QuotationSheetService; import cn.iocoder.yudao.module.bpm.service.quotationsheet.QuotationSheetService;
@Tag(name = "管理后台 - 报价单") @Tag(name = "管理后台 - 报价单")
@RestController @RestController
@ -40,10 +45,17 @@ public class QuotationSheetController {
@Resource @Resource
private QuotationSheetService quotationSheetService; private QuotationSheetService quotationSheetService;
@Resource
private ExpenseApplyTripService expenseApplyTripService;
@Resource
@Lazy // 解决循环依赖
private BpmTaskService taskService;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建报价单") @Operation(summary = "创建报价单")
@PreAuthorize("@ss.hasPermission('bs:quotation-sheet:create')") @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:create')")
public CommonResult<Long> createQuotationSheet(@Valid @RequestBody QuotationSheetCreateReqVO createReqVO) { public CommonResult<Long> createQuotationSheet(@RequestBody QuotationSheetCreateReqVO createReqVO) {
return success(quotationSheetService.createQuotationSheet(createReqVO)); return success(quotationSheetService.createQuotationSheet(createReqVO));
} }
@ -70,7 +82,18 @@ public class QuotationSheetController {
@PreAuthorize("@ss.hasPermission('bs:quotation-sheet:query')") @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:query')")
public CommonResult<QuotationSheetRespVO> getQuotationSheet(@RequestParam("id") Long id) { public CommonResult<QuotationSheetRespVO> getQuotationSheet(@RequestParam("id") Long id) {
QuotationSheetDO quotationSheet = quotationSheetService.getQuotationSheet(id); QuotationSheetDO quotationSheet = quotationSheetService.getQuotationSheet(id);
return success(QuotationSheetConvert.INSTANCE.convert(quotationSheet)); if (quotationSheet.getStatus().equals(QuotationSheetEnum.NOSUBMIT.getValue())) {
LambdaQueryWrapperX<ExpenseApplyTripDO> queryWrapper = new LambdaQueryWrapperX<>();
queryWrapper.eq(ExpenseApplyTripDO::getApplyId, quotationSheet.getId());
List<ExpenseApplyTripDO> list = expenseApplyTripService.list(queryWrapper);
quotationSheet.setExpenseApplyTrips(list);
}
quotationSheetService.setNickNameField(CollUtil.toList(quotationSheet));
quotationSheetService.setDeptNameField(CollUtil.toList(quotationSheet));
taskService.handleApprovalAuthority(CollUtil.toList(quotationSheet));
QuotationSheetRespVO sheetRespVO =QuotationSheetConvert.INSTANCE.convert(quotationSheet);
return success(sheetRespVO);
} }
@GetMapping("/list") @GetMapping("/list")
@ -87,6 +110,12 @@ public class QuotationSheetController {
@PreAuthorize("@ss.hasPermission('bs:quotation-sheet:query')") @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:query')")
public CommonResult<PageResult<QuotationSheetRespVO>> getQuotationSheetPage(@Valid QuotationSheetPageReqVO pageVO) { public CommonResult<PageResult<QuotationSheetRespVO>> getQuotationSheetPage(@Valid QuotationSheetPageReqVO pageVO) {
PageResult<QuotationSheetDO> pageResult = quotationSheetService.getQuotationSheetPage(pageVO); PageResult<QuotationSheetDO> pageResult = quotationSheetService.getQuotationSheetPage(pageVO);
List<QuotationSheetDO> list = pageResult.getList();
if (CollUtil.isNotEmpty(list)) {
quotationSheetService.setNickNameField(list);
taskService.handleApprovalAuthority(list);
}
return success(QuotationSheetConvert.INSTANCE.convertPage(pageResult)); return success(QuotationSheetConvert.INSTANCE.convertPage(pageResult));
} }

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; package cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo;
import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.common.pojo.ImageVo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@ -57,7 +57,7 @@ public class QuotationSheetBaseVO {
private Integer status; private Integer status;
@Schema(description = "创建采购单审批流程实例的编号", example = "11202") @Schema(description = "创建采购单审批流程实例的编号", example = "11202")
private Long processInstanceId; private String processInstanceId;
@Schema(description = "审核进度") @Schema(description = "审核进度")
private Integer auditProgress; private Integer auditProgress;
@ -98,6 +98,8 @@ public class QuotationSheetBaseVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime applyTime; private LocalDateTime applyTime;
@Schema(description = "申请人") @Schema(description = "申请人")
private Long applicant; private Long applicant;

@ -1,7 +1,5 @@
package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; package cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo;
import cn.iocoder.yudao.module.bs.controller.admin.quotationsheetdetail.vo.QuotationSheetDetailBaseVO;
import cn.iocoder.yudao.module.bs.controller.admin.quotationsheetdetail.vo.QuotationSheetDetailCreateReqVO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; package cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo;
import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.common.pojo.ImageVo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@ -61,7 +61,7 @@ public class QuotationSheetExcelVO {
private Integer status; private Integer status;
@ExcelProperty("创建采购单审批流程实例的编号") @ExcelProperty("创建采购单审批流程实例的编号")
private Long processInstanceId; private String processInstanceId;
@ExcelProperty("审核进度") @ExcelProperty("审核进度")
private Integer auditProgress; private Integer auditProgress;

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; package cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo;
import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.common.pojo.ImageVo;
import lombok.*; import lombok.*;
@ -97,6 +97,8 @@ public class QuotationSheetExportReqVO {
@Schema(description = "申请人") @Schema(description = "申请人")
private Long applicant; private Long applicant;
@Schema(description = "申请人部门id", example = "10907") @Schema(description = "申请人部门id", example = "10907")
private Long deptId; private Long deptId;

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; package cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo;
import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.common.pojo.ImageVo;
import lombok.*; import lombok.*;

@ -1,13 +1,11 @@
package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; package cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import org.apache.poi.ss.formula.functions.T;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@ -24,6 +22,9 @@ public class QuotationSheetRespVO extends QuotationSheetBaseVO {
@Schema(description = "创建时间") @Schema(description = "创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
private Boolean isAuthorised = false;
/** /**
* *
*/ */

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; package cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;

@ -1,12 +1,15 @@
package cn.iocoder.yudao.module.bs.convert.quotationsheet; package cn.iocoder.yudao.module.bpm.convert.quotationsheet;
import java.util.*; import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetCreateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetExcelVO;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetUpdateReqVO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo.*;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO;
/** /**

@ -1,13 +1,14 @@
package cn.iocoder.yudao.module.bs.dal.mysql.quotationsheet; package cn.iocoder.yudao.module.bpm.dal.mysql.quotationsheet;
import java.util.*; import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetExportReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetPageReqVO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo.*;
/** /**
* Mapper * Mapper
@ -45,7 +46,7 @@ public interface QuotationSheetMapper extends BaseMapperX<QuotationSheetDO> {
.eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent()) .eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent())
.betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime()) .betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime())
.eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant()) .eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant())
.likeIfPresent(QuotationSheetDO::getSupplierIdAll,reqVO.getSupplierCompanyId())
.eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId()) .eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId())
.likeIfPresent(QuotationSheetDO::getSupplierBiddingId, reqVO.getSupplierBiddingId()) .likeIfPresent(QuotationSheetDO::getSupplierBiddingId, reqVO.getSupplierBiddingId())
.orderByDesc(QuotationSheetDO::getId)); .orderByDesc(QuotationSheetDO::getId));
@ -113,6 +114,7 @@ public interface QuotationSheetMapper extends BaseMapperX<QuotationSheetDO> {
.eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent()) .eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent())
.betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime()) .betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime())
.eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant()) .eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant())
// .likeIfPresent(QuotationSheetDO::getSupplierIdAll, reqVO.getSupplierCompanyId()) // .likeIfPresent(QuotationSheetDO::getSupplierIdAll, reqVO.getSupplierCompanyId())
.eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId()) .eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId())
.orderByDesc(QuotationSheetDO::getId)); .orderByDesc(QuotationSheetDO::getId));

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.bpm.service.oa.listener;
import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEvent;
import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventListener;
import cn.iocoder.yudao.module.bpm.service.quotationsheet.QuotationSheetService;
import cn.iocoder.yudao.module.bpm.service.quotationsheet.QuotationSheetServiceImpl;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
*
* @author MrFang
* @date 20230828 10:42
*/
@Component
public class QuotationSheetResultListener extends BpmProcessInstanceResultEventListener{
@Resource
private QuotationSheetService quotationSheetService;
@Override
protected String getProcessDefinitionKey() {
return QuotationSheetServiceImpl.PROCESS_KEY;
}
@Override
protected void onEvent(BpmProcessInstanceResultEvent event) {
quotationSheetService.processInstanceCallBack(Long.parseLong(event.getBusinessKey()), event.getResult());
}
}

@ -1,9 +1,12 @@
package cn.iocoder.yudao.module.bs.service.quotationsheet; package cn.iocoder.yudao.module.bpm.service.quotationsheet;
import java.util.*; import java.util.*;
import javax.validation.*; import javax.validation.*;
import cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo.*;
import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetCreateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetExportReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetPageReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetUpdateReqVO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import com.github.yulichang.base.MPJBaseService; import com.github.yulichang.base.MPJBaseService;
@ -94,4 +97,16 @@ public interface QuotationSheetService extends MPJBaseService<QuotationSheetDO>
* @return * @return
*/ */
PageResult<QuotationSheetDO> tendereeQuery(QuotationSheetPageReqVO pageVO); PageResult<QuotationSheetDO> tendereeQuery(QuotationSheetPageReqVO pageVO);
/**
*
* @param id
* @param result
*/
void processInstanceCallBack(long id, Integer result);
void setNickNameField(List<QuotationSheetDO> list);
void setDeptNameField(List<QuotationSheetDO> toList);
} }

@ -1,21 +1,26 @@
package cn.iocoder.yudao.module.bs.service.quotationsheet; package cn.iocoder.yudao.module.bpm.service.quotationsheet;
import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetCreateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetExportReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetPageReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetUpdateReqVO;
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
import cn.iocoder.yudao.module.bs.dal.dataobject.materiel.MaterielDO; import cn.iocoder.yudao.module.bs.dal.dataobject.materiel.MaterielDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO;
import cn.iocoder.yudao.module.bs.enums.QuotationSheetEnum;
import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO;
import cn.iocoder.yudao.module.bs.service.materiel.MaterielService; import cn.iocoder.yudao.module.bs.service.materiel.MaterielService;
import cn.iocoder.yudao.module.bs.service.quotationsheetbidding.QuotationSheetBiddingService; import cn.iocoder.yudao.module.bs.service.quotationsheetbidding.QuotationSheetBiddingService;
import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailService; import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailService;
import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailServiceImpl;
import cn.iocoder.yudao.module.bs.service.suppliercompany.SupplierCompanyService; import cn.iocoder.yudao.module.bs.service.suppliercompany.SupplierCompanyService;
import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import cn.iocoder.yudao.module.system.api.tenant.TenantApi; import cn.iocoder.yudao.module.system.api.tenant.TenantApi;
import cn.iocoder.yudao.module.system.api.tenant.dto.TenantDTO; import cn.iocoder.yudao.module.system.api.tenant.dto.TenantDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
@ -24,10 +29,9 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.base.MPJBaseServiceImpl; import com.github.yulichang.base.MPJBaseServiceImpl;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -36,12 +40,11 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo.*;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.bs.convert.quotationsheet.QuotationSheetConvert; import cn.iocoder.yudao.module.bpm.convert.quotationsheet.QuotationSheetConvert;
import cn.iocoder.yudao.module.bs.dal.mysql.quotationsheet.QuotationSheetMapper; import cn.iocoder.yudao.module.bpm.dal.mysql.quotationsheet.QuotationSheetMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
@ -93,6 +96,8 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
AdminUserRespDTO user = adminUserApi.getUser(loginUser.getId()); AdminUserRespDTO user = adminUserApi.getUser(loginUser.getId());
quotationSheet.setDeptId(user.getDeptId()); quotationSheet.setDeptId(user.getDeptId());
quotationSheet.setApplicant(loginUser.getId()); quotationSheet.setApplicant(loginUser.getId());
quotationSheet.setQuotationStatus(1);
quotationSheet.setStatus("0");
saveOrUpdate(quotationSheet); saveOrUpdate(quotationSheet);
if (createReqVO.getQuotationDetails().size() > 0){ if (createReqVO.getQuotationDetails().size() > 0){
//中间表插入数据 //中间表插入数据
@ -100,7 +105,18 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
quotationSheetDetailDO.setCompanyId(quotationSheet.getId()); quotationSheetDetailDO.setCompanyId(quotationSheet.getId());
} }
quotationSheetDetailService.saveBatch(createReqVO.getQuotationDetails()); quotationSheetDetailService.saveBatch(createReqVO.getQuotationDetails());
}
if (quotationSheet.getStatus().equals(QuotationSheetEnum.NOSUBMIT.getValue())) {
Map<String, Object> variables = new HashMap<>();
// variables.put("type", quotationSheet.getType());
variables.put("name", quotationSheet.getProductName());
// variables.put("number",quotationSheet.getNumber());
// variables.put("deptId", quotationSheet.getDeptId());
String processInstanceId = processInstanceApi.createProcessInstance(quotationSheet.getApplicant(),
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
.setVariables(variables).setBusinessKey(String.valueOf(quotationSheet.getId())));
updateById(new QuotationSheetDO().setId(quotationSheet.getId()).setProcessInstanceId(processInstanceId));
} }
return quotationSheet.getId(); return quotationSheet.getId();
} }
@ -432,6 +448,45 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
return sheetDOPageResult; return sheetDOPageResult;
} }
@Override
public void processInstanceCallBack(long id, Integer result) {
QuotationSheetDO apply = getById(id);
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
//审核通过
apply.setQuotationStatus(3);
apply.setStatus(QuotationSheetEnum.APPROVE.getValue());
updateById(apply);
} else if (BpmProcessInstanceResultEnum.REJECT.getResult().equals(result)) {
//驳回
apply.setQuotationStatus(2);
apply.setStatus(QuotationSheetEnum.APPROVE.getValue());
updateById(apply);
}else if (BpmProcessInstanceResultEnum.CANCEL.getResult().equals(result)) {
//驳回
apply.setQuotationStatus(1);
apply.setStatus(QuotationSheetEnum.APPROVE.getValue());
updateById(apply);
}
}
@Override
public void setNickNameField(List<QuotationSheetDO> list) {
List<Long> userIds = list.stream().map(QuotationSheetDO::getApplicant).distinct().collect(Collectors.toList());
Map<Long, String> userMap = adminUserApi.getUserList(userIds).stream().collect(Collectors.toMap(AdminUserRespDTO::getId, user -> user.getNickname()));
for (QuotationSheetDO quotationSheetDO : list) {
quotationSheetDO.setNickname(userMap.get(quotationSheetDO.getApplicant()));
}
}
@Override
public void setDeptNameField(List<QuotationSheetDO> toList) {
List<Long> deptIds = toList.stream().map(QuotationSheetDO::getDeptId).distinct().collect(Collectors.toList());
Map<Long, String> deptMap = deptApi.getDeptList(deptIds).stream().collect(Collectors.toMap(DeptRespDTO::getId, dept -> dept.getName()));
for (QuotationSheetDO quotationSheetDO : toList) {
quotationSheetDO.setDeptName(deptMap.get(quotationSheetDO.getDeptId()));
}
}
/** /**
* *
* @return * @return
@ -439,15 +494,15 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
private String numberCreate(){ private String numberCreate(){
long currentTime = System.currentTimeMillis(); long currentTime = System.currentTimeMillis();
Date date = new Date(currentTime); Date date = new Date(currentTime);
String companyNumber="bjd"+ DateUtils.dateToStr(DateUtils.FORMAT_HOUR_MINUT,date); String companyNumber="BJD"+ DateUtils.dateToStr(DateUtils.FORMAT_HOUR_MINUT,date);
QuotationSheetDO supplierCompanyDO = quotationSheetMapper.selectOne(new QueryWrapper<QuotationSheetDO>().like("number", companyNumber).orderByDesc("create_time").last("limit 1")); QuotationSheetDO supplierCompanyDO = quotationSheetMapper.selectOne(new QueryWrapper<QuotationSheetDO>().like("number", companyNumber).orderByDesc("create_time").last("limit 1"));
if (null!=supplierCompanyDO){ if (null!=supplierCompanyDO){
Long aLong = numKun(supplierCompanyDO.getNumber()); Long aLong = numKun(supplierCompanyDO.getNumber());
companyNumber ="bjd"+(aLong+1); companyNumber ="BJD"+(aLong+1);
}else { }else {
companyNumber=companyNumber+"0000"; companyNumber=companyNumber+"0000";
long l = numKun(companyNumber) + 1; long l = numKun(companyNumber) + 1;
companyNumber ="bjd"+(numKun(companyNumber) + 1); companyNumber ="BJD"+(numKun(companyNumber) + 1);
} }
return companyNumber; return companyNumber;
} }

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.bs.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
*/
@AllArgsConstructor
@Getter
public enum QuotationSheetEnum {
NOSUBMIT("0", "未提交"),
PROCESS("1", "待审核"),
APPROVE("2", "通过"),
REJECT("3", "驳回"),
CANCEL("4", "取消");
/**
*
*/
private final String value;
/**
*
*/
private final String name;
}

@ -19,12 +19,15 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-bpm-api</artifactId> <artifactId>yudao-module-bpm-api</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
@ -41,6 +44,12 @@
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-bpm-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- Web 相关 --> <!-- Web 相关 -->
<dependency> <dependency>
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet;
import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.common.pojo.ImageVo;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO;
@ -85,11 +86,11 @@ public class QuotationSheetDO extends TenantBaseDO {
/** /**
* *
*/ */
private Integer status; private String status;
/** /**
* *
*/ */
private Long processInstanceId; private String processInstanceId;
/** /**
* *
*/ */
@ -191,4 +192,15 @@ public class QuotationSheetDO extends TenantBaseDO {
@TableField(exist = false) @TableField(exist = false)
private String tenantName; private String tenantName;
@TableField(exist = false)
private List<ExpenseApplyTripDO> expenseApplyTrips;
@TableField(exist = false)
private Boolean deleted;
@TableField(exist = false)
private String nickname;
@TableField(exist = false)
private String deptName;
} }

@ -1,11 +1,8 @@
package cn.iocoder.yudao.module.bs.service.materiel; package cn.iocoder.yudao.module.bs.service.materiel;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO;
import cn.iocoder.yudao.module.bs.dal.mysql.quotationsheet.QuotationSheetMapper;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.github.yulichang.base.MPJBaseServiceImpl; import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;

Loading…
Cancel
Save