Commit 532aedf755cb7e236845389a3ae9fc078c1a03af

Authored by 房远帅
1 parent f9e67472

楚江ERP:草稿要车单-按钮展示

... ... @@ -172,6 +172,12 @@ public class GetDraftRequestCarTicketBo extends BaseBo<DraftRequestCarTicket> {
172 172 @ApiModelProperty("审核状态")
173 173 private String status;
174 174
  175 + /**
  176 + * 是否为草稿要车单创建人
  177 + */
  178 + @ApiModelProperty("是否为草稿要车单创建人")
  179 + private boolean draftCreateBy;
  180 +
175 181 public GetDraftRequestCarTicketBo() {
176 182
177 183 }
... ...
... ... @@ -6,14 +6,12 @@ import com.lframework.starter.web.core.annotations.security.HasPermission;
6 6 import com.lframework.starter.web.core.components.resp.InvokeResult;
7 7 import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
8 8 import com.lframework.starter.web.core.components.resp.PageResult;
  9 +import com.lframework.starter.web.core.components.security.SecurityUtil;
9 10 import com.lframework.starter.web.core.controller.DefaultBaseController;
10 11 import com.lframework.starter.web.core.utils.PageResultUtil;
11 12 import com.lframework.xingyun.sc.bo.shipments.car.GetDraftRequestCarTicketBo;
12   -import com.lframework.xingyun.sc.bo.shipments.car.GetRequestCarTicketBo;
13 13 import com.lframework.xingyun.sc.entity.DraftRequestCarTicket;
14   -import com.lframework.xingyun.sc.entity.RequestCarTicket;
15 14 import com.lframework.xingyun.sc.service.shipments.car.DraftRequestCarTicketService;
16   -import com.lframework.xingyun.sc.service.shipments.car.RequestCarTicketService;
17 15 import com.lframework.xingyun.sc.vo.shipments.car.*;
18 16 import io.swagger.annotations.Api;
19 17 import io.swagger.annotations.ApiImplicitParam;
... ... @@ -54,9 +52,21 @@ public class DraftRequestCarTicketController extends DefaultBaseController {
54 52 List<GetDraftRequestCarTicketBo> results = null;
55 53
56 54 if (!CollectionUtil.isEmpty(datas)) {
57   - results = datas.stream().map(GetDraftRequestCarTicketBo::new).collect(Collectors.toList());
  55 + String currentUserId = SecurityUtil.getCurrentUser().getId();
  56 +
  57 + results = datas.stream().map(draftRequestCarTicket -> {
  58 + GetDraftRequestCarTicketBo bo = new GetDraftRequestCarTicketBo(draftRequestCarTicket);
  59 + // 判断 createById 是否等于当前用户 ID
  60 + boolean isCreateBy = false;
  61 + if (currentUserId.equals(draftRequestCarTicket.getCreateById())) {
  62 + isCreateBy = true;
  63 + }
  64 + bo.setDraftCreateBy(isCreateBy);
  65 + return bo;
  66 + }).collect(Collectors.toList());
58 67 }
59 68
  69 +
60 70 return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
61 71 }
62 72
... ...
... ... @@ -156,6 +156,12 @@ public class DraftRequestCarTicket extends BaseEntity implements BaseDto {
156 156 private String status;
157 157
158 158 /**
  159 + * 是否展示审核按钮
  160 + */
  161 + @TableField(exist = false)
  162 + private boolean showExamine;
  163 +
  164 + /**
159 165 * 创建人ID
160 166 */
161 167 @TableField(fill = FieldFill.INSERT)
... ...
... ... @@ -3,7 +3,10 @@ package com.lframework.xingyun.sc.impl.shipments.car;
3 3 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.github.pagehelper.PageInfo;
  6 +import com.lframework.starter.bpm.dto.FlowTaskDto;
  7 +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
6 8 import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
  9 +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
7 10 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
8 11 import com.lframework.starter.common.utils.Assert;
9 12 import com.lframework.starter.common.utils.ObjectUtil;
... ... @@ -21,6 +24,7 @@ import com.lframework.xingyun.sc.entity.DraftRequestCarTicket;
21 24 import com.lframework.xingyun.sc.mappers.DraftRequestCarTicketMapper;
22 25 import com.lframework.xingyun.sc.service.shipments.car.DraftRequestCarTicketService;
23 26 import com.lframework.xingyun.sc.vo.shipments.car.*;
  27 +import org.apache.commons.collections.CollectionUtils;
24 28 import org.apache.commons.lang3.StringUtils;
25 29 import org.springframework.stereotype.Service;
26 30 import org.springframework.transaction.annotation.Transactional;
... ... @@ -28,12 +32,15 @@ import org.springframework.transaction.annotation.Transactional;
28 32 import javax.annotation.Resource;
29 33 import java.io.Serializable;
30 34 import java.util.List;
  35 +import java.util.stream.Collectors;
31 36
32 37 @Service
33 38 public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftRequestCarTicketMapper, DraftRequestCarTicket> implements DraftRequestCarTicketService {
34 39 private static final String BPM_FLAG = "DRAFT_REQUEST_CAR";
35 40 @Resource
36 41 private FlowInstanceWrapperService flowInstanceWrapperService;
  42 + @Resource
  43 + private FlowTaskWrapperMapper flowTaskWrapperMapper;
37 44
38 45 @Override
39 46 public PageResult<DraftRequestCarTicket> query(Integer pageIndex, Integer pageSize, QueryDraftRequestCarTicketVo vo) {
... ... @@ -43,6 +50,21 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq
43 50
44 51 PageHelperUtil.startPage(pageIndex, pageSize);
45 52 List<DraftRequestCarTicket> datas = this.query(vo);
  53 + if (CollectionUtils.isNotEmpty(datas)) {
  54 + // 获取当前人员的待办任务数据
  55 + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
  56 + if (CollectionUtils.isEmpty(flowTaskList)) {
  57 + return new PageResult<>();
  58 + }
  59 + List<String> ids = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
  60 + for (DraftRequestCarTicket draftRequestCarTicket : datas) {
  61 + if (ids.contains(draftRequestCarTicket.getId())) {
  62 + draftRequestCarTicket.setShowExamine(true);
  63 + } else {
  64 + draftRequestCarTicket.setShowExamine(false);
  65 + }
  66 + }
  67 + }
46 68
47 69 return PageResultUtil.convert(new PageInfo<>(datas));
48 70 }
... ... @@ -75,9 +97,9 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq
75 97 if (!StringUtil.isBlank(vo.getDeptId())) {
76 98 data.setDeptId(vo.getDeptId());
77 99 }
78   - if (vo.getDeliveryDate() != null) {
79   - data.setDeliveryDate(vo.getDeliveryDate());
80   - }
  100 +// if (vo.getDeliveryDate() != null) {
  101 +// data.setDeliveryDate(vo.getDeliveryDate());
  102 +// }
81 103 if (!StringUtil.isBlank(vo.getWorkshopId())) {
82 104 data.setWorkshopId(vo.getWorkshopId());
83 105 }
... ... @@ -108,9 +130,9 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq
108 130 if (!StringUtil.isBlank(vo.getExternalAuditor())) {
109 131 data.setExternalAuditor(vo.getExternalAuditor());
110 132 }
111   - if (!StringUtil.isBlank(vo.getLoadingTime())) {
112   - data.setLoadingTime(vo.getLoadingTime());
113   - }
  133 +// if (!StringUtil.isBlank(vo.getLoadingTime())) {
  134 +// data.setLoadingTime(vo.getLoadingTime());
  135 +// }
114 136 if (!StringUtil.isBlank(vo.getSpecialLoadingRequirement())) {
115 137 data.setSpecialLoadingRequirement(vo.getSpecialLoadingRequirement());
116 138 }
... ... @@ -149,7 +171,7 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq
149 171 .set(DraftRequestCarTicket::getPurchaseOrderId, StringUtil.isBlank(vo.getPurchaseOrderId()) ? null : vo.getPurchaseOrderId())
150 172 .set(DraftRequestCarTicket::getRequestCarData, vo.getRequestCarData() == null ? null : vo.getRequestCarData())
151 173 .set(DraftRequestCarTicket::getDeptId, StringUtil.isBlank(vo.getDeptId()) ? null : vo.getDeptId())
152   - .set(DraftRequestCarTicket::getDeliveryDate, vo.getDeliveryDate() == null ? null : vo.getDeliveryDate())
  174 +// .set(DraftRequestCarTicket::getDeliveryDate, vo.getDeliveryDate() == null ? null : vo.getDeliveryDate())
153 175 .set(DraftRequestCarTicket::getWorkshopId, StringUtil.isBlank(vo.getWorkshopId()) ? null : vo.getWorkshopId())
154 176 .set(DraftRequestCarTicket::getOrderNo, StringUtil.isBlank(vo.getOrderNo()) ? null : vo.getOrderNo())
155 177 .set(DraftRequestCarTicket::getCustomerShortName, StringUtil.isBlank(vo.getCustomerShortName()) ? null : vo.getCustomerShortName())
... ... @@ -160,7 +182,7 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq
160 182 .set(DraftRequestCarTicket::getReturnPlanArrangement, StringUtil.isBlank(vo.getReturnPlanArrangement()) ? null : vo.getReturnPlanArrangement())
161 183 .set(DraftRequestCarTicket::getOther, StringUtil.isBlank(vo.getOther()) ? null : vo.getOther())
162 184 .set(DraftRequestCarTicket::getExternalAuditor, StringUtil.isBlank(vo.getExternalAuditor()) ? null : vo.getExternalAuditor())
163   - .set(DraftRequestCarTicket::getLoadingTime, StringUtil.isBlank(vo.getLoadingTime()) ? null : vo.getLoadingTime())
  185 +// .set(DraftRequestCarTicket::getLoadingTime, StringUtil.isBlank(vo.getLoadingTime()) ? null : vo.getLoadingTime())
164 186 .set(DraftRequestCarTicket::getSpecialLoadingRequirement, StringUtil.isBlank(vo.getSpecialLoadingRequirement()) ? null : vo.getSpecialLoadingRequirement())
165 187 .set(DraftRequestCarTicket::getBusinessOfficeAuditor, StringUtil.isBlank(vo.getBusinessOfficeAuditor()) ? null : vo.getBusinessOfficeAuditor())
166 188 .set(DraftRequestCarTicket::getOperationsDepartmentAuditor, StringUtil.isBlank(vo.getOperationsDepartmentAuditor()) ? null : vo.getOperationsDepartmentAuditor())
... ...