feat(system): 新增项目管理功能
- 添加项目管理相关的数据对象、控制器、服务接口和实现类 - 实现项目管理的 CRUD 功能,包括创建、更新、删除和查询项目信息 - 添加租赁客户管理功能 - 优化文件更新接口,支持批量更新- 新增用户信息查询接口- 添加系统错误码常量
This commit is contained in:
parent
f5ff97b375
commit
066ccf7021
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.dataobject.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
}
|
@ -83,11 +83,10 @@ public interface FileApi {
|
||||
@RequestBody byte[] content);
|
||||
|
||||
@PostMapping(PREFIX + "/updateBusinessFile")
|
||||
@Operation(summary = "修改BusinessFile文件中的 businessInstanceId | 入职申请用")
|
||||
CommonResult<Boolean> updateBusinessFileFormEntry(@RequestParam("url") String url,
|
||||
@Operation(summary = "修改BusinessFile文件中的 businessInstanceId")
|
||||
CommonResult<Boolean> updateBusinessFile(@RequestParam("url") List<String> url,
|
||||
@RequestParam("businessInstanceId") String businessInstanceId);
|
||||
|
||||
|
||||
@DeleteMapping(PREFIX + "/deleteBpmFile")
|
||||
@Operation(summary = "删除工作流附件")
|
||||
@Parameter(name = "url", description = "附件URL地址", required = true)
|
||||
|
@ -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);
|
||||
|
@ -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,177 @@
|
||||
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());
|
||||
// 拼接项目人员名称
|
||||
item.setStaffName(userVOs.stream().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,76 @@
|
||||
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.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("/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,108 @@
|
||||
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.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.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
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-order")
|
||||
@Validated
|
||||
public class RentalOrderController {
|
||||
|
||||
@Resource
|
||||
private RentalOrderService rentalOrderService;
|
||||
|
||||
@Resource
|
||||
private RentalCustomerService rentalCustomerService;
|
||||
|
||||
@Resource
|
||||
private RentalDepositRecordService rentalDepositRecordService;
|
||||
|
||||
@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);
|
||||
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已退")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
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 String notes;
|
||||
|
||||
@Schema(description = "状态 | 1租赁中 2退款中 3已退")
|
||||
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已退")
|
||||
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,53 @@
|
||||
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 = "收款/退款日期", 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 = "只包含被开启的用户,主要用于前端的下拉选项,无数据权限")
|
||||
|
@ -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,60 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.rental;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
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("system_rental_order")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RentalOrderDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 租赁订单表单主键
|
||||
*/
|
||||
@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已退
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -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,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.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);
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
@ -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,129 @@
|
||||
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.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.mysql.rental.RentalDepositRecordMapper;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
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;
|
||||
|
||||
@Override
|
||||
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:
|
||||
// 押金退款
|
||||
// 判断当前退款金额 大于 实际已收的金额时
|
||||
if (amount.compareTo(createReqVO.getAmount()) < 0) {
|
||||
throw exception(RENTAL_REFUND_AMOUNT_EXCESS);
|
||||
}
|
||||
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);
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package cn.iocoder.yudao.module.system.service.rental;
|
||||
|
||||
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.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.RentalItemsRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalItemsRecordDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.rental.RentalItemsRecordMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.RENTAL_ITEMS_NUMBER_EXCESS;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.RENTAL_ITEMS_RECORD_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 租赁物品记录 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class RentalItemsRecordServiceImpl implements RentalItemsRecordService{
|
||||
|
||||
@Resource
|
||||
private RentalItemsRecordMapper rentalItemsRecordMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createRentalItemsRecord(RentalItemsRecordSaveReqVO createReqVO) {
|
||||
|
||||
// 获取订单剩余租借数量 使用悲观锁
|
||||
List<RentalItemsCountReqVO> reqVOS = getRentalItemsCount(createReqVO.getOrderNo());
|
||||
Map<Integer, RentalItemsCountReqVO> countMap = convertMap(reqVOS, RentalItemsCountReqVO::getRentalItemsType);
|
||||
|
||||
// 判断租借类型为归还时,检验归还数量是否大于剩余数量
|
||||
if (createReqVO.getType() == 2 && countMap.get(createReqVO.getRentalItemsType()).getNumber() < createReqVO.getNumber()) {
|
||||
throw exception(RENTAL_ITEMS_NUMBER_EXCESS);
|
||||
}
|
||||
|
||||
RentalItemsRecordDO createDO = BeanUtils.toBean(createReqVO, RentalItemsRecordDO.class);
|
||||
rentalItemsRecordMapper.insert(createDO);
|
||||
|
||||
return createDO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createRentalItemsRecordBath(List<RentalItemsRecordSaveReqVO> createReqVO) {
|
||||
|
||||
// 获取订单剩余租借数量 使用悲观锁
|
||||
List<RentalItemsCountReqVO> reqVOS = getRentalItemsCount(createReqVO.get(0).getOrderNo());
|
||||
Map<Integer, RentalItemsCountReqVO> countMap = convertMap(reqVOS, RentalItemsCountReqVO::getRentalItemsType);
|
||||
|
||||
for (RentalItemsRecordSaveReqVO vo : createReqVO) {
|
||||
|
||||
// 判断租借类型为归还时,检验归还数量是否大于剩余数量
|
||||
if (vo.getType() == 2) {
|
||||
|
||||
if (countMap.get(vo.getRentalItemsType()) != null &&
|
||||
countMap.get(vo.getRentalItemsType()).getNumber() < vo.getNumber()) {
|
||||
throw exception(RENTAL_ITEMS_NUMBER_EXCESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<RentalItemsRecordDO> createReq = BeanUtils.toBean(createReqVO, RentalItemsRecordDO.class);
|
||||
rentalItemsRecordMapper.insertBatch(createReq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRentalItemsRecord(RentalItemsRecordSaveReqVO updateReqVO) {
|
||||
|
||||
// 校验存在
|
||||
validateRentalItemsRecordExists(updateReqVO.getId());
|
||||
|
||||
RentalItemsRecordDO updateObj = BeanUtils.toBean(updateReqVO, RentalItemsRecordDO.class);
|
||||
rentalItemsRecordMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RentalItemsRecordDO getRentalItemsRecord(Long id) {
|
||||
return rentalItemsRecordMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RentalItemsRecordDO> getRentalItemsRecordPage(RentalItemsRecordPageReqVO pageReqVO) {
|
||||
return rentalItemsRecordMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RentalItemsCountReqVO> getRentalItemsCount(String orderNo) {
|
||||
|
||||
return rentalItemsRecordMapper.selectRentalItemsCount(orderNo);
|
||||
}
|
||||
|
||||
private void validateRentalItemsRecordExists(Long id) {
|
||||
if (rentalItemsRecordMapper.selectById(id) == null) {
|
||||
throw exception(RENTAL_ITEMS_RECORD_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
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.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.dal.dataobject.rental.RentalOrderDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 租赁订单 Service 接口
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
public interface RentalOrderService {
|
||||
|
||||
/**
|
||||
* 创建租赁订单
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createRentalOrder(@Valid RentalOrderSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新租赁订单
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
BigDecimal updateRentalOrder(@Valid RentalOrderSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除租赁订单
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteRentalOrder(Long id);
|
||||
|
||||
/**
|
||||
* 获得租赁订单
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 租赁订单
|
||||
*/
|
||||
RentalOrderDO getRentalOrder(Long id);
|
||||
|
||||
/**
|
||||
* 获得租赁订单分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 租赁订单分页
|
||||
*/
|
||||
PageResult<RentalOrderRespVO> getRentalOrderPage(RentalOrderPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获取订单的剩余押金金额(押金金额-扣款金额)
|
||||
* @param orderNo 订单编号
|
||||
* @return 剩余押金金额
|
||||
*/
|
||||
BigDecimal getOrderAmount(String orderNo);
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
package cn.iocoder.yudao.module.system.service.rental;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
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.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.dal.dataobject.rental.RentalOrderDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.rental.RentalOrderMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.RENTAL_ORDER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 租赁订单 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class RentalOrderServiceImpl implements RentalOrderService {
|
||||
|
||||
@Resource
|
||||
private RentalOrderMapper rentalOrderMapper;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private RentalItemsRecordService rentalItemsRecordService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private RentalDepositRecordService rentalDepositRecordService;
|
||||
|
||||
@Resource
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Override
|
||||
public Long createRentalOrder(RentalOrderSaveReqVO createReqVO) {
|
||||
// 新增订单DO
|
||||
RentalOrderDO rentalOrder = BeanUtils.toBean(createReqVO, RentalOrderDO.class);
|
||||
|
||||
// 获取当前日期
|
||||
String now = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
// 获取分布式锁
|
||||
String LOCK_KEY = "lock:rental:order:create";
|
||||
RLock lock = redissonClient.getLock(LOCK_KEY);
|
||||
try {
|
||||
lock.lock();
|
||||
// redis 获取当天订单号
|
||||
String no = stringRedisTemplate.opsForValue().get(now);
|
||||
if (no != null) {
|
||||
no = "ZL" + now + String.format("%03d", Integer.parseInt(no) + 1);
|
||||
// redis 缓存订单号
|
||||
stringRedisTemplate.opsForValue().increment(now, 1);
|
||||
}else {
|
||||
no = "ZL" + now + String.format("%03d", 1);
|
||||
// redis 缓存订单号
|
||||
stringRedisTemplate.opsForValue().set(now, "1", 1, TimeUnit.DAYS);
|
||||
}
|
||||
// 设置订单编号
|
||||
rentalOrder.setOrderNo(no);
|
||||
createReqVO.getDepositRecords().forEach(item -> item.setOrderNo(rentalOrder.getOrderNo()));
|
||||
createReqVO.getItemsRecords().forEach(item -> item.setOrderNo(rentalOrder.getOrderNo()));
|
||||
} catch (Exception ex) {
|
||||
log.error("[messageResend][执行异常]", ex);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
// 插入订单
|
||||
rentalOrderMapper.insert(rentalOrder);
|
||||
|
||||
// 同步插入租赁物品记录
|
||||
rentalItemsRecordService.createRentalItemsRecordBath(createReqVO.getItemsRecords());
|
||||
if (CollectionUtil.isNotEmpty(createReqVO.getDepositRecords())) {
|
||||
// 同步插入租赁押金记录
|
||||
rentalDepositRecordService.createRentalDepositRecordBatch(createReqVO.getDepositRecords());
|
||||
}
|
||||
|
||||
// 返回
|
||||
return rentalOrder.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@CachePut(value = RedisKeyConstants.RENTAL_ORDER_AMOUNT, key = "#updateReqVO.orderNo", condition = "#updateReqVO.status == 1")
|
||||
public BigDecimal updateRentalOrder(RentalOrderSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRentalOrderExists(updateReqVO.getId());
|
||||
// 更新
|
||||
RentalOrderDO updateObj = BeanUtils.toBean(updateReqVO, RentalOrderDO.class);
|
||||
rentalOrderMapper.updateById(updateObj);
|
||||
|
||||
return updateObj.getDepositAmount().subtract(updateObj.getChargebacksAmount() == null ? BigDecimal.ZERO : updateObj.getChargebacksAmount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRentalOrder(Long id) {
|
||||
// 校验存在
|
||||
validateRentalOrderExists(id);
|
||||
// 删除
|
||||
rentalOrderMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateRentalOrderExists(Long id) {
|
||||
if (rentalOrderMapper.selectById(id) == null) {
|
||||
throw exception(RENTAL_ORDER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RentalOrderDO getRentalOrder(Long id) {
|
||||
return rentalOrderMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RentalOrderRespVO> getRentalOrderPage(RentalOrderPageReqVO pageReqVO) {
|
||||
return rentalOrderMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = RedisKeyConstants.RENTAL_ORDER_AMOUNT, key = "#orderNo", unless = "#result == null")
|
||||
public BigDecimal getOrderAmount(String orderNo) {
|
||||
return rentalOrderMapper.selectOrderAmount(orderNo);
|
||||
}
|
||||
|
||||
}
|
@ -413,4 +413,13 @@ public interface AdminUserService {
|
||||
* @param entryDate
|
||||
*/
|
||||
void updateUserEntryDate(Long id, LocalDateTime entryDate);
|
||||
|
||||
/**
|
||||
* 获取指定部门下的用户信息
|
||||
* @param userType 用户类型
|
||||
* @param deptIds 部门列表
|
||||
* @param status 用户状态
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<AdminUserDO> getUserListByDepts(Integer userType, List<Long> deptIds, Integer status);
|
||||
}
|
||||
|
@ -810,4 +810,12 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
public void updateUserEntryDate(Long id, LocalDateTime entryDate) {
|
||||
userMapper.updateById(new AdminUserDO().setId(id).setEntryDate(entryDate));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserDO> getUserListByDepts(Integer userType, List<Long> deptIds, Integer status) {
|
||||
return userMapper.selectList(new LambdaQueryWrapperX<AdminUserDO>()
|
||||
.eqIfPresent(AdminUserDO::getUserType, userType)
|
||||
.eqIfPresent(AdminUserDO::getStatus, status)
|
||||
.inIfPresent(AdminUserDO::getDeptId, deptIds));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.rental.RentalDepositRecordMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectAmount" resultType="cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositAmountReqVO">
|
||||
SELECT
|
||||
COALESCE(SUM( CASE WHEN type = 1 THEN amount END ),0) AS receivedAmount,
|
||||
COALESCE(SUM( CASE WHEN type = 2 THEN amount END ),0) AS refundAmount
|
||||
FROM
|
||||
system_rental_deposit_record
|
||||
WHERE
|
||||
order_no = #{orderNo}
|
||||
AND deleted = 0
|
||||
<if test="isUpdate">
|
||||
FOR UPDATE
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.rental.RentalItemsRecordMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectRentalItemsCount" resultType="cn.iocoder.yudao.module.system.controller.admin.rental.vo.itemsrecord.RentalItemsCountReqVO">
|
||||
SELECT
|
||||
rental_items_type AS rentalItemsType,
|
||||
COALESCE(SUM( CASE WHEN type = 1 THEN number END ),0) -
|
||||
COALESCE(SUM( CASE WHEN type = 2 THEN number END ),0) AS number
|
||||
FROM
|
||||
system_rental_items_record
|
||||
WHERE
|
||||
order_no = #{orderNo}
|
||||
AND deleted = 0
|
||||
FOR UPDATE
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.rental.RentalOrderMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectOrderAmount" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
deposit_amount - COALESCE(chargebacks_amount, 0)
|
||||
FROM
|
||||
system_rental_order
|
||||
WHERE
|
||||
order_no = #{orderNo}
|
||||
AND deleted = 0
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user