Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into dev-crm
# Conflicts: # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/rpc/config/RpcConfiguration.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java
This commit is contained in:
commit
3df040cbf3
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.framework.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 全局部门类型枚举
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum DeptTypeEnum {
|
||||
|
||||
COMPANY("COMPANY", "公司"),
|
||||
SALE_DEPT("SALE_DEPT", "销售部门"),
|
||||
DEVELOPMENT_DEPT("DEVELOPMENT_DEPT", "开发部门"),
|
||||
PRODUCTION_DEPT("TECHNICAL_DEPT", "生产部门"),
|
||||
MARKETING_DEPT("MARKETING_DEPT", "市场部门"),
|
||||
FINANCE_DEPT("FINANCE_DEPT", "财务部门"),
|
||||
HR_DEPT("HR_DEPT", "人力部门"),
|
||||
PURCHASING_DEPT("PURCHASING_DEPT", "采购部门"),
|
||||
OTHER("OTHER", "其他部门");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String value;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private final String name;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.bpm.api.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.BpmOARefundDTO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 退款申请")
|
||||
public interface BpmOARefundApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/oa/refund";
|
||||
|
||||
@PostMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得指定的退款申请列表")
|
||||
CommonResult<Map<String,BpmOARefundDTO>> getListByOrderNo(@RequestBody List<String> orderNos);
|
||||
|
||||
@GetMapping(PREFIX + "/update-status")
|
||||
@Operation(summary = "修改退款申请的退款状态 为已退款")
|
||||
@Parameter(name = "orderNo", description = "订单编号", required = true)
|
||||
@Parameter(name = "status", description = "状态", required = true)
|
||||
CommonResult<Boolean> updateStatus(@RequestParam("orderNo") String orderNo);
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.module.bpm.api.oa.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
/**
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Schema(description = "管理后台 - 退款申请 请求Request VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOARefundDTO {
|
||||
|
||||
@Schema(description = "表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "状态-参见 bpm_process_instance_result 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer result;
|
||||
|
||||
@Schema(description = "流程id")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "扣款金额")
|
||||
private BigDecimal chargebacksAmount;
|
||||
|
||||
@Schema(description = "退款金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
@Schema(description = "退款日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate refundDate;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String notes;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
}
|
@ -57,6 +57,9 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode OA_EVECTION_IS_EXISTS = new ErrorCode(1_009_001_120, "该时间段您正在出差!请重新选择正确出差时间。");
|
||||
ErrorCode OA_INVOICE_NOT_EXISTS = new ErrorCode(1_009_001_121, "开票申请不存在");
|
||||
ErrorCode OA_REPLACEMENT_CARD_NOT_EXISTS = new ErrorCode(1_009_001_122, "补卡申请不存在");
|
||||
ErrorCode OA_REFUND_NOT_EXISTS = new ErrorCode(1_009_001_123, "退款申请不存在");
|
||||
ErrorCode OA_PROJECT_NOT_EXISTS = new ErrorCode(1_009_001_124, "项目申请不存在");
|
||||
|
||||
|
||||
// ========== 流程模型 1-009-002-000 ==========
|
||||
ErrorCode MODEL_KEY_EXISTS = new ErrorCode(1_009_002_000, "已经存在流程标识为【{}】的流程");
|
||||
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.bpm.api.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.BpmOARefundDTO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOARefundDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOARefundService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
|
||||
/**
|
||||
* Flowable 流程实例 Api 实现类
|
||||
*/
|
||||
@RestController
|
||||
@Validated
|
||||
public class BpmOARefundApiImpl implements BpmOARefundApi{
|
||||
|
||||
@Resource
|
||||
private BpmOARefundService refundService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Map<String, BpmOARefundDTO>> getListByOrderNo(List<String> orderNos) {
|
||||
List<BpmOARefundDO> list = refundService.getListByOrderNo(orderNos);
|
||||
return success(convertMap(BeanUtils.toBean(list, BpmOARefundDTO.class), BpmOARefundDTO::getOrderNo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateStatus(String orderNo) {
|
||||
refundService.updateStatus(orderNo);
|
||||
return success(true);
|
||||
}
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.project.BpmOAProjectCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.project.BpmOAProjectRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProjectDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAProjectService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
/**
|
||||
* OA 项目申请 Controller
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Tag(name = "管理后台 - OA 项目申请")
|
||||
@RestController
|
||||
@RequestMapping("/bpm/oa/project")
|
||||
@Validated
|
||||
public class BpmOAProjectController {
|
||||
|
||||
@Resource
|
||||
private BpmOAProjectService projectService;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建请求申请")
|
||||
public CommonResult<Long> createProject(@Valid @RequestBody BpmOAProjectCreateReqVO createReqVO) {
|
||||
|
||||
return success(projectService.createProject(getLoginUserId(), createReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得项目申请")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<BpmOAProjectRespVO> getProject(@RequestParam("id") Long id) {
|
||||
|
||||
BpmOAProjectDO project = projectService.getProject(id);
|
||||
BpmOAProjectRespVO respVO = BeanUtils.toBean(project, BpmOAProjectRespVO.class);
|
||||
|
||||
if (respVO != null) {
|
||||
|
||||
// 获取项目中所有部门编号列表
|
||||
Set<Long> deptIds = respVO.getParticipationDept() == null ? new HashSet<>() : respVO.getParticipationDept();
|
||||
deptIds.add(respVO.getResponsibleDept());
|
||||
|
||||
// 获取所有用户信息
|
||||
AdminUserRespDTO userRespDTO = userApi.getUser(respVO.getDirectorUserId()).getCheckedData();
|
||||
// 获取所有部门信息
|
||||
List<DeptRespDTO> deptDOS = deptApi.getDeptList(deptIds).getCheckedData();
|
||||
Map<Long, DeptRespDTO> deptMap = convertMap(deptDOS, DeptRespDTO::getId);
|
||||
|
||||
// 设置责任人名称
|
||||
respVO.setDirectorUserName(userRespDTO.getNickname());
|
||||
|
||||
// 筛选出不是责任人部门的部门信息
|
||||
List<DeptRespDTO> deptVOs = deptDOS.stream()
|
||||
.filter(dept -> !dept.getId().equals(respVO.getResponsibleDept()))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 设置责任部门名称
|
||||
respVO.setResponsibleDeptName(deptMap.get(respVO.getResponsibleDept()).getName());
|
||||
// 拼接参与部门名称
|
||||
respVO.setParticipationDeptName(deptVOs.stream().map(DeptRespDTO::getName).collect(Collectors.joining("、")));
|
||||
}
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/getByProcessInstanceId")
|
||||
@Operation(summary = "获得项目申请")
|
||||
@Parameter(name = "processInstanceId", description = "流程实例编号", required = true, example = "1024")
|
||||
public CommonResult<BpmOAProjectRespVO> getByProcessInstanceId(@RequestParam("processInstanceId") String processInstanceId) {
|
||||
|
||||
BpmOAProjectDO project = projectService.getByProcessInstanceId(processInstanceId);
|
||||
BpmOAProjectRespVO respVO = BeanUtils.toBean(project, BpmOAProjectRespVO.class);
|
||||
|
||||
if (respVO != null) {
|
||||
|
||||
// 获取项目中所有部门编号列表
|
||||
Set<Long> deptIds = respVO.getParticipationDept() == null ? new HashSet<>() : respVO.getParticipationDept();
|
||||
deptIds.add(respVO.getResponsibleDept());
|
||||
|
||||
// 获取所有用户信息
|
||||
AdminUserRespDTO userRespDTO = userApi.getUser(respVO.getDirectorUserId()).getCheckedData();
|
||||
// 获取所有部门信息
|
||||
List<DeptRespDTO> deptDOS = deptApi.getDeptList(deptIds).getCheckedData();
|
||||
Map<Long, DeptRespDTO> deptMap = convertMap(deptDOS, DeptRespDTO::getId);
|
||||
|
||||
// 设置责任人名称
|
||||
respVO.setDirectorUserName(userRespDTO.getNickname());
|
||||
|
||||
// 筛选出不是责任人部门的部门信息
|
||||
List<DeptRespDTO> deptVOs = deptDOS.stream()
|
||||
.filter(dept -> !dept.getId().equals(respVO.getResponsibleDept()))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 设置责任部门名称
|
||||
respVO.setResponsibleDeptName(deptMap.get(respVO.getResponsibleDept()).getName());
|
||||
// 拼接参与部门名称
|
||||
respVO.setParticipationDeptName(deptVOs.stream().map(DeptRespDTO::getName).collect(Collectors.joining("、")));
|
||||
}
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.refund.BpmOARefundCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.refund.BpmOARefundRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOARefundDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOARefundService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
/**
|
||||
* OA 退款申请 Controller
|
||||
*
|
||||
* @author 符溶馨
|
||||
|
||||
*/
|
||||
@Tag(name = "管理后台 - OA 退款申请")
|
||||
@RestController
|
||||
@RequestMapping("/bpm/oa/refund")
|
||||
@Validated
|
||||
public class BpmOARefundController {
|
||||
|
||||
@Resource
|
||||
private BpmOARefundService refundService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建请求申请")
|
||||
public CommonResult<Long> createRefund(@Valid @RequestBody BpmOARefundCreateReqVO createReqVO) {
|
||||
|
||||
return success(refundService.createRefund(getLoginUserId(), createReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得退款申请")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<BpmOARefundRespVO> getRefund(@RequestParam("id") Long id) {
|
||||
|
||||
BpmOARefundDO refund = refundService.getRefund(id);
|
||||
|
||||
return success(BeanUtils.toBean(refund, BpmOARefundRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getByProcessInstanceId")
|
||||
@Operation(summary = "获得退款申请")
|
||||
@Parameter(name = "processInstanceId", description = "流程实例编号", required = true, example = "1024")
|
||||
public CommonResult<BpmOARefundRespVO> getByProcessInstanceId(@RequestParam("processInstanceId") String processInstanceId) {
|
||||
|
||||
BpmOARefundDO refund = refundService.getByProcessInstanceId(processInstanceId);
|
||||
|
||||
return success(BeanUtils.toBean(refund, BpmOARefundRespVO.class));
|
||||
}
|
||||
}
|
@ -46,6 +46,9 @@ public class BpmOACashRespVO extends BpmOABaseRespVO {
|
||||
@Schema(description = "备用金金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "备用金剩余金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private BigDecimal remainingAmount;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
}
|
||||
|
@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.project;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
/**
|
||||
* 项目申请 创建 Request VO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Schema(description = "管理后台 - 项目申请创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode()
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAProjectCreateReqVO {
|
||||
|
||||
@Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "项目类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "项目名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "责任部门", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "责任部门不能为空")
|
||||
private Long responsibleDept;
|
||||
|
||||
@Schema(description = "参与部门集合")
|
||||
private Set<Long> participationDept;
|
||||
|
||||
@Schema(description = "责任人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "责任人不能为空")
|
||||
private Long directorUserId;
|
||||
|
||||
@Schema(description = "项目开始日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "项目开始日期不能为空")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate startDate;
|
||||
|
||||
@Schema(description = "项目结束日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate endDate;
|
||||
|
||||
@Schema(description = "是否长期项目", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Integer isLongTerm;
|
||||
|
||||
@Schema(description = "项目预算", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "项目预算不能为空")
|
||||
private BigDecimal projectBudget;
|
||||
|
||||
@Schema(description = "项目内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "项目内容不能为空")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "项目额外属性", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Map<String, Object> dynamicAttribute;
|
||||
|
||||
@Schema(description = "流程实例编号")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "状态-参见 bpm_process_instance_result 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer result;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.project;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOABaseRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.refund.BpmOARefundItems;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
/**
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Schema(description = "管理后台 - 项目申请 请求Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAProjectRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String name;
|
||||
|
||||
@Schema(description = "责任部门", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long responsibleDept;
|
||||
|
||||
@Schema(description = "责任部门名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String responsibleDeptName;
|
||||
|
||||
@Schema(description = "参与部门集合")
|
||||
private Set<Long> participationDept;
|
||||
|
||||
@Schema(description = "参与部门名称集合")
|
||||
private String participationDeptName;
|
||||
|
||||
@Schema(description = "责任人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long directorUserId;
|
||||
|
||||
@Schema(description = "责任人名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String directorUserName;
|
||||
|
||||
@Schema(description = "项目开始日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate startDate;
|
||||
|
||||
@Schema(description = "项目结束日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate endDate;
|
||||
|
||||
@Schema(description = "是否长期项目", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Integer isLongTerm;
|
||||
|
||||
@Schema(description = "项目预算", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal projectBudget;
|
||||
|
||||
@Schema(description = "项目内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "项目内容不能为空")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "项目额外属性", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Map<String, Object> dynamicAttribute;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.refund;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
/**
|
||||
* 退款申请 创建 Request VO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Schema(description = "管理后台 - 退款申请创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode()
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOARefundCreateReqVO {
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "订单编号不能为空")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "归还物品明细", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@NotNull(message = "归还物品明细不能为空")
|
||||
private List<BpmOARefundItems> refundItems;
|
||||
|
||||
@Schema(description = "扣款金额")
|
||||
private BigDecimal chargebacksAmount;
|
||||
|
||||
@Schema(description = "退款金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@NotNull(message = "退款金额不能为空")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
@Schema(description = "退款日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate refundDate;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String notes;
|
||||
|
||||
@Schema(description = "状态 | 0未退款 1已退款", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "流程实例编号")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "状态-参见 bpm_process_instance_result 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer result;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.refund;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 退款申请 归还物品明细 Request VO")
|
||||
@Data
|
||||
public class BpmOARefundItems {
|
||||
|
||||
@Schema(description = "租赁物品类型")
|
||||
private Integer rentalItemsType;
|
||||
|
||||
@Schema(description = "归还数量")
|
||||
private Integer rentalNumber;
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.refund;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOABaseRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
/**
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Schema(description = "管理后台 - 退款申请 请求Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOARefundRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "订单编号不能为空")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "归还物品明细", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@NotNull(message = "归还物品明细不能为空")
|
||||
private List<BpmOARefundItems> refundItems;
|
||||
|
||||
@Schema(description = "扣款金额")
|
||||
private BigDecimal chargebacksAmount;
|
||||
|
||||
@Schema(description = "退款金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@NotNull(message = "退款金额不能为空")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
@Schema(description = "退款日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate refundDate;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String notes;
|
||||
|
||||
@Schema(description = "状态 | 0未退款 1已退款", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
}
|
@ -44,7 +44,10 @@ public class BpmOAReimbursementRespVO extends BpmOABaseRespVO {
|
||||
private BigDecimal reimbursementType ;
|
||||
|
||||
@Schema(description = "备用金金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private BigDecimal amount ;
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "备用金剩余金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private BigDecimal remainingAmount;
|
||||
|
||||
@Schema(description = "备用金ID")
|
||||
private Long imprestId;
|
||||
|
@ -0,0 +1,120 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.dataobject.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* OA 项目申请 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName(value ="bpm_oa_project", autoResultMap = true)
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BpmOAProjectDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 出差表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请人的用户编号
|
||||
* 关联 AdminUserDO 的 id 属性
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 责任部门
|
||||
*/
|
||||
private Long responsibleDept;
|
||||
|
||||
/**
|
||||
* 参与部门
|
||||
*/
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> participationDept;
|
||||
|
||||
/**
|
||||
* 责任人
|
||||
*/
|
||||
private Long directorUserId;
|
||||
|
||||
/**
|
||||
* 项目开始日期
|
||||
*/
|
||||
private LocalDate startDate;
|
||||
|
||||
/**
|
||||
* 项目结束日期
|
||||
*/
|
||||
private LocalDate endDate;
|
||||
|
||||
/**
|
||||
* 是否为长期项目 | 0否 1是
|
||||
*/
|
||||
private Integer isLongTerm;
|
||||
|
||||
/**
|
||||
* 项目预算
|
||||
*/
|
||||
private BigDecimal projectBudget;
|
||||
|
||||
/**
|
||||
* 项目内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 项目额外属性
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private Map<String, Object> dynamicAttribute;
|
||||
|
||||
/**
|
||||
* 结果
|
||||
* 枚举 {@link BpmProcessInstanceResultEnum}
|
||||
* 考虑到简单,所以直接复用了 BpmProcessInstanceResultEnum 枚举,也可以自己定义一个枚举哈
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 对应的流程编号
|
||||
* 关联 ProcessInstance 的 id 属性
|
||||
*/
|
||||
private String processInstanceId;
|
||||
|
||||
/**
|
||||
* 附件基本信息
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<UploadUserFile> fileItems;
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.dataobject.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.refund.BpmOARefundItems;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OA 退款申请 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName(value ="bpm_oa_refund", autoResultMap = true)
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BpmOARefundDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 出差表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请人的用户编号
|
||||
* 关联 AdminUserDO 的 id 属性
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 归还物品明细
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<BpmOARefundItems> refundItems;
|
||||
|
||||
/**
|
||||
* 扣款金额
|
||||
*/
|
||||
private BigDecimal chargebacksAmount;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 退款日期
|
||||
*/
|
||||
private LocalDate refundDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String notes;
|
||||
|
||||
/**
|
||||
* 状态 | 0未退款 1已退款
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 结果
|
||||
* 枚举 {@link BpmProcessInstanceResultEnum}
|
||||
* 考虑到简单,所以直接复用了 BpmProcessInstanceResultEnum 枚举,也可以自己定义一个枚举哈
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 对应的流程编号
|
||||
* 关联 ProcessInstance 的 id 属性
|
||||
*/
|
||||
private String processInstanceId;
|
||||
|
||||
/**
|
||||
* 附件基本信息
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<UploadUserFile> fileItems ;
|
||||
}
|
@ -20,7 +20,7 @@ public interface BpmProcessCcMapper extends BaseMapperX<BpmProcessCcDO> {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<BpmProcessCcDO>()
|
||||
.likeIfPresent(BpmProcessCcDO::getName, reqVO.getName())
|
||||
.likeIfPresent(BpmProcessCcDO::getUserGroupId, reqVO.getUserGroupId())
|
||||
.eqIfPresent(BpmProcessCcDO::getCompanyDeptId, reqVO.getCompanyDeptId())
|
||||
.likeIfPresent(BpmProcessCcDO::getCompanyDeptId, reqVO.getCompanyDeptId())
|
||||
.eqIfPresent(BpmProcessCcDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(BpmProcessCcDO::getId));
|
||||
}
|
||||
|
@ -4,8 +4,11 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.evection.BpmOAEvectionCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAEvectionDO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 出差申请 Mapper
|
||||
*
|
||||
@ -20,6 +23,7 @@ public interface BpmOAEvectionMapper extends BaseMapperX<BpmOAEvectionDO> {
|
||||
return selectCount(new LambdaQueryWrapperX<BpmOAEvectionDO>()
|
||||
.eq(BpmOAEvectionDO::getUserId, userId)
|
||||
.leIfPresent(BpmOAEvectionDO::getStartTime, createReqVO.getEndTime())
|
||||
.geIfPresent(BpmOAEvectionDO::getEndTime, createReqVO.getStartTime()));
|
||||
.geIfPresent(BpmOAEvectionDO::getEndTime, createReqVO.getStartTime())
|
||||
.in(BpmOAEvectionDO::getResult, Arrays.asList(BpmProcessInstanceResultEnum.PROCESS, BpmProcessInstanceResultEnum.APPROVE)));
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,13 @@ package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.procure.BpmOAProcurePageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProcureDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OA 采购申请 Mapper
|
||||
@ -30,4 +34,5 @@ public interface BpmOAProcureMapper extends BaseMapperX<BpmOAProcureDO> {
|
||||
.orderByDesc(BpmOAProcureDO::getId));
|
||||
}
|
||||
|
||||
List<BpmOAProcureDO> selectListByDeptId(@Param("companyDeptId") Long companyDeptId);
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProjectDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BpmOAProjectMapper extends BaseMapperX<BpmOAProjectDO> {
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOARefundDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BpmOARefundMapper extends BaseMapperX<BpmOARefundDO> {
|
||||
}
|
@ -17,6 +17,10 @@ import cn.iocoder.yudao.module.system.api.holiday.HolidayApi;
|
||||
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||
import cn.iocoder.yudao.module.system.api.position.PositionApi;
|
||||
import cn.iocoder.yudao.module.system.api.project.ProjectApi;
|
||||
import cn.iocoder.yudao.module.system.api.rental.RentalDepositRecordApi;
|
||||
import cn.iocoder.yudao.module.system.api.rental.RentalItemsRecordApi;
|
||||
import cn.iocoder.yudao.module.system.api.rental.RentalOrderApi;
|
||||
import cn.iocoder.yudao.module.system.api.sms.SmsSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
|
||||
import cn.iocoder.yudao.module.system.api.subscribe.SubscribeMessageSendApi;
|
||||
@ -29,7 +33,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, RoleApi.class, DeptApi.class, PostApi.class, AdminUserApi.class, SmsSendApi.class, DictDataApi.class, NotifyMessageSendApi.class,
|
||||
SubscribeMessageSendApi.class, SocialClientApi.class, UsersExtApi.class, AttendanceApi.class, BankApi.class, ConfigApi.class, PositionApi.class, SupplierApi.class, AssetsApi.class,
|
||||
AssetsTypeApi.class, AssetReceiveApi.class, AttendanceApi.class, AttendanceGroupApi.class, WorkOvertimeApi.class, HolidayApi.class, AdminOauthUserOtherInfoApi.class
|
||||
AssetsTypeApi.class, AssetReceiveApi.class, AttendanceApi.class, AttendanceGroupApi.class, WorkOvertimeApi.class, HolidayApi.class,
|
||||
RentalOrderApi.class, RentalDepositRecordApi.class, ProjectApi.class, RentalItemsRecordApi.class,AdminOauthUserOtherInfoApi.class
|
||||
})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -134,7 +134,8 @@ public class BpmOALeaveServiceImpl extends BpmOABaseService implements BpmOALeav
|
||||
beginTimeStr = "1".equals(leave.getStartTimeExtraFields()) ? "上午" : "下午";
|
||||
endTimeStr = "2".equals(leave.getStartTimeExtraFields()) ? "上午" : "下午";
|
||||
}
|
||||
String reason = "开始时间:" + leave.getStartTime().format(DateTimeFormatter.ofPattern(DateUtils.FORMAT_YEAR_MONTH_DAY)) + " " + beginTimeStr +
|
||||
String reason = createReqVO.getReason() +
|
||||
" 开始时间:" + leave.getStartTime().format(DateTimeFormatter.ofPattern(DateUtils.FORMAT_YEAR_MONTH_DAY)) + " " + beginTimeStr +
|
||||
" 结束时间:" + leave.getEndTime().format(DateTimeFormatter.ofPattern(DateUtils.FORMAT_YEAR_MONTH_DAY)) + " " + endTimeStr;
|
||||
holidayApi.createUserHoliday(new CreateUserHolidayDTO().setUserId(leave.getUserId()).setHolidaySettingId(leave.getHolidaySettingId())
|
||||
.setDirection(1).setHolidayBalance(duration).setReason(reason));
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.DeptTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
@ -28,6 +29,8 @@ import cn.iocoder.yudao.module.bpm.service.definition.BpmModelService;
|
||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -38,6 +41,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -77,6 +81,9 @@ public class BpmOAProcurePayServiceImpl extends BpmOABaseService implements BpmO
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Resource
|
||||
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
||||
|
||||
@ -154,15 +161,31 @@ public class BpmOAProcurePayServiceImpl extends BpmOABaseService implements BpmO
|
||||
public List<BpmOAProcureDO> getAvailablePurchaseOrders() {
|
||||
//获取当前登录用户id
|
||||
Long userId = WebFrameworkUtils.getLoginUserId();
|
||||
//查询当前登录用户所在部门所有用户id
|
||||
CommonResult<List<Long>> userIdsResult = adminUserApi.getUserIdsByUserIdGroupByDept(userId);
|
||||
List<Long> userIds = userIdsResult.getData();
|
||||
//根据用户ids 获取所有可用采购单
|
||||
return oaProcureMapper.selectList(new LambdaQueryWrapperX<BpmOAProcureDO>()
|
||||
.in(BpmOAProcureDO::getUserId, userIds)
|
||||
.eq(BpmOAProcureDO::getResult, BpmProcessInstanceResultEnum.APPROVE.getResult())
|
||||
.eq(BpmOAProcureDO::getPayFlag, BpmOAProcureDO.FLAG_FALSE)
|
||||
);
|
||||
// 获取当前登录用的部门信息
|
||||
DeptRespDTO dto = deptApi.getDept(adminUserApi.getUser(userId).getCheckedData().getDeptId()).getCheckedData();
|
||||
|
||||
// 用户属于采购部时
|
||||
if (dto.getType().equals(DeptTypeEnum.PURCHASING_DEPT.getValue())) {
|
||||
|
||||
// 获取用户所在公司信息
|
||||
DeptRespDTO company = deptApi.getUserCompanyDept(userId).getCheckedData();
|
||||
|
||||
// 查询当前用户所在公司下,所有部门可用的采购单
|
||||
return oaProcureMapper.selectListByDeptId(company.getId());
|
||||
|
||||
}else {
|
||||
|
||||
//查询当前登录用户所在部门下所有用户的信息
|
||||
CommonResult<List<Long>> userIdsResult = adminUserApi.getUserIdsByUserIdGroupByDept(userId);
|
||||
List<Long> userIds; userIds = userIdsResult.getData();
|
||||
|
||||
//根据用户ids 获取所有可用采购单
|
||||
return oaProcureMapper.selectList(new LambdaQueryWrapperX<BpmOAProcureDO>()
|
||||
.in(BpmOAProcureDO::getUserId, userIds)
|
||||
.eq(BpmOAProcureDO::getResult, BpmProcessInstanceResultEnum.APPROVE.getResult())
|
||||
.eq(BpmOAProcureDO::getPayFlag, BpmOAProcureDO.FLAG_FALSE)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.project.BpmOAProjectCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProjectDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
public interface BpmOAProjectService {
|
||||
|
||||
/**
|
||||
* 创建转正申请
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createProject(Long userId, @Valid BpmOAProjectCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新转正申请的状态
|
||||
*
|
||||
* @param id 编号
|
||||
* @param result 结果
|
||||
*/
|
||||
void updateProjectResult(String processInstanceId, Long id, Integer result);
|
||||
|
||||
/**
|
||||
* 获得转正申请
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 转正申请
|
||||
*/
|
||||
BpmOAProjectDO getProject(Long id);
|
||||
|
||||
/**
|
||||
* 获得指定的转正申请
|
||||
* @param processInstanceId 流程实例编号
|
||||
* @return 转正申请
|
||||
*/
|
||||
BpmOAProjectDO getByProcessInstanceId(String processInstanceId);
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
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.project.BpmOAProjectCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProjectDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAProjectMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.system.api.project.ProjectApi;
|
||||
import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_PROJECT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* OA 项目申请 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class BpmOAProjectServiceImpl extends BpmOABaseService implements BpmOAProjectService{
|
||||
|
||||
/**
|
||||
* OA 项目申请对应的流程定义 KEY
|
||||
*/
|
||||
public static final String PROCESS_KEY = "oa_project_2";
|
||||
|
||||
@Resource
|
||||
private BpmOAProjectMapper projectMapper;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
@Resource
|
||||
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceService bpmProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
private ProjectApi projectApi;
|
||||
|
||||
@Override
|
||||
public Long createProject(Long userId, BpmOAProjectCreateReqVO createReqVO) {
|
||||
|
||||
//插入OA 项目申请
|
||||
BpmOAProjectDO project = BeanUtils.toBean(createReqVO, BpmOAProjectDO.class)
|
||||
.setUserId(userId)
|
||||
.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult());
|
||||
projectMapper.insert(project) ;
|
||||
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(userId,
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(project.getId()))).getCheckedData();
|
||||
|
||||
// 将工作流的编号,更新到 OA 项目申请单中
|
||||
projectMapper.updateById(new BpmOAProjectDO().setId(project.getId()).setProcessInstanceId(processInstanceId));
|
||||
|
||||
// 判断是否为重新发起的流程
|
||||
if (createReqVO.getProcessInstanceId() != null && createReqVO.getResult() == 3) {
|
||||
|
||||
historyProcessInstanceService.createHistoryProcessInstance(processInstanceId, createReqVO.getProcessInstanceId());
|
||||
}
|
||||
|
||||
List<UploadUserFile> fileItems = createReqVO.getFileItems() ;
|
||||
//这里的逻辑,如果fileItems不为空,且有数据,那么说明是上传了附件的,则需要更工作流文件表对应的实例Id
|
||||
if (fileItems != null && !fileItems.isEmpty()) {
|
||||
uploadBpmFileProcessInstanceId(processInstanceId,fileItems) ;
|
||||
}
|
||||
return project.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProjectResult(String processInstanceId, Long id, Integer result) {
|
||||
|
||||
BpmOAProjectDO project = validateLeaveExists(id);
|
||||
//审核通过 (最后节点)
|
||||
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
|
||||
|
||||
ProcessInstance instance = bpmProcessInstanceService.getProcessInstance(processInstanceId);
|
||||
|
||||
if (instance.isEnded()) {
|
||||
|
||||
// 同步创建 项目
|
||||
projectApi.create(BeanUtils.toBean(project, ProjectDTO.class).setStatus(1));
|
||||
}
|
||||
}
|
||||
|
||||
projectMapper.updateById(new BpmOAProjectDO().setId(id).setResult(result));
|
||||
}
|
||||
|
||||
private BpmOAProjectDO validateLeaveExists(Long id) {
|
||||
BpmOAProjectDO project = projectMapper.selectById(id);
|
||||
if (project == null) {
|
||||
throw exception(OA_PROJECT_NOT_EXISTS);
|
||||
}
|
||||
return project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmOAProjectDO getProject(Long id) {
|
||||
|
||||
return projectMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmOAProjectDO getByProcessInstanceId(String processInstanceId) {
|
||||
|
||||
return projectMapper.selectOne(BpmOAProjectDO::getProcessInstanceId, processInstanceId);
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.refund.BpmOARefundCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOARefundDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
public interface BpmOARefundService {
|
||||
|
||||
/**
|
||||
* 创建退款申请
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createRefund(Long userId, @Valid BpmOARefundCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新退款申请的状态
|
||||
*
|
||||
* @param id 编号
|
||||
* @param result 结果
|
||||
*/
|
||||
void updateRefundResult(String processInstanceId, Long id, Integer result);
|
||||
|
||||
/**
|
||||
* 获得退款申请
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 退款申请
|
||||
*/
|
||||
BpmOARefundDO getRefund(Long id);
|
||||
|
||||
/**
|
||||
* 获得指定的退款申请
|
||||
* @param processInstanceId 流程实例编号
|
||||
* @return 退款申请
|
||||
*/
|
||||
BpmOARefundDO getByProcessInstanceId(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 获得指定的退款申请列表
|
||||
* @param orderNos 订单编号
|
||||
* @return 退款申请列表
|
||||
*/
|
||||
List<BpmOARefundDO> getListByOrderNo(List<String> orderNos);
|
||||
|
||||
/**
|
||||
* 更新退款申请状态
|
||||
* @param orderNo 订单编号
|
||||
*/
|
||||
void updateStatus(String orderNo);
|
||||
}
|
@ -0,0 +1,216 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
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.refund.BpmOARefundCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.refund.BpmOARefundItems;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOARefundDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOARefundMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.system.api.rental.RentalDepositRecordApi;
|
||||
import cn.iocoder.yudao.module.system.api.rental.RentalItemsRecordApi;
|
||||
import cn.iocoder.yudao.module.system.api.rental.RentalOrderApi;
|
||||
import cn.iocoder.yudao.module.system.api.rental.dto.RentalItemsRecordDTO;
|
||||
import cn.iocoder.yudao.module.system.api.rental.dto.RentalOrderDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_REFUND_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.RENTAL_REFUND_AMOUNT_EXCESS;
|
||||
|
||||
/**
|
||||
* OA 退款申请 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class BpmOARefundServiceImpl extends BpmOABaseService implements BpmOARefundService{
|
||||
|
||||
/**
|
||||
* OA 退款对应的流程定义 KEY
|
||||
*/
|
||||
public static final String PROCESS_KEY = "oa_refund_2";
|
||||
|
||||
@Resource
|
||||
private BpmOARefundMapper refundMapper;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
@Resource
|
||||
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceService bpmProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
private RentalOrderApi rentalOrderApi;
|
||||
|
||||
@Resource
|
||||
private RentalItemsRecordApi rentalItemsRecordApi;
|
||||
|
||||
@Resource
|
||||
private RentalDepositRecordApi depositRecordApi;
|
||||
|
||||
@Override
|
||||
public Long createRefund(Long userId, BpmOARefundCreateReqVO createReqVO) {
|
||||
|
||||
// 发起流程前 校验扣款金额+退款金额是否大于已收金额
|
||||
validateRefundAmount(createReqVO.getOrderNo(), createReqVO.getChargebacksAmount(), createReqVO.getRefundAmount());
|
||||
|
||||
//插入OA 退款申请
|
||||
BpmOARefundDO refund = BeanUtils.toBean(createReqVO, BpmOARefundDO.class)
|
||||
.setUserId(userId)
|
||||
.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult());
|
||||
refundMapper.insert(refund) ;
|
||||
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(userId,
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(refund.getId()))).getCheckedData();
|
||||
|
||||
// 将工作流的编号,更新到 OA 退款申请单中
|
||||
refundMapper.updateById(new BpmOARefundDO().setId(refund.getId()).setProcessInstanceId(processInstanceId));
|
||||
|
||||
// 判断是否为重新发起的流程
|
||||
if (createReqVO.getProcessInstanceId() != null && createReqVO.getResult() == 3) {
|
||||
|
||||
historyProcessInstanceService.createHistoryProcessInstance(processInstanceId, createReqVO.getProcessInstanceId());
|
||||
}
|
||||
|
||||
List<UploadUserFile> fileItems = createReqVO.getFileItems() ;
|
||||
//这里的逻辑,如果fileItems不为空,且有数据,那么说明是上传了附件的,则需要更工作流文件表对应的实例Id
|
||||
if (fileItems != null && !fileItems.isEmpty()) {
|
||||
uploadBpmFileProcessInstanceId(processInstanceId,fileItems) ;
|
||||
}
|
||||
|
||||
// 退款申请发起后,变更租赁订单状态为 退款申请中
|
||||
rentalOrderApi.updateOrder(new RentalOrderDTO()
|
||||
.setOrderNo(refund.getOrderNo())
|
||||
.setStatus(2));
|
||||
|
||||
return refund.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验扣款金额+退款金额是否大于已收金额
|
||||
*/
|
||||
private void validateRefundAmount(String orderNo, BigDecimal chargebacksAmount, BigDecimal refundAmount) {
|
||||
|
||||
// 获取订单的已收金额 和 已退金额
|
||||
Map<String, BigDecimal> respVO = depositRecordApi.getRecordAmount(orderNo).getCheckedData();
|
||||
// 获取当前订单 还需退款金额 = 已收金额 - 已退金额
|
||||
BigDecimal recordAmount = respVO.get("receivedAmount").subtract(respVO.get("refundAmount"));
|
||||
|
||||
if (recordAmount.compareTo(chargebacksAmount.add(refundAmount)) < 0) {
|
||||
throw exception(RENTAL_REFUND_AMOUNT_EXCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRefundResult(String processInstanceId, Long id, Integer result) {
|
||||
|
||||
BpmOARefundDO refundDO = validateLeaveExists(id);
|
||||
//审核通过 (最后节点)
|
||||
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
|
||||
|
||||
ProcessInstance instance = bpmProcessInstanceService.getProcessInstance(processInstanceId);
|
||||
|
||||
if (instance.isEnded()) {
|
||||
|
||||
// 获取订单的扣款金额
|
||||
BigDecimal chargebacks = rentalOrderApi.getOrder(refundDO.getOrderNo()).getCheckedData().getChargebacksAmount();
|
||||
|
||||
// 审批通过后 更新租赁订单信息
|
||||
rentalOrderApi.updateOrder(new RentalOrderDTO()
|
||||
.setOrderNo(refundDO.getOrderNo())
|
||||
.setChargebacksAmount(refundDO.getChargebacksAmount().add(chargebacks)) // 扣款金额累加
|
||||
.setStatus(3)); // 状态变更为 等待退款中
|
||||
|
||||
List<BpmOARefundItems> items = refundDO.getRefundItems();
|
||||
//直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
|
||||
//将list再次转为json串,然后由json串再转为list
|
||||
String json = JsonUtils.toJsonString(items);
|
||||
items = JsonUtils.parseArray(json, BpmOARefundItems.class);
|
||||
|
||||
// 审批通过后 更新租赁物品 归还信息
|
||||
List<RentalItemsRecordDTO> createReqVO = items.stream()
|
||||
.map(item -> new RentalItemsRecordDTO()
|
||||
.setOrderNo(refundDO.getOrderNo())
|
||||
.setRentalItemsType(item.getRentalItemsType())
|
||||
.setNumber(item.getRentalNumber())
|
||||
.setType(2))
|
||||
.collect(Collectors.toList());
|
||||
rentalItemsRecordApi.create(createReqVO);
|
||||
}
|
||||
}
|
||||
|
||||
// -- 自己取消
|
||||
// -- 审核拒绝
|
||||
if (BpmProcessInstanceResultEnum.REJECT.getResult().equals(result)
|
||||
|| BpmProcessInstanceResultEnum.CANCEL.getResult().equals(result)
|
||||
|| BpmProcessInstanceResultEnum.BACK.getResult().equals(result)) {
|
||||
|
||||
// 变更租赁订单状态 为租借中
|
||||
rentalOrderApi.updateOrder(new RentalOrderDTO()
|
||||
.setOrderNo(refundDO.getOrderNo())
|
||||
.setStatus(1));
|
||||
}
|
||||
|
||||
refundMapper.updateById(new BpmOARefundDO().setId(id).setResult(result));
|
||||
}
|
||||
|
||||
private BpmOARefundDO validateLeaveExists(Long id) {
|
||||
BpmOARefundDO refundDO = refundMapper.selectById(id);
|
||||
if (refundDO == null) {
|
||||
throw exception(OA_REFUND_NOT_EXISTS);
|
||||
}
|
||||
return refundDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmOARefundDO getRefund(Long id) {
|
||||
|
||||
return refundMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmOARefundDO getByProcessInstanceId(String processInstanceId) {
|
||||
|
||||
return refundMapper.selectOne(BpmOARefundDO::getProcessInstanceId, processInstanceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmOARefundDO> getListByOrderNo(List<String> orderNos) {
|
||||
return refundMapper.selectList(new LambdaQueryWrapperX<BpmOARefundDO>()
|
||||
.inIfPresent(BpmOARefundDO::getOrderNo, orderNos)
|
||||
.eq(BpmOARefundDO::getStatus, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(String orderNo) {
|
||||
refundMapper.update(null, new LambdaUpdateWrapper<BpmOARefundDO>()
|
||||
.set(BpmOARefundDO::getStatus, 1)
|
||||
.eq(BpmOARefundDO::getOrderNo, orderNo)
|
||||
.eq(BpmOARefundDO::getStatus, 0));
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa.listener;
|
||||
|
||||
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.bpm.service.oa.BpmOAProjectService;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAProjectServiceImpl;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* OA 项目申请单的结果的监听器实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Component
|
||||
public class BpmOAProjectResultListener extends BpmProcessInstanceResultEventListener {
|
||||
|
||||
@Resource
|
||||
private BpmOAProjectService projectService;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
|
||||
return BpmOAProjectServiceImpl.PROCESS_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceResultEvent event) {
|
||||
projectService.updateProjectResult(event.getId(), Long.parseLong(event.getBusinessKey()), event.getResult());
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa.listener;
|
||||
|
||||
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.bpm.service.oa.BpmOARefundService;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOARefundServiceImpl;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* OA 转正单的结果的监听器实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Component
|
||||
public class BpmOARefundResultListener extends BpmProcessInstanceResultEventListener {
|
||||
|
||||
@Resource
|
||||
private BpmOARefundService refundService;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
|
||||
return BpmOARefundServiceImpl.PROCESS_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceResultEvent event) {
|
||||
refundService.updateRefundResult(event.getId(), Long.parseLong(event.getBusinessKey()), event.getResult());
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -9,4 +9,25 @@
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectListByDeptId" resultType="cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProcureDO">
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
bpm_oa_procure a
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
u.id AS id
|
||||
FROM
|
||||
system_users u, system_dept d
|
||||
WHERE
|
||||
d.id = u.dept_id
|
||||
AND d.flag LIKE CONCAT('%', #{companyDeptId}, '%')
|
||||
AND u.deleted = 0
|
||||
AND d.deleted = 0
|
||||
) uu ON a.user_id = uu.id
|
||||
WHERE
|
||||
a.result = 2
|
||||
AND a.pay_flag = 0
|
||||
AND a.deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -50,15 +50,17 @@
|
||||
<!-- 根据用户分组,统计查询平均审批耗时最长Top10 数据包括已完成数据和平均耗时 -->
|
||||
<select id="getUserProcessTpo10"
|
||||
resultType="cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessFinishStatisticsRespVO">
|
||||
SELECT assignee_user_id as userId,
|
||||
SELECT a.assignee_user_id as userId,
|
||||
COUNT(*) as finfishCount,
|
||||
(SUM(UNIX_TIMESTAMP(end_time) - UNIX_TIMESTAMP(create_time))/60) /count(*) as userTime
|
||||
FROM bpm_task_ext
|
||||
WHERE end_time IS NOT NULL
|
||||
AND reason != '自动审批'
|
||||
AND deleted = FALSE
|
||||
AND process_definition_id like 'oa_%'
|
||||
GROUP BY assignee_user_id order by userTime desc limit 0, 10
|
||||
(SUM(UNIX_TIMESTAMP(a.end_time) - UNIX_TIMESTAMP(a.create_time))/60) /count(*) as userTime
|
||||
FROM bpm_task_ext a
|
||||
left join system_users b on a.assignee_user_id = b.id
|
||||
WHERE a.end_time IS NOT NULL
|
||||
AND a.reason != '自动审批'
|
||||
AND a.deleted = FALSE
|
||||
AND a.process_definition_id like 'oa_%'
|
||||
AND b.status = 0
|
||||
GROUP BY a.assignee_user_id order by userTime desc limit 0, 10
|
||||
</select>
|
||||
|
||||
<select id="selectUnfinishProcessCount"
|
||||
|
@ -83,10 +83,9 @@ public interface FileApi {
|
||||
@RequestBody byte[] content);
|
||||
|
||||
@PostMapping(PREFIX + "/updateBusinessFile")
|
||||
@Operation(summary = "修改BusinessFile文件中的 businessInstanceId | 入职申请用")
|
||||
CommonResult<Boolean> updateBusinessFileFormEntry(@RequestParam("url") String url,
|
||||
@RequestParam("businessInstanceId") String businessInstanceId);
|
||||
|
||||
@Operation(summary = "修改BusinessFile文件中的 businessInstanceId")
|
||||
CommonResult<Boolean> updateBusinessFile(@RequestParam("url") List<String> url,
|
||||
@RequestParam("businessInstanceId") String businessInstanceId);
|
||||
|
||||
@DeleteMapping(PREFIX + "/deleteBpmFile")
|
||||
@Operation(summary = "删除工作流附件")
|
||||
|
@ -67,9 +67,9 @@ public class FileApiImpl implements FileApi {
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public CommonResult<Boolean> updateBusinessFileFormEntry(String url, String businessInstanceId) {
|
||||
public CommonResult<Boolean> updateBusinessFile(List<String> url, String businessInstanceId) {
|
||||
|
||||
fileService.uploadBusinessFileFormEntry(url, businessInstanceId);
|
||||
fileService.uploadBusinessFile(url, businessInstanceId);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public interface FileService {
|
||||
* 更新文件的流程实例ID | 入职申请用
|
||||
* @param url 文件地址
|
||||
*/
|
||||
void uploadBusinessFileFormEntry(String url, String businessInstanceId);
|
||||
void uploadBusinessFile(List<String> url, String businessInstanceId);
|
||||
|
||||
/**
|
||||
* 获取用户的签名图片地址
|
||||
|
@ -337,14 +337,11 @@ public class FileServiceImpl implements FileService {
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public void uploadBusinessFileFormEntry(String url, String businessInstanceId) {
|
||||
public void uploadBusinessFile(List<String> url, String businessInstanceId) {
|
||||
|
||||
LambdaUpdateWrapper<BusinessFileDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(BusinessFileDO::getUrl, url);
|
||||
lambdaUpdateWrapper.in(BusinessFileDO::getUrl, url);
|
||||
lambdaUpdateWrapper.set(BusinessFileDO::getBusinessInstanceId, businessInstanceId); // 假设 bid 是要更新的 bid 值
|
||||
lambdaUpdateWrapper.set(BusinessFileDO::getUploadUserId, businessInstanceId);
|
||||
lambdaUpdateWrapper.set(BusinessFileDO::getCreator, businessInstanceId);
|
||||
lambdaUpdateWrapper.set(BusinessFileDO::getUpdater, businessInstanceId);
|
||||
|
||||
// 调用 MyBatis Plus 的 update 方法执行批量更新
|
||||
businessFileMapper.update(null, lambdaUpdateWrapper);
|
||||
|
@ -19,6 +19,9 @@ public class DeptRespDTO {
|
||||
@Schema(description = "父部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "部门类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "部门层级", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer level;
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.system.api.project;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.position.dto.PositionDTO;
|
||||
import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 项目")
|
||||
public interface ProjectApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/project";
|
||||
|
||||
@PostMapping(PREFIX + "/create")
|
||||
@Operation(summary = "创建项目")
|
||||
CommonResult<Long> create(@RequestBody ProjectDTO createReqVO);
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.system.api.project.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - 项目管理新增/修改 Request VO")
|
||||
@Data
|
||||
public class ProjectDTO {
|
||||
|
||||
@Schema(description = "项目管理表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "项目编号")
|
||||
private String projectNo;
|
||||
|
||||
@Schema(description = "项目类型 | 字典值参考system_project_type", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "项目类型 | 字典值参考system_project_type不能为空")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "项目名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "责任部门", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "责任部门不能为空")
|
||||
private Long responsibleDept;
|
||||
|
||||
@Schema(description = "参与部门集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "参与部门集合不能为空")
|
||||
private Set<Long> participationDept;
|
||||
|
||||
@Schema(description = "责任人用户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "责任人用户编号不能为空")
|
||||
private Long directorUserId;
|
||||
|
||||
@Schema(description = "项目开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "项目开始时间不能为空")
|
||||
private LocalDate startDate;
|
||||
|
||||
@Schema(description = "项目结束时间")
|
||||
private LocalDate endDate;
|
||||
|
||||
@Schema(description = "是否长期 | 0否 1是")
|
||||
private Integer isLongTerm;
|
||||
|
||||
@Schema(description = "项目预算")
|
||||
private Integer projectBudget;
|
||||
|
||||
@Schema(description = "项目内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "项目内容不能为空")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "项目人员用户编号集合")
|
||||
private Set<Long> staff;
|
||||
|
||||
@Schema(description = "项目额外属性")
|
||||
private Map<String, Object> dynamicAttribute;
|
||||
|
||||
@Schema(description = "项目状态 | 1 进行中 2已完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "项目状态 | 1 进行中 2已完成不能为空")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.system.api.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.rental.dto.RentalDepositRecordDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 租赁订单金额记录")
|
||||
public interface RentalDepositRecordApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/rental-deposit";
|
||||
|
||||
@PutMapping(PREFIX + "/create")
|
||||
@Operation(summary = "创建租赁订单出入张记录")
|
||||
CommonResult<Long> create(@RequestBody RentalDepositRecordDTO createReqVO);
|
||||
|
||||
@GetMapping(PREFIX + "/getRecordAmount")
|
||||
@Operation(summary = "获取租赁订单已收取的金额")
|
||||
CommonResult<Map<String, BigDecimal>> getRecordAmount(@RequestParam("orderNo") String orderNo);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.system.api.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.rental.dto.RentalItemsRecordDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 租赁订单物品记录")
|
||||
public interface RentalItemsRecordApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/rental-items";
|
||||
|
||||
@PutMapping(PREFIX + "/create")
|
||||
@Operation(summary = "创建租赁订单出入库记录")
|
||||
CommonResult<Boolean> create(@RequestBody List<RentalItemsRecordDTO> createReqVO);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.system.api.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.rental.dto.RentalOrderDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 租赁订单")
|
||||
public interface RentalOrderApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/rental-order";
|
||||
|
||||
@PutMapping(PREFIX + "/update")
|
||||
@Operation(summary = "更新租赁订单信息")
|
||||
CommonResult<Boolean> updateOrder(@RequestBody RentalOrderDTO updateReqVO);
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获取租赁订单信息")
|
||||
@Parameter(name = "orderNo", description = "订单编号", required = true)
|
||||
CommonResult<RentalOrderDTO> getOrder(@RequestParam("orderNo") String orderNo);
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.module.system.api.rental.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁订单押金记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class RentalDepositRecordDTO {
|
||||
|
||||
@Schema(description = "租赁订单押金记录表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "订单编号不能为空")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "支付方式 | 1支付宝 2微信 3银行卡", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "支付方式不能为空")
|
||||
private Integer paymentMethod;
|
||||
|
||||
@Schema(description = "交易订单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "交易订单号不能为空")
|
||||
private String transactionOrderNumber;
|
||||
|
||||
@Schema(description = "银行卡号")
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "客户银行卡号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "客户银行卡号不能为空")
|
||||
private String customerBankNo;
|
||||
|
||||
@Schema(description = "收款/退款金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "收款/退款金额不能为空")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "收款/退款日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "收款/退款日期不能为空")
|
||||
private LocalDate paymentDate;
|
||||
|
||||
@Schema(description = "类型 | 1收款 2退款", example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "附件信息")
|
||||
private List<UploadUserFile> fileItems;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.system.api.rental.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁物品记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class RentalItemsRecordDTO {
|
||||
|
||||
@Schema(description = "租赁订单表单主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "订单编号不能为空")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "租赁物品种类 | 字典值参考 system_rental_items_type", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "租赁物品种类不能为空")
|
||||
private Integer rentalItemsType;
|
||||
|
||||
@Schema(description = "租赁数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "租赁数量不能为空")
|
||||
private Integer number;
|
||||
|
||||
@Schema(description = "类型 | 1租借 2归还", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.system.api.rental.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁订单新增/修改 Request VO")
|
||||
@Data
|
||||
public class RentalOrderDTO {
|
||||
|
||||
@Schema(description = "租赁订单表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long customerId;
|
||||
|
||||
@Schema(description = "收款人")
|
||||
private String recipient;
|
||||
|
||||
@Schema(description = "押金金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "押金金额不能为空")
|
||||
private BigDecimal depositAmount;
|
||||
|
||||
@Schema(description = "扣款金额")
|
||||
private BigDecimal chargebacksAmount;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String notes;
|
||||
|
||||
@Schema(description = "状态 | 1租赁中 2退款中 3已退")
|
||||
private Integer status;
|
||||
}
|
@ -270,4 +270,16 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode PAYSLIP_EXISTS = new ErrorCode(1_012_002_007, "所选公司在当前月份已上传工资条!如需修改,请勾选覆盖导入。");
|
||||
ErrorCode PAYSLIP_ID_CARD_ERROR = new ErrorCode(1_012_002_008, "【{}】身份证输入有误,请核对后导入!");
|
||||
ErrorCode PAYSLIP_ISSUED = new ErrorCode(1_012_002_009, "所选公司在当前月份的工资条已下发,不能修改!");
|
||||
|
||||
// ========== 租赁相关 1-013-001-001 ==========
|
||||
ErrorCode RENTAL_CUSTOMER_NOT_EXISTS = new ErrorCode(1_013_001_001, "租赁客户不存在");
|
||||
ErrorCode RENTAL_ORDER_NOT_EXISTS = new ErrorCode(1_013_001_002, "租赁订单不存在");
|
||||
ErrorCode RENTAL_ITEMS_RECORD_NOT_EXISTS = new ErrorCode(1_013_001_003, "租赁物品记录不存在");
|
||||
ErrorCode RENTAL_DEPOSIT_RECORD_NOT_EXISTS = new ErrorCode(1_013_001_004, "租赁订单押金记录不存在");
|
||||
ErrorCode RENTAL_ITEMS_NUMBER_EXCESS = new ErrorCode(1_013_001_005, "归还数量不能大于剩余租借数量!");
|
||||
ErrorCode RENTAL_RECEIVED_AMOUNT_EXCESS = new ErrorCode(1_013_001_006, "收款金额不能大于押金金额!");
|
||||
ErrorCode RENTAL_REFUND_AMOUNT_EXCESS = new ErrorCode(1_013_001_007, "退款金额不能大于收款金额!");
|
||||
|
||||
// ========== 项目管理相关 1-014-001-001 ==========
|
||||
ErrorCode PROJECT_NOT_EXISTS = new ErrorCode(1_014_001_001, "项目不存在!");
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.system.api.project;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.service.project.ProjectService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class ProjectApiImpl implements ProjectApi {
|
||||
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> create(ProjectDTO createReqVO) {
|
||||
return success(projectService.createProject(BeanUtils.toBean(createReqVO, ProjectSaveReqVO.class)));
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.system.api.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.api.rental.dto.RentalDepositRecordDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositAmountReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.service.rental.RentalDepositRecordService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class RentalDepositRecordApiImpl implements RentalDepositRecordApi {
|
||||
|
||||
@Resource
|
||||
private RentalDepositRecordService rentalDepositRecordService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> create(RentalDepositRecordDTO createReqVO) {
|
||||
RentalDepositRecordSaveReqVO depositRecord = BeanUtils.toBean(createReqVO, RentalDepositRecordSaveReqVO.class);
|
||||
return success(rentalDepositRecordService.createRentalDepositRecord(depositRecord));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Map<String, BigDecimal>> getRecordAmount(String orderNo) {
|
||||
RentalDepositAmountReqVO reqVO = rentalDepositRecordService.getRentalDepositRecordAmount(orderNo, false);
|
||||
Map<String, BigDecimal> result = new HashMap<>();
|
||||
result.put("receivedAmount", reqVO.getReceivedAmount());
|
||||
result.put("refundAmount", reqVO.getRefundAmount());
|
||||
return success(result);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.system.api.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.api.rental.dto.RentalItemsRecordDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.service.rental.RentalItemsRecordService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class RentalItemsRecordApiImpl implements RentalItemsRecordApi {
|
||||
|
||||
@Resource
|
||||
private RentalItemsRecordService rentalItemsRecordService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> create(List<RentalItemsRecordDTO> createReqVO) {
|
||||
rentalItemsRecordService.createRentalItemsRecordBath(BeanUtils.toBean(createReqVO, RentalItemsRecordSaveReqVO.class));
|
||||
return success(true);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.system.api.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.api.rental.dto.RentalOrderDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalOrderDO;
|
||||
import cn.iocoder.yudao.module.system.service.rental.RentalOrderService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class RentalOrderApiImpl implements RentalOrderApi {
|
||||
|
||||
@Resource
|
||||
private RentalOrderService rentalOrderService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateOrder(RentalOrderDTO updateReqVO) {
|
||||
rentalOrderService.update(BeanUtils.toBean(updateReqVO, RentalOrderDO.class));
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<RentalOrderDTO> getOrder(String orderNo) {
|
||||
RentalOrderDO rentalOrder = rentalOrderService.getRentalOrder(orderNo);
|
||||
return success(BeanUtils.toBean(rentalOrder, RentalOrderDTO.class));
|
||||
}
|
||||
}
|
@ -77,13 +77,14 @@ public class AttendancePunchPageVO {
|
||||
|
||||
/**
|
||||
* 处理加班打卡 不计算是否迟到早退
|
||||
*
|
||||
* @param punchType
|
||||
*/
|
||||
public void setPunchType(Integer punchType) {
|
||||
if (this.getFieldworkFlag() == 0) {
|
||||
if (this.getWorkOvertimeFlag() == 0) {
|
||||
this.punchType = punchType;
|
||||
} else {
|
||||
this.punchType = Arrays.asList(0, 2).contains(punchType) ? 0 : 1;
|
||||
this.punchType = Arrays.asList(0, 2).contains(punchType) ? 0 : (Arrays.asList(1, 3).contains(punchType) ? 1 : 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ public class DeptRespVO {
|
||||
@Schema(description = "父部门 ID", example = "1024")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "机构类型 | 0公司 1部门", example = "0")
|
||||
private Integer type;
|
||||
@Schema(description = "机构类型 | 字典值参考 system_dept_type", example = "0")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer sort;
|
||||
|
@ -28,8 +28,8 @@ public class DeptSaveReqVO {
|
||||
@Schema(description = "父部门 ID", example = "1024")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "机构类型 | 0公司 1部门", example = "0")
|
||||
private Integer type;
|
||||
@Schema(description = "机构类型 | 字典值参考 system_dept_type", example = "0")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
|
@ -0,0 +1,183 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.project;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.project.ProjectDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||
import cn.iocoder.yudao.module.system.service.project.ProjectService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
|
||||
@Tag(name = "管理后台 - 项目管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/project")
|
||||
@Validated
|
||||
public class ProjectController {
|
||||
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
@Resource
|
||||
private AdminUserService userService;
|
||||
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建项目管理")
|
||||
@PreAuthorize("@ss.hasPermission('system:project:create')")
|
||||
public CommonResult<Long> createProject(@Valid @RequestBody ProjectSaveReqVO createReqVO) {
|
||||
return success(projectService.createProject(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新项目管理")
|
||||
@PreAuthorize("@ss.hasPermission('system:project:update')")
|
||||
public CommonResult<Boolean> updateProject(@Valid @RequestBody ProjectSaveReqVO updateReqVO) {
|
||||
projectService.updateProject(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除项目管理")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:project:delete')")
|
||||
public CommonResult<Boolean> deleteProject(@RequestParam("id") Long id) {
|
||||
projectService.deleteProject(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得项目管理")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:project:query')")
|
||||
public CommonResult<ProjectRespVO> getProject(@RequestParam("id") Long id) {
|
||||
ProjectDO project = projectService.getProject(id);
|
||||
ProjectRespVO respVO = BeanUtils.toBean(project, ProjectRespVO.class);
|
||||
if (respVO != null) {
|
||||
// 获取项目中所有人员的用户编号列表
|
||||
Set<Long> userIds = respVO.getStaff() == null ? new HashSet<>() : respVO.getStaff();
|
||||
userIds.add(respVO.getDirectorUserId());
|
||||
|
||||
// 获取项目中所有部门编号列表
|
||||
Set<Long> deptIds = respVO.getParticipationDept() == null ? new HashSet<>() : respVO.getParticipationDept();
|
||||
deptIds.add(respVO.getResponsibleDept());
|
||||
|
||||
// 获取所有用户信息
|
||||
List<AdminUserDO> userDOS = userService.getUserList(userIds);
|
||||
Map<Long, AdminUserDO> userMap = convertMap(userDOS, AdminUserDO::getId);
|
||||
// 获取所有部门信息
|
||||
List<DeptDO> deptDOS = deptService.getDeptList(deptIds);
|
||||
Map<Long, DeptDO> deptMap = convertMap(deptDOS, DeptDO::getId);
|
||||
|
||||
// 筛选出不是责任人的用户信息
|
||||
List<AdminUserDO> userVOs = userDOS.stream()
|
||||
.filter(user -> !user.getId().equals(respVO.getDirectorUserId()))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 设置责任人名称
|
||||
respVO.setDirectorUserName(userMap.get(respVO.getDirectorUserId()).getNickname());
|
||||
// 拼接项目人员名称
|
||||
respVO.setStaffName(userVOs.stream().map(AdminUserDO::getNickname).collect(Collectors.joining("、")));
|
||||
|
||||
// 筛选出不是责任人部门的部门信息
|
||||
List<DeptDO> deptVOs = deptDOS.stream()
|
||||
.filter(dept -> !dept.getId().equals(respVO.getResponsibleDept()))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 设置责任部门名称
|
||||
respVO.setResponsibleDeptName(deptMap.get(respVO.getResponsibleDept()).getName());
|
||||
// 拼接参与部门名称
|
||||
respVO.setParticipationDeptName(deptVOs.stream().map(DeptDO::getName).collect(Collectors.joining("、")));
|
||||
}
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得项目管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:project:query')")
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<PageResult<ProjectRespVO>> getProjectPage(@Valid ProjectPageReqVO pageReqVO) {
|
||||
PageResult<ProjectDO> pageResult = projectService.getProjectPage(pageReqVO);
|
||||
PageResult<ProjectRespVO> respVOs = BeanUtils.toBean(pageResult, ProjectRespVO.class);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(respVOs.getList())) {
|
||||
// 获取项目中所有人员的用户编号列表
|
||||
List<Long> userIds = respVOs.getList().stream()
|
||||
.filter(item -> Objects.nonNull(item.getStaff()))
|
||||
.flatMap(item -> item.getStaff().stream())
|
||||
.collect(Collectors.toList());
|
||||
userIds.addAll(convertList(respVOs.getList(), ProjectRespVO::getDirectorUserId));
|
||||
|
||||
// 获取项目中所有部门编号列表
|
||||
List<Long> deptIds = respVOs.getList().stream()
|
||||
.filter(item -> Objects.nonNull(item.getParticipationDept()))
|
||||
.flatMap(item -> item.getParticipationDept().stream())
|
||||
.collect(Collectors.toList());
|
||||
deptIds.addAll(convertList(respVOs.getList(), ProjectRespVO::getResponsibleDept));
|
||||
|
||||
// 获取所有用户信息
|
||||
List<AdminUserDO> userDOS = userService.getUserList(userIds);
|
||||
Map<Long, AdminUserDO> userMap = convertMap(userDOS, AdminUserDO::getId);
|
||||
// 获取所有部门信息
|
||||
List<DeptDO> deptDOS = deptService.getDeptList(deptIds);
|
||||
Map<Long, DeptDO> deptMap = convertMap(deptDOS, DeptDO::getId);
|
||||
respVOs.getList().forEach(item -> {
|
||||
// 筛选出不是责任人的用户信息
|
||||
List<AdminUserDO> userVOs = userDOS.stream()
|
||||
.filter(user -> !user.getId().equals(item.getDirectorUserId()))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 设置责任人名称
|
||||
item.setDirectorUserName(userMap.get(item.getDirectorUserId()).getNickname());
|
||||
// 拼接项目人员名称
|
||||
if (item.getStaff() != null) {
|
||||
item.setStaffName(userVOs.stream()
|
||||
.filter(user -> item.getStaff().contains(user.getId()))
|
||||
.map(AdminUserDO::getNickname)
|
||||
.collect(Collectors.joining("、")));
|
||||
|
||||
}
|
||||
|
||||
// 筛选出不是责任人部门的部门信息
|
||||
List<DeptDO> deptVOs = deptDOS.stream()
|
||||
.filter(dept -> !dept.getId().equals(item.getResponsibleDept()))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 设置责任部门名称
|
||||
item.setResponsibleDeptName(deptMap.get(item.getResponsibleDept()).getName());
|
||||
// 拼接参与部门名称
|
||||
item.setParticipationDeptName(deptVOs.stream().map(DeptDO::getName).collect(Collectors.joining("、")));
|
||||
});
|
||||
}
|
||||
|
||||
return success(respVOs);
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.project.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 项目管理分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProjectPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "项目编号")
|
||||
private String projectNo;
|
||||
|
||||
@Schema(description = "项目类型 | 字典值参考system_project_type", example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "项目名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "责任部门")
|
||||
private Long responsibleDept;
|
||||
|
||||
@Schema(description = "参与部门集合")
|
||||
private String participationDept;
|
||||
|
||||
@Schema(description = "责任人用户编号")
|
||||
private Long directorUserId;
|
||||
|
||||
@Schema(description = "项目开始时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDate[] startDate;
|
||||
|
||||
@Schema(description = "项目结束时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDate[] endDate;
|
||||
|
||||
@Schema(description = "是否长期 | 0否 1是")
|
||||
private Integer isLongTerm;
|
||||
|
||||
@Schema(description = "项目状态 | 1 进行中 2已完成", example = "1")
|
||||
private Integer status;
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.project.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - 项目管理 Response VO")
|
||||
@Data
|
||||
public class ProjectRespVO {
|
||||
|
||||
@Schema(description = "项目管理表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String projectNo;
|
||||
|
||||
@Schema(description = "项目类型 | 字典值参考system_project_type", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("项目名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "责任部门", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long responsibleDept;
|
||||
|
||||
@Schema(description = "责任部门名称")
|
||||
private String responsibleDeptName;
|
||||
|
||||
@Schema(description = "参与部门集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Set<Long> participationDept;
|
||||
|
||||
@Schema(description = "参与部门名称")
|
||||
private String participationDeptName;
|
||||
|
||||
@Schema(description = "责任人用户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long directorUserId;
|
||||
|
||||
@Schema(description = "责任人用户名称")
|
||||
private String directorUserName;
|
||||
|
||||
@Schema(description = "项目开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDate startDate;
|
||||
|
||||
@Schema(description = "项目结束时间")
|
||||
private LocalDate endDate;
|
||||
|
||||
@Schema(description = "是否长期 | 0否 1是")
|
||||
private Integer isLongTerm;
|
||||
|
||||
@Schema(description = "项目预算")
|
||||
private Integer projectBudget;
|
||||
|
||||
@Schema(description = "项目内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String content;
|
||||
|
||||
@Schema(description = "项目人员用户编号集合")
|
||||
private Set<Long> staff;
|
||||
|
||||
@Schema(description = "项目人员用户名称")
|
||||
private String staffName;
|
||||
|
||||
@Schema(description = "项目状态 | 1 进行中 2已完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.project.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - 项目管理新增/修改 Request VO")
|
||||
@Data
|
||||
public class ProjectSaveReqVO {
|
||||
|
||||
@Schema(description = "项目管理表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "项目编号")
|
||||
private String projectNo;
|
||||
|
||||
@Schema(description = "项目类型 | 字典值参考system_project_type", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "项目类型 | 字典值参考system_project_type不能为空")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "项目名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "责任部门", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "责任部门不能为空")
|
||||
private Long responsibleDept;
|
||||
|
||||
@Schema(description = "参与部门集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "参与部门集合不能为空")
|
||||
private Set<Long> participationDept;
|
||||
|
||||
@Schema(description = "责任人用户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "责任人用户编号不能为空")
|
||||
private Long directorUserId;
|
||||
|
||||
@Schema(description = "项目开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "项目开始时间不能为空")
|
||||
private LocalDate startDate;
|
||||
|
||||
@Schema(description = "项目结束时间")
|
||||
private LocalDate endDate;
|
||||
|
||||
@Schema(description = "是否长期 | 0否 1是")
|
||||
private Integer isLongTerm;
|
||||
|
||||
@Schema(description = "项目预算")
|
||||
private Integer projectBudget;
|
||||
|
||||
@Schema(description = "项目内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "项目内容不能为空")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "项目人员用户编号集合")
|
||||
private Set<Long> staff;
|
||||
|
||||
@Schema(description = "项目额外属性")
|
||||
private Map<String, Object> dynamicAttribute;
|
||||
|
||||
@Schema(description = "项目状态 | 1 进行中 2已完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "项目状态 | 1 进行中 2已完成不能为空")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerStatusReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalCustomerDO;
|
||||
import cn.iocoder.yudao.module.system.service.rental.RentalCustomerService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 租赁客户")
|
||||
@RestController
|
||||
@RequestMapping("/system/rental-customer")
|
||||
@Validated
|
||||
public class RentalCustomerController {
|
||||
|
||||
@Resource
|
||||
private RentalCustomerService rentalCustomerService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建租赁客户")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-customer:create')")
|
||||
public CommonResult<Long> createRentalCustomer(@Valid @RequestBody RentalCustomerSaveReqVO createReqVO) {
|
||||
return success(rentalCustomerService.createRentalCustomer(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新租赁客户")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-customer:update')")
|
||||
public CommonResult<Boolean> updateRentalCustomer(@Valid @RequestBody RentalCustomerSaveReqVO updateReqVO) {
|
||||
rentalCustomerService.updateRentalCustomer(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "更新租赁客户状态")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-customer:update')")
|
||||
public CommonResult<Boolean> updateRentalCustomer(@RequestBody RentalCustomerStatusReqVO updateReqVO) {
|
||||
rentalCustomerService.updateRentalCustomerStatus(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除租赁客户")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-customer:delete')")
|
||||
public CommonResult<Boolean> deleteRentalCustomer(@RequestParam("id") Long id) {
|
||||
rentalCustomerService.deleteRentalCustomer(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得租赁客户")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-customer:query')")
|
||||
public CommonResult<RentalCustomerRespVO> getRentalCustomer(@RequestParam("id") Long id) {
|
||||
RentalCustomerDO rentalCustomer = rentalCustomerService.getRentalCustomer(id);
|
||||
return success(BeanUtils.toBean(rentalCustomer, RentalCustomerRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-list")
|
||||
@Operation(summary = "获得开启状态的租赁客户列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-customer:query')")
|
||||
public CommonResult<List<RentalCustomerRespVO>> getRentalCustomerList() {
|
||||
List<RentalCustomerDO> rentalCustomer = rentalCustomerService.getRentalCustomerList();
|
||||
return success(BeanUtils.toBean(rentalCustomer, RentalCustomerRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得租赁客户分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-customer:query')")
|
||||
public CommonResult<PageResult<RentalCustomerRespVO>> getRentalCustomerPage(@Valid RentalCustomerPageReqVO pageReqVO) {
|
||||
PageResult<RentalCustomerDO> pageResult = rentalCustomerService.getRentalCustomerPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RentalCustomerRespVO.class));
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositRecordRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalDepositRecordDO;
|
||||
import cn.iocoder.yudao.module.system.service.rental.RentalDepositRecordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 租赁订单押金记录")
|
||||
@RestController
|
||||
@RequestMapping("/system/rental-deposit-record")
|
||||
@Validated
|
||||
public class RentalDepositRecordController {
|
||||
|
||||
@Resource
|
||||
private RentalDepositRecordService rentalDepositRecordService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建租赁订单押金记录")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-deposit-record:create')")
|
||||
public CommonResult<Long> createRentalDepositRecord(@Valid @RequestBody RentalDepositRecordSaveReqVO createReqVO) {
|
||||
return success(rentalDepositRecordService.createRentalDepositRecord(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新租赁订单押金记录")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-deposit-record:update')")
|
||||
public CommonResult<Boolean> updateRentalDepositRecord(@Valid @RequestBody RentalDepositRecordSaveReqVO updateReqVO) {
|
||||
rentalDepositRecordService.updateRentalDepositRecord(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得租赁订单押金记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-deposit-record:query')")
|
||||
public CommonResult<RentalDepositRecordRespVO> getRentalDepositRecord(@RequestParam("id") Long id) {
|
||||
RentalDepositRecordDO rentalDepositRecord = rentalDepositRecordService.getRentalDepositRecord(id);
|
||||
return success(BeanUtils.toBean(rentalDepositRecord, RentalDepositRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得租赁订单押金记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-deposit-record:query')")
|
||||
public CommonResult<PageResult<RentalDepositRecordRespVO>> getRentalDepositRecordPage(@Valid RentalDepositRecordPageReqVO pageReqVO) {
|
||||
PageResult<RentalDepositRecordDO> pageResult = rentalDepositRecordService.getRentalDepositRecordPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RentalDepositRecordRespVO.class));
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsCountReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsRecordRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalCustomerDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalItemsRecordDO;
|
||||
import cn.iocoder.yudao.module.system.service.rental.RentalItemsRecordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 租赁物品记录")
|
||||
@RestController
|
||||
@RequestMapping("/system/rental-items")
|
||||
@Validated
|
||||
public class RentalItemsRecordController {
|
||||
|
||||
@Resource
|
||||
private RentalItemsRecordService rentalItemsRecordService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建租赁物品记录")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-items:create')")
|
||||
public CommonResult<Long> createRentalItemsRecord(@Valid @RequestBody RentalItemsRecordSaveReqVO createReqVO) {
|
||||
return success(rentalItemsRecordService.createRentalItemsRecord(createReqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/createBatch")
|
||||
@Operation(summary = "批量创建租赁物品记录")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-items:create')")
|
||||
public CommonResult<Boolean> createRentalItemsRecord(@Valid @RequestBody List<RentalItemsRecordSaveReqVO> createReqVO) {
|
||||
rentalItemsRecordService.createRentalItemsRecordBath(createReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新租赁物品记录")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-items:update')")
|
||||
public CommonResult<Boolean> updateRentalItemsRecord(@Valid @RequestBody RentalItemsRecordSaveReqVO updateReqVO) {
|
||||
rentalItemsRecordService.updateRentalItemsRecord(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获取租赁物品记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-items:query')")
|
||||
public CommonResult<RentalItemsRecordRespVO> getRentalItemsRecord(@RequestParam("id") Long id) {
|
||||
|
||||
return success(BeanUtils.toBean(rentalItemsRecordService.getRentalItemsRecord(id), RentalItemsRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-count")
|
||||
@Operation(summary = "获取指定订单剩余租赁物品数量")
|
||||
@Parameter(name = "orderNo", description = "订单编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-items:query')")
|
||||
public CommonResult<List<RentalItemsCountReqVO>> getRentalItemsRecord(@RequestParam("orderNo") String orderNo) {
|
||||
|
||||
return success(rentalItemsRecordService.getRentalItemsCount(orderNo, false));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得租赁物品记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-items:query')")
|
||||
public CommonResult<PageResult<RentalItemsRecordRespVO>> getRentalItemsRecordPage(@Valid RentalItemsRecordPageReqVO pageReqVO) {
|
||||
PageResult<RentalItemsRecordDO> pageResult = rentalItemsRecordService.getRentalItemsRecordPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RentalItemsRecordRespVO.class));
|
||||
}
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOARefundApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.BpmOARefundDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.order.RentalOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.order.RentalOrderRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.order.RentalOrderSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositAmountReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalCustomerDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalOrderDO;
|
||||
import cn.iocoder.yudao.module.system.service.rental.RentalCustomerService;
|
||||
import cn.iocoder.yudao.module.system.service.rental.RentalDepositRecordService;
|
||||
import cn.iocoder.yudao.module.system.service.rental.RentalOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 租赁订单")
|
||||
@RestController
|
||||
@RequestMapping("/system/rental-order")
|
||||
@Validated
|
||||
public class RentalOrderController {
|
||||
|
||||
@Resource
|
||||
private RentalOrderService rentalOrderService;
|
||||
|
||||
@Resource
|
||||
private RentalCustomerService rentalCustomerService;
|
||||
|
||||
@Resource
|
||||
private RentalDepositRecordService rentalDepositRecordService;
|
||||
|
||||
@Resource
|
||||
private BpmOARefundApi refundApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建租赁订单")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-order:create')")
|
||||
public CommonResult<Long> createRentalOrder(@Valid @RequestBody RentalOrderSaveReqVO createReqVO) {
|
||||
return success(rentalOrderService.createRentalOrder(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新租赁订单")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-order:update')")
|
||||
public CommonResult<BigDecimal> updateRentalOrder(@Valid @RequestBody RentalOrderSaveReqVO updateReqVO) {
|
||||
return success(rentalOrderService.updateRentalOrder(updateReqVO));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除租赁订单")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-order:delete')")
|
||||
public CommonResult<Boolean> deleteRentalOrder(@RequestParam("id") Long id) {
|
||||
rentalOrderService.deleteRentalOrder(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得租赁订单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-order:query')")
|
||||
public CommonResult<RentalOrderRespVO> getRentalOrder(@RequestParam("id") Long id) {
|
||||
RentalOrderDO rentalOrder = rentalOrderService.getRentalOrder(id);
|
||||
RentalOrderRespVO respVO = BeanUtils.toBean(rentalOrder, RentalOrderRespVO.class);
|
||||
|
||||
// 获取客户详情
|
||||
RentalCustomerDO customerDO = rentalCustomerService.getRentalCustomer(rentalOrder.getCustomerId());
|
||||
if (customerDO != null) {
|
||||
// 设置客户信息
|
||||
respVO.setCustomerName(customerDO.getName());
|
||||
respVO.setCustomerBankName(customerDO.getBankName());
|
||||
respVO.setCustomerBankNo(customerDO.getBankNo());
|
||||
}
|
||||
|
||||
// 获取已收金额
|
||||
RentalDepositAmountReqVO amountReqVO = rentalDepositRecordService.getRentalDepositRecordAmount(rentalOrder.getOrderNo(), false);
|
||||
// 设置已收金额
|
||||
respVO.setReceivedAmount(amountReqVO.getReceivedAmount());
|
||||
// 设置已退金额
|
||||
respVO.setRefundAmount(amountReqVO.getRefundAmount());
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得租赁订单分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:rental-order:query')")
|
||||
public CommonResult<PageResult<RentalOrderRespVO>> getRentalOrderPage(@Valid RentalOrderPageReqVO pageReqVO) {
|
||||
PageResult<RentalOrderRespVO> pageResult = rentalOrderService.getRentalOrderPage(pageReqVO);
|
||||
// 获取等待退款的订单号
|
||||
List<String> orderNos = pageResult.getList().stream()
|
||||
.filter(item -> Objects.equals(item.getStatus(), RentalOrderDO.WAITING_FOR_REFUND))
|
||||
.map(RentalOrderRespVO::getOrderNo)
|
||||
.collect(Collectors.toList());
|
||||
// 获取订单号对应的退款申请
|
||||
Map<String, BpmOARefundDTO> refundMap = refundApi.getListByOrderNo(orderNos).getCheckedData();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(refundMap)) {
|
||||
// 设置对应的订单号中的 申请退款和扣款金额
|
||||
pageResult.getList().forEach(item -> {
|
||||
item.setApplyRefundAmount(refundMap.get(item.getOrderNo()).getRefundAmount());
|
||||
item.setApplyChargebacksAmount(refundMap.get(item.getOrderNo()).getChargebacksAmount());
|
||||
});
|
||||
}
|
||||
|
||||
return success(pageResult);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁客户分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RentalCustomerPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "客户名称", example = "赵六")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "开户行", example = "=")
|
||||
private String bankName;
|
||||
|
||||
@Schema(description = "卡号")
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "剩余押金金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁客户 Response VO")
|
||||
@Data
|
||||
public class RentalCustomerRespVO {
|
||||
|
||||
@Schema(description = "租赁客户表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "开户行", requiredMode = Schema.RequiredMode.REQUIRED, example = "=")
|
||||
private String bankName;
|
||||
|
||||
@Schema(description = "卡号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "剩余押金金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "状态 | 0开启 1关闭")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁客户新增/修改 Request VO")
|
||||
@Data
|
||||
public class RentalCustomerSaveReqVO {
|
||||
|
||||
@Schema(description = "租赁客户表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "客户名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "开户行", requiredMode = Schema.RequiredMode.REQUIRED, example = "=")
|
||||
@NotEmpty(message = "开户行不能为空")
|
||||
private String bankName;
|
||||
|
||||
@Schema(description = "卡号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "卡号不能为空")
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "剩余押金金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "状态 | 0开启 1关闭")
|
||||
private Integer status;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁客户新增/修改 Request VO")
|
||||
@Data
|
||||
public class RentalCustomerStatusReqVO {
|
||||
|
||||
@Schema(description = "租赁客户表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "状态 | 0开启 1关闭")
|
||||
private Integer status;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁物品数量 Request VO")
|
||||
@Data
|
||||
public class RentalItemsCountReqVO {
|
||||
|
||||
@Schema(description = "租赁物品类型")
|
||||
private Integer rentalItemsType;
|
||||
|
||||
@Schema(description = "已租借数量")
|
||||
private Integer number;
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁物品记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RentalItemsRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "租赁物品种类 | 字典值参考 system_rental_items_type")
|
||||
private Integer rentalItemsType;
|
||||
|
||||
@Schema(description = "类型 | 1租借 2归还")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁物品记录 Response VO")
|
||||
@Data
|
||||
public class RentalItemsRecordRespVO {
|
||||
|
||||
@Schema(description = "租赁订单表单主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "租赁物品种类 | 字典值参考 system_rental_items_type")
|
||||
private Integer rentalItemsType;
|
||||
|
||||
@Schema(description = "租赁数量")
|
||||
private Integer number;
|
||||
|
||||
@Schema(description = "类型 | 1租借 2归还")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁物品记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class RentalItemsRecordSaveReqVO {
|
||||
|
||||
@Schema(description = "租赁订单表单主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "订单编号不能为空")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "租赁物品种类 | 字典值参考 system_rental_items_type", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "租赁物品种类不能为空")
|
||||
private Integer rentalItemsType;
|
||||
|
||||
@Schema(description = "租赁数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "租赁数量不能为空")
|
||||
private Integer number;
|
||||
|
||||
@Schema(description = "类型 | 1租借 2归还", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.order;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁订单分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RentalOrderPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "收款人")
|
||||
private String recipient;
|
||||
|
||||
@Schema(description = "客户编号")
|
||||
private Long customerId;
|
||||
|
||||
@Schema(description = "押金金额")
|
||||
private Integer depositAmount;
|
||||
|
||||
@Schema(description = "状态 | 1租赁中 2退款申请中 3等待退款中 4已退款")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.order;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁订单 Response VO")
|
||||
@Data
|
||||
public class RentalOrderRespVO {
|
||||
|
||||
@Schema(description = "租赁订单表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "客户编号")
|
||||
private Long customerId;
|
||||
|
||||
@Schema(description = "客户名称")
|
||||
private String customerName;
|
||||
|
||||
@Schema(description = "客户开户行")
|
||||
private String customerBankName;
|
||||
|
||||
@Schema(description = "客户银行卡号")
|
||||
private String customerBankNo;
|
||||
|
||||
@Schema(description = "收款人")
|
||||
private String recipient;
|
||||
|
||||
@Schema(description = "押金金额")
|
||||
private BigDecimal depositAmount;
|
||||
|
||||
@Schema(description = "已收金额")
|
||||
private BigDecimal receivedAmount;
|
||||
|
||||
@Schema(description = "退款金额")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
@Schema(description = "扣款金额")
|
||||
private BigDecimal chargebacksAmount;
|
||||
|
||||
@Schema(description = "申请退款金额")
|
||||
private BigDecimal applyRefundAmount;
|
||||
|
||||
@Schema(description = "申请扣款金额")
|
||||
private BigDecimal applyChargebacksAmount;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String notes;
|
||||
|
||||
@Schema(description = "状态 | 1租赁中 2退款申请中 3等待退款中 4已退款")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "创建人姓名")
|
||||
private String creatorName;
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.order;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositRecordSaveReqVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁订单新增/修改 Request VO")
|
||||
@Data
|
||||
public class RentalOrderSaveReqVO {
|
||||
|
||||
@Schema(description = "租赁订单表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "客户编号不能为空")
|
||||
private Long customerId;
|
||||
|
||||
@Schema(description = "收款人")
|
||||
private String recipient;
|
||||
|
||||
@Schema(description = "押金金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "押金金额不能为空")
|
||||
private BigDecimal depositAmount;
|
||||
|
||||
@Schema(description = "扣款金额")
|
||||
private BigDecimal chargebacksAmount;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String notes;
|
||||
|
||||
@Schema(description = "状态 | 1租赁中 2退款申请中 3等待退款中 4已退款")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "租赁物品记录")
|
||||
private List<RentalItemsRecordSaveReqVO> itemsRecords;
|
||||
|
||||
@Schema(description = "租赁订单押金记录")
|
||||
private List<RentalDepositRecordSaveReqVO> depositRecords;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 押金金额 Request VO")
|
||||
@Data
|
||||
public class RentalDepositAmountReqVO {
|
||||
|
||||
@Schema(description = "已收金额")
|
||||
private BigDecimal receivedAmount;
|
||||
|
||||
@Schema(description = "退款金额")
|
||||
private BigDecimal refundAmount;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁订单押金记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RentalDepositRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "支付方式 | 1支付宝 2微信 3银行卡")
|
||||
private Integer paymentMethod;
|
||||
|
||||
@Schema(description = "交易订单号")
|
||||
private String transactionOrderNumber;
|
||||
|
||||
@Schema(description = "收款/退款日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDate[] paymentDate;
|
||||
|
||||
@Schema(description = "类型 | 1收款 2退款", example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁订单押金记录 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RentalDepositRecordRespVO {
|
||||
|
||||
@Schema(description = "租赁订单押金记录表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("租赁订单押金记录表单主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "支付方式 | 1支付宝 2微信 3银行卡", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("支付方式 | 1支付宝 2微信 3银行卡")
|
||||
private Integer paymentMethod;
|
||||
|
||||
@Schema(description = "交易订单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("交易订单号")
|
||||
private String transactionOrderNumber;
|
||||
|
||||
@Schema(description = "银行卡号")
|
||||
@ExcelProperty("银行卡号")
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "客户银行卡号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("客户银行卡号")
|
||||
private String customerBankNo;
|
||||
|
||||
@Schema(description = "收款/退款金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("收款/退款金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "收款/退款日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("收款/退款日期")
|
||||
private LocalDate paymentDate;
|
||||
|
||||
@Schema(description = "类型 | 1收款 2退款", example = "1")
|
||||
@ExcelProperty("类型 | 1收款 2退款")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "附件信息")
|
||||
@ExcelProperty("附件信息")
|
||||
private List<UploadUserFile> fileItems;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 租赁订单押金记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class RentalDepositRecordSaveReqVO {
|
||||
|
||||
@Schema(description = "租赁订单押金记录表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "订单编号不能为空")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "支付方式 | 1支付宝 2微信 3银行卡", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "支付方式 | 1支付宝 2微信 3银行卡不能为空")
|
||||
private Integer paymentMethod;
|
||||
|
||||
@Schema(description = "交易订单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "交易订单号不能为空")
|
||||
private String transactionOrderNumber;
|
||||
|
||||
@Schema(description = "银行卡号")
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "客户银行卡号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "客户银行卡号不能为空")
|
||||
private String customerBankNo;
|
||||
|
||||
@Schema(description = "收款/退款金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "收款/退款金额不能为空")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "扣款金额")
|
||||
private BigDecimal chargebacksAmount;
|
||||
|
||||
@Schema(description = "收款/退款日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "收款/退款日期不能为空")
|
||||
private LocalDate paymentDate;
|
||||
|
||||
@Schema(description = "类型 | 1收款 2退款", example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "附件信息")
|
||||
private List<UploadUserFile> fileItems;
|
||||
|
||||
}
|
@ -181,6 +181,16 @@ public class UserController {
|
||||
return success(UserConvert.INSTANCE.convertSimpleList(list, deptMap));
|
||||
}
|
||||
|
||||
@PostMapping({"/list-by-deptIds"})
|
||||
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项,无数据权限")
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<List<UserSimpleRespVO>> getAllUserList(@RequestBody List<Long> deptIds) {
|
||||
List<AdminUserDO> list = userService.getUserListByDepts(1, deptIds, CommonStatusEnum.ENABLE.getStatus());
|
||||
// 拼接数据
|
||||
Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
||||
convertList(list, AdminUserDO::getDeptId));
|
||||
return success(UserConvert.INSTANCE.convertSimpleList(list, deptMap));
|
||||
}
|
||||
|
||||
@PostMapping({"/list-all"})
|
||||
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项,无数据权限")
|
||||
|
@ -42,9 +42,9 @@ public class DeptDO extends TenantBaseDO {
|
||||
*/
|
||||
private Long parentId;
|
||||
/**
|
||||
* 机构类型 | 0公司 1部门
|
||||
* 机构类型 | 字典值参考 system_dept_type
|
||||
*/
|
||||
private Integer type;
|
||||
private String type;
|
||||
/**
|
||||
* 部门层级
|
||||
*/
|
||||
|
@ -0,0 +1,94 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.project;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 项目管理 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName(value = "system_project", autoResultMap = true)
|
||||
@KeySequence("system_project_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProjectDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 项目管理表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 项目编号
|
||||
*/
|
||||
private String projectNo;
|
||||
/**
|
||||
* 项目类型 | 字典值参考system_project_type
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 责任部门
|
||||
*/
|
||||
private Long responsibleDept;
|
||||
/**
|
||||
* 参与部门集合
|
||||
*/
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> participationDept;
|
||||
/**
|
||||
* 责任人用户编号
|
||||
*/
|
||||
private Long directorUserId;
|
||||
/**
|
||||
* 项目开始时间
|
||||
*/
|
||||
private LocalDate startDate;
|
||||
/**
|
||||
* 项目结束时间
|
||||
*/
|
||||
private LocalDate endDate;
|
||||
/**
|
||||
* 是否长期 | 0否 1是
|
||||
*/
|
||||
private Integer isLongTerm;
|
||||
/**
|
||||
* 项目预算
|
||||
*/
|
||||
private Integer projectBudget;
|
||||
/**
|
||||
* 项目内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 项目人员用户编号集合
|
||||
*/
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> staff;
|
||||
/**
|
||||
* 项目额外属性
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private Map<String, Object> dynamicAttribute;
|
||||
/**
|
||||
* 项目状态 | 1 进行中 2已完成
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 租赁客户 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName("system_rental_customer")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RentalCustomerDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 租赁客户表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 开户行
|
||||
*/
|
||||
private String bankName;
|
||||
/**
|
||||
* 卡号
|
||||
*/
|
||||
private String bankNo;
|
||||
/**
|
||||
* 剩余押金金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 状态 0开启 1关闭
|
||||
*/
|
||||
private Integer status;
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租赁订单押金记录 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName(value = "system_rental_deposit_record", autoResultMap = true)
|
||||
@KeySequence("system_rental_deposit_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RentalDepositRecordDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 租赁订单押金记录表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 支付方式 | 1支付宝 2微信 3银行卡
|
||||
*/
|
||||
private Integer paymentMethod;
|
||||
/**
|
||||
* 交易订单号
|
||||
*/
|
||||
private String transactionOrderNumber;
|
||||
/**
|
||||
* 银行卡号
|
||||
*/
|
||||
private String bankNo;
|
||||
/**
|
||||
* 客户银行卡号
|
||||
*/
|
||||
private String customerBankNo;
|
||||
/**
|
||||
* 收款/退款金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 收款/退款日期
|
||||
*/
|
||||
private LocalDate paymentDate;
|
||||
/**
|
||||
* 类型 | 1收款 2退款
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 附件信息
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<UploadUserFile> fileItems;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 订单租赁物品记录 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName("system_rental_items_record")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RentalItemsRecordDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 订单租赁物品记录表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 租赁物品种类 | 字典值参考 system_rental_items_type
|
||||
*/
|
||||
private Integer rentalItemsType;
|
||||
/**
|
||||
* 租赁数量
|
||||
*/
|
||||
private Integer number;
|
||||
/**
|
||||
* 类型 | 1租借 2归还
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 租赁订单 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName("system_rental_order")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RentalOrderDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 状态 1 租赁中
|
||||
*/
|
||||
public static final Integer ON_LEASE = 1;
|
||||
/**
|
||||
* 状态 2 退款申请中
|
||||
*/
|
||||
public static final Integer REFUND_REQUESTED = 2;
|
||||
/**
|
||||
* 状态 3 等待退款中
|
||||
*/
|
||||
public static final Integer WAITING_FOR_REFUND = 3;
|
||||
/**
|
||||
* 状态 4 已退款
|
||||
*/
|
||||
public static final Integer REFUNDED = 4;
|
||||
|
||||
/**
|
||||
* 租赁订单表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 客户编号
|
||||
*/
|
||||
private Long customerId;
|
||||
/**
|
||||
* 收款人
|
||||
*/
|
||||
private String recipient;
|
||||
/**
|
||||
* 押金金额
|
||||
*/
|
||||
private BigDecimal depositAmount;
|
||||
/**
|
||||
* 扣款金额
|
||||
*/
|
||||
private BigDecimal chargebacksAmount;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String notes;
|
||||
/**
|
||||
* 状态 | 1租赁中 2退款申请中 3等待退款中 4已退款
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqV
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -60,4 +61,7 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
|
||||
|
||||
return selectJoinOne(DeptDO.class, query);
|
||||
}
|
||||
|
||||
List<DeptDO> selectCompany(@Param("flag") String flag,
|
||||
@Param("type") String type);
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.project;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.project.ProjectDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 项目管理 Mapper
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProjectMapper extends BaseMapperX<ProjectDO> {
|
||||
|
||||
default PageResult<ProjectDO> selectPage(ProjectPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ProjectDO>()
|
||||
.eqIfPresent(ProjectDO::getProjectNo, reqVO.getProjectNo())
|
||||
.eqIfPresent(ProjectDO::getType, reqVO.getType())
|
||||
.likeIfPresent(ProjectDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ProjectDO::getResponsibleDept, reqVO.getResponsibleDept())
|
||||
.likeIfPresent(ProjectDO::getParticipationDept, reqVO.getParticipationDept())
|
||||
.eqIfPresent(ProjectDO::getDirectorUserId, reqVO.getDirectorUserId())
|
||||
.betweenIfPresent(ProjectDO::getStartDate, reqVO.getStartDate())
|
||||
.betweenIfPresent(ProjectDO::getEndDate, reqVO.getEndDate())
|
||||
.eqIfPresent(ProjectDO::getIsLongTerm, reqVO.getIsLongTerm())
|
||||
.eqIfPresent(ProjectDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(ProjectDO::getId));
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalCustomerDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 租赁客户 Mapper
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Mapper
|
||||
public interface RentalCustomerMapper extends BaseMapperX<RentalCustomerDO> {
|
||||
|
||||
default PageResult<RentalCustomerDO> selectPage(RentalCustomerPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RentalCustomerDO>()
|
||||
.likeIfPresent(RentalCustomerDO::getName, reqVO.getName())
|
||||
.eqIfPresent(RentalCustomerDO::getMobile, reqVO.getMobile())
|
||||
.likeIfPresent(RentalCustomerDO::getBankName, reqVO.getBankName())
|
||||
.eqIfPresent(RentalCustomerDO::getBankNo, reqVO.getBankNo())
|
||||
.eqIfPresent(RentalCustomerDO::getAmount, reqVO.getAmount())
|
||||
.betweenIfPresent(RentalCustomerDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(RentalCustomerDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositAmountReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalDepositRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 租赁订单押金记录 Mapper
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Mapper
|
||||
public interface RentalDepositRecordMapper extends BaseMapperX<RentalDepositRecordDO> {
|
||||
|
||||
default PageResult<RentalDepositRecordDO> selectPage(RentalDepositRecordPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RentalDepositRecordDO>()
|
||||
.eqIfPresent(RentalDepositRecordDO::getOrderNo, reqVO.getOrderNo())
|
||||
.eqIfPresent(RentalDepositRecordDO::getPaymentMethod, reqVO.getPaymentMethod())
|
||||
.eqIfPresent(RentalDepositRecordDO::getTransactionOrderNumber, reqVO.getTransactionOrderNumber())
|
||||
.betweenIfPresent(RentalDepositRecordDO::getPaymentDate, reqVO.getPaymentDate())
|
||||
.eqIfPresent(RentalDepositRecordDO::getType, reqVO.getType())
|
||||
.betweenIfPresent(RentalDepositRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(RentalDepositRecordDO::getCreateTime));
|
||||
}
|
||||
|
||||
RentalDepositAmountReqVO selectAmount(@Param("orderNo") String orderNo,
|
||||
@Param("isUpdate") Boolean isUpdate);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsCountReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalItemsRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface RentalItemsRecordMapper extends BaseMapperX<RentalItemsRecordDO> {
|
||||
|
||||
default PageResult<RentalItemsRecordDO> selectPage(RentalItemsRecordPageReqVO reqVO) {
|
||||
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RentalItemsRecordDO>()
|
||||
.eqIfPresent(RentalItemsRecordDO::getOrderNo, reqVO.getOrderNo())
|
||||
.eqIfPresent(RentalItemsRecordDO::getRentalItemsType, reqVO.getRentalItemsType())
|
||||
.eqIfPresent(RentalItemsRecordDO::getType, reqVO.getType())
|
||||
.betweenIfPresent(RentalItemsRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(RentalItemsRecordDO::getCreateTime));
|
||||
}
|
||||
|
||||
List<RentalItemsCountReqVO> selectRentalItemsCount(@Param("orderNo") String orderNo,
|
||||
@Param("isUpdate") Boolean isUpdate);
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.order.RentalOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.order.RentalOrderRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalCustomerDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalDepositRecordDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalOrderDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 租赁订单 Mapper
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Mapper
|
||||
public interface RentalOrderMapper extends BaseMapperX<RentalOrderDO> {
|
||||
|
||||
default PageResult<RentalOrderRespVO> selectPage(RentalOrderPageReqVO reqVO) {
|
||||
|
||||
MPJLambdaWrapperX<RentalOrderDO> queryWrapper = new MPJLambdaWrapperX<>();
|
||||
queryWrapper.selectAll(RentalOrderDO.class);
|
||||
queryWrapper.selectAs(RentalCustomerDO::getName, RentalOrderRespVO::getCustomerName);
|
||||
queryWrapper.selectAs("SUM( CASE WHEN deposit.type = 1 THEN deposit.amount END )", RentalOrderRespVO::getReceivedAmount);
|
||||
queryWrapper.selectAs("SUM( CASE WHEN deposit.type = 2 THEN deposit.amount END )", RentalOrderRespVO::getRefundAmount);
|
||||
queryWrapper.selectAs(AdminUserDO::getNickname, RentalOrderRespVO::getCreatorName);
|
||||
queryWrapper.leftJoin(RentalDepositRecordDO.class, "deposit", RentalDepositRecordDO::getOrderNo, RentalOrderDO::getOrderNo);
|
||||
queryWrapper.leftJoin(AdminUserDO.class, AdminUserDO::getId, RentalOrderDO::getCreator);
|
||||
queryWrapper.leftJoin(RentalCustomerDO.class, RentalCustomerDO::getId, RentalOrderDO::getCustomerId);
|
||||
queryWrapper.eqIfPresent(RentalOrderDO::getOrderNo, reqVO.getOrderNo())
|
||||
.eqIfPresent(RentalOrderDO::getCustomerId, reqVO.getCustomerId())
|
||||
.eqIfPresent(RentalOrderDO::getDepositAmount, reqVO.getDepositAmount())
|
||||
.eqIfPresent(RentalOrderDO::getStatus, reqVO.getStatus())
|
||||
.likeIfPresent(RentalOrderDO::getRecipient, reqVO.getRecipient())
|
||||
.betweenIfPresent(RentalOrderDO::getCreateTime, reqVO.getCreateTime())
|
||||
.groupBy(RentalOrderDO::getOrderNo)
|
||||
.orderByDesc(RentalOrderDO::getCreateTime);
|
||||
|
||||
return selectJoinPage(reqVO, RentalOrderRespVO.class, queryWrapper);
|
||||
}
|
||||
|
||||
BigDecimal selectOrderAmount(@Param("orderNo") String orderNo);
|
||||
}
|
@ -98,4 +98,11 @@ public interface RedisKeyConstants {
|
||||
* VALUE 数据格式:String 模版信息
|
||||
*/
|
||||
String SMS_TEMPLATE = "sms_template";
|
||||
|
||||
/**
|
||||
* 租赁订单剩余押金金额的缓存
|
||||
* KEY 格式:rental_order_amount:{orderNo}
|
||||
* VALUE 数据格式:String 剩余金额
|
||||
*/
|
||||
String RENTAL_ORDER_AMOUNT = "rental_order_amount";
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.framework.rpc.config;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.api.model.BpmModelApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAEntryApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAEvectionApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAGoOutApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAReplacementCardApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.*;
|
||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||
@ -14,6 +11,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, FactoryInfoApi.class, BpmModelApi.class, BpmOAGoOutApi.class, BpmOAEntryApi.class, ConfigApi.class,
|
||||
BpmOAEvectionApi.class, BpmOAReplacementCardApi.class})
|
||||
BpmOAEvectionApi.class, BpmOAReplacementCardApi.class, BpmOARefundApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.DeptTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@ -326,7 +327,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
public List<DeptDO> getCompanyDept() {
|
||||
|
||||
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
||||
.eq(DeptDO::getType, 0)
|
||||
.eq(DeptDO::getType, DeptTypeEnum.COMPANY.getValue())
|
||||
.eq(DeptDO::getVirtuallyStatus, 0)
|
||||
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
|
||||
}
|
||||
@ -362,9 +363,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
}
|
||||
|
||||
// 根据所在部门信息获取 所在公司信息
|
||||
List<DeptDO> companyDeptList = deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
||||
.likeIfPresent(DeptDO::getFlag, deptDo.getFlag())
|
||||
.eq(DeptDO::getType, 0));
|
||||
List<DeptDO> companyDeptList = deptMapper.selectCompany(deptDo.getFlag(), DeptTypeEnum.COMPANY.getValue());
|
||||
|
||||
if (CollectionUtil.isEmpty(companyDeptList)) {
|
||||
return new DeptDO();
|
||||
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.system.service.project;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.project.ProjectDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 项目管理 Service 接口
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
public interface ProjectService {
|
||||
|
||||
/**
|
||||
* 创建项目管理
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createProject(@Valid ProjectSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新项目管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateProject(@Valid ProjectSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除项目管理
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteProject(Long id);
|
||||
|
||||
/**
|
||||
* 获得项目管理
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 项目管理
|
||||
*/
|
||||
ProjectDO getProject(Long id);
|
||||
|
||||
/**
|
||||
* 获得项目管理分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 项目管理分页
|
||||
*/
|
||||
PageResult<ProjectDO> getProjectPage(ProjectPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package cn.iocoder.yudao.module.system.service.project;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.project.ProjectDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.project.ProjectMapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.PROJECT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 项目管理 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ProjectServiceImpl implements ProjectService {
|
||||
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
@Override
|
||||
public Long createProject(ProjectSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ProjectDO project = BeanUtils.toBean(createReqVO, ProjectDO.class);
|
||||
project.setProjectNo(IdWorker.getIdStr());
|
||||
projectMapper.insert(project);
|
||||
// 返回
|
||||
return project.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProject(ProjectSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateProjectExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ProjectDO updateObj = BeanUtils.toBean(updateReqVO, ProjectDO.class);
|
||||
projectMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProject(Long id) {
|
||||
// 校验存在
|
||||
validateProjectExists(id);
|
||||
// 删除
|
||||
projectMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateProjectExists(Long id) {
|
||||
if (projectMapper.selectById(id) == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectDO getProject(Long id) {
|
||||
return projectMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ProjectDO> getProjectPage(ProjectPageReqVO pageReqVO) {
|
||||
return projectMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.system.service.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerStatusReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalCustomerDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租赁客户 Service 接口
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
public interface RentalCustomerService {
|
||||
|
||||
/**
|
||||
* 创建租赁客户
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createRentalCustomer(@Valid RentalCustomerSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新租赁客户
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRentalCustomer(@Valid RentalCustomerSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 更新租赁客户状态
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRentalCustomerStatus(RentalCustomerStatusReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除租赁客户
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteRentalCustomer(Long id);
|
||||
|
||||
/**
|
||||
* 获得租赁客户
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 租赁客户
|
||||
*/
|
||||
RentalCustomerDO getRentalCustomer(Long id);
|
||||
|
||||
/**
|
||||
* 获得租赁客户分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 租赁客户分页
|
||||
*/
|
||||
PageResult<RentalCustomerDO> getRentalCustomerPage(RentalCustomerPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得租赁客户列表
|
||||
* @return 租赁客户列表
|
||||
*/
|
||||
List<RentalCustomerDO> getRentalCustomerList();
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package cn.iocoder.yudao.module.system.service.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerStatusReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalCustomerDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.rental.RentalCustomerMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.RENTAL_CUSTOMER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 租赁客户 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class RentalCustomerServiceImpl implements RentalCustomerService {
|
||||
|
||||
@Resource
|
||||
private RentalCustomerMapper rentalCustomerMapper;
|
||||
|
||||
@Override
|
||||
public Long createRentalCustomer(RentalCustomerSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
RentalCustomerDO rentalCustomer = BeanUtils.toBean(createReqVO, RentalCustomerDO.class);
|
||||
rentalCustomer.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
rentalCustomerMapper.insert(rentalCustomer);
|
||||
// 返回
|
||||
return rentalCustomer.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRentalCustomer(RentalCustomerSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRentalCustomerExists(updateReqVO.getId());
|
||||
// 更新
|
||||
RentalCustomerDO updateObj = BeanUtils.toBean(updateReqVO, RentalCustomerDO.class);
|
||||
rentalCustomerMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRentalCustomerStatus(RentalCustomerStatusReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRentalCustomerExists(updateReqVO.getId());
|
||||
// 更新
|
||||
RentalCustomerDO updateObj = BeanUtils.toBean(updateReqVO, RentalCustomerDO.class);
|
||||
rentalCustomerMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRentalCustomer(Long id) {
|
||||
// 校验存在
|
||||
validateRentalCustomerExists(id);
|
||||
// 删除
|
||||
rentalCustomerMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateRentalCustomerExists(Long id) {
|
||||
if (rentalCustomerMapper.selectById(id) == null) {
|
||||
throw exception(RENTAL_CUSTOMER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RentalCustomerDO getRentalCustomer(Long id) {
|
||||
return rentalCustomerMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RentalCustomerDO> getRentalCustomerPage(RentalCustomerPageReqVO pageReqVO) {
|
||||
return rentalCustomerMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RentalCustomerDO> getRentalCustomerList() {
|
||||
return rentalCustomerMapper.selectList(RentalCustomerDO::getStatus, CommonStatusEnum.ENABLE.getStatus());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.system.service.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositAmountReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalDepositRecordDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租赁订单押金记录 Service 接口
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
public interface RentalDepositRecordService {
|
||||
|
||||
/**
|
||||
* 创建租赁订单押金记录
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createRentalDepositRecord(@Valid RentalDepositRecordSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 批量创建租赁订单押金记录
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
*/
|
||||
void createRentalDepositRecordBatch(@Valid List<RentalDepositRecordSaveReqVO> createReqVO);
|
||||
|
||||
/**
|
||||
* 更新租赁订单押金记录
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRentalDepositRecord(@Valid RentalDepositRecordSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 获得租赁订单押金记录
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 租赁订单押金记录
|
||||
*/
|
||||
RentalDepositRecordDO getRentalDepositRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得租赁订单押金记录分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 租赁订单押金记录分页
|
||||
*/
|
||||
PageResult<RentalDepositRecordDO> getRentalDepositRecordPage(RentalDepositRecordPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得指定订单的已收取的押金金额
|
||||
* @param orderNo 订单编号
|
||||
* @return 数量
|
||||
*/
|
||||
RentalDepositAmountReqVO getRentalDepositRecordAmount(String orderNo, Boolean isUpdate);
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
package cn.iocoder.yudao.module.system.service.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOARefundApi;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositAmountReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalDepositRecordDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalOrderDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.rental.RentalDepositRecordMapper;
|
||||
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.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 租赁订单押金记录 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class RentalDepositRecordServiceImpl implements RentalDepositRecordService {
|
||||
|
||||
@Resource
|
||||
private RentalDepositRecordMapper rentalDepositRecordMapper;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private RentalOrderService rentalOrderService;
|
||||
|
||||
@Resource
|
||||
private FileApi fileApi;
|
||||
|
||||
@Resource
|
||||
private BpmOARefundApi refundApi;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createRentalDepositRecord(RentalDepositRecordSaveReqVO createReqVO) {
|
||||
|
||||
// 获取当前订单的 剩余押金金额
|
||||
BigDecimal depositAmount = rentalOrderService.getOrderAmount(createReqVO.getOrderNo());
|
||||
|
||||
// 获取当前订单的金额
|
||||
RentalDepositAmountReqVO reqVO = getRentalDepositRecordAmount(createReqVO.getOrderNo(), true);
|
||||
// 已收金额 - 退款金额
|
||||
BigDecimal amount = reqVO.getReceivedAmount().subtract(reqVO.getRefundAmount());
|
||||
|
||||
switch (createReqVO.getType()) {
|
||||
case 1:
|
||||
// 押金收款
|
||||
// 判断实际已收的金额 + 本次收款金额 大于 当前订单的剩余押金金额时
|
||||
if (amount.add(createReqVO.getAmount()).compareTo(depositAmount) > 0) {
|
||||
throw exception(RENTAL_RECEIVED_AMOUNT_EXCESS);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
RentalOrderDO updateOrder = new RentalOrderDO();
|
||||
// 押金退款
|
||||
// 判断当前退款金额 + 扣款金额 大于 剩余已收金额时
|
||||
BigDecimal refundAmount = createReqVO.getAmount().add(createReqVO.getChargebacksAmount() == null ? BigDecimal.ZERO : createReqVO.getChargebacksAmount());
|
||||
if (amount.compareTo(refundAmount) < 0) {
|
||||
throw exception(RENTAL_REFUND_AMOUNT_EXCESS);
|
||||
} else if (amount.compareTo(refundAmount) == 0) { // 判断当前退款金额 是否等于 实际已收的金额 - 扣款金额时
|
||||
// 更新订单状态为 已退款
|
||||
updateOrder.setOrderNo(createReqVO.getOrderNo());
|
||||
updateOrder.setStatus(RentalOrderDO.REFUNDED);
|
||||
}else { // 判断当前退款金额 是否小于 实际已收的金额 - 扣款金额时
|
||||
// 更新订单状态为 租赁中
|
||||
updateOrder.setOrderNo(createReqVO.getOrderNo());
|
||||
updateOrder.setStatus(RentalOrderDO.ON_LEASE);
|
||||
}
|
||||
// 同步更新 退款申请流程中的 退款状态
|
||||
refundApi.updateStatus(createReqVO.getOrderNo());
|
||||
// 同步更新 租赁订单状态
|
||||
rentalOrderService.update(updateOrder);
|
||||
break;
|
||||
}
|
||||
|
||||
// 插入
|
||||
RentalDepositRecordDO rentalDepositRecord = BeanUtils.toBean(createReqVO, RentalDepositRecordDO.class);
|
||||
rentalDepositRecordMapper.insert(rentalDepositRecord);
|
||||
|
||||
// 更新交易凭证附件 业务编号
|
||||
UpdateBusinessFile(rentalDepositRecord);
|
||||
// 返回
|
||||
return rentalDepositRecord.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createRentalDepositRecordBatch(List<RentalDepositRecordSaveReqVO> createReqVO) {
|
||||
// 插入
|
||||
List<RentalDepositRecordDO> rentalDepositRecord = BeanUtils.toBean(createReqVO, RentalDepositRecordDO.class);
|
||||
rentalDepositRecordMapper.insertBatch(rentalDepositRecord);
|
||||
|
||||
for (RentalDepositRecordDO record : rentalDepositRecord) {
|
||||
// 更新交易凭证附件 业务编号
|
||||
UpdateBusinessFile(record);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateBusinessFile(RentalDepositRecordDO updateReqVO) {
|
||||
|
||||
List<String> urls = updateReqVO.getFileItems().stream().map(UploadUserFile::getUrl).collect(Collectors.toList());
|
||||
fileApi.updateBusinessFile(urls, updateReqVO.getId().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRentalDepositRecord(RentalDepositRecordSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRentalDepositRecordExists(updateReqVO.getId());
|
||||
// 更新
|
||||
RentalDepositRecordDO updateObj = BeanUtils.toBean(updateReqVO, RentalDepositRecordDO.class);
|
||||
rentalDepositRecordMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
private void validateRentalDepositRecordExists(Long id) {
|
||||
if (rentalDepositRecordMapper.selectById(id) == null) {
|
||||
throw exception(RENTAL_DEPOSIT_RECORD_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RentalDepositRecordDO getRentalDepositRecord(Long id) {
|
||||
return rentalDepositRecordMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RentalDepositRecordDO> getRentalDepositRecordPage(RentalDepositRecordPageReqVO pageReqVO) {
|
||||
return rentalDepositRecordMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RentalDepositAmountReqVO getRentalDepositRecordAmount(String orderNo, Boolean isUpdate) {
|
||||
return rentalDepositRecordMapper.selectAmount(orderNo, isUpdate);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.system.service.rental;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsCountReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsRecordRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalItemsRecordDO;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租赁物品记录 Service 接口
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
public interface RentalItemsRecordService {
|
||||
|
||||
/**
|
||||
* 创建租赁物品记录
|
||||
* @param createReqVO 创建信息
|
||||
*/
|
||||
Long createRentalItemsRecord(@Valid RentalItemsRecordSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 创建租赁物品记录
|
||||
* @param createReqVO 创建信息
|
||||
*/
|
||||
void createRentalItemsRecordBath(@Valid List<RentalItemsRecordSaveReqVO> createReqVO);
|
||||
|
||||
/**
|
||||
* 更新租赁物品记录
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRentalItemsRecord(@Valid RentalItemsRecordSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 查询租赁物品记录
|
||||
* @param id id
|
||||
* @return 租赁物品记录
|
||||
*/
|
||||
RentalItemsRecordDO getRentalItemsRecord(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询租赁物品记录
|
||||
* @param pageReqVO 分页参数
|
||||
* @return 租赁物品记录列表
|
||||
*/
|
||||
PageResult<RentalItemsRecordDO> getRentalItemsRecordPage(RentalItemsRecordPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获取指定订单指定类型的租赁物品的剩余数量
|
||||
* @param orderNo 订单编号
|
||||
* @return 剩余数量
|
||||
*/
|
||||
List<RentalItemsCountReqVO> getRentalItemsCount(String orderNo, Boolean isUpdate);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user