Commit 532aedf755cb7e236845389a3ae9fc078c1a03af

Authored by 房远帅
1 parent f9e67472

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

@@ -172,6 +172,12 @@ public class GetDraftRequestCarTicketBo extends BaseBo<DraftRequestCarTicket> { @@ -172,6 +172,12 @@ public class GetDraftRequestCarTicketBo extends BaseBo<DraftRequestCarTicket> {
172 @ApiModelProperty("审核状态") 172 @ApiModelProperty("审核状态")
173 private String status; 173 private String status;
174 174
  175 + /**
  176 + * 是否为草稿要车单创建人
  177 + */
  178 + @ApiModelProperty("是否为草稿要车单创建人")
  179 + private boolean draftCreateBy;
  180 +
175 public GetDraftRequestCarTicketBo() { 181 public GetDraftRequestCarTicketBo() {
176 182
177 } 183 }
@@ -6,14 +6,12 @@ import com.lframework.starter.web.core.annotations.security.HasPermission; @@ -6,14 +6,12 @@ import com.lframework.starter.web.core.annotations.security.HasPermission;
6 import com.lframework.starter.web.core.components.resp.InvokeResult; 6 import com.lframework.starter.web.core.components.resp.InvokeResult;
7 import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; 7 import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
8 import com.lframework.starter.web.core.components.resp.PageResult; 8 import com.lframework.starter.web.core.components.resp.PageResult;
  9 +import com.lframework.starter.web.core.components.security.SecurityUtil;
9 import com.lframework.starter.web.core.controller.DefaultBaseController; 10 import com.lframework.starter.web.core.controller.DefaultBaseController;
10 import com.lframework.starter.web.core.utils.PageResultUtil; 11 import com.lframework.starter.web.core.utils.PageResultUtil;
11 import com.lframework.xingyun.sc.bo.shipments.car.GetDraftRequestCarTicketBo; 12 import com.lframework.xingyun.sc.bo.shipments.car.GetDraftRequestCarTicketBo;
12 -import com.lframework.xingyun.sc.bo.shipments.car.GetRequestCarTicketBo;  
13 import com.lframework.xingyun.sc.entity.DraftRequestCarTicket; 13 import com.lframework.xingyun.sc.entity.DraftRequestCarTicket;
14 -import com.lframework.xingyun.sc.entity.RequestCarTicket;  
15 import com.lframework.xingyun.sc.service.shipments.car.DraftRequestCarTicketService; 14 import com.lframework.xingyun.sc.service.shipments.car.DraftRequestCarTicketService;
16 -import com.lframework.xingyun.sc.service.shipments.car.RequestCarTicketService;  
17 import com.lframework.xingyun.sc.vo.shipments.car.*; 15 import com.lframework.xingyun.sc.vo.shipments.car.*;
18 import io.swagger.annotations.Api; 16 import io.swagger.annotations.Api;
19 import io.swagger.annotations.ApiImplicitParam; 17 import io.swagger.annotations.ApiImplicitParam;
@@ -54,9 +52,21 @@ public class DraftRequestCarTicketController extends DefaultBaseController { @@ -54,9 +52,21 @@ public class DraftRequestCarTicketController extends DefaultBaseController {
54 List<GetDraftRequestCarTicketBo> results = null; 52 List<GetDraftRequestCarTicketBo> results = null;
55 53
56 if (!CollectionUtil.isEmpty(datas)) { 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 return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); 70 return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
61 } 71 }
62 72
@@ -156,6 +156,12 @@ public class DraftRequestCarTicket extends BaseEntity implements BaseDto { @@ -156,6 +156,12 @@ public class DraftRequestCarTicket extends BaseEntity implements BaseDto {
156 private String status; 156 private String status;
157 157
158 /** 158 /**
  159 + * 是否展示审核按钮
  160 + */
  161 + @TableField(exist = false)
  162 + private boolean showExamine;
  163 +
  164 + /**
159 * 创建人ID 165 * 创建人ID
160 */ 166 */
161 @TableField(fill = FieldFill.INSERT) 167 @TableField(fill = FieldFill.INSERT)
@@ -3,7 +3,10 @@ package com.lframework.xingyun.sc.impl.shipments.car; @@ -3,7 +3,10 @@ package com.lframework.xingyun.sc.impl.shipments.car;
3 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 3 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
4 import com.baomidou.mybatisplus.core.toolkit.Wrappers; 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 import com.github.pagehelper.PageInfo; 5 import com.github.pagehelper.PageInfo;
  6 +import com.lframework.starter.bpm.dto.FlowTaskDto;
  7 +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
6 import com.lframework.starter.bpm.service.FlowInstanceWrapperService; 8 import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
  9 +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
7 import com.lframework.starter.common.exceptions.impl.DefaultClientException; 10 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
8 import com.lframework.starter.common.utils.Assert; 11 import com.lframework.starter.common.utils.Assert;
9 import com.lframework.starter.common.utils.ObjectUtil; 12 import com.lframework.starter.common.utils.ObjectUtil;
@@ -21,6 +24,7 @@ import com.lframework.xingyun.sc.entity.DraftRequestCarTicket; @@ -21,6 +24,7 @@ import com.lframework.xingyun.sc.entity.DraftRequestCarTicket;
21 import com.lframework.xingyun.sc.mappers.DraftRequestCarTicketMapper; 24 import com.lframework.xingyun.sc.mappers.DraftRequestCarTicketMapper;
22 import com.lframework.xingyun.sc.service.shipments.car.DraftRequestCarTicketService; 25 import com.lframework.xingyun.sc.service.shipments.car.DraftRequestCarTicketService;
23 import com.lframework.xingyun.sc.vo.shipments.car.*; 26 import com.lframework.xingyun.sc.vo.shipments.car.*;
  27 +import org.apache.commons.collections.CollectionUtils;
24 import org.apache.commons.lang3.StringUtils; 28 import org.apache.commons.lang3.StringUtils;
25 import org.springframework.stereotype.Service; 29 import org.springframework.stereotype.Service;
26 import org.springframework.transaction.annotation.Transactional; 30 import org.springframework.transaction.annotation.Transactional;
@@ -28,12 +32,15 @@ import org.springframework.transaction.annotation.Transactional; @@ -28,12 +32,15 @@ import org.springframework.transaction.annotation.Transactional;
28 import javax.annotation.Resource; 32 import javax.annotation.Resource;
29 import java.io.Serializable; 33 import java.io.Serializable;
30 import java.util.List; 34 import java.util.List;
  35 +import java.util.stream.Collectors;
31 36
32 @Service 37 @Service
33 public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftRequestCarTicketMapper, DraftRequestCarTicket> implements DraftRequestCarTicketService { 38 public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftRequestCarTicketMapper, DraftRequestCarTicket> implements DraftRequestCarTicketService {
34 private static final String BPM_FLAG = "DRAFT_REQUEST_CAR"; 39 private static final String BPM_FLAG = "DRAFT_REQUEST_CAR";
35 @Resource 40 @Resource
36 private FlowInstanceWrapperService flowInstanceWrapperService; 41 private FlowInstanceWrapperService flowInstanceWrapperService;
  42 + @Resource
  43 + private FlowTaskWrapperMapper flowTaskWrapperMapper;
37 44
38 @Override 45 @Override
39 public PageResult<DraftRequestCarTicket> query(Integer pageIndex, Integer pageSize, QueryDraftRequestCarTicketVo vo) { 46 public PageResult<DraftRequestCarTicket> query(Integer pageIndex, Integer pageSize, QueryDraftRequestCarTicketVo vo) {
@@ -43,6 +50,21 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq @@ -43,6 +50,21 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq
43 50
44 PageHelperUtil.startPage(pageIndex, pageSize); 51 PageHelperUtil.startPage(pageIndex, pageSize);
45 List<DraftRequestCarTicket> datas = this.query(vo); 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 return PageResultUtil.convert(new PageInfo<>(datas)); 69 return PageResultUtil.convert(new PageInfo<>(datas));
48 } 70 }
@@ -75,9 +97,9 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq @@ -75,9 +97,9 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq
75 if (!StringUtil.isBlank(vo.getDeptId())) { 97 if (!StringUtil.isBlank(vo.getDeptId())) {
76 data.setDeptId(vo.getDeptId()); 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 if (!StringUtil.isBlank(vo.getWorkshopId())) { 103 if (!StringUtil.isBlank(vo.getWorkshopId())) {
82 data.setWorkshopId(vo.getWorkshopId()); 104 data.setWorkshopId(vo.getWorkshopId());
83 } 105 }
@@ -108,9 +130,9 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq @@ -108,9 +130,9 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq
108 if (!StringUtil.isBlank(vo.getExternalAuditor())) { 130 if (!StringUtil.isBlank(vo.getExternalAuditor())) {
109 data.setExternalAuditor(vo.getExternalAuditor()); 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 if (!StringUtil.isBlank(vo.getSpecialLoadingRequirement())) { 136 if (!StringUtil.isBlank(vo.getSpecialLoadingRequirement())) {
115 data.setSpecialLoadingRequirement(vo.getSpecialLoadingRequirement()); 137 data.setSpecialLoadingRequirement(vo.getSpecialLoadingRequirement());
116 } 138 }
@@ -149,7 +171,7 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq @@ -149,7 +171,7 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq
149 .set(DraftRequestCarTicket::getPurchaseOrderId, StringUtil.isBlank(vo.getPurchaseOrderId()) ? null : vo.getPurchaseOrderId()) 171 .set(DraftRequestCarTicket::getPurchaseOrderId, StringUtil.isBlank(vo.getPurchaseOrderId()) ? null : vo.getPurchaseOrderId())
150 .set(DraftRequestCarTicket::getRequestCarData, vo.getRequestCarData() == null ? null : vo.getRequestCarData()) 172 .set(DraftRequestCarTicket::getRequestCarData, vo.getRequestCarData() == null ? null : vo.getRequestCarData())
151 .set(DraftRequestCarTicket::getDeptId, StringUtil.isBlank(vo.getDeptId()) ? null : vo.getDeptId()) 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 .set(DraftRequestCarTicket::getWorkshopId, StringUtil.isBlank(vo.getWorkshopId()) ? null : vo.getWorkshopId()) 175 .set(DraftRequestCarTicket::getWorkshopId, StringUtil.isBlank(vo.getWorkshopId()) ? null : vo.getWorkshopId())
154 .set(DraftRequestCarTicket::getOrderNo, StringUtil.isBlank(vo.getOrderNo()) ? null : vo.getOrderNo()) 176 .set(DraftRequestCarTicket::getOrderNo, StringUtil.isBlank(vo.getOrderNo()) ? null : vo.getOrderNo())
155 .set(DraftRequestCarTicket::getCustomerShortName, StringUtil.isBlank(vo.getCustomerShortName()) ? null : vo.getCustomerShortName()) 177 .set(DraftRequestCarTicket::getCustomerShortName, StringUtil.isBlank(vo.getCustomerShortName()) ? null : vo.getCustomerShortName())
@@ -160,7 +182,7 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq @@ -160,7 +182,7 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq
160 .set(DraftRequestCarTicket::getReturnPlanArrangement, StringUtil.isBlank(vo.getReturnPlanArrangement()) ? null : vo.getReturnPlanArrangement()) 182 .set(DraftRequestCarTicket::getReturnPlanArrangement, StringUtil.isBlank(vo.getReturnPlanArrangement()) ? null : vo.getReturnPlanArrangement())
161 .set(DraftRequestCarTicket::getOther, StringUtil.isBlank(vo.getOther()) ? null : vo.getOther()) 183 .set(DraftRequestCarTicket::getOther, StringUtil.isBlank(vo.getOther()) ? null : vo.getOther())
162 .set(DraftRequestCarTicket::getExternalAuditor, StringUtil.isBlank(vo.getExternalAuditor()) ? null : vo.getExternalAuditor()) 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 .set(DraftRequestCarTicket::getSpecialLoadingRequirement, StringUtil.isBlank(vo.getSpecialLoadingRequirement()) ? null : vo.getSpecialLoadingRequirement()) 186 .set(DraftRequestCarTicket::getSpecialLoadingRequirement, StringUtil.isBlank(vo.getSpecialLoadingRequirement()) ? null : vo.getSpecialLoadingRequirement())
165 .set(DraftRequestCarTicket::getBusinessOfficeAuditor, StringUtil.isBlank(vo.getBusinessOfficeAuditor()) ? null : vo.getBusinessOfficeAuditor()) 187 .set(DraftRequestCarTicket::getBusinessOfficeAuditor, StringUtil.isBlank(vo.getBusinessOfficeAuditor()) ? null : vo.getBusinessOfficeAuditor())
166 .set(DraftRequestCarTicket::getOperationsDepartmentAuditor, StringUtil.isBlank(vo.getOperationsDepartmentAuditor()) ? null : vo.getOperationsDepartmentAuditor()) 188 .set(DraftRequestCarTicket::getOperationsDepartmentAuditor, StringUtil.isBlank(vo.getOperationsDepartmentAuditor()) ? null : vo.getOperationsDepartmentAuditor())