diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/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 index 0ba4a9f2..40ae19aa 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/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,10 +1,14 @@ package cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet; import cn.hutool.core.collection.CollUtil; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONException; +import cn.hutool.json.JSONObject; 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.quotationsheetbidding.QuotationSheetBiddingService; 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; @@ -48,6 +52,9 @@ public class QuotationSheetController { @Resource private ExpenseApplyTripService expenseApplyTripService; + @Resource + private QuotationSheetBiddingService quotationSheetBiddingService; + @Resource @Lazy // 解决循环依赖 private BpmTaskService taskService; @@ -96,6 +103,27 @@ public class QuotationSheetController { return success(sheetRespVO); } + + @GetMapping("/getBidding") + @Operation(summary = "获得中标报价单详情") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:query')") + public CommonResult getBidding(@RequestParam("id") Long id) { + QuotationSheetDO quotationSheet = quotationSheetService.getQuotationSheet(id); + 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); + } + quotationSheetBiddingService.setNickNameField(CollUtil.toList(quotationSheet)); + quotationSheetBiddingService.setDeptNameField(CollUtil.toList(quotationSheet)); + taskService.handleApprovalAuthority2(CollUtil.toList(quotationSheet)); + + QuotationSheetRespVO sheetRespVO =QuotationSheetConvert.INSTANCE.convert(quotationSheet); + return success(sheetRespVO); + } + @GetMapping("/list") @Operation(summary = "获得报价单列表") @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") @@ -105,6 +133,8 @@ public class QuotationSheetController { return success(QuotationSheetConvert.INSTANCE.convertList(list)); } + + @GetMapping("/page") @Operation(summary = "获得报价单分页") @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:query')") @@ -114,7 +144,6 @@ public class QuotationSheetController { if (CollUtil.isNotEmpty(list)) { quotationSheetService.setNickNameField(list); taskService.handleApprovalAuthority(list); - } return success(QuotationSheetConvert.INSTANCE.convertPage(pageResult)); } @@ -137,6 +166,11 @@ public class QuotationSheetController { @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:query')") public CommonResult> pageBidding(@Valid QuotationSheetPageReqVO pageVO) { PageResult pageResult = quotationSheetService.getQuotationSheetPageBidding(pageVO); + List list = pageResult.getList(); + if (CollUtil.isNotEmpty(list)) { + quotationSheetService.setNickNameField(list); + taskService.handleApprovalAuthority(list); + } return success(QuotationSheetConvert.INSTANCE.convertPage(pageResult)); } @@ -145,7 +179,7 @@ public class QuotationSheetController { @Operation(summary = "中标审批发起接口") // @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:approvalBidding')") public CommonResult approvalBidding(@RequestBody QuotationSheetUpdateReqVO pageVO) { - return success(quotationSheetService.approvalBidding(pageVO)); + return success(quotationSheetBiddingService.approvalBidding(pageVO)); } @PutMapping("/releaseFlag") diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/bpm/core/event/BpmProcessInstanceResultEventListener.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/bpm/core/event/BpmProcessInstanceResultEventListener.java index c2b21539..493bd491 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/bpm/core/event/BpmProcessInstanceResultEventListener.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/bpm/core/event/BpmProcessInstanceResultEventListener.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.bpm.framework.bpm.core.event; import cn.hutool.core.util.StrUtil; +import com.fasterxml.jackson.core.JsonProcessingException; import org.springframework.context.ApplicationListener; /** @@ -29,6 +30,6 @@ public abstract class BpmProcessInstanceResultEventListener * * @param event 事件 */ - protected abstract void onEvent(BpmProcessInstanceResultEvent event); + protected abstract void onEvent(BpmProcessInstanceResultEvent event) ; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/listener/QuotationSheetBiddingResultListener.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/listener/QuotationSheetBiddingResultListener.java index ac6db313..4a1b758e 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/listener/QuotationSheetBiddingResultListener.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/listener/QuotationSheetBiddingResultListener.java @@ -4,6 +4,9 @@ import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceRe 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 cn.iocoder.yudao.module.bpm.service.quotationsheetbidding.QuotationSheetBiddingService; +import cn.iocoder.yudao.module.bpm.service.quotationsheetbidding.QuotationSheetBiddingServiceImpl; +import com.fasterxml.jackson.core.JsonProcessingException; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -16,15 +19,15 @@ import javax.annotation.Resource; @Component public class QuotationSheetBiddingResultListener extends BpmProcessInstanceResultEventListener{ @Resource - private QuotationSheetService quotationSheetService; + private QuotationSheetBiddingService quotationSheetBiddingService; @Override protected String getProcessDefinitionKey() { - return QuotationSheetServiceImpl.BIDDING_KEY; + return QuotationSheetBiddingServiceImpl.BIDDING_KEY; } @Override - protected void onEvent(BpmProcessInstanceResultEvent event) { - quotationSheetService.processInstanceCallBack2(Long.parseLong(event.getBusinessKey()), event.getResult()); + protected void onEvent(BpmProcessInstanceResultEvent event) { + quotationSheetBiddingService.processInstanceCallBack(Long.parseLong(event.getBusinessKey()), event.getResult()); } } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetService.java index cbee85c8..7c34f06e 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetService.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetService.java @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationS 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.fasterxml.jackson.core.JsonProcessingException; import com.github.yulichang.base.MPJBaseService; import liquibase.pro.packaged.S; @@ -24,8 +25,7 @@ public interface QuotationSheetService extends MPJBaseService //报价单流程ID public static final String PROCESS_KEY = "quotation_sheet_seq"; - //报价单中标流程 - public static final String BIDDING_KEY = "quotation_sheet_bidding"; + /** * 创建报价单 * @@ -88,12 +88,7 @@ public interface QuotationSheetService extends MPJBaseService */ PageResult getQuotationSheetPageBidding(QuotationSheetPageReqVO pageVO); - /** - * 报价单中标发起审批 - * @param pageVO - * @return - */ - String approvalBidding(QuotationSheetUpdateReqVO pageVO); + /** * 供应商招标列表 @@ -109,12 +104,6 @@ public interface QuotationSheetService extends MPJBaseService */ void processInstanceCallBack(long id, Integer result); - /** - * 报价单中标流程回调 - * @param id - * @param result - */ - void processInstanceCallBack2(long id, Integer result); void setNickNameField(List list); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetServiceImpl.java index 67516cfc..091d6ee7 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheet/QuotationSheetServiceImpl.java @@ -29,12 +29,16 @@ 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.dto.AdminUserRespDTO; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import com.github.yulichang.base.MPJBaseServiceImpl; -import liquibase.pro.packaged.S; import org.flowable.engine.runtime.ProcessInstance; +import org.json.JSONArray; +import org.json.JSONObject; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -81,6 +85,7 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl 0){ @@ -446,24 +450,7 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl variables = new HashMap<>(); - variables.put("bidding", JSON.toJSONString(pageVO.getQuotationSheetBiddingDOList())); - //variables.put("name", quotationSheet.getProductName()); - // variables.put("number",quotationSheet.getNumber()); - // variables.put("deptId", quotationSheet.getDeptId()); - String processInstanceId = processInstanceApi.createProcessInstance(questionDO.getApplicant(), - new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY) - .setVariables(variables).setBusinessKey(String.valueOf(questionDO.getId()))); - updateById(new QuotationSheetDO().setId(questionDO.getId()).setProcessId(processInstanceId)); - return processInstanceId; - } - return null; - } + @Override public PageResult tendereeQuery(QuotationSheetPageReqVO pageVO) { @@ -501,36 +488,8 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl>>>>>>>"+proces.getProcessVariables().get("bidding")); - if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) { - //通过 - quotationShe.setBiddingStatus(QuotationSheetBiddingEnum.CONFIRM.getValue()); - updateById(quotationShe); - } else if (BpmProcessInstanceResultEnum.REJECT.getResult().equals(result)) { - //驳回 - quotationShe.setBiddingStatus(QuotationSheetBiddingEnum.ABANDON.getValue()); - updateById(quotationShe); - }else if (BpmProcessInstanceResultEnum.CANCEL.getResult().equals(result)) { - //驳回 - quotationShe.setBiddingStatus(QuotationSheetBiddingEnum.NO_CONFIRM.getValue()); - updateById(quotationShe); - } - - - - - - } - @Override public void setNickNameField(List list) { List userIds = list.stream().map(QuotationSheetDO::getApplicant).distinct().collect(Collectors.toList()); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheetbidding/QuotationSheetBiddingService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheetbidding/QuotationSheetBiddingService.java index 993aa747..0082b417 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheetbidding/QuotationSheetBiddingService.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheetbidding/QuotationSheetBiddingService.java @@ -3,10 +3,12 @@ package cn.iocoder.yudao.module.bpm.service.quotationsheetbidding; import java.util.*; import javax.validation.*; +import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetUpdateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheetbidding.vo.QuotationSheetBiddingCreateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheetbidding.vo.QuotationSheetBiddingExportReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheetbidding.vo.QuotationSheetBiddingPageReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheetbidding.vo.QuotationSheetBiddingUpdateReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import com.github.yulichang.base.MPJBaseService; @@ -72,4 +74,23 @@ public interface QuotationSheetBiddingService extends MPJBaseService getQuotationSheetBiddingList(QuotationSheetBiddingExportReqVO exportReqVO); + /** + * 报价单审核流程回调 + * @param id + * @param result + */ + void processInstanceCallBack(long id, Integer result); + + + /** + * 报价单中标发起审批 + * @param pageVO + * @return + */ + String approvalBidding(QuotationSheetUpdateReqVO pageVO); + + + void setNickNameField(List list); + + void setDeptNameField(List toList); } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheetbidding/QuotationSheetBiddingServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheetbidding/QuotationSheetBiddingServiceImpl.java index 9d0d7e72..556dced6 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheetbidding/QuotationSheetBiddingServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/quotationsheetbidding/QuotationSheetBiddingServiceImpl.java @@ -1,19 +1,35 @@ package cn.iocoder.yudao.module.bpm.service.quotationsheetbidding; +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.dto.BpmProcessInstanceCreateReqDTO; +import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheet.vo.QuotationSheetUpdateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheetbidding.vo.QuotationSheetBiddingCreateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheetbidding.vo.QuotationSheetBiddingExportReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheetbidding.vo.QuotationSheetBiddingPageReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.quotationsheetbidding.vo.QuotationSheetBiddingUpdateReqVO; +import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; +import cn.iocoder.yudao.module.bpm.service.quotationsheet.QuotationSheetService; +import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; +import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; +import cn.iocoder.yudao.module.bs.enums.QuotationSheetBiddingEnum; 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; +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import com.github.yulichang.base.MPJBaseServiceImpl; +import org.flowable.engine.runtime.ProcessInstance; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; import java.util.*; +import java.util.stream.Collectors; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -22,6 +38,7 @@ import cn.iocoder.yudao.module.bpm.convert.quotationsheetbidding.QuotationSheetB import cn.iocoder.yudao.module.bpm.dal.mysql.quotationsheetbidding.QuotationSheetBiddingMapper; 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.module.bs.enums.ErrorCodeConstants.*; /** @@ -33,6 +50,8 @@ import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.*; @Validated public class QuotationSheetBiddingServiceImpl extends MPJBaseServiceImpl implements QuotationSheetBiddingService { + //报价单中标流程 + public static final String BIDDING_KEY = "quotation_sheet_bidding"; @Resource private QuotationSheetBiddingMapper quotationSheetBiddingMapper; @@ -42,6 +61,22 @@ public class QuotationSheetBiddingServiceImpl extends MPJBaseServiceImpl biddingList = null; + try { + //获取中标报价数据 + biddingList = (List) proces.getProcessVariables().get("bidding"); + } catch (Exception e) { + biddingList = new ArrayList<>(); + e.printStackTrace(); + } + + if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) { + //通过 + if (biddingList!=null){ + biddingList.forEach(biddingId->{ + QuotationSheetBiddingDO quotationSheetBiddingDO = getById(biddingId); + //中标赋值 + quotationSheetBiddingDO.setIsWin(1); + this.updateById(quotationSheetBiddingDO); + }); + } + + quotationShe.setBiddingStatus(QuotationSheetBiddingEnum.CONFIRM.getValue()); + quotationSheetService.updateById(quotationShe); + } else if (BpmProcessInstanceResultEnum.REJECT.getResult().equals(result)) { + //驳回 + quotationShe.setBiddingStatus(QuotationSheetBiddingEnum.ABANDON.getValue()); + quotationSheetService.updateById(quotationShe); + }else if (BpmProcessInstanceResultEnum.CANCEL.getResult().equals(result)) { + //驳回 + quotationShe.setBiddingStatus(QuotationSheetBiddingEnum.NO_CONFIRM.getValue()); + quotationSheetService.updateById(quotationShe); + } + } + + @Override + public String approvalBidding(QuotationSheetUpdateReqVO pageVO) { + QuotationSheetDO questionDO = quotationSheetService.getById(pageVO.getId()); + //发起实例 + if (questionDO.getBiddingStatus().equals(QuotationSheetBiddingEnum.PRIMED_FOR_ACTION.getValue())) { + Map variables = new HashMap<>(); + variables.put("bidding", pageVO.getApprovalBiddingIdList()); + LoginUser loginUser = getLoginUser(); + String processInstanceId = processInstanceApi.createProcessInstance(questionDO.getApplicant(), + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(BIDDING_KEY) + .setVariables(variables).setBusinessKey(String.valueOf(questionDO.getId()))); + quotationSheetService.updateById(new QuotationSheetDO().setId(questionDO.getId()).setProcessId(processInstanceId).setUserId(loginUser.getId())); + return processInstanceId; + } + return null; + } + + @Override + public void setNickNameField(List list) { + List userIds = list.stream().map(QuotationSheetDO::getUserId).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())); + } + } } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskService.java index f9047554..c1ebad6d 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskService.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskService.java @@ -130,4 +130,6 @@ public interface BpmTaskService { void updateTaskExtAssign(Task task); List handleApprovalAuthority(List list); + + List handleApprovalAuthority2(List list); } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java index d99fcf48..1324e0c7 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java @@ -372,4 +372,35 @@ public class BpmTaskServiceImpl implements BpmTaskService { } return list; } + + @Override + public List handleApprovalAuthority2(List list) { + if (CollUtil.isNotEmpty(list)) { + for (T t : list) { + Object processInstanceId = ReflectUtil.getFieldValue(t, "processId"); + if (processInstanceId != null) { + List taskList = historyService.createHistoricTaskInstanceQuery() + .processInstanceId(Convert.toStr(processInstanceId)) + .taskTenantId(TenantContextHolder.getTenantId().toString()) + .list(); + if (CollUtil.isNotEmpty(taskList)) { + //endtime为null表示未结束的task + List taskIdS = taskList.stream().filter(tk -> tk.getEndTime() == null).map(HistoricTaskInstance::getId).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(taskIdS)) { + LambdaQueryWrapperX wrapperX = new LambdaQueryWrapperX<>(); + wrapperX.in(BpmTaskExtDO::getTaskId, taskIdS); + wrapperX.in(BpmTaskExtDO::getAssigneeUserId, SecurityFrameworkUtils.getLoginUserId()); + boolean exists = taskExtMapper.exists(wrapperX); + if (exists) { + t.setIsAuthorised(true); + } else { + t.setIsAuthorised(false); + } + } + } + } + } + } + return list; + } } 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 db486663..bf6949bf 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 @@ -184,6 +184,11 @@ public class QuotationSheetDO extends TenantBaseDO { */ private String processId; + /** + * 中标申请人 + */ + private Long userId; + /** * 物料信息集合 */ diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetbidding/QuotationSheetBiddingDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetbidding/QuotationSheetBiddingDO.java index 77c2a3c3..22f8c246 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetbidding/QuotationSheetBiddingDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetbidding/QuotationSheetBiddingDO.java @@ -83,6 +83,8 @@ public class QuotationSheetBiddingDO extends BaseDO { * 是否中标 */ private Integer isWin; + + /** * 附件 */