Commit 1304b50f authored by zhengyi's avatar zhengyi

调整批量费用申请审批业务

parent 92e50bd9
package cn.iocoder.yudao.module.order.dal.dataobject.orderFeeApplication;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
......@@ -101,4 +102,8 @@ public class OrderFeeApplicationDO extends BaseDO {
*/
private String batchBpmBusinessId;
@TableField(exist = false)
@ApiModelProperty(value = "是否有修改的状态")
private boolean editMode;
}
......@@ -198,18 +198,48 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
String formId = bpmCreateServiceFactory.createBmp(SecurityFrameworkUtils.getLoginUserId(),
orderApprovalDO.getOrderApprovalId(), WorkFlowEmus.ORDER_BATCH_FREE_APPLY.getKey(), orderDO.getOrderNo(), createReqVO.getCopyUserId());
orderApprovalDO.setFormId(formId);
//更新费用列表对应的流程申请ID
for (OrderFeeApplicationDO feeApplication : batchFeeList) {
feeApplication.setBatchBpmBusinessId(formId);
feeApplication.setStatus(ApprovalResultStatusEnum.processing.getValue());
List<ApplyInfoVO> list = new ArrayList<>();
//更新费用列表对应的流程申请ID及状态,并封装审批详情说明文案
for (OrderFeeApplicationDO feeApplicationDO : batchFeeList) {
if (feeApplicationDO.isEditMode() || Objects.isNull(feeApplicationDO.getId())) {
feeApplicationDO.setBatchBpmBusinessId(formId);
feeApplicationDO.setStatus(ApprovalResultStatusEnum.processing.getValue());
DictDataRespDTO feeDictDataFromCache = DictFrameworkUtils.getDictDataFromCache(DictTypeConstants.RECEIVABLE_FEE_TYPE, String.valueOf(feeApplicationDO.getFeeType()));
DictDataRespDTO payDictDataFromCache = DictFrameworkUtils.getDictDataFromCache(DictTypeConstants.PAYMENT_TYPE, String.valueOf(feeApplicationDO.getPayType()));
CurrencyDO currency = currencyService.getCurrency(feeApplicationDO.getApplicationFeeCurrency());
String value = "%s: 金额[%s%s], 付款类型[%s]";
ApplyInfoVO applyInfoVO = new ApplyInfoVO();
if (Objects.isNull(feeApplicationDO.getId())) {
applyInfoVO.setName("新增申请费用");
applyInfoVO.setNewValue(String.format(value,
I18nMessage.getLang() == 0 ? feeDictDataFromCache.getLabel() : feeDictDataFromCache.getLabelEn() ,
feeApplicationDO.getApplicationFee().toString(),
I18nMessage.getLang() == 0 ? currency.getTitleZh() : currency.getTitleEn(),
I18nMessage.getLang() == 0 ? payDictDataFromCache.getLabel() : payDictDataFromCache.getLabelEn()));
}else {
OrderFeeApplicationDO oldFeeAppliction = feeApplicationMapper.selectById(feeApplicationDO.getId());
DictDataRespDTO feeDictDataFromCacheOld = DictFrameworkUtils.getDictDataFromCache(DictTypeConstants.RECEIVABLE_FEE_TYPE, String.valueOf(oldFeeAppliction.getFeeType()));
DictDataRespDTO payDictDataFromCacheOld = DictFrameworkUtils.getDictDataFromCache(DictTypeConstants.PAYMENT_TYPE, String.valueOf(oldFeeAppliction.getPayType()));
CurrencyDO currencyOld = currencyService.getCurrency(oldFeeAppliction.getApplicationFeeCurrency());
applyInfoVO.setName("修改申请费用");
applyInfoVO.setNewValue(String.format(value,
I18nMessage.getLang() == 0 ? feeDictDataFromCache.getLabel() : feeDictDataFromCache.getLabelEn() ,
feeApplicationDO.getApplicationFee().toString(),
I18nMessage.getLang() == 0 ? currency.getTitleZh() : currency.getTitleEn(),
I18nMessage.getLang() == 0 ? payDictDataFromCache.getLabel() : payDictDataFromCache.getLabelEn()));
applyInfoVO.setOrgValue(String.format(value,
I18nMessage.getLang() == 0 ? feeDictDataFromCacheOld.getLabel() : feeDictDataFromCacheOld.getLabelEn() ,
oldFeeAppliction.getApplicationFee().toString(),
I18nMessage.getLang() == 0 ? currencyOld.getTitleZh() : currencyOld.getTitleEn(),
I18nMessage.getLang() == 0 ? payDictDataFromCacheOld.getLabel() : payDictDataFromCacheOld.getLabelEn()));
}
list.add(applyInfoVO);
}
}
orderApprovalDO.setDetails(JSONObject.toJSONString(batchFeeList));
orderApprovalService.updateById(orderApprovalDO);
// Long bpmProcessId = orderApprovalService.applyAndCreate(orderApprovalDO, WorkFlowEmus.ORDER_BATCH_FREE_APPLY, createReqVO.getCopyUserId());
//创建审批流
// OrderDO orderDO = orderService.selectOne(OrderDO::getOrderId, createReqVO.getOrderId());
orderBusinessService.addOrderOperateLog(createReqVO.getOrderId(), "", "提交费用申请", list);
orderService.updateStatus(orderDO.getOrderId(), null, null, null, null, null, OrderApprovalTypeResultEnum.expense_apply_batch_processing.getType(), OrderApprovalTypeResultEnum.expense_apply_batch_processing.getDesc());
......@@ -218,7 +248,6 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFeeApplication(OrderFeeApplicationUpdateReqVO updateReqVO) {
OrderDO orderDO = orderService.getById(updateReqVO.getOrderId());
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(updateReqVO.getOrderId(), null, expense_apply.getValue(), null, false);
applicationContext.publishEvent(approvalTypeCheckEvent);
......@@ -273,7 +302,6 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
applyInfoVO.setOrgValue(I18nMessage.getLang() == 0 ? payDictDataFromCacheOld.getLabel() : payDictDataFromCacheOld.getLabelEn());
applyInfoVO.setNewValue(I18nMessage.getLang() == 0 ? payDictDataFromCache.getLabel() : payDictDataFromCache.getLabelEn());
list.add(applyInfoVO);
orderBusinessService.addOrderOperateLog(updateObj.getOrderId(), "", "费用修改提交审核", list);
}
......@@ -567,7 +595,7 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
.orderByDesc(OrderApprovalDO::getOrderApprovalId).last("limit 1"));
if (Objects.nonNull(approvalDO) && approvalDO.getType() == 41 && Objects.nonNull(approvalDO.getDetails())) {
// 对于批量审批中的费用申请,直接返回审批中数据即可
return JSONObject.parseArray(JSONObject.toJSONString(approvalDO.getDetails()), OrderFeeApplicationDO.class);
return JSONObject.parseArray(approvalDO.getDetails(), OrderFeeApplicationDO.class);
}
List<OrderFeeApplicationDO> feeApplicationList = feeApplicationMapper.getFeeApplicationListByOrderId(orderId);
feeApplicationList.stream().forEach(item -> {
......
......@@ -18,4 +18,8 @@ public class OrderFeeApplicationUpdateReqVO extends OrderFeeApplicationBaseVO {
@ApiModelProperty(value = "抄送人userId")
String[] copyUserId;
@ApiModelProperty(value = "是否有修改的状态")
private boolean editMode;
}
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