Showing
8 changed files
with
108 additions
and
0 deletions
| ... | ... | @@ -26,6 +26,12 @@ public class GetRequestCarTicketBo extends BaseBo<RequestCarTicket> { |
| 26 | 26 | private String id; |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | + * 订货单ID | |
| 30 | + */ | |
| 31 | + @ApiModelProperty("订货单ID") | |
| 32 | + private String purchaseOrderId; | |
| 33 | + | |
| 34 | + /** | |
| 29 | 35 | * 要车日期 |
| 30 | 36 | */ |
| 31 | 37 | @ApiModelProperty("要车日期") | ... | ... |
| ... | ... | @@ -8,6 +8,7 @@ import java.time.LocalDateTime; |
| 8 | 8 | import com.baomidou.mybatisplus.annotation.FieldFill; |
| 9 | 9 | import com.lframework.starter.web.core.entity.BaseEntity; |
| 10 | 10 | import com.baomidou.mybatisplus.annotation.TableField; |
| 11 | +import io.swagger.annotations.ApiModelProperty; | |
| 11 | 12 | import lombok.Data; |
| 12 | 13 | |
| 13 | 14 | /** |
| ... | ... | @@ -30,6 +31,11 @@ public class RequestCarTicket extends BaseEntity implements BaseDto { |
| 30 | 31 | private String id; |
| 31 | 32 | |
| 32 | 33 | /** |
| 34 | + * 订货单ID | |
| 35 | + */ | |
| 36 | + private String purchaseOrderId; | |
| 37 | + | |
| 38 | + /** | |
| 33 | 39 | * 要车日期 |
| 34 | 40 | */ |
| 35 | 41 | private LocalDate requestCarData; | ... | ... |
| ... | ... | @@ -5,6 +5,7 @@ import com.lframework.starter.bpm.enums.FlowInstanceStatus; |
| 5 | 5 | import com.lframework.starter.bpm.service.BusinessDataHandlerService; |
| 6 | 6 | import com.lframework.starter.mq.core.service.MqProducerService; |
| 7 | 7 | import com.lframework.starter.web.core.components.redis.RedisHandler; |
| 8 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | |
| 8 | 9 | import com.lframework.starter.web.core.utils.IdUtil; |
| 9 | 10 | import com.lframework.starter.web.core.utils.JsonUtil; |
| 10 | 11 | import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto; |
| ... | ... | @@ -17,6 +18,7 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService; |
| 17 | 18 | import com.lframework.xingyun.sc.service.customer.CustomerCreditService; |
| 18 | 19 | import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService; |
| 19 | 20 | import com.lframework.xingyun.sc.service.order.*; |
| 21 | +import com.lframework.xingyun.sc.service.shipments.car.RequestCarTicketService; | |
| 20 | 22 | import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelHistoryVo; |
| 21 | 23 | import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo; |
| 22 | 24 | import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo; |
| ... | ... | @@ -69,6 +71,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic |
| 69 | 71 | private TransactorHandler transactorHandler; |
| 70 | 72 | @Resource |
| 71 | 73 | private SpecLockDelayApplicationService specLockDelayApplicationService; |
| 74 | + @Resource | |
| 75 | + private RequestCarTicketService requestCarTicketService; | |
| 72 | 76 | |
| 73 | 77 | |
| 74 | 78 | /** |
| ... | ... | @@ -124,6 +128,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic |
| 124 | 128 | case "SPEC_LOCK_DELAY": |
| 125 | 129 | handleSpecLockDelayAuditData(flowStatus, businessId); |
| 126 | 130 | break; |
| 131 | + case "REQUEST_CAR_TICKET": | |
| 132 | + handleRequestCarTicketData(flowStatus, businessId); | |
| 133 | + break; | |
| 127 | 134 | default: |
| 128 | 135 | break; |
| 129 | 136 | } |
| ... | ... | @@ -383,4 +390,24 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic |
| 383 | 390 | orderChangeRecordService.updateStatus(businessId, "REFUSE"); |
| 384 | 391 | } |
| 385 | 392 | } |
| 393 | + | |
| 394 | + /** | |
| 395 | + * 发货计划-草稿要车单业务数据处理 | |
| 396 | + * | |
| 397 | + * @param businessId 业务ID | |
| 398 | + */ | |
| 399 | + private void handleRequestCarTicketData(String flowStatus, String businessId) { | |
| 400 | + if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus) | |
| 401 | + || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) { | |
| 402 | + requestCarTicketService.updateStatus(businessId, "PASS"); | |
| 403 | + //更新外办审核人 | |
| 404 | + requestCarTicketService.updateExamineUser(businessId, SecurityUtil.getCurrentUser().getId(), null, null); | |
| 405 | + } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus) | |
| 406 | + || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus) | |
| 407 | + || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) { | |
| 408 | + requestCarTicketService.updateStatus(businessId, "REFUSE"); | |
| 409 | + //更新外办审核人 | |
| 410 | + requestCarTicketService.updateExamineUser(businessId, SecurityUtil.getCurrentUser().getId(), null, null); | |
| 411 | + } | |
| 412 | + } | |
| 386 | 413 | } | ... | ... |
| ... | ... | @@ -3,6 +3,8 @@ 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.service.FlowInstanceWrapperService; | |
| 7 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | |
| 6 | 8 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 7 | 9 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| 8 | 10 | import com.lframework.starter.web.core.components.resp.PageResult; |
| ... | ... | @@ -26,10 +28,14 @@ import org.apache.commons.lang3.StringUtils; |
| 26 | 28 | import org.springframework.transaction.annotation.Transactional; |
| 27 | 29 | import org.springframework.stereotype.Service; |
| 28 | 30 | |
| 31 | +import javax.annotation.Resource; | |
| 29 | 32 | import java.util.List; |
| 30 | 33 | |
| 31 | 34 | @Service |
| 32 | 35 | public class RequestCarTicketServiceImpl extends BaseMpServiceImpl<RequestCarTicketMapper, RequestCarTicket> implements RequestCarTicketService { |
| 36 | + private static final String BPM_FLAG = "REQUEST_CAR_TICKET"; | |
| 37 | + @Resource | |
| 38 | + private FlowInstanceWrapperService flowInstanceWrapperService; | |
| 33 | 39 | |
| 34 | 40 | @Override |
| 35 | 41 | public PageResult<RequestCarTicket> query(Integer pageIndex, Integer pageSize, QueryRequestCarTicketVo vo) { |
| ... | ... | @@ -62,6 +68,9 @@ public class RequestCarTicketServiceImpl extends BaseMpServiceImpl<RequestCarTic |
| 62 | 68 | |
| 63 | 69 | RequestCarTicket data = new RequestCarTicket(); |
| 64 | 70 | data.setId(IdUtil.getId()); |
| 71 | + if (!StringUtil.isBlank(vo.getPurchaseOrderId())) { | |
| 72 | + data.setPurchaseOrderId(vo.getPurchaseOrderId()); | |
| 73 | + } | |
| 65 | 74 | if (vo.getRequestCarData() != null) { |
| 66 | 75 | data.setRequestCarData(vo.getRequestCarData()); |
| 67 | 76 | } |
| ... | ... | @@ -121,6 +130,9 @@ public class RequestCarTicketServiceImpl extends BaseMpServiceImpl<RequestCarTic |
| 121 | 130 | |
| 122 | 131 | OpLogUtil.setVariable("id", data.getId()); |
| 123 | 132 | OpLogUtil.setExtra(vo); |
| 133 | + //开启审核 | |
| 134 | + data.setUpdateById(SecurityUtil.getCurrentUser().getId()); | |
| 135 | + flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, data); | |
| 124 | 136 | |
| 125 | 137 | return data.getId(); |
| 126 | 138 | } |
| ... | ... | @@ -136,6 +148,7 @@ public class RequestCarTicketServiceImpl extends BaseMpServiceImpl<RequestCarTic |
| 136 | 148 | } |
| 137 | 149 | |
| 138 | 150 | LambdaUpdateWrapper<RequestCarTicket> updateWrapper = Wrappers.lambdaUpdate(RequestCarTicket.class) |
| 151 | + .set(RequestCarTicket::getPurchaseOrderId, StringUtil.isBlank(vo.getPurchaseOrderId()) ? null : vo.getPurchaseOrderId()) | |
| 139 | 152 | .set(RequestCarTicket::getRequestCarData, vo.getRequestCarData() == null ? null : vo.getRequestCarData()) |
| 140 | 153 | .set(RequestCarTicket::getDeptId, StringUtil.isBlank(vo.getDeptId()) ? null : vo.getDeptId()) |
| 141 | 154 | .set(RequestCarTicket::getDeliveryDate, vo.getDeliveryDate() == null ? null : vo.getDeliveryDate()) |
| ... | ... | @@ -160,6 +173,9 @@ public class RequestCarTicketServiceImpl extends BaseMpServiceImpl<RequestCarTic |
| 160 | 173 | |
| 161 | 174 | OpLogUtil.setVariable("id", data.getId()); |
| 162 | 175 | OpLogUtil.setExtra(vo); |
| 176 | + //开启审核 | |
| 177 | + RequestCarTicket requestCarTicket = getBaseMapper().selectById(vo.getId()); | |
| 178 | + flowInstanceWrapperService.startInstance(BPM_FLAG, requestCarTicket.getId(), BPM_FLAG, requestCarTicket); | |
| 163 | 179 | } |
| 164 | 180 | |
| 165 | 181 | @OpLog(type = OtherOpLogType.class, name = "修改草稿要车单状态,ID:{}", params = {"#id"}) |
| ... | ... | @@ -183,6 +199,35 @@ public class RequestCarTicketServiceImpl extends BaseMpServiceImpl<RequestCarTic |
| 183 | 199 | OpLogUtil.setExtra(id); |
| 184 | 200 | } |
| 185 | 201 | |
| 202 | + @OpLog(type = OtherOpLogType.class, name = "更新草稿要车单审核人,ID:{}", params = {"#id"}) | |
| 203 | + @Transactional(rollbackFor = Exception.class) | |
| 204 | + @Override | |
| 205 | + public void updateExamineUser(String id, String externalAuditor, String businessOfficeAuditor, String operationsDepartmentAuditor) { | |
| 206 | + if (StringUtils.isBlank(id)) { | |
| 207 | + return; | |
| 208 | + } | |
| 209 | + RequestCarTicket data = getBaseMapper().findById(id); | |
| 210 | + if (ObjectUtil.isNull(data)) { | |
| 211 | + throw new DefaultClientException("草稿要车单不存在!"); | |
| 212 | + } | |
| 213 | + LambdaUpdateWrapper<RequestCarTicket> updateWrapper = Wrappers.lambdaUpdate(RequestCarTicket.class) | |
| 214 | + .eq(RequestCarTicket::getId, id); | |
| 215 | + if (externalAuditor != null) { | |
| 216 | + updateWrapper.set(RequestCarTicket::getExternalAuditor, externalAuditor); | |
| 217 | + } | |
| 218 | + if (businessOfficeAuditor != null) { | |
| 219 | + updateWrapper.set(RequestCarTicket::getBusinessOfficeAuditor, businessOfficeAuditor); | |
| 220 | + } | |
| 221 | + if (operationsDepartmentAuditor != null) { | |
| 222 | + updateWrapper.set(RequestCarTicket::getOperationsDepartmentAuditor, operationsDepartmentAuditor); | |
| 223 | + } | |
| 224 | + | |
| 225 | + getBaseMapper().update(updateWrapper); | |
| 226 | + | |
| 227 | + OpLogUtil.setVariable("id", data.getId()); | |
| 228 | + OpLogUtil.setExtra(id); | |
| 229 | + } | |
| 230 | + | |
| 186 | 231 | @OpLog(type = OtherOpLogType.class, name = "删除要车单表,ID:{}", params = {"#id"}) |
| 187 | 232 | @Transactional(rollbackFor = Exception.class) |
| 188 | 233 | @Override | ... | ... |
| ... | ... | @@ -55,6 +55,16 @@ public interface RequestCarTicketService extends BaseMpService<RequestCarTicket> |
| 55 | 55 | void updateStatus(String id, String status); |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | + * 更新审核人 | |
| 59 | + * | |
| 60 | + * @param id 主键 | |
| 61 | + * @param externalAuditor 外办审核人 | |
| 62 | + * @param businessOfficeAuditor 经营办审核人 | |
| 63 | + * @param operationsDepartmentAuditor 运作科审核人 | |
| 64 | + */ | |
| 65 | + void updateExamineUser(String id, String externalAuditor, String businessOfficeAuditor, String operationsDepartmentAuditor); | |
| 66 | + | |
| 67 | + /** | |
| 58 | 68 | * 根据ID删除 |
| 59 | 69 | * @param id |
| 60 | 70 | * @return | ... | ... |
| ... | ... | @@ -16,6 +16,12 @@ public class CreateRequestCarTicketVo implements BaseVo, Serializable { |
| 16 | 16 | private static final long serialVersionUID = 1L; |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | + * 订货单ID | |
| 20 | + */ | |
| 21 | + @ApiModelProperty("订货单ID") | |
| 22 | + private String purchaseOrderId; | |
| 23 | + | |
| 24 | + /** | |
| 19 | 25 | * 要车日期 |
| 20 | 26 | */ |
| 21 | 27 | @ApiModelProperty("要车日期") | ... | ... |
| ... | ... | @@ -24,6 +24,12 @@ public class UpdateRequestCarTicketVo implements BaseVo, Serializable { |
| 24 | 24 | private String id; |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | + * 订货单ID | |
| 28 | + */ | |
| 29 | + @ApiModelProperty("订货单ID") | |
| 30 | + private String purchaseOrderId; | |
| 31 | + | |
| 32 | + /** | |
| 27 | 33 | * 要车日期 |
| 28 | 34 | */ |
| 29 | 35 | @ApiModelProperty("要车日期") | ... | ... |
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | <resultMap id="RequestCarTicket" type="com.lframework.xingyun.sc.entity.RequestCarTicket"> |
| 6 | 6 | <id column="id" property="id"/> |
| 7 | + <result column="purchase_order_id" property="purchaseOrderId"/> | |
| 7 | 8 | <result column="request_car_data" property="requestCarData"/> |
| 8 | 9 | <result column="dept_id" property="deptId"/> |
| 9 | 10 | <result column="dept_name" property="deptName"/> |
| ... | ... | @@ -38,6 +39,7 @@ |
| 38 | 39 | <sql id="RequestCarTicket_sql"> |
| 39 | 40 | SELECT |
| 40 | 41 | tb.id, |
| 42 | + tb.purchase_order_id, | |
| 41 | 43 | tb.request_car_data, |
| 42 | 44 | tb.dept_id, |
| 43 | 45 | sd.name AS dept_name, | ... | ... |