diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/QuotationSheetController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/QuotationSheetController.java similarity index 73% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/QuotationSheetController.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/QuotationSheetController.java index e1690738..ee3cd3f0 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/QuotationSheetController.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/QuotationSheetController.java @@ -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.iocoder.yudao.module.bs.service.suppliercompany.SupplierCompanyService; -import com.alibaba.fastjson.JSON; +import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +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 javax.annotation.Resource; 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.Operation; -import javax.validation.constraints.*; import javax.validation.*; import javax.servlet.http.*; 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 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.convert.quotationsheet.QuotationSheetConvert; -import cn.iocoder.yudao.module.bs.service.quotationsheet.QuotationSheetService; +import cn.iocoder.yudao.module.bpm.convert.quotationsheet.QuotationSheetConvert; +import cn.iocoder.yudao.module.bpm.service.quotationsheet.QuotationSheetService; @Tag(name = "管理后台 - 报价单") @RestController @@ -40,10 +45,17 @@ public class QuotationSheetController { @Resource private QuotationSheetService quotationSheetService; + @Resource + private ExpenseApplyTripService expenseApplyTripService; + + @Resource + @Lazy // 解决循环依赖 + private BpmTaskService taskService; + @PostMapping("/create") @Operation(summary = "创建报价单") @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:create')") - public CommonResult createQuotationSheet(@Valid @RequestBody QuotationSheetCreateReqVO createReqVO) { + public CommonResult createQuotationSheet(@RequestBody QuotationSheetCreateReqVO createReqVO) { return success(quotationSheetService.createQuotationSheet(createReqVO)); } @@ -70,7 +82,18 @@ public class QuotationSheetController { @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:query')") public CommonResult getQuotationSheet(@RequestParam("id") Long id) { QuotationSheetDO quotationSheet = quotationSheetService.getQuotationSheet(id); - return success(QuotationSheetConvert.INSTANCE.convert(quotationSheet)); + if (quotationSheet.getStatus().equals(QuotationSheetEnum.NOSUBMIT.getValue())) { + LambdaQueryWrapperX queryWrapper = new LambdaQueryWrapperX<>(); + queryWrapper.eq(ExpenseApplyTripDO::getApplyId, quotationSheet.getId()); + List 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") @@ -87,6 +110,12 @@ public class QuotationSheetController { @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:query')") public CommonResult> getQuotationSheetPage(@Valid QuotationSheetPageReqVO pageVO) { PageResult pageResult = quotationSheetService.getQuotationSheetPage(pageVO); + List list = pageResult.getList(); + if (CollUtil.isNotEmpty(list)) { + quotationSheetService.setNickNameField(list); + taskService.handleApprovalAuthority(list); + + } return success(QuotationSheetConvert.INSTANCE.convertPage(pageResult)); } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetBaseVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetBaseVO.java similarity index 96% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetBaseVO.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetBaseVO.java index f196d069..62130c0a 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetBaseVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetBaseVO.java @@ -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 io.swagger.v3.oas.annotations.media.Schema; @@ -57,7 +57,7 @@ public class QuotationSheetBaseVO { private Integer status; @Schema(description = "创建采购单审批流程实例的编号", example = "11202") - private Long processInstanceId; + private String processInstanceId; @Schema(description = "审核进度") private Integer auditProgress; @@ -98,6 +98,8 @@ public class QuotationSheetBaseVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime applyTime; + + @Schema(description = "申请人") private Long applicant; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java similarity index 72% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java index fcb5ec88..42e72732 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java @@ -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 lombok.*; import java.util.*; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExcelVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetExcelVO.java similarity index 95% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExcelVO.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetExcelVO.java index ad03b5ca..4b771b39 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExcelVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetExcelVO.java @@ -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 io.swagger.v3.oas.annotations.media.Schema; @@ -61,7 +61,7 @@ public class QuotationSheetExcelVO { private Integer status; @ExcelProperty("创建采购单审批流程实例的编号") - private Long processInstanceId; + private String processInstanceId; @ExcelProperty("审核进度") private Integer auditProgress; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExportReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetExportReqVO.java similarity index 97% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExportReqVO.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetExportReqVO.java index 949f9b87..b3dca342 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExportReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetExportReqVO.java @@ -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 lombok.*; @@ -97,6 +97,8 @@ public class QuotationSheetExportReqVO { @Schema(description = "申请人") private Long applicant; + + @Schema(description = "申请人部门id", example = "10907") private Long deptId; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetPageReqVO.java similarity index 98% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetPageReqVO.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetPageReqVO.java index d6721223..bd14a8ae 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetPageReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetPageReqVO.java @@ -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 lombok.*; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java similarity index 90% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java index 9909b7fa..b0dd9319 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java @@ -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.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; -import org.apache.poi.ss.formula.functions.T; import java.time.LocalDateTime; import java.util.List; @@ -24,6 +22,9 @@ public class QuotationSheetRespVO extends QuotationSheetBaseVO { @Schema(description = "创建时间") private LocalDateTime createTime; + + private Boolean isAuthorised = false; + /** * 供应商信息 */ diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java similarity index 93% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java index 7fdc3293..4ccd0d8c 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java @@ -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 io.swagger.v3.oas.annotations.media.Schema; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/quotationsheet/QuotationSheetConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/quotationsheet/QuotationSheetConvert.java similarity index 65% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/quotationsheet/QuotationSheetConvert.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/quotationsheet/QuotationSheetConvert.java index 75ed8f35..9ef715ba 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/quotationsheet/QuotationSheetConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/quotationsheet/QuotationSheetConvert.java @@ -1,12 +1,15 @@ -package cn.iocoder.yudao.module.bs.convert.quotationsheet; +package cn.iocoder.yudao.module.bpm.convert.quotationsheet; import java.util.*; 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.factory.Mappers; -import cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo.*; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; /** diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/quotationsheet/QuotationSheetMapper.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/quotationsheet/QuotationSheetMapper.java similarity index 97% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/quotationsheet/QuotationSheetMapper.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/quotationsheet/QuotationSheetMapper.java index de56f445..fad3f76b 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/quotationsheet/QuotationSheetMapper.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/quotationsheet/QuotationSheetMapper.java @@ -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 cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 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 org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo.*; /** * 报价单 Mapper @@ -45,7 +46,7 @@ public interface QuotationSheetMapper extends BaseMapperX { .eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent()) .betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime()) .eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant()) - .likeIfPresent(QuotationSheetDO::getSupplierIdAll,reqVO.getSupplierCompanyId()) + .eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId()) .likeIfPresent(QuotationSheetDO::getSupplierBiddingId, reqVO.getSupplierBiddingId()) .orderByDesc(QuotationSheetDO::getId)); @@ -113,6 +114,7 @@ public interface QuotationSheetMapper extends BaseMapperX { .eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent()) .betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime()) .eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant()) + // .likeIfPresent(QuotationSheetDO::getSupplierIdAll, reqVO.getSupplierCompanyId()) .eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId()) .orderByDesc(QuotationSheetDO::getId)); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/listener/QuotationSheetResultListener.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/listener/QuotationSheetResultListener.java new file mode 100644 index 00000000..badeb19c --- /dev/null +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/listener/QuotationSheetResultListener.java @@ -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 2023年08月28日 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()); + } +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetService.java similarity index 76% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetService.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetService.java index f9f456c4..ccca9928 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetService.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetService.java @@ -1,9 +1,12 @@ -package cn.iocoder.yudao.module.bs.service.quotationsheet; +package cn.iocoder.yudao.module.bpm.service.quotationsheet; import java.util.*; 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.framework.common.pojo.PageResult; import com.github.yulichang.base.MPJBaseService; @@ -94,4 +97,16 @@ public interface QuotationSheetService extends MPJBaseService * @return */ PageResult tendereeQuery(QuotationSheetPageReqVO pageVO); + + /** + * 流程回调 + * @param id + * @param result + */ + void processInstanceCallBack(long id, Integer result); + + + void setNickNameField(List list); + + void setDeptNameField(List toList); } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetServiceImpl.java similarity index 85% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetServiceImpl.java index 2176d99c..31811b49 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetServiceImpl.java @@ -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.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.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.quotationsheetbidding.QuotationSheetBiddingDO; 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.service.materiel.MaterielService; 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.QuotationSheetDetailServiceImpl; 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.dto.DeptRespDTO; 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.user.AdminUserApi; @@ -24,10 +29,9 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.yulichang.base.MPJBaseServiceImpl; -import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import javax.validation.Valid; + import org.springframework.validation.annotation.Validated; @@ -36,12 +40,11 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; 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.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.bs.convert.quotationsheet.QuotationSheetConvert; -import cn.iocoder.yudao.module.bs.dal.mysql.quotationsheet.QuotationSheetMapper; +import cn.iocoder.yudao.module.bpm.convert.quotationsheet.QuotationSheetConvert; +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.security.core.util.SecurityFrameworkUtils.getLoginUser; @@ -93,6 +96,8 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl 0){ //中间表插入数据 @@ -100,7 +105,18 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl 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(); } @@ -432,6 +448,45 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl list) { + List userIds = list.stream().map(QuotationSheetDO::getApplicant).distinct().collect(Collectors.toList()); + Map 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 toList) { + List deptIds = toList.stream().map(QuotationSheetDO::getDeptId).distinct().collect(Collectors.toList()); + Map deptMap = deptApi.getDeptList(deptIds).stream().collect(Collectors.toMap(DeptRespDTO::getId, dept -> dept.getName())); + for (QuotationSheetDO quotationSheetDO : toList) { + quotationSheetDO.setDeptName(deptMap.get(quotationSheetDO.getDeptId())); + } + } + /** * 编号生成方法 * @return @@ -439,15 +494,15 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl().like("number", companyNumber).orderByDesc("create_time").last("limit 1")); if (null!=supplierCompanyDO){ Long aLong = numKun(supplierCompanyDO.getNumber()); - companyNumber ="bjd"+(aLong+1); + companyNumber ="BJD"+(aLong+1); }else { companyNumber=companyNumber+"0000"; long l = numKun(companyNumber) + 1; - companyNumber ="bjd"+(numKun(companyNumber) + 1); + companyNumber ="BJD"+(numKun(companyNumber) + 1); } return companyNumber; } diff --git a/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/QuotationSheetEnum.java b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/QuotationSheetEnum.java new file mode 100644 index 00000000..c379f3ea --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/QuotationSheetEnum.java @@ -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; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/pom.xml b/yudao-module-bs/yudao-module-bs-biz/pom.xml index 2f4d6c7a..d0ed57b9 100644 --- a/yudao-module-bs/yudao-module-bs-biz/pom.xml +++ b/yudao-module-bs/yudao-module-bs-biz/pom.xml @@ -19,12 +19,15 @@ + cn.iocoder.boot yudao-module-bpm-api ${revision} + + cn.iocoder.boot yudao-spring-boot-starter-biz-tenant @@ -41,6 +44,12 @@ yudao-spring-boot-starter-biz-operatelog + + cn.iocoder.boot + yudao-module-bpm-api + ${revision} + + cn.iocoder.boot diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheet/QuotationSheetDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheet/QuotationSheetDO.java index 907d4a2d..02bddbb6 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheet/QuotationSheetDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheet/QuotationSheetDO.java @@ -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.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.quotationsheetdetail.QuotationSheetDetailDO; 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) private String tenantName; + + + + @TableField(exist = false) + private List expenseApplyTrips; + @TableField(exist = false) + private Boolean deleted; + @TableField(exist = false) + private String nickname; + @TableField(exist = false) + private String deptName; } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/materiel/MaterielServiceImpl.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/materiel/MaterielServiceImpl.java index 9f2be072..20606c95 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/materiel/MaterielServiceImpl.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/materiel/MaterielServiceImpl.java @@ -1,11 +1,8 @@ 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.JSONArray; import com.github.yulichang.base.MPJBaseServiceImpl; -import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated;