Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into dev
This commit is contained in:
commit
663518e00a
@ -12,4 +12,7 @@ public class ReceiptSettlementDTO {
|
|||||||
|
|
||||||
@Schema(description = "回款总金额")
|
@Schema(description = "回款总金额")
|
||||||
private BigDecimal money;
|
private BigDecimal money;
|
||||||
|
|
||||||
|
@Schema(description = "渠道商回款总金额")
|
||||||
|
private BigDecimal channelAmount;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode OA_PAYMENT_FILES_NOT_NULL = new ErrorCode(1_009_001_128, "后补发票不能为空!");
|
ErrorCode OA_PAYMENT_FILES_NOT_NULL = new ErrorCode(1_009_001_128, "后补发票不能为空!");
|
||||||
ErrorCode OA_EXPENSES_NOT_EXISTS = new ErrorCode(1_009_001_129, "开支日报申请不存在");
|
ErrorCode OA_EXPENSES_NOT_EXISTS = new ErrorCode(1_009_001_129, "开支日报申请不存在");
|
||||||
ErrorCode OA_LOAN_NOT_EXISTS = new ErrorCode(1_009_001_130, "借支申请不存在");
|
ErrorCode OA_LOAN_NOT_EXISTS = new ErrorCode(1_009_001_130, "借支申请不存在");
|
||||||
|
ErrorCode OA_LOAN_NOT_CREATE = new ErrorCode(1_009_001_131, "厂区员工信息不存在");
|
||||||
|
|
||||||
// ========== 流程模型 1-009-002-000 ==========
|
// ========== 流程模型 1-009-002-000 ==========
|
||||||
ErrorCode MODEL_KEY_EXISTS = new ErrorCode(1_009_002_000, "已经存在流程标识为【{}】的流程");
|
ErrorCode MODEL_KEY_EXISTS = new ErrorCode(1_009_002_000, "已经存在流程标识为【{}】的流程");
|
||||||
|
@ -62,4 +62,16 @@ public class FinancialPaymentRespVO {
|
|||||||
|
|
||||||
@Schema(description = "流程实例名称")
|
@Schema(description = "流程实例名称")
|
||||||
private String processInstanceName;
|
private String processInstanceName;
|
||||||
|
|
||||||
|
@Schema(description = "收款人名称")
|
||||||
|
private String recipientName;
|
||||||
|
|
||||||
|
@Schema(description = "付款公司编号")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@Schema(description = "付款公司工厂编号")
|
||||||
|
private Long companyFactoryId;
|
||||||
|
|
||||||
|
@Schema(description = "付款公司名称")
|
||||||
|
private String companyName;
|
||||||
}
|
}
|
||||||
|
@ -74,4 +74,24 @@ public class BpmOAExpensesController {
|
|||||||
|
|
||||||
return success(expensesService.getExpensesTotal(pageReqVO));
|
return success(expensesService.getExpensesTotal(pageReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/payment")
|
||||||
|
@Operation(summary = "提前付款")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
public CommonResult<Boolean> getPayment(Long id) {
|
||||||
|
|
||||||
|
expensesService.getPayment(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/refused")
|
||||||
|
@Operation(summary = "拒绝付款")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@Parameter(name = "processInstanceId", description = "流程实例编号", required = true, example = "1024")
|
||||||
|
public CommonResult<Boolean> refused(@RequestParam("id") Long id,
|
||||||
|
@RequestParam("processInstanceId") String processInstanceId) {
|
||||||
|
|
||||||
|
expensesService.refused(id, processInstanceId);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
}
|
}
|
@ -2,9 +2,12 @@ package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
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.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanCreateReqVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanPageReqVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanRespVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanRespVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOAReturnVO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
||||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||||
@ -143,30 +146,29 @@ public class BpmOALoanController {
|
|||||||
|
|
||||||
@GetMapping("/get-list")
|
@GetMapping("/get-list")
|
||||||
@Operation(summary = "获得指定用户的借支申请列表")
|
@Operation(summary = "获得指定用户的借支申请列表")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
public CommonResult<PageResult<BpmOALoanRespVO>> getLoanList(BpmOALoanPageReqVO pageReqVO) {
|
||||||
public CommonResult<List<BpmOALoanRespVO>> getLoanList(@RequestParam("staffId") Long staffId) {
|
|
||||||
|
|
||||||
List<BpmOALoanDO> loanList = loanService.getListByStaffId(staffId);
|
PageResult<BpmOALoanDO> loanList = loanService.getListByStaffId(pageReqVO);
|
||||||
List<BpmOALoanRespVO> respVOS = BeanUtils.toBean(loanList, BpmOALoanRespVO.class);
|
PageResult<BpmOALoanRespVO> respVOS = BeanUtils.toBean(loanList, BpmOALoanRespVO.class);
|
||||||
if (CollUtil.isNotEmpty(respVOS)) {
|
if (CollUtil.isNotEmpty(respVOS.getList())) {
|
||||||
|
|
||||||
// 获取支付信息
|
// 获取支付信息
|
||||||
List<String> processInstanceIds = convertList(loanList, BpmOALoanDO::getProcessInstanceId);
|
List<String> processInstanceIds = convertList(loanList.getList(), BpmOALoanDO::getProcessInstanceId);
|
||||||
Map<String, FinancialPaymentDO> financialPayments = convertMap(financialPaymentService.getFinancialPaymentList(processInstanceIds), FinancialPaymentDO::getProcessInstanceId);
|
Map<String, FinancialPaymentDO> financialPayments = convertMap(financialPaymentService.getFinancialPaymentList(processInstanceIds), FinancialPaymentDO::getProcessInstanceId);
|
||||||
|
|
||||||
// 获取申请人信息
|
// 获取申请人信息
|
||||||
Set<Long> userIds = convertSet(loanList, BpmOALoanDO::getUserId);
|
Set<Long> userIds = convertSet(loanList.getList(), BpmOALoanDO::getUserId);
|
||||||
Map<Long, AdminUserRespDTO> userMap = userApi.getUserMap(userIds);
|
Map<Long, AdminUserRespDTO> userMap = userApi.getUserMap(userIds);
|
||||||
|
|
||||||
// 获取借支人信息
|
// 获取借支人信息
|
||||||
Set<Long> loanUserIds = convertSet(loanList, BpmOALoanDO::getSfUserId);
|
Set<Long> loanUserIds = convertSet(loanList.getList(), BpmOALoanDO::getSfUserId);
|
||||||
Map<Long, StaffDTO> loanUserMap = convertMap(staffApi.getStaffList(loanUserIds).getCheckedData(), StaffDTO::getId);
|
Map<Long, StaffDTO> loanUserMap = convertMap(staffApi.getStaffList(loanUserIds).getCheckedData(), StaffDTO::getId);
|
||||||
|
|
||||||
// 获取工厂信息
|
// 获取工厂信息
|
||||||
Set<Long> deptIds = convertSet(loanList, BpmOALoanDO::getFactoryId);
|
Set<Long> deptIds = convertSet(loanList.getList(), BpmOALoanDO::getFactoryId);
|
||||||
Map<Long, FactoryInfoDTO> factoryMap = factoryInfoApi.getFactoryMap(deptIds);
|
Map<Long, FactoryInfoDTO> factoryMap = factoryInfoApi.getFactoryMap(deptIds);
|
||||||
|
|
||||||
respVOS.forEach(item -> {
|
respVOS.getList().forEach(item -> {
|
||||||
// 设置申请人名称
|
// 设置申请人名称
|
||||||
item.setUserName(userMap.get(item.getUserId()).getNickname());
|
item.setUserName(userMap.get(item.getUserId()).getNickname());
|
||||||
// 设置借支用户名称
|
// 设置借支用户名称
|
||||||
@ -180,4 +182,13 @@ public class BpmOALoanController {
|
|||||||
|
|
||||||
return success(respVOS);
|
return success(respVOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-return-list")
|
||||||
|
@Operation(summary = "获得指定用户的还款列表")
|
||||||
|
public CommonResult<PageResult<BpmOAReturnVO>> getReturnList(BpmOALoanPageReqVO pageReqVO) {
|
||||||
|
|
||||||
|
PageResult<BpmOAReturnVO> respVOS = loanService.getReturnList(pageReqVO);
|
||||||
|
|
||||||
|
return success(respVOS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
@ -10,7 +11,8 @@ import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.procurepay.BpmOAProcur
|
|||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProcureDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProcureDO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProcurePayDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProcurePayDO;
|
||||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAProcurePayService;
|
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAProcurePayService;
|
||||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAProcureService;
|
import cn.iocoder.yudao.module.system.api.project.ProjectApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -20,8 +22,12 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 采购支付")
|
@Tag(name = "管理后台 - 采购支付")
|
||||||
@RestController
|
@RestController
|
||||||
@ -32,7 +38,7 @@ public class BpmOAProcurePayController {
|
|||||||
@Resource
|
@Resource
|
||||||
private BpmOAProcurePayService oAProcurePayService;
|
private BpmOAProcurePayService oAProcurePayService;
|
||||||
@Resource
|
@Resource
|
||||||
private BpmOAProcureService oaProcureService;
|
private ProjectApi projectApi;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建采购支付")
|
@Operation(summary = "创建采购支付")
|
||||||
@ -80,7 +86,18 @@ public class BpmOAProcurePayController {
|
|||||||
@Operation(summary = "获取可用采购单列表")
|
@Operation(summary = "获取可用采购单列表")
|
||||||
public CommonResult<List<BpmOAProcureRespVO>> getAvailablePurchaseOrders(@RequestParam(name = "type", required = false) Integer type) {
|
public CommonResult<List<BpmOAProcureRespVO>> getAvailablePurchaseOrders(@RequestParam(name = "type", required = false) Integer type) {
|
||||||
List<BpmOAProcureDO> list = oAProcurePayService.getAvailablePurchaseOrders(type);
|
List<BpmOAProcureDO> list = oAProcurePayService.getAvailablePurchaseOrders(type);
|
||||||
return success(BeanUtils.toBean(list, BpmOAProcureRespVO.class));
|
List<BpmOAProcureRespVO> respVOS = BeanUtils.toBean(list, BpmOAProcureRespVO.class);
|
||||||
|
if (CollUtil.isNotEmpty(respVOS)) {
|
||||||
|
// 获取项目编号列表
|
||||||
|
Set<String> projectNo = convertSet(respVOS, BpmOAProcureRespVO::getProjectNo);
|
||||||
|
List<ProjectDTO> projectList = projectApi.getProjectList(projectNo).getCheckedData();
|
||||||
|
Map<String, ProjectDTO> projectMap = convertMap(projectList, ProjectDTO::getProjectNo);
|
||||||
|
|
||||||
|
respVOS.forEach(respVO -> {
|
||||||
|
respVO.setProjectName(projectMap.get(respVO.getProjectNo()) != null ? projectMap.get(respVO.getProjectNo()).getName() : "");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return success(respVOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getByProcessInstanceId")
|
@GetMapping("/getByProcessInstanceId")
|
||||||
|
@ -27,7 +27,7 @@ public class BpmOAExpensesCreateReqVO {
|
|||||||
@Schema(description = "开支明细")
|
@Schema(description = "开支明细")
|
||||||
private List<Expenses> expensesItem;
|
private List<Expenses> expensesItem;
|
||||||
|
|
||||||
@Schema(description = "工厂类型 | 1公司 工厂")
|
@Schema(description = "工厂类型 |1工厂 2公司 ")
|
||||||
private Integer factoryType;
|
private Integer factoryType;
|
||||||
|
|
||||||
@Schema(description = "报销总金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "报销总金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ -14,4 +14,7 @@ public class BpmOAExpensesTotal {
|
|||||||
|
|
||||||
@Schema(description = "应付款金额")
|
@Schema(description = "应付款金额")
|
||||||
private BigDecimal payableAmount;
|
private BigDecimal payableAmount;
|
||||||
|
|
||||||
|
@Schema(description = "剩余付款金额")
|
||||||
|
private BigDecimal remainingPayable;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 借支申请分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class BpmOALoanPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "员工ID")
|
||||||
|
private Long staffId;
|
||||||
|
|
||||||
|
@Schema(description = "借支类型")
|
||||||
|
private Integer loanType;
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 借支申请还款 Response VO")
|
||||||
|
@Data
|
||||||
|
public class BpmOAReturnVO {
|
||||||
|
|
||||||
|
@Schema(description = "员工ID")
|
||||||
|
private Long staffId;
|
||||||
|
|
||||||
|
@Schema(description = "员工名称")
|
||||||
|
private String staffName;
|
||||||
|
|
||||||
|
@Schema(description = "工厂ID")
|
||||||
|
private Long factoryId;
|
||||||
|
|
||||||
|
@Schema(description = "工厂名称")
|
||||||
|
private String factoryName;
|
||||||
|
|
||||||
|
@Schema(description = "还款月份")
|
||||||
|
private String month;
|
||||||
|
|
||||||
|
@Schema(description = "还款金额")
|
||||||
|
private BigDecimal repaymentAmount;
|
||||||
|
|
||||||
|
@Schema(description = "还款类型 | 1开支抵扣 2工资还款")
|
||||||
|
private Integer type;
|
||||||
|
}
|
@ -55,7 +55,7 @@ public class FinancialPaymentDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String reason;
|
private String reason;
|
||||||
/**
|
/**
|
||||||
* 流程类型 1现金支出 2备用金 3采购付款 4报销 5付款申请 6薪资付款 7借支申请 8供应商采购付款
|
* 流程类型 1现金支出 2备用金 3采购付款 4报销 5付款申请 6薪资付款 7借支申请 8供应商采购付款 9开支日报
|
||||||
*/
|
*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
/**
|
/**
|
||||||
@ -83,6 +83,19 @@ public class FinancialPaymentDO extends BaseDO {
|
|||||||
* 流程结束时间
|
* 流程结束时间
|
||||||
*/
|
*/
|
||||||
private LocalDateTime endTime;
|
private LocalDateTime endTime;
|
||||||
|
/**
|
||||||
|
* 收款人名称
|
||||||
|
*/
|
||||||
|
private String recipientName;
|
||||||
|
/**
|
||||||
|
* 付款公司编号
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司工厂编号
|
||||||
|
*/
|
||||||
|
private Long companyFactoryId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
@ -99,4 +112,9 @@ public class FinancialPaymentDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String receiveUserNickName;
|
private String receiveUserNickName;
|
||||||
|
/**
|
||||||
|
* 付款公司名称
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String companyName;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
|
import liquibase.pro.packaged.I;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -54,6 +55,16 @@ public class BpmOAExpensesDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal totalMoney;
|
private BigDecimal totalMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal amountPaid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付状态 | 0未支付 1已支付 2已抵扣 3未抵扣完
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请结果
|
* 申请结果
|
||||||
* 枚举 {@link BpmProcessInstanceResultEnum}
|
* 枚举 {@link BpmProcessInstanceResultEnum}
|
||||||
|
@ -69,6 +69,11 @@ public class BpmOALoanDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal totalMoney;
|
private BigDecimal totalMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 还款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal returnAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 借支原因
|
* 借支原因
|
||||||
*/
|
*/
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOAReturnVO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -14,4 +18,7 @@ public interface BpmOALoanMapper extends BaseMapperX<BpmOALoanDO> {
|
|||||||
|
|
||||||
List<BpmOALoanSumDTO> selectSumByStaffId(@Param("staffId") Collection<Long> staffId,
|
List<BpmOALoanSumDTO> selectSumByStaffId(@Param("staffId") Collection<Long> staffId,
|
||||||
@Param("month") String month);
|
@Param("month") String month);
|
||||||
|
|
||||||
|
IPage<BpmOAReturnVO> selectReturnList(@Param("pageReqVO") BpmOALoanPageReqVO pageReqVO,
|
||||||
|
@Param("page") IPage<BpmOAReturnVO> page);
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,12 @@ public class BpmTaskEntryLeaderScript implements BpmTaskAssignScript {
|
|||||||
//根据部门ID 获取部门信息
|
//根据部门ID 获取部门信息
|
||||||
DeptRespDTO dept = deptApi.getDept(deptId).getCheckedData();
|
DeptRespDTO dept = deptApi.getDept(deptId).getCheckedData();
|
||||||
|
|
||||||
|
// 获取4级部门信息
|
||||||
|
if (dept.getLevel() > 4) {
|
||||||
|
String[] level = dept.getFlag().split("-");
|
||||||
|
dept = deptApi.getDept(Long.valueOf(level[4])).getCheckedData();
|
||||||
|
}
|
||||||
|
|
||||||
return dept != null && dept.getLeaderUserId() != null ? asSet(dept.getLeaderUserId()) : emptySet();
|
return dept != null && dept.getLeaderUserId() != null ? asSet(dept.getLeaderUserId()) : emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +89,13 @@ public interface FinancialPaymentService {
|
|||||||
*/
|
*/
|
||||||
List<FinancialPaymentDO> getFinancialPaymentList(List<String> processInstanceIds);
|
List<FinancialPaymentDO> getFinancialPaymentList(List<String> processInstanceIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据流程实例编号获取支付信息
|
||||||
|
* @param processInstanceId 流程实例编号
|
||||||
|
* @return 支付信息
|
||||||
|
*/
|
||||||
|
FinancialPaymentDO getFinancialPaymentByProcessInstanceId(String processInstanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取支付信息 统计
|
* 获取支付信息 统计
|
||||||
* @param pageReqVO 查询条件
|
* @param pageReqVO 查询条件
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.service.financialpayment;
|
package cn.iocoder.yudao.module.bpm.service.financialpayment;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.Constants;
|
import cn.iocoder.yudao.framework.common.Constants;
|
||||||
import cn.iocoder.yudao.framework.common.enums.SocialTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.SocialTypeEnum;
|
||||||
@ -24,6 +25,7 @@ import cn.iocoder.yudao.module.bpm.dal.mysql.oa.*;
|
|||||||
import cn.iocoder.yudao.module.bpm.dal.mysql.task.BpmProcessInstanceExtMapper;
|
import cn.iocoder.yudao.module.bpm.dal.mysql.task.BpmProcessInstanceExtMapper;
|
||||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum;
|
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAExpensesService;
|
||||||
import cn.iocoder.yudao.module.system.api.auth.AdminOauthUserOtherInfoApi;
|
import cn.iocoder.yudao.module.system.api.auth.AdminOauthUserOtherInfoApi;
|
||||||
import cn.iocoder.yudao.module.system.api.auth.dto.AdminOauthUserOtherInfoApiDTO;
|
import cn.iocoder.yudao.module.system.api.auth.dto.AdminOauthUserOtherInfoApiDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.auth.vo.AdminOauthUserOtherInfoApiVO;
|
import cn.iocoder.yudao.module.system.api.auth.vo.AdminOauthUserOtherInfoApiVO;
|
||||||
@ -89,6 +91,9 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
|||||||
@Resource
|
@Resource
|
||||||
private BpmOASalaryMapper salaryMapper;
|
private BpmOASalaryMapper salaryMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BpmOAExpensesMapper expensesMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createFinancialPayment(FinancialPaymentSaveVO vo) {
|
public Long createFinancialPayment(FinancialPaymentSaveVO vo) {
|
||||||
FinancialPaymentItemSaveReqVO createReqVO = vo.getFinancialPaymentItemSaveReqVO();
|
FinancialPaymentItemSaveReqVO createReqVO = vo.getFinancialPaymentItemSaveReqVO();
|
||||||
@ -139,6 +144,8 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
|||||||
case 8:
|
case 8:
|
||||||
supplierPurchasePaymentMapper.updateById(new BpmOASupplierPurchasePaymentDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
supplierPurchasePaymentMapper.updateById(new BpmOASupplierPurchasePaymentDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||||
break;
|
break;
|
||||||
|
case 9:
|
||||||
|
expensesMapper.updateById(new BpmOAExpensesDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||||
}
|
}
|
||||||
BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO().setProcessInstanceId(financialPayment.getProcessInstanceId())
|
BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO().setProcessInstanceId(financialPayment.getProcessInstanceId())
|
||||||
.setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus())
|
.setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus())
|
||||||
@ -147,19 +154,31 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
|||||||
}
|
}
|
||||||
this.updateById(financialPayment);
|
this.updateById(financialPayment);
|
||||||
|
|
||||||
// 判断是借支申请时
|
// 支付完成时
|
||||||
if (financialPayment.getType() == 7 && financialPayment.getStatus() == 2) {
|
if (financialPayment.getStatus() == 2) {
|
||||||
|
|
||||||
// 获取借支信息
|
switch (financialPayment.getType()) {
|
||||||
BpmOALoanDO loanDO = loanMapper.selectById(financialPayment.getObjectId());
|
case 7: // 借支申请时
|
||||||
|
// 获取借支信息
|
||||||
|
BpmOALoanDO loanDO = loanMapper.selectById(financialPayment.getObjectId());
|
||||||
|
|
||||||
// 同步插入借支表中
|
// 同步插入借支表中
|
||||||
LoanDTO createDO = new LoanDTO()
|
LoanDTO createDO = new LoanDTO()
|
||||||
.setUserId(loanDO.getSfUserId())
|
.setUserId(loanDO.getSfUserId())
|
||||||
.setDeptId(loanDO.getFactoryId())
|
.setDeptId(loanDO.getFactoryId())
|
||||||
.setAmount(loanDO.getTotalMoney())
|
.setLoanType(loanDO.getLoanType())
|
||||||
.setReturnAmount(BigDecimal.ZERO);
|
.setAmount(loanDO.getTotalMoney())
|
||||||
loanApi.createLoan(createDO);
|
.setReturnAmount(BigDecimal.ZERO);
|
||||||
|
loanApi.createLoan(createDO);
|
||||||
|
break;
|
||||||
|
case 9: // 开支日报时
|
||||||
|
// 更新开支日报支付状态、支付金额
|
||||||
|
expensesMapper.updateById(new BpmOAExpensesDO()
|
||||||
|
.setId(financialPayment.getObjectId())
|
||||||
|
.setStatus(1)
|
||||||
|
.setAmountPaid(financialPayment.getActualPayment()));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- 获取发起人的openId
|
// -- 获取发起人的openId
|
||||||
@ -253,6 +272,15 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FinancialPaymentDO getFinancialPaymentByProcessInstanceId(String processInstanceId) {
|
||||||
|
List<FinancialPaymentDO> financialPaymentDO = financialPaymentMapper.selectList(FinancialPaymentDO::getProcessInstanceId, processInstanceId);
|
||||||
|
if (CollUtil.isNotEmpty(financialPaymentDO)) {
|
||||||
|
return financialPaymentDO.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FinancialPaymentDO getPaymentTotal(FinancialPaymentPageReqVO pageReqVO) {
|
public FinancialPaymentDO getPaymentTotal(FinancialPaymentPageReqVO pageReqVO) {
|
||||||
pageReqVO.setReceiveUserId(getLoginUserId());
|
pageReqVO.setReceiveUserId(getLoginUserId());
|
||||||
|
@ -229,6 +229,16 @@ public class BpmOACashServiceImpl extends BpmOABaseService implements BpmOACashS
|
|||||||
|
|
||||||
BpmProcessInstanceExtDO processInstance = bpmProcessInstanceService.getProcessInstanceDO(processInstanceId);
|
BpmProcessInstanceExtDO processInstance = bpmProcessInstanceService.getProcessInstanceDO(processInstanceId);
|
||||||
CommonResult<AdminUserRespDTO> user = userApi.getUser(cash.getUserId());
|
CommonResult<AdminUserRespDTO> user = userApi.getUser(cash.getUserId());
|
||||||
|
|
||||||
|
// 从缓存中部门所属公司信息
|
||||||
|
DeptRespDTO deptRespDTO = deptApi.getCompanyByDept(cashItemDOs.get(0).getDeptId()).getCheckedData();
|
||||||
|
|
||||||
|
// 获取收款人信息
|
||||||
|
BankRespDTO bankRespDTO = new BankRespDTO();
|
||||||
|
if (cash.getBankId() != null) {
|
||||||
|
bankRespDTO = bankApi.getBank(cash.getBankId()).getCheckedData();
|
||||||
|
}
|
||||||
|
|
||||||
// -- 插入到财务支付表中
|
// -- 插入到财务支付表中
|
||||||
financialPaymentService.save(new FinancialPaymentDO()
|
financialPaymentService.save(new FinancialPaymentDO()
|
||||||
.setUserId(cash.getUserId())
|
.setUserId(cash.getUserId())
|
||||||
@ -242,6 +252,8 @@ public class BpmOACashServiceImpl extends BpmOABaseService implements BpmOACashS
|
|||||||
.setAmountPayable(isImprest == 1 ? amount.abs() : cash.getTotalMoney())
|
.setAmountPayable(isImprest == 1 ? amount.abs() : cash.getTotalMoney())
|
||||||
.setBeginTime(processInstance.getCreateTime())
|
.setBeginTime(processInstance.getCreateTime())
|
||||||
.setEndTime(processInstance.getEndTime())
|
.setEndTime(processInstance.getEndTime())
|
||||||
|
.setRecipientName(bankRespDTO.getNickname())
|
||||||
|
.setCompanyId(deptRespDTO != null ? deptRespDTO.getId() : null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
|||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesItemDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesItemDO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface BpmOAExpensesService {
|
public interface BpmOAExpensesService {
|
||||||
@ -70,4 +71,24 @@ public interface BpmOAExpensesService {
|
|||||||
* @return 统计信息
|
* @return 统计信息
|
||||||
*/
|
*/
|
||||||
BpmOAExpensesTotal getExpensesTotal(BpmOAExpensesPageReqVO pageReqVO);
|
BpmOAExpensesTotal getExpensesTotal(BpmOAExpensesPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提前付款 | 手动插入至支付管理
|
||||||
|
* @param id 生产开支id
|
||||||
|
*/
|
||||||
|
void getPayment(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新生产开支 支付状态
|
||||||
|
* @param status 支付状态
|
||||||
|
* @param amountPaid 支付金额
|
||||||
|
*/
|
||||||
|
void updateExpenses(Long id ,Integer status, BigDecimal amountPaid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拒绝付款
|
||||||
|
* @param id 生产开支id
|
||||||
|
* @param processInstanceId 流程实例编号
|
||||||
|
*/
|
||||||
|
void refused(Long id, String processInstanceId);
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,50 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
|
||||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.*;
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.*;
|
||||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAExpensesConvert;
|
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAExpensesConvert;
|
||||||
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesItemDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesItemDO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAExpensesItemMapper;
|
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAExpensesItemMapper;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAExpensesMapper;
|
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAExpensesMapper;
|
||||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||||
|
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||||
|
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
||||||
|
import cn.iocoder.yudao.module.smartfactory.api.staff.StaffApi;
|
||||||
|
import cn.iocoder.yudao.module.smartfactory.api.staff.dto.StaffDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.bank.BankApi;
|
import cn.iocoder.yudao.module.system.api.bank.BankApi;
|
||||||
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
|
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
import cn.iocoder.yudao.module.system.api.loan.LoanApi;
|
||||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
import cn.iocoder.yudao.module.system.api.loan.dto.LoanDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.flowable.engine.runtime.ProcessInstance;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
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.framework.common.util.collection.CollectionUtils.convertSet;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_EXPENSES_NOT_EXISTS;
|
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_EXPENSES_NOT_EXISTS;
|
||||||
|
|
||||||
@ -59,7 +69,7 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
|||||||
private BpmOAExpensesItemMapper expensesItemMapper;
|
private BpmOAExpensesItemMapper expensesItemMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private BpmProcessInstanceApi processInstanceApi;
|
private BpmProcessInstanceService processInstanceService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FactoryInfoApi factoryInfoApi;
|
private FactoryInfoApi factoryInfoApi;
|
||||||
@ -67,10 +77,22 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
|||||||
@Resource
|
@Resource
|
||||||
private BankApi bankApi;
|
private BankApi bankApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FinancialPaymentService financialPaymentService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 解决循环依赖
|
@Lazy // 解决循环依赖
|
||||||
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserApi userApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LoanApi loanApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StaffApi staffApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createExpenses(Long userId, BpmOAExpensesCreateReqVO createReqVO) {
|
public Long createExpenses(Long userId, BpmOAExpensesCreateReqVO createReqVO) {
|
||||||
|
|
||||||
@ -90,9 +112,9 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
|||||||
String type = bpmOAExpensesItemDOS.stream().map(item -> item.getType().toString()).collect(Collectors.joining(","));
|
String type = bpmOAExpensesItemDOS.stream().map(item -> item.getType().toString()).collect(Collectors.joining(","));
|
||||||
processInstanceVariables.put("type", type);
|
processInstanceVariables.put("type", type);
|
||||||
processInstanceVariables.put("factoryType", expenses.getFactoryType());
|
processInstanceVariables.put("factoryType", expenses.getFactoryType());
|
||||||
String processInstanceId = processInstanceApi.createProcessInstance(userId,
|
String processInstanceId = processInstanceService.createProcessInstance(userId,
|
||||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||||
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(expenses.getId()))).getCheckedData();
|
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(expenses.getId())));
|
||||||
|
|
||||||
// 将工作流的编号,更新到 OA 生产开支单中
|
// 将工作流的编号,更新到 OA 生产开支单中
|
||||||
expensesMapper.updateById(new BpmOAExpensesDO().setId(expenses.getId()).setProcessInstanceId(processInstanceId));
|
expensesMapper.updateById(new BpmOAExpensesDO().setId(expenses.getId()).setProcessInstanceId(processInstanceId));
|
||||||
@ -118,7 +140,48 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
|||||||
// 获得现金支出业务数据
|
// 获得现金支出业务数据
|
||||||
BpmOAExpensesDO expenses = validateLeaveExists(id);
|
BpmOAExpensesDO expenses = validateLeaveExists(id);
|
||||||
|
|
||||||
expensesMapper.updateById(new BpmOAExpensesDO().setId(id).setResult(result));
|
//审核通过 (最后节点)
|
||||||
|
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
|
||||||
|
|
||||||
|
ProcessInstance instance = processInstanceService.getProcessInstance(processInstanceId);
|
||||||
|
if (instance.isEnded()) {
|
||||||
|
|
||||||
|
// 获取申请人对应的厂区员工编号
|
||||||
|
StaffDTO staffDTO = staffApi.getStaffByUserId(expenses.getUserId()).getCheckedData();
|
||||||
|
if (staffDTO != null) {
|
||||||
|
|
||||||
|
// 判断申请人是否存在 费用借支
|
||||||
|
LoanDTO loanDTO = loanApi.getByUserId(staffDTO.getId(), 2).getCheckedData();
|
||||||
|
if (loanDTO != null) {
|
||||||
|
|
||||||
|
if (loanDTO.getRemainingAmount().compareTo(expenses.getTotalMoney()) >= 0) {
|
||||||
|
|
||||||
|
// 设置开支日报支付状态为 已抵扣
|
||||||
|
expenses.setStatus(2).setAmountPaid(expenses.getTotalMoney());
|
||||||
|
|
||||||
|
}else {
|
||||||
|
|
||||||
|
// 设置开支日报支付状态为 未抵扣完毕
|
||||||
|
expenses.setStatus(3).setAmountPaid(loanDTO.getRemainingAmount());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新借支表中 归还金额
|
||||||
|
loanApi.createLoan(new LoanDTO()
|
||||||
|
.setUserId(staffDTO.getId())
|
||||||
|
.setLoanType(2)
|
||||||
|
.setAmount(BigDecimal.ZERO)
|
||||||
|
.setReturnAmount(expenses.getAmountPaid()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新开支日报 审批结果、支付状态以及支付金额
|
||||||
|
expensesMapper.updateById(new BpmOAExpensesDO()
|
||||||
|
.setId(id)
|
||||||
|
.setResult(result)
|
||||||
|
.setStatus(expenses.getStatus())
|
||||||
|
.setAmountPaid(expenses.getAmountPaid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private BpmOAExpensesDO validateLeaveExists(Long id) {
|
private BpmOAExpensesDO validateLeaveExists(Long id) {
|
||||||
@ -181,4 +244,70 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
|||||||
public BpmOAExpensesTotal getExpensesTotal(BpmOAExpensesPageReqVO pageReqVO) {
|
public BpmOAExpensesTotal getExpensesTotal(BpmOAExpensesPageReqVO pageReqVO) {
|
||||||
return expensesMapper.selectTotal(pageReqVO);
|
return expensesMapper.selectTotal(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getPayment(Long id) {
|
||||||
|
|
||||||
|
// 获取开支详情
|
||||||
|
BpmOAExpensesDO expenses = this.getExpenses(id);
|
||||||
|
List<BpmOAExpensesItemDO> expensesItems = this.getExpensesItem(id);
|
||||||
|
|
||||||
|
// 校验是否已添加至支付管理
|
||||||
|
if (financialPaymentService.getFinancialPaymentByProcessInstanceId(expenses.getProcessInstanceId()) == null) {
|
||||||
|
|
||||||
|
String reason = expensesItems.stream().map(BpmOAExpensesItemDO::getDetail)
|
||||||
|
.filter(StrUtil::isNotEmpty)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
|
||||||
|
BpmProcessInstanceExtDO processInstance = processInstanceService.getProcessInstanceDO(expenses.getProcessInstanceId());
|
||||||
|
// -- 插入到财务支付表中
|
||||||
|
CommonResult<AdminUserRespDTO> user = userApi.getUser(expenses.getUserId());
|
||||||
|
|
||||||
|
// 获取收款人信息
|
||||||
|
BankRespDTO bankRespDTO = bankApi.getBank(expenses.getBankId()).getCheckedData();
|
||||||
|
|
||||||
|
// 获取付款公司信息
|
||||||
|
FactoryInfoDTO dto = new FactoryInfoDTO();
|
||||||
|
if (expenses.getFactoryType() == 1) {
|
||||||
|
dto = factoryInfoApi.getFactoryInfo(expensesItems.get(0).getDeptId()).getCheckedData();
|
||||||
|
}
|
||||||
|
|
||||||
|
financialPaymentService.save(new FinancialPaymentDO()
|
||||||
|
.setUserId(expenses.getUserId())
|
||||||
|
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
||||||
|
.setProcessInstanceId(expenses.getProcessInstanceId())
|
||||||
|
.setReason(reason)
|
||||||
|
.setObjectId(id)
|
||||||
|
.setType(9)
|
||||||
|
.setStatus(0)
|
||||||
|
.setAmountPayable(expenses.getTotalMoney())
|
||||||
|
.setProcessInstanceName(processInstance.getName())
|
||||||
|
.setBeginTime(processInstance.getCreateTime())
|
||||||
|
.setEndTime(processInstance.getEndTime())
|
||||||
|
.setRecipientName(bankRespDTO.getNickname())
|
||||||
|
.setCompanyFactoryId(dto.getId())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateExpenses(Long id ,Integer status, BigDecimal amountPaid) {
|
||||||
|
|
||||||
|
expensesMapper.updateById(new BpmOAExpensesDO()
|
||||||
|
.setId(id)
|
||||||
|
.setStatus(status)
|
||||||
|
.setAmountPaid(amountPaid));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void refused(Long id, String processInstanceId) {
|
||||||
|
|
||||||
|
// 设置状态为 驳回
|
||||||
|
expensesMapper.updateById(new BpmOAExpensesDO()
|
||||||
|
.setId(id)
|
||||||
|
.setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||||
|
|
||||||
|
// 同步更新流程实例表
|
||||||
|
processInstanceService.updateProcessInstanceResult(processInstanceId, BpmProcessInstanceResultEnum.BACK.getResult());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,10 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
|||||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||||
|
import cn.iocoder.yudao.module.system.api.bank.BankApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@ -40,7 +44,7 @@ import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_IMPREST_NO
|
|||||||
public class BpmOAImprestServiceImpl extends BpmOABaseService implements BpmOAImprestService {
|
public class BpmOAImprestServiceImpl extends BpmOABaseService implements BpmOAImprestService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OA 出差对应的流程定义 KEY
|
* OA 备用金对应的流程定义 KEY
|
||||||
*/
|
*/
|
||||||
public static final String PROCESS_KEY = "oa_imprest";
|
public static final String PROCESS_KEY = "oa_imprest";
|
||||||
|
|
||||||
@ -49,14 +53,23 @@ public class BpmOAImprestServiceImpl extends BpmOABaseService implements BpmOAIm
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private BpmProcessInstanceApi processInstanceApi;
|
private BpmProcessInstanceApi processInstanceApi;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 解决循环依赖
|
@Lazy // 解决循环依赖
|
||||||
private BpmProcessInstanceService bpmProcessInstanceService;
|
private BpmProcessInstanceService bpmProcessInstanceService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FinancialPaymentService financialPaymentService;
|
private FinancialPaymentService financialPaymentService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AdminUserApi userApi;
|
private AdminUserApi userApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeptApi deptApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BankApi bankApi;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
||||||
|
|
||||||
@ -95,7 +108,7 @@ public class BpmOAImprestServiceImpl extends BpmOABaseService implements BpmOAIm
|
|||||||
@Override
|
@Override
|
||||||
public void updateImprestResult(String processInstanceId, Long id, Integer result) {
|
public void updateImprestResult(String processInstanceId, Long id, Integer result) {
|
||||||
|
|
||||||
validateLeaveExists(id);
|
BpmOAImprestDO imprestDO = validateLeaveExists(id);
|
||||||
imprestMapper.updateById(new BpmOAImprestDO().setId(id).setResult(result));
|
imprestMapper.updateById(new BpmOAImprestDO().setId(id).setResult(result));
|
||||||
|
|
||||||
//审核通过 (最后节点)
|
//审核通过 (最后节点)
|
||||||
@ -105,31 +118,44 @@ public class BpmOAImprestServiceImpl extends BpmOABaseService implements BpmOAIm
|
|||||||
|
|
||||||
if (instance.isEnded()) {
|
if (instance.isEnded()) {
|
||||||
//判断是否有采购报销
|
//判断是否有采购报销
|
||||||
BpmOAImprestDO cash = getImprest(id);
|
|
||||||
BpmProcessInstanceExtDO processInstance = bpmProcessInstanceService.getProcessInstanceDO(processInstanceId);
|
BpmProcessInstanceExtDO processInstance = bpmProcessInstanceService.getProcessInstanceDO(processInstanceId);
|
||||||
CommonResult<AdminUserRespDTO> user = userApi.getUser(cash.getUserId());
|
CommonResult<AdminUserRespDTO> user = userApi.getUser(imprestDO.getUserId());
|
||||||
|
|
||||||
|
// 从缓存中部门所属公司信息
|
||||||
|
DeptRespDTO deptRespDTO = deptApi.getDept(imprestDO.getCompanyId()).getCheckedData();
|
||||||
|
|
||||||
|
// 获取收款人信息
|
||||||
|
BankRespDTO bankRespDTO = new BankRespDTO();
|
||||||
|
if (imprestDO.getBankId() != null) {
|
||||||
|
bankRespDTO = bankApi.getBank(imprestDO.getBankId()).getCheckedData();
|
||||||
|
}
|
||||||
|
|
||||||
// -- 插入到财务支付表中
|
// -- 插入到财务支付表中
|
||||||
financialPaymentService.save(new FinancialPaymentDO()
|
financialPaymentService.save(new FinancialPaymentDO()
|
||||||
.setUserId(cash.getUserId())
|
.setUserId(imprestDO.getUserId())
|
||||||
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
||||||
.setProcessInstanceId(cash.getProcessInstanceId())
|
.setProcessInstanceId(imprestDO.getProcessInstanceId())
|
||||||
.setReason(cash.getReason())
|
.setReason(imprestDO.getReason())
|
||||||
.setObjectId(id)
|
.setObjectId(id)
|
||||||
.setType(2)
|
.setType(2)
|
||||||
.setStatus(0)
|
.setStatus(0)
|
||||||
.setAmountPayable(cash.getAmount())
|
.setAmountPayable(imprestDO.getAmount())
|
||||||
.setProcessInstanceName(processInstance.getName())
|
.setProcessInstanceName(processInstance.getName())
|
||||||
.setBeginTime(processInstance.getCreateTime())
|
.setBeginTime(processInstance.getCreateTime())
|
||||||
.setEndTime(processInstance.getEndTime())
|
.setEndTime(processInstance.getEndTime())
|
||||||
|
.setRecipientName(bankRespDTO.getNickname())
|
||||||
|
.setCompanyId(deptRespDTO != null ? deptRespDTO.getId() : null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateLeaveExists(Long id) {
|
private BpmOAImprestDO validateLeaveExists(Long id) {
|
||||||
if (imprestMapper.selectById(id) == null) {
|
BpmOAImprestDO imprestDO = imprestMapper.selectById(id);
|
||||||
|
if (imprestDO == null) {
|
||||||
throw exception(OA_IMPREST_NOT_EXISTS);
|
throw exception(OA_IMPREST_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
return imprestDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanCreateReqVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOAReturnVO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
@ -50,11 +53,11 @@ public interface BpmOALoanService {
|
|||||||
BpmOALoanDO getByProcessInstanceId(String processInstanceId);
|
BpmOALoanDO getByProcessInstanceId(String processInstanceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得指定用户的借支列表
|
* 获得指定用户的借支分页列表
|
||||||
* @param staffId 员工编号
|
* @param pageReqVO 分页参数
|
||||||
* @return 借支列表
|
* @return 借支列表
|
||||||
*/
|
*/
|
||||||
List<BpmOALoanDO> getListByStaffId(Long staffId);
|
PageResult<BpmOALoanDO> getListByStaffId(BpmOALoanPageReqVO pageReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取员工当月需抵扣的借支金额
|
* 获取员工当月需抵扣的借支金额
|
||||||
@ -62,4 +65,11 @@ public interface BpmOALoanService {
|
|||||||
* @return 借支金额统计
|
* @return 借支金额统计
|
||||||
*/
|
*/
|
||||||
List<BpmOALoanSumDTO> getListByStaffId(Collection<Long> staffId, String month);
|
List<BpmOALoanSumDTO> getListByStaffId(Collection<Long> staffId, String month);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取员工还款分页列表
|
||||||
|
* @param pageReqVO 分页信息
|
||||||
|
* @return 还款分页列表
|
||||||
|
*/
|
||||||
|
PageResult<BpmOAReturnVO> getReturnList(BpmOALoanPageReqVO pageReqVO);
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,16 @@ package cn.iocoder.yudao.module.bpm.service.oa;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
||||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanCreateReqVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOAReturnVO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
|
||||||
@ -16,8 +20,13 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
|||||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||||
|
import cn.iocoder.yudao.module.smartfactory.api.staff.StaffApi;
|
||||||
|
import cn.iocoder.yudao.module.smartfactory.api.staff.dto.StaffDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.api.bank.BankApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
import org.flowable.engine.runtime.ProcessInstance;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -30,6 +39,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_LOAN_NOT_CREATE;
|
||||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_LOAN_NOT_EXISTS;
|
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_LOAN_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,10 +71,26 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
|||||||
@Resource
|
@Resource
|
||||||
private FinancialPaymentService financialPaymentService;
|
private FinancialPaymentService financialPaymentService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StaffApi staffApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BankApi bankApi;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long createLoan(Long userId, BpmOALoanCreateReqVO vo) {
|
public Long createLoan(Long userId, BpmOALoanCreateReqVO vo) {
|
||||||
|
|
||||||
|
// 提交是费用借支时
|
||||||
|
if (vo.getLoanType() == 2) {
|
||||||
|
|
||||||
|
// 校验创建
|
||||||
|
StaffDTO staffDTO = validateCreate(userId, vo);
|
||||||
|
vo.setSfUserId(staffDTO.getId());
|
||||||
|
vo.setFactoryId(staffDTO.getFactoryId());
|
||||||
|
}
|
||||||
|
|
||||||
//插入OA 借支申请
|
//插入OA 借支申请
|
||||||
BpmOALoanDO loan = BeanUtils.toBean(vo, BpmOALoanDO.class)
|
BpmOALoanDO loan = BeanUtils.toBean(vo, BpmOALoanDO.class)
|
||||||
.setUserId(userId)
|
.setUserId(userId)
|
||||||
@ -92,9 +118,19 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
|||||||
return loan.getId();
|
return loan.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private StaffDTO validateCreate(Long userId, BpmOALoanCreateReqVO vo) {
|
||||||
|
|
||||||
|
StaffDTO staffDTO = staffApi.getStaffByUserId(userId).getCheckedData();
|
||||||
|
if (staffDTO == null) {
|
||||||
|
throw exception(OA_LOAN_NOT_CREATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return staffDTO;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLoanResult(String processInstanceId, Long id, Integer result) {
|
public void updateLoanResult(String processInstanceId, Long id, Integer result) {
|
||||||
BpmOALoanDO loanDO = validateLeaveExists(id);
|
BpmOALoanDO loanDO = validateLoanExists(id);
|
||||||
loanMapper.updateById(new BpmOALoanDO().setId(id).setResult(result));
|
loanMapper.updateById(new BpmOALoanDO().setId(id).setResult(result));
|
||||||
|
|
||||||
//审核通过 (最后节点)
|
//审核通过 (最后节点)
|
||||||
@ -106,6 +142,10 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
|||||||
BpmProcessInstanceExtDO processInstance = processInstanceService.getProcessInstanceDO(processInstanceId);
|
BpmProcessInstanceExtDO processInstance = processInstanceService.getProcessInstanceDO(processInstanceId);
|
||||||
// -- 插入到财务支付表中
|
// -- 插入到财务支付表中
|
||||||
CommonResult<AdminUserRespDTO> user = userApi.getUser(loanDO.getUserId());
|
CommonResult<AdminUserRespDTO> user = userApi.getUser(loanDO.getUserId());
|
||||||
|
|
||||||
|
// 获取收款人信息
|
||||||
|
BankRespDTO bankRespDTO = bankApi.getBank(loanDO.getBankId()).getCheckedData();
|
||||||
|
|
||||||
financialPaymentService.save(new FinancialPaymentDO()
|
financialPaymentService.save(new FinancialPaymentDO()
|
||||||
.setUserId(loanDO.getUserId())
|
.setUserId(loanDO.getUserId())
|
||||||
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
||||||
@ -118,12 +158,13 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
|||||||
.setProcessInstanceName(processInstance.getName())
|
.setProcessInstanceName(processInstance.getName())
|
||||||
.setBeginTime(processInstance.getCreateTime())
|
.setBeginTime(processInstance.getCreateTime())
|
||||||
.setEndTime(processInstance.getEndTime())
|
.setEndTime(processInstance.getEndTime())
|
||||||
|
.setRecipientName(bankRespDTO.getNickname())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BpmOALoanDO validateLeaveExists(Long id) {
|
private BpmOALoanDO validateLoanExists(Long id) {
|
||||||
BpmOALoanDO loanDO = loanMapper.selectById(id);
|
BpmOALoanDO loanDO = loanMapper.selectById(id);
|
||||||
if (loanDO == null) {
|
if (loanDO == null) {
|
||||||
throw exception(OA_LOAN_NOT_EXISTS);
|
throw exception(OA_LOAN_NOT_EXISTS);
|
||||||
@ -148,9 +189,10 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BpmOALoanDO> getListByStaffId(Long staffId) {
|
public PageResult<BpmOALoanDO> getListByStaffId(BpmOALoanPageReqVO pageReqVO) {
|
||||||
return loanMapper.selectList(new LambdaQueryWrapperX<BpmOALoanDO>()
|
return loanMapper.selectPage(pageReqVO, new LambdaQueryWrapperX<BpmOALoanDO>()
|
||||||
.eq(BpmOALoanDO::getSfUserId, staffId)
|
.eq(BpmOALoanDO::getSfUserId, pageReqVO.getStaffId())
|
||||||
|
.eq(BpmOALoanDO::getLoanType, pageReqVO.getLoanType())
|
||||||
.eq(BpmOALoanDO::getResult, BpmProcessInstanceResultEnum.APPROVE.getResult()));
|
.eq(BpmOALoanDO::getResult, BpmProcessInstanceResultEnum.APPROVE.getResult()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,4 +200,10 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
|||||||
public List<BpmOALoanSumDTO> getListByStaffId(Collection<Long> staffId, String month) {
|
public List<BpmOALoanSumDTO> getListByStaffId(Collection<Long> staffId, String month) {
|
||||||
return loanMapper.selectSumByStaffId(staffId, month);
|
return loanMapper.selectSumByStaffId(staffId, month);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<BpmOAReturnVO> getReturnList(BpmOALoanPageReqVO pageReqVO) {
|
||||||
|
IPage<BpmOAReturnVO> page = loanMapper.selectReturnList(pageReqVO, MyBatisUtils.buildPage(pageReqVO));
|
||||||
|
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,16 @@ public class BpmOAPaymentServiceImpl extends BpmOABaseService implements BpmOAPa
|
|||||||
BpmProcessInstanceExtDO processInstance = processInstanceService.getProcessInstanceDO(processInstanceId);
|
BpmProcessInstanceExtDO processInstance = processInstanceService.getProcessInstanceDO(processInstanceId);
|
||||||
// -- 插入到财务支付表中
|
// -- 插入到财务支付表中
|
||||||
CommonResult<AdminUserRespDTO> user = userApi.getUser(paymentDO.getUserId());
|
CommonResult<AdminUserRespDTO> user = userApi.getUser(paymentDO.getUserId());
|
||||||
|
|
||||||
|
// 从缓存中部门所属公司信息
|
||||||
|
DeptRespDTO deptRespDTO = deptApi.getDept(paymentDO.getPaymentCompany()).getCheckedData();
|
||||||
|
|
||||||
|
// 获取收款人信息
|
||||||
|
BankRespDTO bankRespDTO = new BankRespDTO();
|
||||||
|
if (paymentDO.getBankId() != null) {
|
||||||
|
bankRespDTO = bankApi.getBank(paymentDO.getBankId()).getCheckedData();
|
||||||
|
}
|
||||||
|
|
||||||
financialPaymentService.save(new FinancialPaymentDO()
|
financialPaymentService.save(new FinancialPaymentDO()
|
||||||
.setUserId(paymentDO.getUserId())
|
.setUserId(paymentDO.getUserId())
|
||||||
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
||||||
@ -137,6 +147,8 @@ public class BpmOAPaymentServiceImpl extends BpmOABaseService implements BpmOAPa
|
|||||||
.setProcessInstanceName(processInstance.getName())
|
.setProcessInstanceName(processInstance.getName())
|
||||||
.setBeginTime(processInstance.getCreateTime())
|
.setBeginTime(processInstance.getCreateTime())
|
||||||
.setEndTime(processInstance.getEndTime())
|
.setEndTime(processInstance.getEndTime())
|
||||||
|
.setRecipientName(bankRespDTO.getNickname())
|
||||||
|
.setCompanyId(deptRespDTO != null ? deptRespDTO.getId() : null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
|||||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||||
|
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
@ -181,12 +182,6 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
|||||||
|
|
||||||
//判断是否有采购报销
|
//判断是否有采购报销
|
||||||
List<Long> procureIds = new ArrayList<>();
|
List<Long> procureIds = new ArrayList<>();
|
||||||
// List<Reimbursement> reimbursements = bpmOAReimbursementDO.getReimbursements();
|
|
||||||
//
|
|
||||||
// //直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
|
|
||||||
// //将list再次转为json串,然后由json串再转为list
|
|
||||||
// String json = JsonUtils.toJsonString(reimbursements);
|
|
||||||
// reimbursements = JsonUtils.parseArray(json, Reimbursement.class);
|
|
||||||
for (BpmOAReimbursementItemDO reimbursement : reimbursements) {
|
for (BpmOAReimbursementItemDO reimbursement : reimbursements) {
|
||||||
//报销类别为 采购费时
|
//报销类别为 采购费时
|
||||||
if ("4".equals(reimbursement.getType())) {
|
if ("4".equals(reimbursement.getType())) {
|
||||||
@ -238,6 +233,10 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
|||||||
BpmProcessInstanceExtDO processInstance = bpmProcessInstanceService.getProcessInstanceDO(processInstanceId);
|
BpmProcessInstanceExtDO processInstance = bpmProcessInstanceService.getProcessInstanceDO(processInstanceId);
|
||||||
// -- 插入到财务支付表中
|
// -- 插入到财务支付表中
|
||||||
CommonResult<AdminUserRespDTO> user = userApi.getUser(bpmOAReimbursementDO.getUserId());
|
CommonResult<AdminUserRespDTO> user = userApi.getUser(bpmOAReimbursementDO.getUserId());
|
||||||
|
|
||||||
|
// 从缓存中部门所属公司信息
|
||||||
|
DeptRespDTO deptRespDTO = deptApi.getCompanyByDept(reimbursements.get(0).getDeptId()).getCheckedData();
|
||||||
|
|
||||||
financialPaymentService.save(new FinancialPaymentDO()
|
financialPaymentService.save(new FinancialPaymentDO()
|
||||||
.setUserId(bpmOAReimbursementDO.getUserId())
|
.setUserId(bpmOAReimbursementDO.getUserId())
|
||||||
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
||||||
@ -250,6 +249,8 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
|||||||
.setProcessInstanceName(processInstance.getName())
|
.setProcessInstanceName(processInstance.getName())
|
||||||
.setBeginTime(processInstance.getCreateTime())
|
.setBeginTime(processInstance.getCreateTime())
|
||||||
.setEndTime(processInstance.getEndTime())
|
.setEndTime(processInstance.getEndTime())
|
||||||
|
.setRecipientName(bpmOAReimbursementDO.getNickname())
|
||||||
|
.setCompanyId(deptRespDTO != null ? deptRespDTO.getId() : null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
|||||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||||
|
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
@ -110,6 +111,10 @@ public class BpmOASalaryServiceImpl extends BpmOABaseService implements BpmOASal
|
|||||||
BpmProcessInstanceExtDO processInstance = processInstanceService.getProcessInstanceDO(processInstanceId);
|
BpmProcessInstanceExtDO processInstance = processInstanceService.getProcessInstanceDO(processInstanceId);
|
||||||
// -- 插入到财务支付表中
|
// -- 插入到财务支付表中
|
||||||
CommonResult<AdminUserRespDTO> user = userApi.getUser(salaryDO.getUserId());
|
CommonResult<AdminUserRespDTO> user = userApi.getUser(salaryDO.getUserId());
|
||||||
|
|
||||||
|
// 从缓存中部门所属公司信息
|
||||||
|
DeptRespDTO deptRespDTO = deptApi.getDept(salaryDO.getCompanyDeptId()).getCheckedData();
|
||||||
|
|
||||||
financialPaymentService.save(new FinancialPaymentDO()
|
financialPaymentService.save(new FinancialPaymentDO()
|
||||||
.setUserId(salaryDO.getUserId())
|
.setUserId(salaryDO.getUserId())
|
||||||
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
||||||
@ -122,6 +127,7 @@ public class BpmOASalaryServiceImpl extends BpmOABaseService implements BpmOASal
|
|||||||
.setProcessInstanceName(processInstance.getName())
|
.setProcessInstanceName(processInstance.getName())
|
||||||
.setBeginTime(processInstance.getCreateTime())
|
.setBeginTime(processInstance.getCreateTime())
|
||||||
.setEndTime(processInstance.getEndTime())
|
.setEndTime(processInstance.getEndTime())
|
||||||
|
.setCompanyId(deptRespDTO != null && deptRespDTO.getFactoryId() == null ? deptRespDTO.getId() : null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,14 @@ public interface BpmProcessInstanceService {
|
|||||||
*/
|
*/
|
||||||
void updateProcessInstanceExtReject(String id, String reason);
|
void updateProcessInstanceExtReject(String id, String reason);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新 ProcessInstance 拓展记录结果
|
||||||
|
*
|
||||||
|
* @param id 流程编号
|
||||||
|
* @param result 结果
|
||||||
|
*/
|
||||||
|
void updateProcessInstanceResult(String id, Integer result);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* /**
|
* /**
|
||||||
* 流程实例数量统计查询
|
* 流程实例数量统计查询
|
||||||
|
File diff suppressed because one or more lines are too long
@ -15,11 +15,14 @@
|
|||||||
a.*,
|
a.*,
|
||||||
b.nickname as nickname,
|
b.nickname as nickname,
|
||||||
c.name as deptName,
|
c.name as deptName,
|
||||||
d.nickname as receiveUserNickName
|
d.nickname as receiveUserNickName,
|
||||||
|
case when ISNULL(a.company_id) THEN sf.short_name ELSE company.short_name END as companyName
|
||||||
from bpm_financial_payment as a
|
from bpm_financial_payment as a
|
||||||
left join system_users as b on a.user_id = b.id
|
left join system_users as b on a.user_id = b.id
|
||||||
left join system_dept as c on b.dept_id = c.id
|
left join system_dept as c on b.dept_id = c.id
|
||||||
left join system_users as d on a.receive_user_id = d.id
|
left join system_users as d on a.receive_user_id = d.id
|
||||||
|
left join system_dept as company on company.id = a.company_id
|
||||||
|
left join sf_factory_info as sf on sf.id = a.company_factory_id
|
||||||
<where>
|
<where>
|
||||||
a.deleted = 0
|
a.deleted = 0
|
||||||
<if test="vo.deptIds != null and vo.deptIds.size() > 0">
|
<if test="vo.deptIds != null and vo.deptIds.size() > 0">
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
ub.bank_name AS bankName,
|
ub.bank_name AS bankName,
|
||||||
b.total_money AS totalMoney,
|
b.total_money AS totalMoney,
|
||||||
b.process_instance_id AS processInstanceId,
|
b.process_instance_id AS processInstanceId,
|
||||||
c.end_time AS endTime
|
c.end_time AS endTime,
|
||||||
|
b.status AS status
|
||||||
FROM bpm_oa_expenses b
|
FROM bpm_oa_expenses b
|
||||||
JOIN bpm_oa_expenses_item a ON a.expenses_id = b.id
|
JOIN bpm_oa_expenses_item a ON a.expenses_id = b.id
|
||||||
JOIN bpm_process_instance_ext c ON c.process_instance_id = b.process_instance_id
|
JOIN bpm_process_instance_ext c ON c.process_instance_id = b.process_instance_id
|
||||||
@ -62,8 +63,9 @@
|
|||||||
|
|
||||||
<select id="selectTotal" resultType="cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesTotal">
|
<select id="selectTotal" resultType="cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesTotal">
|
||||||
SELECT
|
SELECT
|
||||||
|
SUM(a.total_money) AS payableAmount,
|
||||||
SUM(a.amount_paid) AS amountPaid,
|
SUM(a.amount_paid) AS amountPaid,
|
||||||
SUM(a.total_money) - SUM(a.amount_paid) AS payableAmount
|
SUM(a.total_money) - SUM(a.amount_paid) AS remainingPayable
|
||||||
FROM
|
FROM
|
||||||
bpm_oa_expenses a
|
bpm_oa_expenses a
|
||||||
JOIN bpm_oa_expenses_item b ON b.expenses_id = b.id
|
JOIN bpm_oa_expenses_item b ON b.expenses_id = b.id
|
||||||
|
@ -19,11 +19,58 @@
|
|||||||
deleted = 0
|
deleted = 0
|
||||||
AND result = 2
|
AND result = 2
|
||||||
AND return_date = #{month}
|
AND return_date = #{month}
|
||||||
sf_user_id IN
|
AND sf_user_id IN
|
||||||
<foreach item="item" index="index" collection="staffId" open="(" separator="," close=")">
|
<foreach item="item" index="index" collection="staffId" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
sf_user_id
|
sf_user_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectReturnList" resultType="cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOAReturnVO">
|
||||||
|
<if test="pageReqVO.loanType == 1">
|
||||||
|
SELECT
|
||||||
|
s.staff_id AS staffId,
|
||||||
|
CONVERT(st.nick_name USING utf8mb4) COLLATE utf8mb4_unicode_ci AS staffName,
|
||||||
|
s.factory_id AS factoryId,
|
||||||
|
sf.short_name AS factoryName,
|
||||||
|
s.month AS month,
|
||||||
|
s.return_amount AS repaymentAmount,
|
||||||
|
2 AS type
|
||||||
|
FROM
|
||||||
|
sf_staff_salary s
|
||||||
|
LEFT JOIN sf_staff st ON s.staff_id = st.id
|
||||||
|
LEFT JOIN sf_factory_info sf ON s.factory_id = sf.id
|
||||||
|
WHERE
|
||||||
|
s.staff_id = #{pageReqVO.staffId}
|
||||||
|
AND s.return_amount > 0
|
||||||
|
AND s.deleted = 0
|
||||||
|
AND st.deleted = 0
|
||||||
|
AND sf.deleted = 0
|
||||||
|
</if>
|
||||||
|
<if test="pageReqVO.loanType == 2">
|
||||||
|
SELECT
|
||||||
|
e.user_id AS staffId,
|
||||||
|
u.nickname AS staffName,
|
||||||
|
d.factory_id AS factoryId,
|
||||||
|
d.name AS factoryName,
|
||||||
|
DATE_FORMAT( p.end_time, '%Y-%m' ) AS month,
|
||||||
|
e.amount_paid AS repaymentAmount,
|
||||||
|
1 AS type
|
||||||
|
FROM
|
||||||
|
bpm_oa_expenses e
|
||||||
|
JOIN bpm_oa_loan l ON e.user_id = l.user_id AND l.sf_user_id = #{pageReqVO.staffId}
|
||||||
|
LEFT JOIN system_users u ON e.user_id = u.id
|
||||||
|
LEFT JOIN system_dept d ON u.dept_id = d.id
|
||||||
|
LEFT JOIN bpm_process_instance_ext p ON e.process_instance_id = p.process_instance_id
|
||||||
|
WHERE
|
||||||
|
e.deleted = 0
|
||||||
|
AND e.result = 2
|
||||||
|
AND e.status = 2
|
||||||
|
AND l.deleted = 0
|
||||||
|
AND u.deleted = 0
|
||||||
|
AND d.deleted = 0
|
||||||
|
AND p.deleted = 0
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -62,21 +62,24 @@
|
|||||||
<select id="getReceiptSettlement"
|
<select id="getReceiptSettlement"
|
||||||
resultType="cn.iocoder.yudao.module.bpm.api.oa.vo.receipt.ReceiptSettlementDTO">
|
resultType="cn.iocoder.yudao.module.bpm.api.oa.vo.receipt.ReceiptSettlementDTO">
|
||||||
SELECT
|
SELECT
|
||||||
user_id AS userId,
|
a.user_id AS userId,
|
||||||
SUM(money) AS money
|
SUM( a.money ) AS money,
|
||||||
|
SUM( CASE WHEN b.is_channel = 1 THEN a.money ELSE 0 END ) AS channelAmount
|
||||||
FROM
|
FROM
|
||||||
bpm_oa_receipt
|
bpm_oa_receipt a
|
||||||
|
INNER JOIN bpm_oa_contract c on a.contract_id = c.id
|
||||||
|
INNER JOIN crm_business b on b.id = c.business_id
|
||||||
WHERE
|
WHERE
|
||||||
deleted = 0
|
deleted = 0
|
||||||
AND result = 2
|
AND result = 2
|
||||||
<if test="vo.createTime != null and vo.createTime.length > 0">
|
<if test="vo.createTime != null and vo.createTime.length > 0">
|
||||||
<if test="vo.createTime[0] != null">
|
<if test="vo.createTime[0] != null">
|
||||||
and create_time >= #{vo.createTime[0]}
|
and create_time >= #{vo.createTime[0]}
|
||||||
|
</if>
|
||||||
|
<if test="vo.createTime[1] != null">
|
||||||
|
and create_time <= #{vo.createTime[1]}
|
||||||
|
</if>
|
||||||
</if>
|
</if>
|
||||||
<if test="vo.createTime[1] != null">
|
|
||||||
and create_time <= #{vo.createTime[1]}
|
|
||||||
</if>
|
|
||||||
</if>
|
|
||||||
GROUP BY user_id
|
GROUP BY user_id
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -22,6 +22,9 @@ public class CrmContractProductSettlementDTO {
|
|||||||
@Schema(description = "数量")
|
@Schema(description = "数量")
|
||||||
private Integer nums;
|
private Integer nums;
|
||||||
|
|
||||||
|
@Schema(description = "渠道商转介数量")
|
||||||
|
private Integer channelNums;
|
||||||
|
|
||||||
@Schema(description = "折扣")
|
@Schema(description = "折扣")
|
||||||
private BigDecimal discount;
|
private BigDecimal discount;
|
||||||
|
|
||||||
|
@ -76,4 +76,15 @@ public class CrmBusinessRespVO {
|
|||||||
@Schema(description = "负责人")
|
@Schema(description = "负责人")
|
||||||
private String ownUserName;
|
private String ownUserName;
|
||||||
|
|
||||||
|
@Schema(description = "是否渠道商转介 | 0否 1是")
|
||||||
|
private Integer isChannel;
|
||||||
|
|
||||||
|
@Schema(description = "渠道商名称")
|
||||||
|
private String channelName;
|
||||||
|
|
||||||
|
@Schema(description = "渠道商联系方式")
|
||||||
|
private String channelPhone;
|
||||||
|
|
||||||
|
@Schema(description = "渠道商银行卡号")
|
||||||
|
private String channelBankNo;
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,19 @@ public class CrmBusinessSaveReqVO {
|
|||||||
@Schema(description = "负责人ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24317")
|
@Schema(description = "负责人ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24317")
|
||||||
private Long ownerUserId;
|
private Long ownerUserId;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "商机产品关联列表")
|
@Schema(description = "商机产品关联列表")
|
||||||
private List<CrmBusinessProductDO> businessProducts;
|
private List<CrmBusinessProductDO> businessProducts;
|
||||||
|
|
||||||
|
@Schema(description = "是否渠道商转介 | 0否 1是")
|
||||||
|
private Integer isChannel;
|
||||||
|
|
||||||
|
@Schema(description = "渠道商名称")
|
||||||
|
private String channelName;
|
||||||
|
|
||||||
|
@Schema(description = "渠道商联系方式")
|
||||||
|
private String channelPhone;
|
||||||
|
|
||||||
|
@Schema(description = "渠道商银行卡号")
|
||||||
|
private String channelBankNo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,15 @@ public class SalesPerformanceSettlementRespVO {
|
|||||||
@Schema(description = "实际回款额")
|
@Schema(description = "实际回款额")
|
||||||
private BigDecimal actualPayment;
|
private BigDecimal actualPayment;
|
||||||
|
|
||||||
|
@Schema(description = "渠道回款额")
|
||||||
|
private BigDecimal channelPayment;
|
||||||
|
|
||||||
@Schema(description = "实际销售额")
|
@Schema(description = "实际销售额")
|
||||||
private Integer actualSale;
|
private Integer actualSale;
|
||||||
|
|
||||||
|
@Schema(description = "渠道销售额")
|
||||||
|
private Integer channelSale;
|
||||||
|
|
||||||
@Schema(description = "回款目标")
|
@Schema(description = "回款目标")
|
||||||
private BigDecimal paymentTarget;
|
private BigDecimal paymentTarget;
|
||||||
|
|
||||||
|
@ -32,9 +32,15 @@ public class SalesPerformanceSettlementSaveReqVO {
|
|||||||
@Schema(description = "实际回款额")
|
@Schema(description = "实际回款额")
|
||||||
private BigDecimal actualPayment;
|
private BigDecimal actualPayment;
|
||||||
|
|
||||||
|
@Schema(description = "渠道回款额")
|
||||||
|
private BigDecimal channelPayment;
|
||||||
|
|
||||||
@Schema(description = "实际销售额")
|
@Schema(description = "实际销售额")
|
||||||
private Integer actualSale;
|
private Integer actualSale;
|
||||||
|
|
||||||
|
@Schema(description = "渠道销售额")
|
||||||
|
private Integer channelSale;
|
||||||
|
|
||||||
@Schema(description = "评分")
|
@Schema(description = "评分")
|
||||||
private BigDecimal score;
|
private BigDecimal score;
|
||||||
|
|
||||||
|
@ -77,6 +77,20 @@ public class CrmBusinessDO extends BaseDO {
|
|||||||
* 负责人ID
|
* 负责人ID
|
||||||
*/
|
*/
|
||||||
private Long ownerUserId;
|
private Long ownerUserId;
|
||||||
|
/**
|
||||||
|
* 是否渠道商转介 | 0否 1是
|
||||||
|
*/
|
||||||
|
private Integer isChannel;
|
||||||
|
/**
|
||||||
|
* 渠道商名称
|
||||||
|
*/
|
||||||
|
private String channelName;
|
||||||
|
/**
|
||||||
|
* 渠道商电话
|
||||||
|
*/
|
||||||
|
private String channelPhone;
|
||||||
|
/**
|
||||||
|
* 渠道商银行账号
|
||||||
|
*/
|
||||||
|
private String channelBankNo;
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,18 @@ public class SalesPerformanceSettlementDO extends BaseDO {
|
|||||||
* 实际回款额
|
* 实际回款额
|
||||||
*/
|
*/
|
||||||
private BigDecimal actualPayment;
|
private BigDecimal actualPayment;
|
||||||
|
/**
|
||||||
|
* 渠道商回款额
|
||||||
|
*/
|
||||||
|
private BigDecimal channelPayment;
|
||||||
/**
|
/**
|
||||||
* 实际销售额
|
* 实际销售额
|
||||||
*/
|
*/
|
||||||
private Integer actualSale;
|
private Integer actualSale;
|
||||||
|
/**
|
||||||
|
* 渠道商销售额
|
||||||
|
*/
|
||||||
|
private Integer channelSale;
|
||||||
/**
|
/**
|
||||||
* 评分
|
* 评分
|
||||||
*/
|
*/
|
||||||
|
@ -55,6 +55,7 @@ import java.util.function.Function;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
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.hrm.enums.ErrorCodeConstants.NOT_EDITABLE_UNTIL_SALES_TARGET_HAS_BEEN_APPLIED;
|
import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.NOT_EDITABLE_UNTIL_SALES_TARGET_HAS_BEEN_APPLIED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -219,6 +220,10 @@ public class SalesPerformanceSettlementServiceImpl extends ServiceImpl<SalesPerf
|
|||||||
//根据用户id分组 并且合并数量
|
//根据用户id分组 并且合并数量
|
||||||
Map<Long, Integer> productMap = contractProductSettlementDTOList.stream().collect(Collectors.groupingBy(CrmContractProductSettlementDTO::getUserId,
|
Map<Long, Integer> productMap = contractProductSettlementDTOList.stream().collect(Collectors.groupingBy(CrmContractProductSettlementDTO::getUserId,
|
||||||
Collectors.summingInt(CrmContractProductSettlementDTO::getNums)));
|
Collectors.summingInt(CrmContractProductSettlementDTO::getNums)));
|
||||||
|
//根据用户id分组 并且合并渠道商转介数量
|
||||||
|
Map<Long, Integer> channelMap = contractProductSettlementDTOList.stream().collect(Collectors.groupingBy(CrmContractProductSettlementDTO::getUserId,
|
||||||
|
Collectors.summingInt(CrmContractProductSettlementDTO::getChannelNums)));
|
||||||
|
|
||||||
// -- 回款申请 / - 回了多少就是多少咯 - 这个没啥业务判断当前月回了多少款即可
|
// -- 回款申请 / - 回了多少就是多少咯 - 这个没啥业务判断当前月回了多少款即可
|
||||||
LocalDateTime beginTime = LocalDateTimeUtils.beginOfMonth(now);
|
LocalDateTime beginTime = LocalDateTimeUtils.beginOfMonth(now);
|
||||||
LocalDateTime endTime = LocalDateTimeUtils.endOfMonth(now);
|
LocalDateTime endTime = LocalDateTimeUtils.endOfMonth(now);
|
||||||
@ -227,8 +232,8 @@ public class SalesPerformanceSettlementServiceImpl extends ServiceImpl<SalesPerf
|
|||||||
receiptSettlementVO.setCreateTime(times);
|
receiptSettlementVO.setCreateTime(times);
|
||||||
List<ReceiptSettlementDTO> receiptSettlementList = receiptApi.getReceiptSettlement(receiptSettlementVO).getCheckedData();
|
List<ReceiptSettlementDTO> receiptSettlementList = receiptApi.getReceiptSettlement(receiptSettlementVO).getCheckedData();
|
||||||
receiptSettlementList = CollUtil.isEmpty(receiptSettlementList) ? Collections.emptyList() : receiptSettlementList;
|
receiptSettlementList = CollUtil.isEmpty(receiptSettlementList) ? Collections.emptyList() : receiptSettlementList;
|
||||||
Map<Long, BigDecimal> receiptSettlementMap = receiptSettlementList.stream()
|
Map<Long, ReceiptSettlementDTO> receiptSettlementMap = convertMap(receiptSettlementList, ReceiptSettlementDTO::getUserId);
|
||||||
.collect(Collectors.toMap(ReceiptSettlementDTO::getUserId, ReceiptSettlementDTO::getMoney));
|
|
||||||
List<SalesPerformanceSettlementDO> salesPerformanceSettlementDOS = salesPerformanceSettlementMapper.selectList(new LambdaQueryWrapperX<SalesPerformanceSettlementDO>()
|
List<SalesPerformanceSettlementDO> salesPerformanceSettlementDOS = salesPerformanceSettlementMapper.selectList(new LambdaQueryWrapperX<SalesPerformanceSettlementDO>()
|
||||||
.eq(SalesPerformanceSettlementDO::getYear, year)
|
.eq(SalesPerformanceSettlementDO::getYear, year)
|
||||||
.eq(SalesPerformanceSettlementDO::getMonth, month));
|
.eq(SalesPerformanceSettlementDO::getMonth, month));
|
||||||
@ -244,6 +249,7 @@ public class SalesPerformanceSettlementServiceImpl extends ServiceImpl<SalesPerf
|
|||||||
//获取绩效考核设置
|
//获取绩效考核设置
|
||||||
for (UserLiveTreeListVO vo : userLiveList) {
|
for (UserLiveTreeListVO vo : userLiveList) {
|
||||||
SalesPerformanceSettlementDO salesPerformanceSettlementDO = map.get(vo.getUserId());
|
SalesPerformanceSettlementDO salesPerformanceSettlementDO = map.get(vo.getUserId());
|
||||||
|
ReceiptSettlementDTO receiptSettlementDTO = receiptSettlementMap.get(vo.getUserId());
|
||||||
if (salesPerformanceSettlementDO == null) {
|
if (salesPerformanceSettlementDO == null) {
|
||||||
salesPerformanceSettlementDO = new SalesPerformanceSettlementDO();
|
salesPerformanceSettlementDO = new SalesPerformanceSettlementDO();
|
||||||
}
|
}
|
||||||
@ -251,7 +257,9 @@ public class SalesPerformanceSettlementServiceImpl extends ServiceImpl<SalesPerf
|
|||||||
salesPerformanceSettlementDO.setYear(String.valueOf(now.getYear()));
|
salesPerformanceSettlementDO.setYear(String.valueOf(now.getYear()));
|
||||||
salesPerformanceSettlementDO.setMonth(String.format("%02d", now.getMonthValue()));
|
salesPerformanceSettlementDO.setMonth(String.format("%02d", now.getMonthValue()));
|
||||||
salesPerformanceSettlementDO.setActualSale(productMap.getOrDefault(vo.getUserId(), 0));
|
salesPerformanceSettlementDO.setActualSale(productMap.getOrDefault(vo.getUserId(), 0));
|
||||||
salesPerformanceSettlementDO.setActualPayment(receiptSettlementMap.getOrDefault(vo.getUserId(), BigDecimal.ZERO));
|
salesPerformanceSettlementDO.setChannelSale(channelMap.getOrDefault(vo.getUserId(), 0));
|
||||||
|
salesPerformanceSettlementDO.setActualPayment(receiptSettlementDTO != null ? receiptSettlementDTO.getMoney() : BigDecimal.ZERO);
|
||||||
|
salesPerformanceSettlementDO.setChannelPayment(receiptSettlementDTO != null ? receiptSettlementDTO.getChannelAmount() : BigDecimal.ZERO);
|
||||||
SalesPerformanceDTO salesPerformanceDTO = salesPerformanceMap.get(vo.getUserId());
|
SalesPerformanceDTO salesPerformanceDTO = salesPerformanceMap.get(vo.getUserId());
|
||||||
if (salesPerformanceDTO == null) {
|
if (salesPerformanceDTO == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -130,11 +130,13 @@
|
|||||||
a.product_id AS productId,
|
a.product_id AS productId,
|
||||||
a.price AS price,
|
a.price AS price,
|
||||||
a.nums AS nums,
|
a.nums AS nums,
|
||||||
|
CASE WHEN bu.is_channel = 1 THEN a.nums ELSE 0 END AS channelNums,
|
||||||
a.discount AS discount,
|
a.discount AS discount,
|
||||||
a.subtotal AS subtotal
|
a.subtotal AS subtotal
|
||||||
FROM
|
FROM
|
||||||
crm_contract_product AS a
|
crm_contract_product AS a
|
||||||
LEFT JOIN bpm_oa_contract AS b ON a.contract_id = b.id
|
LEFT JOIN bpm_oa_contract AS b ON a.contract_id = b.id
|
||||||
|
LEFT JOIN crm_business bu ON bu.id = b.business_id
|
||||||
WHERE
|
WHERE
|
||||||
a.deleted = 0
|
a.deleted = 0
|
||||||
and b.deleted = 0
|
and b.deleted = 0
|
||||||
|
@ -113,4 +113,9 @@ public interface DeptApi {
|
|||||||
@Operation(summary = "获取指定类型的部门列表")
|
@Operation(summary = "获取指定类型的部门列表")
|
||||||
@Parameter(name = "type", description = "部门类型", required = true)
|
@Parameter(name = "type", description = "部门类型", required = true)
|
||||||
CommonResult<List<DeptRespDTO>> getDeptListByType(@RequestParam("type") String type);
|
CommonResult<List<DeptRespDTO>> getDeptListByType(@RequestParam("type") String type);
|
||||||
|
|
||||||
|
@GetMapping("/getCompanyByDept")
|
||||||
|
@Operation(summary = "获取指定类型的部门列表")
|
||||||
|
@Parameter(name = "deptId", description = "部门编号", required = true)
|
||||||
|
CommonResult<DeptRespDTO> getCompanyByDept(@RequestParam("deptId") Long deptId);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
@Tag(name = "RPC 服务 - 假期")
|
@Tag(name = "RPC 服务 - 假期")
|
||||||
public interface LoanApi {
|
public interface LoanApi {
|
||||||
@ -25,5 +28,24 @@ public interface LoanApi {
|
|||||||
@GetMapping(PREFIX + "/getByUserId")
|
@GetMapping(PREFIX + "/getByUserId")
|
||||||
@Operation(summary = "获取借支记录")
|
@Operation(summary = "获取借支记录")
|
||||||
@Parameter(name = "userId", description = "用户编号", required = true)
|
@Parameter(name = "userId", description = "用户编号", required = true)
|
||||||
CommonResult<LoanDTO> getByUserId(@RequestParam("userId") Long userId);
|
@Parameter(name = "loanType", description = "借支类型", required = true)
|
||||||
|
CommonResult<LoanDTO> getByUserId(@RequestParam("userId") Long userId,
|
||||||
|
@RequestParam("loanType") Integer loanType);
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/getListByUserId")
|
||||||
|
@Operation(summary = "获取借支记录")
|
||||||
|
@Parameter(name = "userIds", description = "用户编号", required = true)
|
||||||
|
@Parameter(name = "loanType", description = "借支类型", required = true)
|
||||||
|
CommonResult<List<LoanDTO>> getListByUserId(@RequestParam("userIds") Collection<Long> userId,
|
||||||
|
@RequestParam("loanType") Integer loanType);
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/getListByMonth")
|
||||||
|
@Operation(summary = "获取员工截止当前月份的工资借支余额")
|
||||||
|
@Parameter(name = "userIds", description = "用户编号", required = true)
|
||||||
|
@Parameter(name = "month", description = "月份", required = true)
|
||||||
|
CommonResult<List<LoanDTO>> getListByMonth(@RequestParam("userIds") Collection<Long> userId,
|
||||||
|
@RequestParam("month") String month);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,9 @@ public class LoanDTO {
|
|||||||
@Schema(description = "借支用户部门名称")
|
@Schema(description = "借支用户部门名称")
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
|
@Schema(description = "借支类型 | 1工资 2费用")
|
||||||
|
private Integer loanType;
|
||||||
|
|
||||||
@Schema(description = "借支总额")
|
@Schema(description = "借支总额")
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
@Tag(name = "RPC 服务 - 项目")
|
@Tag(name = "RPC 服务 - 项目")
|
||||||
public interface ProjectApi {
|
public interface ProjectApi {
|
||||||
@ -26,4 +29,8 @@ public interface ProjectApi {
|
|||||||
@Operation(summary = "获得项目")
|
@Operation(summary = "获得项目")
|
||||||
@Parameter(name = "projectNo", description = "项目编号", required = true)
|
@Parameter(name = "projectNo", description = "项目编号", required = true)
|
||||||
CommonResult<ProjectDTO> getProject(@RequestParam("projectNo") String projectNo);
|
CommonResult<ProjectDTO> getProject(@RequestParam("projectNo") String projectNo);
|
||||||
|
|
||||||
|
@PostMapping(PREFIX + "/get")
|
||||||
|
@Operation(summary = "获得项目")
|
||||||
|
CommonResult<List<ProjectDTO>> getProjectList(@RequestBody Collection<String> projectNos);
|
||||||
}
|
}
|
||||||
|
@ -282,6 +282,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode RENTAL_REFUND_AMOUNT_EXCESS = new ErrorCode(1_013_001_007, "退款金额不能大于收款金额!");
|
ErrorCode RENTAL_REFUND_AMOUNT_EXCESS = new ErrorCode(1_013_001_007, "退款金额不能大于收款金额!");
|
||||||
ErrorCode RENTAL_ITEMS_NOT_REFUND = new ErrorCode(1_013_001_008, "物品还未全部退还,不能全额退款!");
|
ErrorCode RENTAL_ITEMS_NOT_REFUND = new ErrorCode(1_013_001_008, "物品还未全部退还,不能全额退款!");
|
||||||
ErrorCode RENTAL_ORDER_CUSTOMER_EXISTS = new ErrorCode(1_013_001_009, "该客户已存在租赁订单!");
|
ErrorCode RENTAL_ORDER_CUSTOMER_EXISTS = new ErrorCode(1_013_001_009, "该客户已存在租赁订单!");
|
||||||
|
ErrorCode RENTAL_SALE_RECORD_NOT_EXISTS = new ErrorCode(1_013_001_010, "租赁转销售记录不存在!");
|
||||||
|
|
||||||
// ========== 项目管理相关 1-014-001-001 ==========
|
// ========== 项目管理相关 1-014-001-001 ==========
|
||||||
ErrorCode PROJECT_NOT_EXISTS = new ErrorCode(1_014_001_001, "项目不存在!");
|
ErrorCode PROJECT_NOT_EXISTS = new ErrorCode(1_014_001_001, "项目不存在!");
|
||||||
|
@ -159,4 +159,11 @@ public class DeptApiImpl implements DeptApi {
|
|||||||
List<DeptDO> deptList = deptService.getDeptListByType(type);
|
List<DeptDO> deptList = deptService.getDeptListByType(type);
|
||||||
return success(BeanUtils.toBean(deptList, DeptRespDTO.class));
|
return success(BeanUtils.toBean(deptList, DeptRespDTO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataPermission(enable = false)
|
||||||
|
public CommonResult<DeptRespDTO> getCompanyByDept(Long deptId) {
|
||||||
|
DeptDO dept = deptService.getCompanyByDept(deptId);
|
||||||
|
return success(BeanUtils.toBean(dept, DeptRespDTO.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@ -28,8 +31,20 @@ public class LoanApiImpl implements LoanApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult<LoanDTO> getByUserId(Long userId) {
|
public CommonResult<LoanDTO> getByUserId(Long userId, Integer loanType) {
|
||||||
LoanDO loanDO = loanService.getByUserId(userId);
|
LoanDO loanDO = loanService.getByUserId(userId, loanType);
|
||||||
return success(BeanUtils.toBean(loanDO, LoanDTO.class));
|
return success(BeanUtils.toBean(loanDO, LoanDTO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<List<LoanDTO>> getListByUserId(Collection<Long> userId, Integer loanType) {
|
||||||
|
List<LoanDO> loanDOList = loanService.getListByUserId(userId, loanType);
|
||||||
|
return success(BeanUtils.toBean(loanDOList, LoanDTO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<List<LoanDTO>> getListByMonth(Collection<Long> userId, String month) {
|
||||||
|
List<LoanDO> loanDOList = loanService.getListByMonth(userId, month);
|
||||||
|
return success(BeanUtils.toBean(loanDOList, LoanDTO.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@ -30,4 +33,10 @@ public class ProjectApiImpl implements ProjectApi {
|
|||||||
ProjectDO projectDO = projectService.getProject(projectNo);
|
ProjectDO projectDO = projectService.getProject(projectNo);
|
||||||
return success(BeanUtils.toBean(projectDO, ProjectDTO.class));
|
return success(BeanUtils.toBean(projectDO, ProjectDTO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<List<ProjectDTO>> getProjectList(Collection<String> projectNos) {
|
||||||
|
List<ProjectDO> projectDOList = projectService.getProjectList(projectNos);
|
||||||
|
return success(BeanUtils.toBean(projectDOList, ProjectDTO.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,10 +71,11 @@ public class CustomerSettlementController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update-confirm")
|
@PutMapping("/update-confirm")
|
||||||
@Operation(summary = "确认结算信息")
|
@Operation(summary = "修改结算状态")
|
||||||
@PreAuthorize("@ss.hasPermission('system:customer-settlement:update')")
|
@PreAuthorize("@ss.hasPermission('system:customer-settlement:update')")
|
||||||
public CommonResult<Boolean> updateConfirm(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> updateConfirm(@RequestParam("id") Long id,
|
||||||
customerSettlementService.updateConfirm(id);
|
@RequestParam("status") Integer status) {
|
||||||
|
customerSettlementService.updateConfirm(id, status);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,11 +35,14 @@ public class CustomerSettlementRespVO {
|
|||||||
@Schema(description = "收款明细")
|
@Schema(description = "收款明细")
|
||||||
private List<PaymentItem> paymentItem;
|
private List<PaymentItem> paymentItem;
|
||||||
|
|
||||||
@Schema(description = "其他扣款明细")
|
@Schema(description = "备注")
|
||||||
private List<OtherDeductionsVO> otherDeductions;
|
private String notes;
|
||||||
|
|
||||||
|
@Schema(description = "结算状态 | 1已复核 2已确认")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
@Schema(description = "附件")
|
@Schema(description = "附件")
|
||||||
private List<UploadUserFile> url;
|
private List<UploadUserFile> fileItems;
|
||||||
|
|
||||||
@Schema(description = "创建人")
|
@Schema(description = "创建人")
|
||||||
private String creator;
|
private String creator;
|
||||||
@ -51,7 +54,4 @@ public class CustomerSettlementRespVO {
|
|||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@ExcelProperty("创建时间")
|
@ExcelProperty("创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@Schema(description = "是否确认")
|
|
||||||
private Integer isConfirm;
|
|
||||||
}
|
}
|
@ -29,10 +29,13 @@ public class CustomerSettlementSaveReqVO {
|
|||||||
@Schema(description = "收款明细")
|
@Schema(description = "收款明细")
|
||||||
private List<PaymentItem> paymentItem;
|
private List<PaymentItem> paymentItem;
|
||||||
|
|
||||||
@Schema(description = "其他扣款明细")
|
@Schema(description = "备注")
|
||||||
private List<OtherDeductionsVO> otherDeductions;
|
private String notes;
|
||||||
|
|
||||||
|
@Schema(description = "结算状态 | 1已复核 2已确认")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
@Schema(description = "上传附件", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "https://www.iocoder.cn")
|
@Schema(description = "上传附件", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "https://www.iocoder.cn")
|
||||||
private List<UploadUserFile> url;
|
private List<UploadUserFile> fileItems;
|
||||||
|
|
||||||
}
|
}
|
@ -3,11 +3,15 @@ package cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 其他扣款明细 Response VO")
|
@Schema(description = "管理后台 - 其他扣款明细 Response VO")
|
||||||
@Data
|
@Data
|
||||||
public class OtherDeductionsVO {
|
public class OtherDeductionsVO {
|
||||||
|
|
||||||
|
@Schema(description = "扣款项")
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
private String value;
|
@Schema(description = "扣款金额")
|
||||||
|
private BigDecimal value;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 结算明细新增/修改 Request VO")
|
@Schema(description = "管理后台 - 结算明细新增/修改 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@ -23,8 +24,8 @@ public class SettlementItemVO {
|
|||||||
@Schema(description = "应结算金额")
|
@Schema(description = "应结算金额")
|
||||||
private BigDecimal shouldSettlementAmount;
|
private BigDecimal shouldSettlementAmount;
|
||||||
|
|
||||||
@Schema(description = "扣款金额")
|
@Schema(description = "扣款明细")
|
||||||
private BigDecimal deductionAmount;
|
private List<OtherDeductionsVO> deductionItems;
|
||||||
|
|
||||||
@Schema(description = "结算金额")
|
@Schema(description = "结算金额")
|
||||||
private BigDecimal settlementAmount;
|
private BigDecimal settlementAmount;
|
||||||
|
@ -60,7 +60,7 @@ public class LoanController {
|
|||||||
@Parameter(name = "staffId", description = "员工编号", required = true, example = "1024")
|
@Parameter(name = "staffId", description = "员工编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('system:loan:query')")
|
@PreAuthorize("@ss.hasPermission('system:loan:query')")
|
||||||
public CommonResult<LoanRespVO> getByStaffId(@RequestParam("id") Long id) {
|
public CommonResult<LoanRespVO> getByStaffId(@RequestParam("id") Long id) {
|
||||||
LoanDO loan = loanService.getByUserId(id);
|
LoanDO loan = loanService.getByUserId(id, 1);
|
||||||
return success(BeanUtils.toBean(loan, LoanRespVO.class));
|
return success(BeanUtils.toBean(loan, LoanRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@ public class LoanRespVO {
|
|||||||
@Schema(description = "借支用户编号")
|
@Schema(description = "借支用户编号")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "借支员工编号")
|
||||||
|
private Long staffId;
|
||||||
|
|
||||||
@Schema(description = "借支用户姓名")
|
@Schema(description = "借支用户姓名")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
@ -28,6 +31,9 @@ public class LoanRespVO {
|
|||||||
@Schema(description = "借支用户部门名称")
|
@Schema(description = "借支用户部门名称")
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
|
@Schema(description = "借支类型 | 1工资 2费用")
|
||||||
|
private Integer loanType;
|
||||||
|
|
||||||
@Schema(description = "借支总额")
|
@Schema(description = "借支总额")
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@ -18,9 +18,12 @@ public class LoanSaveReqVO {
|
|||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@Schema(description = "借支用户部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "128")
|
@Schema(description = "借支用户部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "128")
|
||||||
@NotNull(message = "借支用户部门编号不能为空")
|
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
|
@Schema(description = "借支类型 | 1工资 2费用")
|
||||||
|
@NotNull(message = "借支类型不能为空")
|
||||||
|
private Integer loanType;
|
||||||
|
|
||||||
@Schema(description = "借支总额")
|
@Schema(description = "借支总额")
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package cn.iocoder.yudao.module.system.controller.admin.rental;
|
package cn.iocoder.yudao.module.system.controller.admin.rental;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
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.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerPageReqVO;
|
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.RentalCustomerRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerSaveReqVO;
|
||||||
@ -20,13 +20,14 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
|
||||||
|
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 租赁客户")
|
@Tag(name = "管理后台 - 租赁客户")
|
||||||
@ -38,6 +39,9 @@ public class RentalCustomerController {
|
|||||||
@Resource
|
@Resource
|
||||||
private RentalCustomerService rentalCustomerService;
|
private RentalCustomerService rentalCustomerService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FactoryInfoApi factoryInfoApi;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建租赁客户")
|
@Operation(summary = "创建租赁客户")
|
||||||
@PreAuthorize("@ss.hasPermission('system:rental-customer:create')")
|
@PreAuthorize("@ss.hasPermission('system:rental-customer:create')")
|
||||||
@ -87,11 +91,47 @@ public class RentalCustomerController {
|
|||||||
return success(BeanUtils.toBean(rentalCustomer, RentalCustomerRespVO.class));
|
return success(BeanUtils.toBean(rentalCustomer, RentalCustomerRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-list-by-factory")
|
||||||
|
@Operation(summary = "获得对应工厂的客户列表")
|
||||||
|
@Parameter(name = "userId", description = "用户id", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:rental-customer:query')")
|
||||||
|
public CommonResult<List<RentalCustomerRespVO>> getListByFactory(@RequestParam("userId") Long userId) {
|
||||||
|
List<RentalCustomerDO> rentalCustomer = rentalCustomerService.getListByFactory(userId);
|
||||||
|
return success(BeanUtils.toBean(rentalCustomer, RentalCustomerRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得租赁客户分页")
|
@Operation(summary = "获得租赁客户分页")
|
||||||
@PreAuthorize("@ss.hasPermission('system:rental-customer:query')")
|
@PreAuthorize("@ss.hasPermission('system:rental-customer:query')")
|
||||||
public CommonResult<PageResult<RentalCustomerRespVO>> getRentalCustomerPage(@Valid RentalCustomerPageReqVO pageReqVO) {
|
public CommonResult<PageResult<RentalCustomerRespVO>> getRentalCustomerPage(@Valid RentalCustomerPageReqVO pageReqVO) {
|
||||||
PageResult<RentalCustomerDO> pageResult = rentalCustomerService.getRentalCustomerPage(pageReqVO);
|
PageResult<RentalCustomerDO> pageResult = rentalCustomerService.getRentalCustomerPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, RentalCustomerRespVO.class));
|
PageResult<RentalCustomerRespVO> respVO = BeanUtils.toBean(pageResult, RentalCustomerRespVO.class);
|
||||||
|
if (CollUtil.isNotEmpty(respVO.getList())) {
|
||||||
|
// 获取工厂编号
|
||||||
|
Set<Long> factoryIds = pageResult.getList().stream()
|
||||||
|
.map(RentalCustomerDO::getFactoryIds)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.flatMap(Set::stream)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
// 获取工厂信息
|
||||||
|
List<FactoryInfoDTO> factoryInfoDTOS = factoryInfoApi.getFactoryInfoList(factoryIds).getCheckedData();
|
||||||
|
// 映射工厂名称
|
||||||
|
Map<Long, String> factoryMap = factoryInfoDTOS.stream()
|
||||||
|
.collect(Collectors.toMap(FactoryInfoDTO::getId, FactoryInfoDTO::getShortName));
|
||||||
|
|
||||||
|
respVO.getList().forEach(item -> {
|
||||||
|
// 设置工厂名称
|
||||||
|
Set<Long> itemFactoryIds = item.getFactoryIds();
|
||||||
|
if (itemFactoryIds != null) {
|
||||||
|
List<String> factoryNames = itemFactoryIds.stream()
|
||||||
|
.map(factoryMap::get)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
item.setFactoryNames(factoryNames);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return success(respVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.system.controller.admin.rental;
|
package cn.iocoder.yudao.module.system.controller.admin.rental;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
@ -31,6 +32,8 @@ import java.util.Objects;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
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.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 租赁订单")
|
@Tag(name = "管理后台 - 租赁订单")
|
||||||
@ -101,10 +104,33 @@ public class RentalOrderController {
|
|||||||
return success(respVO);
|
return success(respVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getByOrderNo")
|
||||||
|
@Operation(summary = "获得租赁订单")
|
||||||
|
@Parameter(name = "orderNo", description = "订单编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:rental-order:query')")
|
||||||
|
public CommonResult<RentalOrderRespVO> getRentalOrder(@RequestParam("orderNo") String orderNo) {
|
||||||
|
RentalOrderDO rentalOrder = rentalOrderService.getRentalOrder(orderNo);
|
||||||
|
RentalOrderRespVO respVO = BeanUtils.toBean(rentalOrder, RentalOrderRespVO.class);
|
||||||
|
|
||||||
|
// 获取已收金额
|
||||||
|
RentalDepositAmountReqVO amountReqVO = rentalDepositRecordService.getRentalDepositRecordAmount(rentalOrder.getOrderNo(), false);
|
||||||
|
// 设置剩余金额 = 已收金额 - 已退金额
|
||||||
|
respVO.setRemainingDeposit(amountReqVO.getReceivedAmount().subtract(amountReqVO.getRefundAmount()));
|
||||||
|
|
||||||
|
return success(respVO);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得租赁订单分页")
|
@Operation(summary = "获得租赁订单分页")
|
||||||
@PreAuthorize("@ss.hasPermission('system:rental-order:query')")
|
@PreAuthorize("@ss.hasPermission('system:rental-order:query')")
|
||||||
public CommonResult<PageResult<RentalOrderRespVO>> getRentalOrderPage(@Valid RentalOrderPageReqVO pageReqVO) {
|
public CommonResult<PageResult<RentalOrderRespVO>> getRentalOrderPage(@Valid RentalOrderPageReqVO pageReqVO) {
|
||||||
|
|
||||||
|
// 获取当前登陆用户的 所属工厂的客户信息
|
||||||
|
List<RentalCustomerDO> rentalCustomerDOList = rentalCustomerService.getListByFactory(getLoginUserId());
|
||||||
|
if (CollUtil.isNotEmpty(rentalCustomerDOList)) {
|
||||||
|
pageReqVO.setCustomerIds(convertList(rentalCustomerDOList, RentalCustomerDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
PageResult<RentalOrderRespVO> pageResult = rentalOrderService.getRentalOrderPage(pageReqVO);
|
PageResult<RentalOrderRespVO> pageResult = rentalOrderService.getRentalOrderPage(pageReqVO);
|
||||||
// 获取等待退款的订单号
|
// 获取等待退款的订单号
|
||||||
List<String> orderNos = pageResult.getList().stream()
|
List<String> orderNos = pageResult.getList().stream()
|
||||||
@ -118,7 +144,6 @@ public class RentalOrderController {
|
|||||||
// 设置对应的订单号中的 申请退款和扣款金额
|
// 设置对应的订单号中的 申请退款和扣款金额
|
||||||
pageResult.getList().forEach(item -> {
|
pageResult.getList().forEach(item -> {
|
||||||
|
|
||||||
|
|
||||||
// 设置剩余押金
|
// 设置剩余押金
|
||||||
item.setRemainingDeposit(item.getReceivedAmount().subtract(item.getRefundAmount().add(item.getChargebacksAmount())));
|
item.setRemainingDeposit(item.getReceivedAmount().subtract(item.getRefundAmount().add(item.getChargebacksAmount())));
|
||||||
|
|
||||||
|
@ -0,0 +1,96 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.rental;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
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.rentalsalerecord.RentalSaleRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleRecordSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleStatusReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalSaleRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.rental.RentalSaleRecordService;
|
||||||
|
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.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 租赁转销售记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/rental-sale-record")
|
||||||
|
@Validated
|
||||||
|
public class RentalSaleRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RentalSaleRecordService rentalSaleRecordService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserService userService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建租赁转销售记录")
|
||||||
|
public CommonResult<Long> createRentalSaleRecord(@Valid @RequestBody RentalSaleRecordSaveReqVO createReqVO) {
|
||||||
|
return success(rentalSaleRecordService.createRentalSaleRecord(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新租赁转销售状态")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:rental-sale-record:update')")
|
||||||
|
public CommonResult<Boolean> updateRentalSaleRecord(@Valid @RequestBody RentalSaleStatusReqVO updateReqVO) {
|
||||||
|
if (updateReqVO.getStatus() == 1) {
|
||||||
|
updateReqVO.setReturnUserId(getLoginUserId());
|
||||||
|
}
|
||||||
|
rentalSaleRecordService.updateRentalSaleRecord(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除租赁转销售记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
public CommonResult<Boolean> deleteRentalSaleRecord(@RequestParam("id") Long id) {
|
||||||
|
rentalSaleRecordService.deleteRentalSaleRecord(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得租赁转销售记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
public CommonResult<RentalSaleRecordRespVO> getRentalSaleRecord(@RequestParam("id") Long id) {
|
||||||
|
RentalSaleRecordDO rentalSaleRecord = rentalSaleRecordService.getRentalSaleRecord(id);
|
||||||
|
return success(BeanUtils.toBean(rentalSaleRecord, RentalSaleRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得租赁转销售记录分页")
|
||||||
|
public CommonResult<PageResult<RentalSaleRecordRespVO>> getRentalSaleRecordPage(@Valid RentalSaleRecordPageReqVO pageReqVO) {
|
||||||
|
PageResult<RentalSaleRecordDO> pageResult = rentalSaleRecordService.getRentalSaleRecordPage(pageReqVO);
|
||||||
|
PageResult<RentalSaleRecordRespVO> respVO = BeanUtils.toBean(pageResult, RentalSaleRecordRespVO.class);
|
||||||
|
if (CollUtil.isNotEmpty(respVO.getList())) {
|
||||||
|
// 获取退还经办人信息
|
||||||
|
List<Long> userIds = convertList(respVO.getList(), RentalSaleRecordRespVO::getReturnUserId);
|
||||||
|
Map<Long, AdminUserDO> userMap = userService.getUserMap(userIds);
|
||||||
|
|
||||||
|
respVO.getList().forEach(item -> {
|
||||||
|
// 设置退还经办人名称
|
||||||
|
item.setReturnUserName(userMap.containsKey(item.getReturnUserId()) ? userMap.get(item.getReturnUserId()).getNickname() : "");
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
return success(respVO);
|
||||||
|
}
|
||||||
|
}
|
@ -33,6 +33,9 @@ public class RentalCustomerPageReqVO extends PageParam {
|
|||||||
@Schema(description = "剩余押金金额")
|
@Schema(description = "剩余押金金额")
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(description = "工厂id")
|
||||||
|
private Long factoryId;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] createTime;
|
private LocalDateTime[] createTime;
|
||||||
|
@ -5,6 +5,8 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 租赁客户 Response VO")
|
@Schema(description = "管理后台 - 租赁客户 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@ -13,6 +15,12 @@ public class RentalCustomerRespVO {
|
|||||||
@Schema(description = "租赁客户表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "租赁客户表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "所属工厂id集合")
|
||||||
|
private Set<Long> factoryIds;
|
||||||
|
|
||||||
|
@Schema(description = "工厂名称")
|
||||||
|
private List<String> factoryNames;
|
||||||
|
|
||||||
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ -31,6 +39,9 @@ public class RentalCustomerRespVO {
|
|||||||
@Schema(description = "状态 | 0开启 1关闭")
|
@Schema(description = "状态 | 0开启 1关闭")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "周转天数")
|
||||||
|
private Integer turnoverDays;
|
||||||
|
|
||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ -4,7 +4,9 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 租赁客户新增/修改 Request VO")
|
@Schema(description = "管理后台 - 租赁客户新增/修改 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@ -13,6 +15,9 @@ public class RentalCustomerSaveReqVO {
|
|||||||
@Schema(description = "租赁客户表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "租赁客户表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "所属工厂id集合")
|
||||||
|
private Set<Long> factoryIds;
|
||||||
|
|
||||||
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ -30,6 +35,10 @@ public class RentalCustomerSaveReqVO {
|
|||||||
@Schema(description = "剩余押金金额")
|
@Schema(description = "剩余押金金额")
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(description = "周转天数")
|
||||||
|
@NotNull(message = "周转天数不能为空")
|
||||||
|
private Integer turnoverDays;
|
||||||
|
|
||||||
@Schema(description = "状态 | 0开启 1关闭")
|
@Schema(description = "状态 | 0开启 1关闭")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
}
|
}
|
@ -8,6 +8,7 @@ import lombok.ToString;
|
|||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
@ -26,6 +27,9 @@ public class RentalOrderPageReqVO extends PageParam {
|
|||||||
@Schema(description = "客户编号")
|
@Schema(description = "客户编号")
|
||||||
private Long customerId;
|
private Long customerId;
|
||||||
|
|
||||||
|
@Schema(description = "客户编号")
|
||||||
|
private List<Long> customerIds;
|
||||||
|
|
||||||
@Schema(description = "押金金额")
|
@Schema(description = "押金金额")
|
||||||
private Integer depositAmount;
|
private Integer depositAmount;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class RentalDepositRecordSaveReqVO {
|
|||||||
private String bankNo;
|
private String bankNo;
|
||||||
|
|
||||||
@Schema(description = "客户银行卡号", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "客户银行卡号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotEmpty(message = "客户银行卡号不能为空")
|
@NotNull(message = "客户银行卡号不能为空")
|
||||||
private String customerBankNo;
|
private String customerBankNo;
|
||||||
|
|
||||||
@Schema(description = "收款/退款金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "收款/退款金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord;
|
||||||
|
|
||||||
|
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 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 RentalSaleRecordPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "订单编号", example = "1024")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
@Schema(description = "转销售记录日期")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDate[] saleDate;
|
||||||
|
|
||||||
|
@Schema(description = "状态 | 0销售 1退还", example = "0")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "退还经办人用户编号", example = "146")
|
||||||
|
private Long returnUserId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 租赁转销售记录 Response VO")
|
||||||
|
@Data
|
||||||
|
public class RentalSaleRecordRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "订单租赁物品记录表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
@Schema(description = "入账记录表主键编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Long depositId;
|
||||||
|
|
||||||
|
@Schema(description = "金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(description = "转销售记录日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDate saleDate;
|
||||||
|
|
||||||
|
@Schema(description = "状态 | 0销售 1退还", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "退还经办人用户编号", example = "146")
|
||||||
|
private Long returnUserId;
|
||||||
|
|
||||||
|
@Schema(description = "退还经办人用户名称", example = "146")
|
||||||
|
private String returnUserName;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 租赁转销售记录新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class RentalSaleRecordSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "订单租赁物品记录表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotNull(message = "客户编号不能为空")
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "订单编号不能为空")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
@Schema(description = "入账记录表主键编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotNull(message = "入账记录表主键编号不能为空")
|
||||||
|
private Long depositId;
|
||||||
|
|
||||||
|
@Schema(description = "金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "金额不能为空")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(description = "转销售记录日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "转销售记录日期不能为空")
|
||||||
|
private LocalDate saleDate;
|
||||||
|
|
||||||
|
@Schema(description = "状态 | 0销售 1退还", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||||
|
@NotNull(message = "状态 | 0销售 1退还不能为空")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "退还经办人用户编号", example = "146")
|
||||||
|
private Long returnUserId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 租金转销售状态 Request VO")
|
||||||
|
@Data
|
||||||
|
public class RentalSaleStatusReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
@Schema(description = "入账编号")
|
||||||
|
private Long depositId;
|
||||||
|
|
||||||
|
@Schema(description = "金额")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(description = "状态 | 0销售 1退还", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "退还经办人用户编号", example = "146")
|
||||||
|
private Long returnUserId;
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.system.dal.dataobject.customersettlement;
|
package cn.iocoder.yudao.module.system.dal.dataobject.customersettlement;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.OtherDeductionsVO;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.PaymentItem;
|
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.PaymentItem;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.upload.UploadUserFile;
|
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.upload.UploadUserFile;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
@ -50,19 +49,18 @@ public class CustomerSettlementDO extends BaseDO {
|
|||||||
private List<PaymentItem> paymentItem;
|
private List<PaymentItem> paymentItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他扣款明细
|
* 备注
|
||||||
*/
|
*/
|
||||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
private String notes;
|
||||||
private List<OtherDeductionsVO> otherDeductions;
|
|
||||||
|
/**
|
||||||
|
* 结算状态 | 1已复核 2已确认
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传附件
|
* 上传附件
|
||||||
*/
|
*/
|
||||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
private List<UploadUserFile> url;
|
private List<UploadUserFile> fileItems;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否确认 | 0否 1是
|
|
||||||
*/
|
|
||||||
private Integer isConfirm;
|
|
||||||
}
|
}
|
@ -1,11 +1,15 @@
|
|||||||
package cn.iocoder.yudao.module.system.dal.dataobject.customersettlement;
|
package cn.iocoder.yudao.module.system.dal.dataobject.customersettlement;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.OtherDeductionsVO;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算明细信息 DO
|
* 结算明细信息 DO
|
||||||
@ -48,9 +52,10 @@ public class SettlementItemDO extends BaseDO {
|
|||||||
private BigDecimal shouldSettlementAmount;
|
private BigDecimal shouldSettlementAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扣款金额
|
* 扣款明细
|
||||||
*/
|
*/
|
||||||
private BigDecimal deductionAmount;
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
|
private List<OtherDeductionsVO> deductionItems;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算金额
|
* 结算金额
|
||||||
|
@ -36,6 +36,10 @@ public class LoanDO extends BaseDO {
|
|||||||
* 借支用户部门编号
|
* 借支用户部门编号
|
||||||
*/
|
*/
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
/**
|
||||||
|
* 借支类型 | 1工资 2费用
|
||||||
|
*/
|
||||||
|
private Integer loanType;
|
||||||
/**
|
/**
|
||||||
* 借支总额
|
* 借支总额
|
||||||
*/
|
*/
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
package cn.iocoder.yudao.module.system.dal.dataobject.rental;
|
package cn.iocoder.yudao.module.system.dal.dataobject.rental;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租赁客户 DO
|
* 租赁客户 DO
|
||||||
*
|
*
|
||||||
* @author 符溶馨
|
* @author 符溶馨
|
||||||
*/
|
*/
|
||||||
@TableName("system_rental_customer")
|
@TableName(value = "system_rental_customer", autoResultMap = true)
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
@ -26,6 +29,11 @@ public class RentalCustomerDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableId
|
@TableId
|
||||||
private Long id;
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 所属工厂集合
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||||
|
private Set<Long> factoryIds;
|
||||||
/**
|
/**
|
||||||
* 客户名称
|
* 客户名称
|
||||||
*/
|
*/
|
||||||
@ -47,6 +55,11 @@ public class RentalCustomerDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 周转天数
|
||||||
|
*/
|
||||||
|
private Integer turnoverDays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 0开启 1关闭
|
* 状态 0开启 1关闭
|
||||||
*/
|
*/
|
||||||
|
@ -62,7 +62,7 @@ public class RentalDepositRecordDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private LocalDate paymentDate;
|
private LocalDate paymentDate;
|
||||||
/**
|
/**
|
||||||
* 类型 | 1收款 2退款
|
* 类型 | 1收款 2退款 3转销售
|
||||||
*/
|
*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.dataobject.rental;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租赁转销售记录 DO
|
||||||
|
*
|
||||||
|
* @author 符溶馨
|
||||||
|
*/
|
||||||
|
@TableName("system_rental_sale_record")
|
||||||
|
@KeySequence("system_rental_sale_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RentalSaleRecordDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单租赁物品记录表单主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 客户编号
|
||||||
|
*/
|
||||||
|
private Long customerId;
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 入账记录表主键编号
|
||||||
|
*/
|
||||||
|
private Long depositId;
|
||||||
|
/**
|
||||||
|
* 金额
|
||||||
|
*/
|
||||||
|
private BigDecimal amount;
|
||||||
|
/**
|
||||||
|
* 转销售记录日期
|
||||||
|
*/
|
||||||
|
private LocalDate saleDate;
|
||||||
|
/**
|
||||||
|
* 状态 | 0销售 1退还
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 退还经办人用户编号
|
||||||
|
*/
|
||||||
|
private Long returnUserId;
|
||||||
|
|
||||||
|
}
|
@ -63,5 +63,5 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DeptDO> selectCompany(@Param("flag") String flag,
|
List<DeptDO> selectCompany(@Param("flag") String flag,
|
||||||
@Param("type") String type);
|
@Param("type") List<String> type);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,10 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||||||
import cn.iocoder.yudao.module.system.controller.admin.loan.vo.LoanPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.loan.vo.LoanPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.loan.LoanDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.loan.LoanDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 借支管理 Mapper
|
* 借支管理 Mapper
|
||||||
@ -20,7 +24,8 @@ public interface LoanMapper extends BaseMapperX<LoanDO> {
|
|||||||
.eqIfPresent(LoanDO::getUserId, reqVO.getUserId())
|
.eqIfPresent(LoanDO::getUserId, reqVO.getUserId())
|
||||||
.eqIfPresent(LoanDO::getDeptId, reqVO.getDeptId())
|
.eqIfPresent(LoanDO::getDeptId, reqVO.getDeptId())
|
||||||
.betweenIfPresent(LoanDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(LoanDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.orderByDesc(LoanDO::getId));
|
.orderByDesc(LoanDO::getUserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<LoanDO> selectListByMonth(@Param("userId") Collection<Long> userId, @Param("month") String month);
|
||||||
}
|
}
|
@ -6,6 +6,10 @@ 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.controller.admin.rental.vo.customer.RentalCustomerPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalCustomerDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalCustomerDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租赁客户 Mapper
|
* 租赁客户 Mapper
|
||||||
@ -23,7 +27,9 @@ public interface RentalCustomerMapper extends BaseMapperX<RentalCustomerDO> {
|
|||||||
.eqIfPresent(RentalCustomerDO::getBankNo, reqVO.getBankNo())
|
.eqIfPresent(RentalCustomerDO::getBankNo, reqVO.getBankNo())
|
||||||
.eqIfPresent(RentalCustomerDO::getAmount, reqVO.getAmount())
|
.eqIfPresent(RentalCustomerDO::getAmount, reqVO.getAmount())
|
||||||
.betweenIfPresent(RentalCustomerDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(RentalCustomerDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.apply(Objects.nonNull(reqVO.getFactoryId()), "JSON_CONTAINS(factory_ids, '{0}', '$')", reqVO.getFactoryId())
|
||||||
.orderByDesc(RentalCustomerDO::getId));
|
.orderByDesc(RentalCustomerDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<RentalCustomerDO> selectListByFactory(@Param("userId") Long userId);
|
||||||
}
|
}
|
@ -9,8 +9,6 @@ import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalDepositRecordD
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租赁订单押金记录 Mapper
|
* 租赁订单押金记录 Mapper
|
||||||
*
|
*
|
||||||
|
@ -39,6 +39,7 @@ public interface RentalOrderMapper extends BaseMapperX<RentalOrderDO> {
|
|||||||
.eqIfPresent(RentalOrderDO::getStatus, reqVO.getStatus())
|
.eqIfPresent(RentalOrderDO::getStatus, reqVO.getStatus())
|
||||||
.likeIfPresent(RentalOrderDO::getRecipient, reqVO.getRecipient())
|
.likeIfPresent(RentalOrderDO::getRecipient, reqVO.getRecipient())
|
||||||
.betweenIfPresent(RentalOrderDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(RentalOrderDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.inIfPresent(RentalOrderDO::getCustomerId, reqVO.getCustomerIds())
|
||||||
.groupBy(RentalOrderDO::getOrderNo)
|
.groupBy(RentalOrderDO::getOrderNo)
|
||||||
.orderByDesc(RentalOrderDO::getCreateTime);
|
.orderByDesc(RentalOrderDO::getCreateTime);
|
||||||
|
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
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.rentalsalerecord.RentalSaleRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalSaleRecordDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租赁转销售记录 Mapper
|
||||||
|
*
|
||||||
|
* @author 符溶馨
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RentalSaleRecordMapper extends BaseMapperX<RentalSaleRecordDO> {
|
||||||
|
|
||||||
|
default PageResult<RentalSaleRecordDO> selectPage(RentalSaleRecordPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<RentalSaleRecordDO>()
|
||||||
|
.eqIfPresent(RentalSaleRecordDO::getOrderNo, reqVO.getOrderNo())
|
||||||
|
.betweenIfPresent(RentalSaleRecordDO::getSaleDate, reqVO.getSaleDate())
|
||||||
|
.eqIfPresent(RentalSaleRecordDO::getStatus, reqVO.getStatus())
|
||||||
|
.eqIfPresent(RentalSaleRecordDO::getReturnUserId, reqVO.getReturnUserId())
|
||||||
|
.betweenIfPresent(RentalSaleRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(RentalSaleRecordDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RentalSaleRecordRespVO> selectSaleDepositRecordList();
|
||||||
|
}
|
@ -113,4 +113,11 @@ public interface RedisKeyConstants {
|
|||||||
* VALUE 数据格式:String 剩余金额
|
* VALUE 数据格式:String 剩余金额
|
||||||
*/
|
*/
|
||||||
String RENTAL_ORDER_AMOUNT = "rental_order_amount";
|
String RENTAL_ORDER_AMOUNT = "rental_order_amount";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有公司类型部门的缓存
|
||||||
|
* KEY 格式:company_dept
|
||||||
|
* VALUE 数据格式:String 剩余金额
|
||||||
|
*/
|
||||||
|
String COMPANY_DEPT = "COMPANY_DEPT";
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,83 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.job.rental;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleRecordSaveReqVO;
|
||||||
|
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.mysql.rental.RentalCustomerMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.service.rental.RentalDepositRecordService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.rental.RentalSaleRecordService;
|
||||||
|
import com.xxl.job.core.biz.model.ReturnT;
|
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
@EnableScheduling
|
||||||
|
public class RentalSaleJob {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RentalSaleRecordService saleRecordService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RentalCustomerMapper customerMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RentalDepositRecordService depositRecordService;
|
||||||
|
|
||||||
|
@XxlJob("rentalSaleJob")
|
||||||
|
@TenantJob // --- ⚠️ 这个注解 会将租户列表拉出来 完了后逐个租户执行 定时任务需要注意
|
||||||
|
public ReturnT<String> execute() {
|
||||||
|
|
||||||
|
// 获取 当前日期已到达周转日期的收款记录
|
||||||
|
List<RentalSaleRecordRespVO> saleRecordList = saleRecordService.getSaleDepositRecordList();
|
||||||
|
|
||||||
|
List<RentalSaleRecordSaveReqVO> saleRecordSaveReqVOList = BeanUtils.toBean(saleRecordList, RentalSaleRecordSaveReqVO.class);
|
||||||
|
|
||||||
|
// 插入销售数据
|
||||||
|
saleRecordService.createBatch(saleRecordSaveReqVOList);
|
||||||
|
|
||||||
|
// 映射出一个map key为客户编号 value为 saleRecordSaveReqVOList该客户金额的和
|
||||||
|
Map<Long, BigDecimal> customerAmountMap = saleRecordSaveReqVOList.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
RentalSaleRecordSaveReqVO::getCustomerId,
|
||||||
|
Collectors.reducing(BigDecimal.ZERO, RentalSaleRecordSaveReqVO::getAmount, BigDecimal::add)
|
||||||
|
));
|
||||||
|
|
||||||
|
// 获取所有客户信息
|
||||||
|
List<RentalCustomerDO> RentalCustomerDO = customerMapper.selectList();
|
||||||
|
|
||||||
|
// 更新客户押金金额
|
||||||
|
RentalCustomerDO = RentalCustomerDO.stream()
|
||||||
|
.peek(customer -> {
|
||||||
|
BigDecimal originalAmount = customer.getAmount();
|
||||||
|
BigDecimal deductionAmount = customerAmountMap.getOrDefault(customer.getId(), BigDecimal.ZERO);
|
||||||
|
customer.setAmount(originalAmount.subtract(deductionAmount));
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 同步更新 客户押金金额
|
||||||
|
customerMapper.updateBatch(RentalCustomerDO);
|
||||||
|
|
||||||
|
List<RentalDepositRecordDO> updateList = saleRecordList.stream()
|
||||||
|
.map(saleRecord -> new RentalDepositRecordDO()
|
||||||
|
.setId(saleRecord.getDepositId())
|
||||||
|
.setType(3))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
// 同步更新 租金记录表
|
||||||
|
depositRecordService.updateRentalDepositRecordType(updateList);
|
||||||
|
|
||||||
|
// 返回执行成功
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
@ -65,7 +65,9 @@ public interface CustomerSettlementService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新结算信息确认状态
|
* 更新结算信息确认状态
|
||||||
* @param id 编号
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @param status
|
||||||
*/
|
*/
|
||||||
void updateConfirm(Long id);
|
void updateConfirm(Long id, Integer status);
|
||||||
}
|
}
|
@ -63,7 +63,7 @@ public class CustomerSettlementServiceImpl implements CustomerSettlementService
|
|||||||
settlementItemMapper.insertBatch(itemDO);
|
settlementItemMapper.insertBatch(itemDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(customerSettlement.getUrl())) {
|
if (CollUtil.isNotEmpty(customerSettlement.getFileItems())) {
|
||||||
// 更新交易凭证附件 业务编号
|
// 更新交易凭证附件 业务编号
|
||||||
UpdateBusinessFile(customerSettlement);
|
UpdateBusinessFile(customerSettlement);
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ public class CustomerSettlementServiceImpl implements CustomerSettlementService
|
|||||||
|
|
||||||
private void UpdateBusinessFile(CustomerSettlementDO updateReqVO) {
|
private void UpdateBusinessFile(CustomerSettlementDO updateReqVO) {
|
||||||
|
|
||||||
List<String> urls = updateReqVO.getUrl().stream().map(UploadUserFile::getUrl).collect(Collectors.toList());
|
List<String> urls = updateReqVO.getFileItems().stream().map(UploadUserFile::getUrl).collect(Collectors.toList());
|
||||||
fileApi.updateBusinessFile(urls, updateReqVO.getId().toString());
|
fileApi.updateBusinessFile(urls, updateReqVO.getId().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,13 +153,13 @@ public class CustomerSettlementServiceImpl implements CustomerSettlementService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateConfirm(Long id) {
|
public void updateConfirm(Long id, Integer status) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateCustomerSettlementExists(id);
|
validateCustomerSettlementExists(id);
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
customerSettlementMapper.updateById(new CustomerSettlementDO()
|
customerSettlementMapper.updateById(new CustomerSettlementDO()
|
||||||
.setId(id)
|
.setId(id)
|
||||||
.setIsConfirm(1));
|
.setStatus(status));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -187,7 +187,6 @@ public interface DeptService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定类型的部门列表
|
* 获取指定类型的部门列表
|
||||||
*
|
|
||||||
* @param type 部门类型
|
* @param type 部门类型
|
||||||
* @return 部门列表
|
* @return 部门列表
|
||||||
*/
|
*/
|
||||||
@ -195,11 +194,17 @@ public interface DeptService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取工厂部门
|
* 获取工厂部门
|
||||||
*
|
|
||||||
* @return 部门列表
|
* @return 部门列表
|
||||||
*/
|
*/
|
||||||
List<DeptDO> getFactoryDept();
|
List<DeptDO> getFactoryDept();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门所属公司信息
|
||||||
|
* @param deptId 部门编号
|
||||||
|
* @return 公司信息
|
||||||
|
*/
|
||||||
|
DeptDO getCompanyByDept(Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前登录用户负责的工厂部门
|
* 获取当前登录用户负责的工厂部门
|
||||||
*
|
*
|
||||||
|
@ -373,7 +373,7 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 根据所在部门信息获取 所在公司信息
|
// 根据所在部门信息获取 所在公司信息
|
||||||
List<DeptDO> companyDeptList = deptMapper.selectCompany(deptDo.getFlag(), DeptTypeEnum.COMPANY.getValue());
|
List<DeptDO> companyDeptList = deptMapper.selectCompany(deptDo.getFlag(), Arrays.asList(DeptTypeEnum.HEAD_COMPANY.getValue(), DeptTypeEnum.COMPANY.getValue()));
|
||||||
|
|
||||||
if (CollectionUtil.isEmpty(companyDeptList)) {
|
if (CollectionUtil.isEmpty(companyDeptList)) {
|
||||||
return new DeptDO();
|
return new DeptDO();
|
||||||
@ -404,6 +404,23 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
.isNotNull(DeptDO::getFactoryId));
|
.isNotNull(DeptDO::getFactoryId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataPermission(enable = false)
|
||||||
|
@Cacheable(cacheNames = RedisKeyConstants.COMPANY_DEPT, key = "#deptId")
|
||||||
|
public DeptDO getCompanyByDept(Long deptId) {
|
||||||
|
DeptDO deptDO = deptMapper.selectById(deptId);
|
||||||
|
if (deptDO.getType().equals(DeptTypeEnum.COMPANY.getValue())) {
|
||||||
|
return deptDO;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从缓存中获取所有非虚机构的公司信息
|
||||||
|
List<DeptDO> companyDOs = this.getCompanyDept(2);
|
||||||
|
return companyDOs.stream()
|
||||||
|
.filter(company -> deptDO.getFlag().contains(company.getFlag()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeptDO> getFactoryDeptByLeaderId(Long id) {
|
public List<DeptDO> getFactoryDeptByLeaderId(Long id) {
|
||||||
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
||||||
|
@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.system.controller.admin.loan.vo.LoanSaveReqVO;
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.loan.LoanDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.loan.LoanDO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 借支管理 Service 接口
|
* 借支管理 Service 接口
|
||||||
@ -41,7 +43,24 @@ public interface LoanService {
|
|||||||
/**
|
/**
|
||||||
* 根据用户编号获取借支管理
|
* 根据用户编号获取借支管理
|
||||||
* @param userId 用户编号
|
* @param userId 用户编号
|
||||||
|
* @param loanType 借支类型
|
||||||
* @return 借支记录
|
* @return 借支记录
|
||||||
*/
|
*/
|
||||||
LoanDO getByUserId(Long userId);
|
LoanDO getByUserId(Long userId, Integer loanType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户编号集合获取借支管理
|
||||||
|
* @param userIds 用户编号集合
|
||||||
|
* @param loanType 借支类型
|
||||||
|
* @return 借支记录
|
||||||
|
*/
|
||||||
|
List<LoanDO> getListByUserId(Collection<Long> userIds, Integer loanType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取员工截止当前月份的工资借支余额
|
||||||
|
* @param userId 用户编号集合
|
||||||
|
* @param month 月份
|
||||||
|
* @return 借支记录
|
||||||
|
*/
|
||||||
|
List<LoanDO> getListByMonth(Collection<Long> userId, String month);
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.service.loan;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.loan.vo.LoanPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.loan.vo.LoanPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.loan.vo.LoanSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.loan.vo.LoanSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.loan.LoanDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.loan.LoanDO;
|
||||||
@ -10,6 +11,8 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 借支管理 Service 实现类
|
* 借支管理 Service 实现类
|
||||||
@ -27,7 +30,9 @@ public class LoanServiceImpl implements LoanService {
|
|||||||
public void createLoan(LoanSaveReqVO createReqVO) {
|
public void createLoan(LoanSaveReqVO createReqVO) {
|
||||||
|
|
||||||
// 判断该借支用户 是否已存在借支记录
|
// 判断该借支用户 是否已存在借支记录
|
||||||
LoanDO loanDO = loanMapper.selectOne(LoanDO::getUserId, createReqVO.getUserId());
|
LoanDO loanDO = loanMapper.selectOne(new LambdaQueryWrapperX<LoanDO>()
|
||||||
|
.eq(LoanDO::getUserId, createReqVO.getUserId())
|
||||||
|
.eq(LoanDO::getLoanType, createReqVO.getLoanType()));
|
||||||
if (loanDO != null) {
|
if (loanDO != null) {
|
||||||
// 借支用户已存在借支记录,则更新该借支用户记录
|
// 借支用户已存在借支记录,则更新该借支用户记录
|
||||||
LoanDO updateDO = new LoanDO()
|
LoanDO updateDO = new LoanDO()
|
||||||
@ -38,8 +43,6 @@ public class LoanServiceImpl implements LoanService {
|
|||||||
loanMapper.updateById(updateDO);
|
loanMapper.updateById(updateDO);
|
||||||
}else {
|
}else {
|
||||||
// 借支用户不存在借支记录,则插入一条新记录
|
// 借支用户不存在借支记录,则插入一条新记录
|
||||||
|
|
||||||
// 插入
|
|
||||||
LoanDO createDO = BeanUtils.toBean(createReqVO, LoanDO.class);
|
LoanDO createDO = BeanUtils.toBean(createReqVO, LoanDO.class);
|
||||||
loanMapper.insert(createDO);
|
loanMapper.insert(createDO);
|
||||||
}
|
}
|
||||||
@ -56,7 +59,22 @@ public class LoanServiceImpl implements LoanService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanDO getByUserId(Long userId) {
|
public LoanDO getByUserId(Long userId, Integer loanType) {
|
||||||
return loanMapper.selectOne(LoanDO::getUserId, userId);
|
return loanMapper.selectOne(new LambdaQueryWrapperX<LoanDO>()
|
||||||
|
.eq(LoanDO::getUserId, userId)
|
||||||
|
.eq(LoanDO::getLoanType, loanType));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LoanDO> getListByUserId(Collection<Long> userIds, Integer loanType) {
|
||||||
|
return loanMapper.selectList(new LambdaQueryWrapperX<LoanDO>()
|
||||||
|
.in(LoanDO::getUserId, userIds)
|
||||||
|
.eq(LoanDO::getLoanType, loanType));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LoanDO> getListByMonth(Collection<Long> userId, String month) {
|
||||||
|
|
||||||
|
return loanMapper.selectListByMonth(userId, month);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectSaveReq
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.project.ProjectDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.project.ProjectDO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,4 +68,11 @@ public interface ProjectService {
|
|||||||
* @return 项目列表
|
* @return 项目列表
|
||||||
*/
|
*/
|
||||||
List<ProjectDO> getMyProject(Long userId);
|
List<ProjectDO> getMyProject(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得项目列表
|
||||||
|
* @param projectNos 项目编号集合
|
||||||
|
* @return 项目信息列表
|
||||||
|
*/
|
||||||
|
List<ProjectDO> getProjectList(Collection<String> projectNos);
|
||||||
}
|
}
|
@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
@ -86,4 +87,10 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
.eq(ProjectDO::getStatus, 1));
|
.eq(ProjectDO::getStatus, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ProjectDO> getProjectList(Collection<String> projectNos) {
|
||||||
|
|
||||||
|
return projectMapper.selectList(ProjectDO::getProjectNo, projectNos);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,12 +2,12 @@ package cn.iocoder.yudao.module.system.service.rental;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
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.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.RentalCustomerSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerStatusReqVO;
|
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.dataobject.rental.RentalCustomerDO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,6 +38,14 @@ public interface RentalCustomerService {
|
|||||||
*/
|
*/
|
||||||
void updateRentalCustomerStatus(RentalCustomerStatusReqVO updateReqVO);
|
void updateRentalCustomerStatus(RentalCustomerStatusReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新客户剩余押金金额
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @param amount 金额
|
||||||
|
*/
|
||||||
|
void updateRentalCustomerAmount(Long id, BigDecimal amount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除租赁客户
|
* 删除租赁客户
|
||||||
*
|
*
|
||||||
@ -66,4 +74,11 @@ public interface RentalCustomerService {
|
|||||||
* @return 租赁客户列表
|
* @return 租赁客户列表
|
||||||
*/
|
*/
|
||||||
List<RentalCustomerDO> getRentalCustomerList();
|
List<RentalCustomerDO> getRentalCustomerList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得对应工厂的客户列表
|
||||||
|
* @param userId 当前登陆用户编号
|
||||||
|
* @return 客户列表
|
||||||
|
*/
|
||||||
|
List<RentalCustomerDO> getListByFactory(Long userId);
|
||||||
}
|
}
|
@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
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.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.RentalCustomerSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.customer.RentalCustomerStatusReqVO;
|
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.dataobject.rental.RentalCustomerDO;
|
||||||
@ -13,7 +12,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
@ -59,6 +58,14 @@ public class RentalCustomerServiceImpl implements RentalCustomerService {
|
|||||||
rentalCustomerMapper.updateById(updateObj);
|
rentalCustomerMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRentalCustomerAmount(Long id, BigDecimal amount) {
|
||||||
|
// 校验存在
|
||||||
|
validateRentalCustomerExists(id);
|
||||||
|
// 更新
|
||||||
|
rentalCustomerMapper.updateById(new RentalCustomerDO().setId(id).setAmount(amount));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteRentalCustomer(Long id) {
|
public void deleteRentalCustomer(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
@ -88,4 +95,9 @@ public class RentalCustomerServiceImpl implements RentalCustomerService {
|
|||||||
return rentalCustomerMapper.selectList(RentalCustomerDO::getStatus, CommonStatusEnum.ENABLE.getStatus());
|
return rentalCustomerMapper.selectList(RentalCustomerDO::getStatus, CommonStatusEnum.ENABLE.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RentalCustomerDO> getListByFactory(Long userId) {
|
||||||
|
return rentalCustomerMapper.selectListByFactory(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -7,7 +7,6 @@ import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositre
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalDepositRecordDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalDepositRecordDO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,6 +38,13 @@ public interface RentalDepositRecordService {
|
|||||||
*/
|
*/
|
||||||
void updateRentalDepositRecord(@Valid RentalDepositRecordSaveReqVO updateReqVO);
|
void updateRentalDepositRecord(@Valid RentalDepositRecordSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新租赁订单押金记录类型
|
||||||
|
*
|
||||||
|
* @param updateReqVO 修改信息
|
||||||
|
| */
|
||||||
|
void updateRentalDepositRecordType(List<RentalDepositRecordDO> updateReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得租赁订单押金记录
|
* 获得租赁订单押金记录
|
||||||
*
|
*
|
||||||
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
|||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOARefundApi;
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOARefundApi;
|
||||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||||
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.RentalItemsCountReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentaldepositrecord.RentalDepositAmountReqVO;
|
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.RentalDepositRecordPageReqVO;
|
||||||
@ -119,9 +118,7 @@ public class RentalDepositRecordServiceImpl implements RentalDepositRecordServic
|
|||||||
Long customerId = rentalOrderService.getCustomerIdByOrderNo(createReqVO.getOrderNo());
|
Long customerId = rentalOrderService.getCustomerIdByOrderNo(createReqVO.getOrderNo());
|
||||||
if (customerId != null) {
|
if (customerId != null) {
|
||||||
// 同步更新客户剩余押金 金额
|
// 同步更新客户剩余押金 金额
|
||||||
customerService.updateRentalCustomer(new RentalCustomerSaveReqVO()
|
customerService.updateRentalCustomerAmount(customerId, customerDepositAmount);
|
||||||
.setId(customerId)
|
|
||||||
.setAmount(customerDepositAmount));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
@ -155,6 +152,13 @@ public class RentalDepositRecordServiceImpl implements RentalDepositRecordServic
|
|||||||
rentalDepositRecordMapper.updateById(updateObj);
|
rentalDepositRecordMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRentalDepositRecordType(List<RentalDepositRecordDO> updateReqVO) {
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
rentalDepositRecordMapper.updateBatch(updateReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
private void validateRentalDepositRecordExists(Long id) {
|
private void validateRentalDepositRecordExists(Long id) {
|
||||||
if (rentalDepositRecordMapper.selectById(id) == null) {
|
if (rentalDepositRecordMapper.selectById(id) == null) {
|
||||||
throw exception(RENTAL_DEPOSIT_RECORD_NOT_EXISTS);
|
throw exception(RENTAL_DEPOSIT_RECORD_NOT_EXISTS);
|
||||||
@ -175,5 +179,4 @@ public class RentalDepositRecordServiceImpl implements RentalDepositRecordServic
|
|||||||
public RentalDepositAmountReqVO getRentalDepositRecordAmount(String orderNo, Boolean isUpdate) {
|
public RentalDepositAmountReqVO getRentalDepositRecordAmount(String orderNo, Boolean isUpdate) {
|
||||||
return rentalDepositRecordMapper.selectAmount(orderNo, isUpdate);
|
return rentalDepositRecordMapper.selectAmount(orderNo, isUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
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.rentalsalerecord.RentalSaleRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleRecordSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleStatusReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.rental.RentalSaleRecordDO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租赁转销售记录 Service 接口
|
||||||
|
*
|
||||||
|
* @author 符溶馨
|
||||||
|
*/
|
||||||
|
public interface RentalSaleRecordService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建租赁转销售记录
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createRentalSaleRecord(@Valid RentalSaleRecordSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建租赁转销售记录
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
*/
|
||||||
|
void createBatch(@Valid List<RentalSaleRecordSaveReqVO> createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新租赁转销售记录
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateRentalSaleRecord(@Valid RentalSaleStatusReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除租赁转销售记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteRentalSaleRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得租赁转销售记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 租赁转销售记录
|
||||||
|
*/
|
||||||
|
RentalSaleRecordDO getRentalSaleRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得租赁转销售记录分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 租赁转销售记录分页
|
||||||
|
*/
|
||||||
|
PageResult<RentalSaleRecordDO> getRentalSaleRecordPage(RentalSaleRecordPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有到达周转期的租赁订单押金记录
|
||||||
|
* @return 订单押金记录
|
||||||
|
*/
|
||||||
|
List<RentalSaleRecordRespVO> getSaleDepositRecordList();
|
||||||
|
}
|
@ -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.rentalsalerecord.RentalSaleRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleRecordSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.rental.vo.rentalsalerecord.RentalSaleStatusReqVO;
|
||||||
|
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.RentalSaleRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.rental.RentalCustomerMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.rental.RentalSaleRecordMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
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_SALE_RECORD_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租赁转销售记录 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 符溶馨
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class RentalSaleRecordServiceImpl implements RentalSaleRecordService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RentalSaleRecordMapper rentalSaleRecordMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RentalCustomerMapper customerMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RentalDepositRecordService depositRecordService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createRentalSaleRecord(RentalSaleRecordSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
RentalSaleRecordDO rentalSaleRecord = BeanUtils.toBean(createReqVO, RentalSaleRecordDO.class);
|
||||||
|
rentalSaleRecordMapper.insert(rentalSaleRecord);
|
||||||
|
// 返回
|
||||||
|
return rentalSaleRecord.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createBatch(List<RentalSaleRecordSaveReqVO> createReqVO) {
|
||||||
|
|
||||||
|
// 批量插入
|
||||||
|
List<RentalSaleRecordDO> rentalSaleDO = BeanUtils.toBean(createReqVO, RentalSaleRecordDO.class);
|
||||||
|
rentalSaleRecordMapper.insertBatch(rentalSaleDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRentalSaleRecord(RentalSaleStatusReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateRentalSaleRecordExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
RentalSaleRecordDO updateObj = BeanUtils.toBean(updateReqVO, RentalSaleRecordDO.class);
|
||||||
|
rentalSaleRecordMapper.updateById(updateObj);
|
||||||
|
|
||||||
|
if (updateReqVO.getStatus() == 1) {
|
||||||
|
|
||||||
|
// 同步更新客户押金
|
||||||
|
customerMapper.update(null, new LambdaUpdateWrapper<RentalCustomerDO>()
|
||||||
|
.setSql("amount = amount + " + updateReqVO.getAmount())
|
||||||
|
.eq(RentalCustomerDO::getId, updateReqVO.getCustomerId()));
|
||||||
|
|
||||||
|
// 同步更新入账类型
|
||||||
|
RentalDepositRecordDO depositRecordDO = new RentalDepositRecordDO()
|
||||||
|
.setId(updateReqVO.getDepositId())
|
||||||
|
.setType(1);
|
||||||
|
depositRecordService.updateRentalDepositRecordType(Collections.singletonList(depositRecordDO));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteRentalSaleRecord(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateRentalSaleRecordExists(id);
|
||||||
|
// 删除
|
||||||
|
rentalSaleRecordMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateRentalSaleRecordExists(Long id) {
|
||||||
|
if (rentalSaleRecordMapper.selectById(id) == null) {
|
||||||
|
throw exception(RENTAL_SALE_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RentalSaleRecordDO getRentalSaleRecord(Long id) {
|
||||||
|
return rentalSaleRecordMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<RentalSaleRecordDO> getRentalSaleRecordPage(RentalSaleRecordPageReqVO pageReqVO) {
|
||||||
|
return rentalSaleRecordMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RentalSaleRecordRespVO> getSaleDepositRecordList() {
|
||||||
|
return rentalSaleRecordMapper.selectSaleDepositRecordList();
|
||||||
|
}
|
||||||
|
}
|
@ -80,9 +80,16 @@ spring:
|
|||||||
|
|
||||||
xxl:
|
xxl:
|
||||||
job:
|
job:
|
||||||
enabled: false # 是否开启调度中心,默认为 true 开启
|
enabled: true # 是否开启调度中心,默认为 true 开启
|
||||||
admin:
|
admin:
|
||||||
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
|
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
|
||||||
|
executor:
|
||||||
|
appname: ${spring.application.name} # 执行器 AppName
|
||||||
|
ip: # 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务";
|
||||||
|
port: 6666 # ### 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
|
||||||
|
logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 # 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
|
||||||
|
#accessToken: default_token
|
||||||
|
logretentiondays: 30 # 执行器日志文件保存天数 [选填] : 过期日志自动清理, 限制值大于等于3时生效; 否则, 如-1, 关闭自动清理功能;
|
||||||
|
|
||||||
--- #################### 服务保障相关配置 ####################
|
--- #################### 服务保障相关配置 ####################
|
||||||
|
|
||||||
|
@ -16,7 +16,10 @@
|
|||||||
system_dept
|
system_dept
|
||||||
WHERE
|
WHERE
|
||||||
#{flag} LIKE CONCAT('%', flag, '%')
|
#{flag} LIKE CONCAT('%', flag, '%')
|
||||||
AND type = #{type}
|
AND type IN
|
||||||
|
<foreach collection="type" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
AND deleted = 0
|
AND deleted = 0
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -0,0 +1,33 @@
|
|||||||
|
<?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.loan.LoanMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<select id="selectListByMonth" resultType="cn.iocoder.yudao.module.system.dal.dataobject.loan.LoanDO">
|
||||||
|
SELECT
|
||||||
|
a.user_id AS userId,
|
||||||
|
a.remaining_amount - sum( b.total_money ) AS remainingAmount
|
||||||
|
FROM
|
||||||
|
system_loan a
|
||||||
|
INNER JOIN bpm_oa_loan b ON a.loan_type = b.loan_type
|
||||||
|
AND a.user_id = b.sf_user_id
|
||||||
|
WHERE
|
||||||
|
b.return_date > #{month}
|
||||||
|
AND b.result = 2
|
||||||
|
AND a.deleted = 0
|
||||||
|
AND b.deleted = 0
|
||||||
|
AND a.loan_type = 1
|
||||||
|
AND a.user_id IN
|
||||||
|
<foreach collection="userId" item="item" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY
|
||||||
|
a.user_id
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user