Commit 130b198d authored by zhengyi's avatar zhengyi

控货相关的审批业务部分提交

Signed-off-by: default avatarzhengyi <landuo321@aliyun.com>
parent ec4cc447
......@@ -93,8 +93,8 @@ public enum WorkFlowEmus {
FINANCE_COMMISSION_PAYMENT_WRITE_OFF("finance_commission_payment_write_off", "财务审核-佣金付款单核销审核"),
FINANCE_COMMISSION_PAYMENT_WRITE_OFF_NO("finance_commission_payment_write_off_no", "财务审核-佣金付款单反核销审核"),
SHIPMENT_LINE_WEIGHT_ALLOW_OVER("shipment_line_weight_allow_over", "出货审批-允许超出线路重量上限审核"),
ORDER_MODEL_CHANGE("order_model_change", "订单审批-订单模式变更审核"),
SHIPMENT_CHANGE_RELEASE_GOODS_LIMIT("shipment_change_release_goods_limit", "出货审批-变更出货限制审核"),
ORDER_MODEL_CHANGE("order_model_change", "订单审批-订单海外仓修改审核"),
SHIPMENT_CHANGE_RELEASE_GOODS_LIMIT("shipment_change_release_goods_limit", "订单审批-变更放货限制审核"),
;
private String key;
private String value;
......
......@@ -3,14 +3,19 @@ package cn.iocoder.yudao.module.bpm.service.order.listener;
import cn.iocoder.yudao.module.bpm.enums.WorkFlowEmus;
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.order.service.order.OrderFeeApplicationService;
import cn.iocoder.yudao.module.order.service.orderCargoControl.OrderCargoControlService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
@Slf4j
public class BmpOrderModelChangeResultListener extends BpmProcessInstanceResultEventListener {
@Resource
OrderCargoControlService orderCargoControlService;
@Override
protected String getProcessDefinitionKey() {
return WorkFlowEmus.ORDER_MODEL_CHANGE.getKey();
......@@ -18,7 +23,8 @@ public class BmpOrderModelChangeResultListener extends BpmProcessInstanceResultE
@Override
protected void onEvent(BpmProcessInstanceResultEvent event) {
log.info("----------------------订单模式变更审核----------------------,{},{}" + event.getBusinessKey(), event.getResult());
log.info("----------------------控货订单海外仓修改审核----------------------,{},{}" + event.getBusinessKey(), event.getResult());
orderCargoControlService.approvalOrderCargoControl(event.getBusinessKey(), event.getResult());
}
}
......@@ -3,14 +3,19 @@ package cn.iocoder.yudao.module.bpm.service.shipment.listener;
import cn.iocoder.yudao.module.bpm.enums.WorkFlowEmus;
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.order.service.orderCargoControl.OrderCargoControlService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
@Slf4j
public class BmpChangeReleaseGoodsLimitResultListener extends BpmProcessInstanceResultEventListener {
@Resource
OrderCargoControlService orderCargoControlService;
@Override
protected String getProcessDefinitionKey() {
return WorkFlowEmus.SHIPMENT_CHANGE_RELEASE_GOODS_LIMIT.getKey();
......@@ -18,7 +23,8 @@ public class BmpChangeReleaseGoodsLimitResultListener extends BpmProcessInstance
@Override
protected void onEvent(BpmProcessInstanceResultEvent event) {
log.info("----------------------变更出货限制回调----------------------,{},{}" + event.getBusinessKey(), event.getResult());
log.info("----------------------变更放货限制回调----------------------,{},{}" + event.getBusinessKey(), event.getResult());
orderCargoControlService.approvalOrderCargoControl(event.getBusinessKey(), event.getResult());
}
}
......@@ -39,7 +39,10 @@ public class OrderApprovalDO extends BaseDO {
* 7 控货订单放货修改 8 控货订单反复核 9 控货订单已放货记录调货审批 10 控货订单取消放货
* 11 合单申请 12 费用申请 13 调仓申请 14 订单修改 18 预装审核 19 封柜审核
* 22 入仓修改 23 退仓
*
* 41 批量费用申请
*
* 61 修改放货限制 62 海外仓修改申请
*/
private Integer type;
/**
......
......@@ -166,6 +166,21 @@ public interface OrderApprovalMapper extends AbstractMapper<OrderApprovalDO> {
})
OrderApprovalDO newOrderCargoControlPickInfo(@Param("orderId") Long orderId, @Param("id") Long id, @Param("type") Integer type);
@ResultType(OrderApprovalDO.class)
@Select({
"<script>",
"select",
" * ",
"from ecw_order_approval ",
"where ",
"order_id = #{orderId} ",
"and type = #{type} ",
"order by order_approval_id desc",
"limit 1",
"</script>"
})
OrderApprovalDO orderApprovalInfoByOrderIdAndType(@Param("orderId") Long orderId, @Param("type") Integer type);
@ResultType(OrderApprovalDO.class)
@Select({
"<script>",
......
......@@ -11,10 +11,8 @@ import cn.iocoder.yudao.module.order.dto.OrderQueryDTO;
import cn.iocoder.yudao.module.order.vo.order.OrderBackPageVO;
import cn.iocoder.yudao.module.order.vo.order.OrderQueryVO;
import cn.iocoder.yudao.module.order.vo.order.OrderSendSmsReqVO;
import cn.iocoder.yudao.module.order.vo.orderCargoControl.OrderCargoControlBackVO;
import cn.iocoder.yudao.module.order.vo.orderCargoControl.OrderCargoControlCreateReqVO;
import cn.iocoder.yudao.module.order.vo.orderCargoControl.OrderCargoControlQueryVO;
import cn.iocoder.yudao.module.order.vo.orderCargoControl.OrderCargoControlUpdateReqVO;
import cn.iocoder.yudao.module.order.vo.orderCargoControl.*;
import cn.iocoder.yudao.module.order.vo.orderCargoControlPick.OrderCargoControlPickApplyVO;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
......@@ -134,4 +132,35 @@ public interface OrderCargoControlService extends IService<OrderCargoControlDO>
* @return 返回是或否
*/
Boolean checkControlPassword(Long orderId);
/**
* @param approveId 表单业务ID
* @param result 1 处理中 2 通过 3 不通过 4 已取消
*/
void approvalOrderCargoControl(String approveId, Integer result);
/**
* 订单放货限制修改申请
*
* @param orderId 订单ID
* @return 订单放货限制修改申请业务表单详情
*/
OrderCargoControlApplyVO approvalOrderCargoControlPickLimitUpdateByOrderId(Long orderId);
/**
* 订单海外仓修改申请
*
* @param orderId 订单ID
* @return 订单海外仓修改申请业务表单详情
*/
OrderCargoControlApplyVO approvalOrderCargoControlOverseasWarehouseUpdateByOrderId(Long orderId);
/**
* 订单控货相关申请管理
*
* @param orderCargoControlApplyVO 控货订单审批业务申请信息
*/
void orderCargoControlPickApply(OrderCargoControlApplyVO orderCargoControlApplyVO);
}
......@@ -3,13 +3,19 @@ package cn.iocoder.yudao.module.order.service.orderCargoControl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.spring.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.util.validation.PhoneUtil;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.excel.handler.WaterMarkHandler;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.bpm.api.BpmCreateServiceFactory;
import cn.iocoder.yudao.module.bpm.enums.WorkFlowEmus;
import cn.iocoder.yudao.module.ecw.api.paramValid.ParamValidatorApi;
import cn.iocoder.yudao.module.ecw.service.paramValid.ParamValidatorService;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.infra.service.file.FileService;
......@@ -17,9 +23,12 @@ import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.UserRespDTO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.order.convert.orderCargoControl.OrderCargoControlConvert;
import cn.iocoder.yudao.module.order.dal.dataobject.approval.OrderApprovalDO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderCargoControl.OrderCargoControlDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderCargoControlPick.OrderCargoControlPickDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignor.OrderConsignorDO;
import cn.iocoder.yudao.module.order.dal.mysql.approval.OrderApprovalMapper;
import cn.iocoder.yudao.module.order.dal.mysql.orderCargoControl.OrderCargoControlMapper;
import cn.iocoder.yudao.module.order.dto.OrderCargoControlReleaseInfoDto;
import cn.iocoder.yudao.module.order.dto.OrderQueryDTO;
......@@ -29,10 +38,9 @@ import cn.iocoder.yudao.module.order.service.order.OrderConsignorService;
import cn.iocoder.yudao.module.order.service.order.OrderQueryService;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import cn.iocoder.yudao.module.order.vo.order.*;
import cn.iocoder.yudao.module.order.vo.orderCargoControl.OrderCargoControlBackVO;
import cn.iocoder.yudao.module.order.vo.orderCargoControl.OrderCargoControlCreateReqVO;
import cn.iocoder.yudao.module.order.vo.orderCargoControl.OrderCargoControlQueryVO;
import cn.iocoder.yudao.module.order.vo.orderCargoControl.OrderCargoControlUpdateReqVO;
import cn.iocoder.yudao.module.order.vo.orderCargoControl.*;
import cn.iocoder.yudao.module.order.vo.orderCargoControlPick.OrderCargoControlPickApplyVO;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi;
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
......@@ -41,6 +49,7 @@ import cn.iocoder.yudao.module.system.framework.ue.UeProperties;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.AllArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
......@@ -61,6 +70,8 @@ import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.apollo.core.constants.Constants.CUSTOMER_USER_APPROVAL_ID;
import static cn.iocoder.yudao.framework.apollo.core.constants.Constants.CUSTOMER_USER_TO_ADMIN;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
import static cn.iocoder.yudao.framework.excel.constant.ExportConstant.*;
......@@ -86,9 +97,12 @@ public class OrderCargoControlServiceImpl extends AbstractService<OrderCargoCont
private final MemberUserApi memberUserApi;
private final ParamValidatorService paramValidatorService;
private final PasswordEncoder passwordEncoder;
private UeProperties ueProperties;
private FileService fileService;
private final UeProperties ueProperties;
private final FileService fileService;
private final OrderApprovalMapper orderApprovalMapper;
private final BpmCreateServiceFactory bpmCreateServiceFactory;
private final DictDataApi dictDataApi;
private final ParamValidatorApi paramValidatorApi;
@Override
public Long createOrderCargoControl(OrderCargoControlCreateReqVO createReqVO, MemberUserDO memberUserDO) {
......@@ -463,4 +477,101 @@ public class OrderCargoControlServiceImpl extends AbstractService<OrderCargoCont
UserRespDTO userRespDTO = memberUserApi.getUserByMobile(backVO.getPhone());
return Objects.nonNull(userRespDTO) && StringUtils.isNotBlank(userRespDTO.getControlPassword());
}
@Override
public void approvalOrderCargoControl(String approveId, Integer result) {
OrderApprovalDO orderApprovalDO = orderApprovalMapper.selectById(approveId);
if (Objects.isNull(orderApprovalDO)) {
throw exception(ORDER_APPROVAL_INFO_NOT_FIND);
}
orderApprovalDO.setStatus(result);
if (result == 1) {
// 进行中的审批直接返回
return;
}
if (result == 3 || result == 4) {
// TODO 审批取消、审批拒绝,待补充业务日志及其他细节
return;
}
if (result == 2){
if (orderApprovalDO.getType() == 61){
// TODO 修改放货限制
}
if (orderApprovalDO.getType() == 62){
// TODO 海外仓修改申请
}
}
orderApprovalMapper.updateById(orderApprovalDO);
// orderBusinessService.createOrderControlLogs(controlLogParams);
}
@Override
public OrderCargoControlApplyVO approvalOrderCargoControlPickLimitUpdateByOrderId(Long orderId) {
OrderApprovalDO orderApprovalDO = orderApprovalMapper.orderApprovalInfoByOrderIdAndType(orderId, 61);
if (Objects.isNull(orderApprovalDO)) {
OrderCargoControlReleaseInfoDto releaseInfoDto = this.getOrderCargoControlReleaseInfo(orderId);
OrderCargoControlApplyVO orderCargoControlApplyVO = new OrderCargoControlApplyVO();
BeanUtils.copyProperties(releaseInfoDto, orderCargoControlApplyVO);
orderCargoControlApplyVO.setApplyStatus(1);
return orderCargoControlApplyVO;
} else {
return JSONObject.parseObject(orderApprovalDO.getDetails(), OrderCargoControlApplyVO.class);
}
}
@Override
public OrderCargoControlApplyVO approvalOrderCargoControlOverseasWarehouseUpdateByOrderId(Long orderId) {
OrderApprovalDO orderApprovalDO = orderApprovalMapper.orderApprovalInfoByOrderIdAndType(orderId, 62);
if (Objects.isNull(orderApprovalDO)) {
OrderCargoControlReleaseInfoDto releaseInfoDto = this.getOrderCargoControlReleaseInfo(orderId);
OrderCargoControlApplyVO orderCargoControlApplyVO = new OrderCargoControlApplyVO();
BeanUtils.copyProperties(releaseInfoDto, orderCargoControlApplyVO);
orderCargoControlApplyVO.setApplyStatus(1);
return orderCargoControlApplyVO;
} else {
return JSONObject.parseObject(orderApprovalDO.getDetails(), OrderCargoControlApplyVO.class);
}
}
@Override
public void orderCargoControlPickApply(OrderCargoControlApplyVO orderCargoControlApplyVO) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Integer userType = loginUser != null ? loginUser.getUserType() : null;
Long userId = loginUser != null ? loginUser.getId() : null;
String creator = String.valueOf(userId);
if (Objects.equals(userType, UserTypeEnum.MEMBER.getValue())) {
DictDataRespDTO dto = dictDataApi.parseDictDataFromCache(CUSTOMER_USER_TO_ADMIN, CUSTOMER_USER_APPROVAL_ID);
userId = Long.valueOf(dto.getValue());
}
Date now = new Date();
OrderDO orderDO = orderService.getById(orderCargoControlApplyVO.getOrderId());
orderCargoControlApplyVO.setOrderNo(orderDO.getOrderNo());
OrderApprovalDO orderApprovalDO = new OrderApprovalDO();
orderApprovalDO.setFollowUpSalesmanId(String.valueOf(orderDO.getSalesmanId()));//跟进业务员为订单的跟进业务员
orderApprovalDO.setDetails(JSONObject.toJSONString(orderCargoControlApplyVO));
orderApprovalDO.setCreator(creator);
orderApprovalDO.setUpdater(creator);
orderApprovalDO.setCreateTime(now);
orderApprovalDO.setUpdateTime(now);
if (orderCargoControlApplyVO.getApplyType() == 61) {
orderApprovalDO.setOrderId(orderCargoControlApplyVO.getOrderId());
orderApprovalDO.setType(61);
orderApprovalDO.setDetails(JSONObject.toJSONString(orderCargoControlApplyVO));
orderApprovalMapper.insert(orderApprovalDO);
String formId = bpmCreateServiceFactory.createBmp(userId, orderApprovalDO.getOrderApprovalId(), WorkFlowEmus.ORDER_MODEL_CHANGE.getKey(), orderDO.getOrderNo(),
StringUtils.isNotBlank(orderCargoControlApplyVO.getCcIds()) ? orderCargoControlApplyVO.getCcIds().split(StrUtil.COMMA) : null);
orderApprovalDO.setFormId(formId);
}else if (orderCargoControlApplyVO.getApplyType() == 62) {
orderApprovalDO.setOrderId(orderCargoControlApplyVO.getOrderId());
orderApprovalDO.setType(62);
orderApprovalDO.setDetails(JSONObject.toJSONString(orderCargoControlApplyVO));
orderApprovalMapper.insert(orderApprovalDO);
String formId = bpmCreateServiceFactory.createBmp(userId, orderApprovalDO.getOrderApprovalId(), WorkFlowEmus.SHIPMENT_CHANGE_RELEASE_GOODS_LIMIT.getKey(), orderDO.getOrderNo(),
StringUtils.isNotBlank(orderCargoControlApplyVO.getCcIds()) ? orderCargoControlApplyVO.getCcIds().split(StrUtil.COMMA) : null);
orderApprovalDO.setFormId(formId);
}
orderApprovalMapper.updateById(orderApprovalDO);
}
}
......@@ -1330,7 +1330,14 @@ public class OrderCargoControlPickServiceImpl extends AbstractService<OrderCargo
userId = Long.valueOf(dto.getValue());
}
OrderApprovalDO approvalDO = orderApprovalMapper.selectById(orderApprovalId);
if (approvalDO.getDeleted() || (approvalDO.getType() != 7 && approvalDO.getType() != 8 && approvalDO.getType() != 9 && approvalDO.getType() != 10 && approvalDO.getStatus() != 1)) {
if (approvalDO.getDeleted() ||
(approvalDO.getType() != 7
&& approvalDO.getType() != 8
&& approvalDO.getType() != 9
&& approvalDO.getType() != 10
&& approvalDO.getType() != 61
&& approvalDO.getType() != 62
&& approvalDO.getStatus() != 1)) {
throw exception(ORDER_APPROVAL_STATUS_NOT_CORRECT);
}
if (Objects.isNull(approvalDO.getFormId())) {
......
package cn.iocoder.yudao.module.order.vo.orderCargoControl;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@Data
@ApiModel(value = "订单控货相关审核信息")
public class OrderCargoControlApplyVO {
@ApiModelProperty(value = "申请类型:此处应该是 61 放货限制修改申请 62 海外仓修改申请", required = true)
@NotNull(message = "申请类型不能为空")
private Integer applyType;
@ExcelProperty("订单id")
@ApiModelProperty(value = "订单id")
@NotNull(message = "订单ID不能为空")
private Long orderId;
@ApiModelProperty(value = "订单编号")
private String orderNo;
@ApiModelProperty(value = "提单号")
private String tidanNo;
@ApiModelProperty(value = "是否控货")
private Boolean isCargoControl;
@ApiModelProperty(value = "0 控货中;1 已放完货;2 部分控货")
private Integer cargoControlStatus;
@ApiModelProperty(value = "入仓数量")
private Integer sumQuantity = 0;
@ApiModelProperty(value = "入仓箱数")
private Integer sumNum = 0;
@ApiModelProperty(value = "入仓体积")
private BigDecimal sumVolume = BigDecimal.ZERO;
@ApiModelProperty(value = "入仓重量")
private BigDecimal sumWeight = BigDecimal.ZERO;
@ApiModelProperty(value = "已放货箱数")
private Integer releaseNum = 0;
@ApiModelProperty(value = "原放货箱数")
private Integer pickNum = 0;
@ApiModelProperty(value = "现在放货箱数")
private Integer currentPickNum = 0;
@ApiModelProperty(value = "放货数量")
private Integer pickQuantity = 0;
@ApiModelProperty(value = "放货体积")
private BigDecimal pickVolume = BigDecimal.ZERO;
@ApiModelProperty(value = "放货重量")
private BigDecimal pickWeight = BigDecimal.ZERO;
@ApiModelProperty(value = "是否限制修改收货人")
private Boolean isLimitUpdateConsignee;
@ApiModelProperty(value = "放货锁定收货人天数")
private Integer lockConsigneeDay;
// @ApiModelProperty(value = "放货锁定收货人到期时间")
// @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
// @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
// private Date lockConsigneeTime;
@ApiModelProperty(value = "附件")
private String annex;
@ApiModelProperty(value = "修改原因")
private String reasonZh;
@ApiModelProperty(value = "审批状态: 1 处理中 2 通过 3 不通过 4 已取消")
private Integer applyStatus = 1;
@ApiModelProperty(value = "抄送人(id逗号拼接)")
private String ccIds;
}
......@@ -142,4 +142,17 @@ public class OrderCargoControlController {
orderCargoControlService.sendSmsCode(getLoginUserId(), reqVO, null);
return success(true);
}
@GetMapping("cancel/approval/{orderApprovalId}")
@ApiOperation("根据审批id取消审批")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderApprovalId", value = "审批ID", required = true, example = "1024", dataType = "Long"),
@ApiImplicitParam(name = "reason", value = "取消原因", required = true, example = "1024", dataType = "String")
})
@Deprecated
public CommonResult<Boolean> cancelApprovalByOrderApprovalId(@PathVariable(value = "orderApprovalId") Long orderApprovalId,
@RequestParam(value = "reason") String reason) {
orderCargoControlPickService.cancelApprovalByOrderApprovalId(orderApprovalId, reason);
return success(Boolean.TRUE);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment