Merge branch 'dev' of http://47.97.8.94:19527/yj/zn-cloud into dev
This commit is contained in:
commit
b6ee116530
@ -58,9 +58,9 @@ public class DeptDataPermissionRule implements DataPermissionRule {
|
||||
|
||||
// TODO: 2024/4/10 注意 - 如果需要降级低权的话 要把需要的表名称加在这里 并且在方法上开启数据权限 并且添加 DataPermissionConfiguration 对象
|
||||
private static final List<String> LOW_POWER_TABLES = Arrays.asList(
|
||||
"bpm_process_instance_ext",
|
||||
"work_log_use",
|
||||
"work_log_statistics",
|
||||
// "bpm_process_instance_ext",
|
||||
// "work_log_use",
|
||||
// "work_log_statistics",
|
||||
"work_log_instance_ext",
|
||||
"bpm_oa_work_task",
|
||||
"zc_dept_assets",
|
||||
|
@ -29,6 +29,17 @@ public class BpmOACashCreateReqVO {
|
||||
@NotNull(message = "申请事由不能为空")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "费用类型 | 字典值参照bpm_oa_cash_type", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "费用类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "费用产生部门", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "费用产生部门不能为空")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "采购申请编号")
|
||||
private Long procureId;
|
||||
|
||||
@Schema(description = "支出金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "申请金额不能为空")
|
||||
private BigDecimal totalMoney;
|
||||
@ -38,6 +49,9 @@ public class BpmOACashCreateReqVO {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate applicationDate;
|
||||
|
||||
@Schema(description = "收款人信息")
|
||||
private Long bankId;
|
||||
|
||||
@Schema(description = "备注说明", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String notes;
|
||||
|
||||
|
@ -28,6 +28,16 @@ public class BpmOACashRespVO extends BpmOABaseRespVO {
|
||||
@NotNull(message = "申请事由不能为空")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "费用类型 | 字典值参照bpm_oa_cash_type", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "费用类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "采购申请编号")
|
||||
private Long procureId;
|
||||
|
||||
@Schema(description = "支出金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "申请金额不能为空")
|
||||
private BigDecimal totalMoney;
|
||||
@ -37,6 +47,15 @@ public class BpmOACashRespVO extends BpmOABaseRespVO {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate applicationDate;
|
||||
|
||||
@Schema(description = "收款人名称")
|
||||
private String payeeName;
|
||||
|
||||
@Schema(description = "银行卡号")
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "开户行名称")
|
||||
private String bankName;
|
||||
|
||||
@Schema(description = "备注说明", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String notes;
|
||||
|
||||
|
@ -45,6 +45,21 @@ public class BpmOACashDO extends BaseDO {
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 费用类型 字典值参照 BPM_OA_REIMBURSEMENT_TYPE
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 费用产生部门
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 采购申请 业务编号
|
||||
*/
|
||||
private Long procureId;
|
||||
|
||||
/**
|
||||
* 现金支出金额
|
||||
*/
|
||||
@ -55,6 +70,12 @@ public class BpmOACashDO extends BaseDO {
|
||||
*/
|
||||
private LocalDate applicationDate;
|
||||
|
||||
/**
|
||||
* 收款人信息
|
||||
* system_bank 编号
|
||||
*/
|
||||
private Long bankId;
|
||||
|
||||
/**
|
||||
* 备注说明
|
||||
*/
|
||||
|
@ -22,7 +22,7 @@ public interface BpmOACashService {
|
||||
* @param id 编号
|
||||
* @param result 结果
|
||||
*/
|
||||
void updateCashResult(Long id, Integer result);
|
||||
void updateCashResult(String processInstanceId, Long id, Integer result);
|
||||
|
||||
/**
|
||||
* 获得现金支出申请
|
||||
|
@ -3,15 +3,22 @@ package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.cash.BpmOACashCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.procure.BpmOAProcureListEditReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.upload.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOACashConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOACashDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProcureDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOACashMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -40,10 +47,17 @@ public class BpmOACashServiceImpl extends BpmOABaseService implements BpmOACashS
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmProcessInstanceService bpmProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
private BpmOAProcureService bpmOAProcureService;
|
||||
|
||||
@Override
|
||||
public Long createCash(Long userId, BpmOACashCreateReqVO createReqVO) {
|
||||
|
||||
//插入OA 出差申请
|
||||
//插入OA 现金支出申请
|
||||
BpmOACashDO cash = BpmOACashConvert.INSTANCE.convert(createReqVO).setUserId(userId)
|
||||
.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult());
|
||||
cashMapper.insert(cash) ;
|
||||
@ -54,9 +68,20 @@ public class BpmOACashServiceImpl extends BpmOABaseService implements BpmOACashS
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(cash.getId()))).getCheckedData();
|
||||
|
||||
// 将工作流的编号,更新到 OA 请假单中
|
||||
// 将工作流的编号,更新到 OA 现金支出单中
|
||||
cashMapper.updateById(new BpmOACashDO().setId(cash.getId()).setProcessInstanceId(processInstanceId));
|
||||
|
||||
//报销类别为 采购费时
|
||||
if (cash.getType() == 4) {
|
||||
|
||||
//所有关联的采购申请改为 进行中状态
|
||||
bpmOAProcureService.updatePayFlagByIds(
|
||||
new BpmOAProcureListEditReqVO()
|
||||
.setPayFlag(BpmOAProcureDO.IN_PROGRESS)
|
||||
.setProcureIds(Collections.singletonList(cash.getProcureId()))
|
||||
);
|
||||
}
|
||||
|
||||
List<UploadUserFile> fileItems = createReqVO.getFileItems() ;
|
||||
//这里的逻辑,如果fileItems不为空,且有数据,那么说明是上传了附件的,则需要更工作流文件表对应的实例Id
|
||||
if (fileItems != null && !fileItems.isEmpty()) {
|
||||
@ -66,9 +91,55 @@ public class BpmOACashServiceImpl extends BpmOABaseService implements BpmOACashS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCashResult(Long id, Integer result) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateCashResult(String processInstanceId, Long id, Integer result) {
|
||||
|
||||
validateLeaveExists(id);
|
||||
//审核通过 (最后节点)
|
||||
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
|
||||
|
||||
ProcessInstance instance = bpmProcessInstanceService.getProcessInstance(processInstanceId);
|
||||
|
||||
if (instance.isEnded()) {
|
||||
|
||||
//判断是否有采购报销
|
||||
BpmOACashDO cash = getCash(id);
|
||||
|
||||
//报销类别为 采购费时
|
||||
if (cash.getType() == 4) {
|
||||
|
||||
//所有关联的采购申请改为 已支付状态
|
||||
bpmOAProcureService.updatePayFlagByIds(
|
||||
new BpmOAProcureListEditReqVO()
|
||||
.setPayFlag(BpmOAProcureDO.FLAG_TRUE)
|
||||
.setProcureIds(Collections.singletonList(cash.getProcureId()))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -- 自己取消
|
||||
// -- 审核拒绝
|
||||
//所有关联的采购申请改为 未支付状态
|
||||
if (BpmProcessInstanceResultEnum.REJECT.getResult().equals(result)
|
||||
|| BpmProcessInstanceResultEnum.CANCEL.getResult().equals(result)
|
||||
|| BpmProcessInstanceResultEnum.BACK.getResult().equals(result)) {
|
||||
|
||||
//判断是否有采购报销
|
||||
BpmOACashDO cash = getCash(id);
|
||||
|
||||
//报销类别为 采购费时
|
||||
if (cash.getType() == 4) {
|
||||
|
||||
//所有关联的采购申请改为 未支付状态
|
||||
bpmOAProcureService.updatePayFlagByIds(
|
||||
new BpmOAProcureListEditReqVO()
|
||||
.setPayFlag(BpmOAProcureDO.FLAG_FALSE)
|
||||
.setProcureIds(Collections.singletonList(cash.getProcureId()))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
cashMapper.updateById(new BpmOACashDO().setId(id).setResult(result));
|
||||
}
|
||||
|
||||
|
@ -104,11 +104,7 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
//报销类别为 采购费时
|
||||
if ("4".equals(data.getType())) {
|
||||
|
||||
BpmOAProcureDO procureDO = bpmOAProcureService.getOaProcure(data.getProcureId());
|
||||
if (procureDO != null) {
|
||||
|
||||
procureIds.add(procureDO.getId());
|
||||
}
|
||||
procureIds.add(data.getProcureId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,11 +159,7 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
//报销类别为 采购费时
|
||||
if ("4".equals(reimbursement.getType())) {
|
||||
|
||||
BpmOAProcureDO procureDO = bpmOAProcureService.getOaProcure(reimbursement.getProcureId());
|
||||
if (procureDO != null) {
|
||||
|
||||
procureIds.add(procureDO.getId());
|
||||
}
|
||||
procureIds.add(reimbursement.getProcureId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,6 @@ public class BpmOACashResultListener extends BpmProcessInstanceResultEventListen
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceResultEvent event) {
|
||||
|
||||
cashService.updateCashResult(Long.parseLong(event.getBusinessKey()), event.getResult());
|
||||
cashService.updateCashResult(event.getId(), Long.parseLong(event.getBusinessKey()), event.getResult());
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@ -235,7 +234,7 @@ public class FactoryDataServiceImpl implements FactoryDataService {
|
||||
});
|
||||
dataDetailRespVO.setItems(date.getValue());
|
||||
|
||||
if (date.getValue().get(0).getCreateTime().equals(LocalDateTime.now())) {
|
||||
if (date.getValue().get(0).getCreateTime().toLocalDate().equals(LocalDate.now())) {
|
||||
|
||||
//设置 可编辑状态
|
||||
dataDetailRespVO.setIsEdit(1);
|
||||
@ -294,7 +293,7 @@ public class FactoryDataServiceImpl implements FactoryDataService {
|
||||
//校验,判断是否有不符合的原因
|
||||
Long factoryId = null;
|
||||
try {
|
||||
factoryId = validateFactoryForCreate(data.getFactoryName(), data.getSizeName(), data.getDate(), type);
|
||||
factoryId = validateFactoryForCreate(data, type);
|
||||
} catch (Exception ex) {
|
||||
|
||||
respVO.getFailureUsernames().put(data.getFactoryName() + "-" + data.getDate(), ex.getMessage());
|
||||
@ -378,7 +377,11 @@ public class FactoryDataServiceImpl implements FactoryDataService {
|
||||
return respVO;
|
||||
}
|
||||
|
||||
private Long validateFactoryForCreate(String factoryName, String sizeName, LocalDate date, Integer type) {
|
||||
private Long validateFactoryForCreate(FactoryDataImportVO data, Integer type) {
|
||||
|
||||
String factoryName = data.getFactoryName();
|
||||
String sizeName = data.getSizeName();
|
||||
LocalDate date = data.getDate();
|
||||
|
||||
if (factoryName == null) {
|
||||
throw exception(FACTORY_INFO_NOT_EXISTS);
|
||||
@ -391,10 +394,16 @@ public class FactoryDataServiceImpl implements FactoryDataService {
|
||||
FactoryInfoDO factoryInfoDO = factoryInfoService.getFactoryByName(factoryName);
|
||||
|
||||
List<Integer> dataType = new ArrayList<>();
|
||||
if (type == 1) {
|
||||
dataType = Arrays.asList(1,4);
|
||||
} else if (type == 2) {
|
||||
dataType = Arrays.asList(2,3);
|
||||
if (data.getNum() != null && data.getDamageNum() != null) {
|
||||
dataType = type == 1 ? Arrays.asList(1,4) : Arrays.asList(2,3);
|
||||
}
|
||||
|
||||
if (data.getNum() != null && data.getDamageNum() == null) {
|
||||
dataType = type == 1 ? Collections.singletonList(4) : Collections.singletonList(2);
|
||||
}
|
||||
|
||||
if (data.getNum() == null && data.getDamageNum() != null) {
|
||||
dataType = type == 1 ? Collections.singletonList(1) : Collections.singletonList(3);
|
||||
}
|
||||
|
||||
// 获取 规格ID
|
||||
|
Loading…
Reference in New Issue
Block a user