mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-06-19 23:11:59 +08:00
[fix] 优化历史应收款管理功能
This commit is contained in:
parent
84a030dc71
commit
7c4cea094d
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.pms.controller.admin.receivableshistory;
|
package cn.iocoder.yudao.module.pms.controller.admin.receivableshistory;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDetailDO;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -24,6 +25,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo.*;
|
import cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo.*;
|
||||||
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDO;
|
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDO;
|
||||||
@ -38,27 +40,11 @@ public class ReceivablesHistoryController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ReceivablesHistoryService receivablesHistoryService;
|
private ReceivablesHistoryService receivablesHistoryService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
|
||||||
@Operation(summary = "创建应收款管理历史记录")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pms:receivables-history:create')")
|
|
||||||
public CommonResult<Long> createReceivablesHistory(@Valid @RequestBody ReceivablesHistorySaveReqVO createReqVO) {
|
|
||||||
return success(receivablesHistoryService.createReceivablesHistory(createReqVO));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新应收款管理历史记录")
|
@Operation(summary = "更新应收款管理历史记录")
|
||||||
@PreAuthorize("@ss.hasPermission('pms:receivables-history:update')")
|
@PreAuthorize("@ss.hasPermission('pms:receivables-history:update')")
|
||||||
public CommonResult<Boolean> updateReceivablesHistory(@Valid @RequestBody ReceivablesHistorySaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateReceivablesHistory(@Valid @RequestBody ReceivablesHistorySaveReqVO updateReqVO) {
|
||||||
receivablesHistoryService.updateReceivablesHistory(updateReqVO);
|
receivablesHistoryService.updateReceivablesHistory(getLoginUserId(), updateReqVO);
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
|
||||||
@Operation(summary = "删除应收款管理历史记录")
|
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
|
||||||
@PreAuthorize("@ss.hasPermission('pms:receivables-history:delete')")
|
|
||||||
public CommonResult<Boolean> deleteReceivablesHistory(@RequestParam("id") Long id) {
|
|
||||||
receivablesHistoryService.deleteReceivablesHistory(id);
|
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,16 +53,18 @@ public class ReceivablesHistoryController {
|
|||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('pms:receivables-history:query')")
|
@PreAuthorize("@ss.hasPermission('pms:receivables-history:query')")
|
||||||
public CommonResult<ReceivablesHistoryRespVO> getReceivablesHistory(@RequestParam("id") Long id) {
|
public CommonResult<ReceivablesHistoryRespVO> getReceivablesHistory(@RequestParam("id") Long id) {
|
||||||
ReceivablesHistoryDO receivablesHistory = receivablesHistoryService.getReceivablesHistory(id);
|
ReceivablesHistoryDetailDO receivablesHistoryDetail = receivablesHistoryService.getReceivablesHistoryDetail(id);
|
||||||
return success(BeanUtils.toBean(receivablesHistory, ReceivablesHistoryRespVO.class));
|
ReceivablesHistoryRespVO receivablesHistoryRespVO = new ReceivablesHistoryRespVO();
|
||||||
|
org.springframework.beans.BeanUtils.copyProperties(receivablesHistoryDetail, receivablesHistoryRespVO);
|
||||||
|
return success(receivablesHistoryRespVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得应收款管理历史记录分页")
|
@Operation(summary = "获得应收款管理历史记录分页")
|
||||||
@PreAuthorize("@ss.hasPermission('pms:receivables-history:query')")
|
@PreAuthorize("@ss.hasPermission('pms:receivables-history:query')")
|
||||||
public CommonResult<PageResult<ReceivablesHistoryRespVO>> getReceivablesHistoryPage(@Valid ReceivablesHistoryPageReqVO pageReqVO) {
|
public CommonResult<PageResult<ReceivablesHistoryRespVO>> getReceivablesHistoryPage(@Valid ReceivablesHistoryPageReqVO pageReqVO) {
|
||||||
PageResult<ReceivablesHistoryDO> pageResult = receivablesHistoryService.getReceivablesHistoryPage(pageReqVO);
|
PageResult<ReceivablesHistoryRespVO> pageResult = receivablesHistoryService.getReceivablesHistoryPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, ReceivablesHistoryRespVO.class));
|
return success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@ -86,7 +74,7 @@ public class ReceivablesHistoryController {
|
|||||||
public void exportReceivablesHistoryExcel(@Valid ReceivablesHistoryPageReqVO pageReqVO,
|
public void exportReceivablesHistoryExcel(@Valid ReceivablesHistoryPageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
List<ReceivablesHistoryDO> list = receivablesHistoryService.getReceivablesHistoryPage(pageReqVO).getList();
|
List<ReceivablesHistoryRespVO> list = receivablesHistoryService.getReceivablesHistoryPage(pageReqVO).getList();
|
||||||
// 导出 Excel
|
// 导出 Excel
|
||||||
ExcelUtils.write(response, "应收款管理历史记录.xls", "数据", ReceivablesHistoryRespVO.class,
|
ExcelUtils.write(response, "应收款管理历史记录.xls", "数据", ReceivablesHistoryRespVO.class,
|
||||||
BeanUtils.toBean(list, ReceivablesHistoryRespVO.class));
|
BeanUtils.toBean(list, ReceivablesHistoryRespVO.class));
|
||||||
|
@ -21,38 +21,4 @@ public class ReceivablesHistoryPageReqVO extends PageParam {
|
|||||||
@Schema(description = "主合同id ", example = "5479")
|
@Schema(description = "主合同id ", example = "5479")
|
||||||
private Long contractId;
|
private Long contractId;
|
||||||
|
|
||||||
@Schema(description = "方案阶段比例")
|
|
||||||
private String planStage;
|
|
||||||
|
|
||||||
@Schema(description = "初设阶段比例")
|
|
||||||
private String initialDesignStage;
|
|
||||||
|
|
||||||
@Schema(description = "施工图阶段比例")
|
|
||||||
private String constructionDrawingStage;
|
|
||||||
|
|
||||||
@Schema(description = "施工配合阶段")
|
|
||||||
private String constructionStage;
|
|
||||||
|
|
||||||
@Schema(description = "审定阶段")
|
|
||||||
private String approveStage;
|
|
||||||
|
|
||||||
@Schema(description = "回款情况")
|
|
||||||
private String collectionSituation;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
private LocalDateTime[] createTime;
|
|
||||||
|
|
||||||
@Schema(description = "流程实体id", example = "4399")
|
|
||||||
private String processInstanceId;
|
|
||||||
|
|
||||||
@Schema(description = "流程状态", example = "1")
|
|
||||||
private String processStatus;
|
|
||||||
|
|
||||||
@Schema(description = "应收款id", example = "22335")
|
|
||||||
private Long receivableId;
|
|
||||||
|
|
||||||
@Schema(description = "版本")
|
|
||||||
private String version;
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo;
|
|||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -12,6 +14,28 @@ import com.alibaba.excel.annotation.*;
|
|||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
public class ReceivablesHistoryRespVO {
|
public class ReceivablesHistoryRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("项目编号")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("合同名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "签订合同总额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("签订合同总额")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(description = "审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("审定金额")
|
||||||
|
private BigDecimal approvedAmount;
|
||||||
|
|
||||||
|
@Schema(description = "已完成的项目阶段", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("已完成的项目阶段")
|
||||||
|
private String preStage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20822")
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20822")
|
||||||
@ExcelProperty("主键")
|
@ExcelProperty("主键")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo;
|
package cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
@ -9,6 +12,28 @@ import jakarta.validation.constraints.*;
|
|||||||
@Data
|
@Data
|
||||||
public class ReceivablesHistorySaveReqVO {
|
public class ReceivablesHistorySaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("项目编号")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("合同名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "签订合同总额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("签订合同总额")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(description = "审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("审定金额")
|
||||||
|
private BigDecimal approvedAmount;
|
||||||
|
|
||||||
|
@Schema(description = "已完成的项目阶段", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("已完成的项目阶段")
|
||||||
|
private String preStage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20822")
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20822")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@ -21,17 +21,17 @@ public interface ReceivablesHistoryMapper extends BaseMapperX<ReceivablesHistory
|
|||||||
return selectPage(reqVO, new LambdaQueryWrapperX<ReceivablesHistoryDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<ReceivablesHistoryDO>()
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getProjectId, reqVO.getProjectId())
|
.eqIfPresent(ReceivablesHistoryDO::getProjectId, reqVO.getProjectId())
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getContractId, reqVO.getContractId())
|
.eqIfPresent(ReceivablesHistoryDO::getContractId, reqVO.getContractId())
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getPlanStage, reqVO.getPlanStage())
|
// .eqIfPresent(ReceivablesHistoryDO::getPlanStage, reqVO.getPlanStage())
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getInitialDesignStage, reqVO.getInitialDesignStage())
|
// .eqIfPresent(ReceivablesHistoryDO::getInitialDesignStage, reqVO.getInitialDesignStage())
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getConstructionDrawingStage, reqVO.getConstructionDrawingStage())
|
// .eqIfPresent(ReceivablesHistoryDO::getConstructionDrawingStage, reqVO.getConstructionDrawingStage())
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getConstructionStage, reqVO.getConstructionStage())
|
// .eqIfPresent(ReceivablesHistoryDO::getConstructionStage, reqVO.getConstructionStage())
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getApproveStage, reqVO.getApproveStage())
|
// .eqIfPresent(ReceivablesHistoryDO::getApproveStage, reqVO.getApproveStage())
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getCollectionSituation, reqVO.getCollectionSituation())
|
// .eqIfPresent(ReceivablesHistoryDO::getCollectionSituation, reqVO.getCollectionSituation())
|
||||||
.betweenIfPresent(ReceivablesHistoryDO::getCreateTime, reqVO.getCreateTime())
|
// .betweenIfPresent(ReceivablesHistoryDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getProcessInstanceId, reqVO.getProcessInstanceId())
|
// .eqIfPresent(ReceivablesHistoryDO::getProcessInstanceId, reqVO.getProcessInstanceId())
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getProcessStatus, reqVO.getProcessStatus())
|
// .eqIfPresent(ReceivablesHistoryDO::getProcessStatus, reqVO.getProcessStatus())
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getReceivableId, reqVO.getReceivableId())
|
// .eqIfPresent(ReceivablesHistoryDO::getReceivableId, reqVO.getReceivableId())
|
||||||
.eqIfPresent(ReceivablesHistoryDO::getVersion, reqVO.getVersion())
|
// .eqIfPresent(ReceivablesHistoryDO::getVersion, reqVO.getVersion())
|
||||||
.orderByDesc(ReceivablesHistoryDO::getId));
|
.orderByDesc(ReceivablesHistoryDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package cn.iocoder.yudao.module.pms.service.receivableshistory;
|
package cn.iocoder.yudao.module.pms.service.receivableshistory;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDetailDO;
|
||||||
import jakarta.validation.*;
|
import jakarta.validation.*;
|
||||||
import cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo.*;
|
import cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo.*;
|
||||||
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDO;
|
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDO;
|
||||||
@ -14,27 +16,14 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|||||||
*/
|
*/
|
||||||
public interface ReceivablesHistoryService {
|
public interface ReceivablesHistoryService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建应收款管理历史记录
|
|
||||||
*
|
|
||||||
* @param createReqVO 创建信息
|
|
||||||
* @return 编号
|
|
||||||
*/
|
|
||||||
Long createReceivablesHistory(@Valid ReceivablesHistorySaveReqVO createReqVO);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新应收款管理历史记录
|
* 更新应收款管理历史记录
|
||||||
*
|
*
|
||||||
* @param updateReqVO 更新信息
|
* @param updateReqVO 更新信息
|
||||||
*/
|
*/
|
||||||
void updateReceivablesHistory(@Valid ReceivablesHistorySaveReqVO updateReqVO);
|
void updateReceivablesHistory(Long loginUserId, @Valid ReceivablesHistorySaveReqVO updateReqVO);
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除应收款管理历史记录
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
*/
|
|
||||||
void deleteReceivablesHistory(Long id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得应收款管理历史记录
|
* 获得应收款管理历史记录
|
||||||
@ -42,7 +31,7 @@ public interface ReceivablesHistoryService {
|
|||||||
* @param id 编号
|
* @param id 编号
|
||||||
* @return 应收款管理历史记录
|
* @return 应收款管理历史记录
|
||||||
*/
|
*/
|
||||||
ReceivablesHistoryDO getReceivablesHistory(Long id);
|
ReceivablesHistoryDetailDO getReceivablesHistoryDetail(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得应收款管理历史记录分页
|
* 获得应收款管理历史记录分页
|
||||||
@ -50,6 +39,6 @@ public interface ReceivablesHistoryService {
|
|||||||
* @param pageReqVO 分页查询
|
* @param pageReqVO 分页查询
|
||||||
* @return 应收款管理历史记录分页
|
* @return 应收款管理历史记录分页
|
||||||
*/
|
*/
|
||||||
PageResult<ReceivablesHistoryDO> getReceivablesHistoryPage(ReceivablesHistoryPageReqVO pageReqVO);
|
PageResult<ReceivablesHistoryRespVO> getReceivablesHistoryPage(ReceivablesHistoryPageReqVO pageReqVO);
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.pms.service.receivableshistory;
|
package cn.iocoder.yudao.module.pms.service.receivableshistory;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.iocoder.yudao.module.cms.api.contract.ContractApi;
|
||||||
|
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractDTO;
|
||||||
|
import cn.iocoder.yudao.module.pms.dal.dataobject.projectschedule.ProjectScheduleDO;
|
||||||
|
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDetailDO;
|
||||||
|
import cn.iocoder.yudao.module.pms.service.projectschedule.ProjectScheduleService;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -9,19 +16,19 @@ import java.util.*;
|
|||||||
import cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo.*;
|
import cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo.*;
|
||||||
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDO;
|
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDO;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pms.dal.mysql.receivableshistory.ReceivablesHistoryMapper;
|
import cn.iocoder.yudao.module.pms.dal.mysql.receivableshistory.ReceivablesHistoryMapper;
|
||||||
|
|
||||||
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.cms.enums.ErrorCodeConstants.PARAM_NOT_EXISTS;
|
||||||
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
|
||||||
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应收款管理历史记录 Service 实现类
|
* 应收款管理历史记录 Service 实现类
|
||||||
*
|
|
||||||
* @author zqc
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
public class ReceivablesHistoryServiceImpl implements ReceivablesHistoryService {
|
public class ReceivablesHistoryServiceImpl implements ReceivablesHistoryService {
|
||||||
@ -29,30 +36,85 @@ public class ReceivablesHistoryServiceImpl implements ReceivablesHistoryService
|
|||||||
@Resource
|
@Resource
|
||||||
private ReceivablesHistoryMapper receivablesHistoryMapper;
|
private ReceivablesHistoryMapper receivablesHistoryMapper;
|
||||||
|
|
||||||
@Override
|
@Resource
|
||||||
public Long createReceivablesHistory(ReceivablesHistorySaveReqVO createReqVO) {
|
private AdminUserApi adminUserApi;
|
||||||
// 插入
|
|
||||||
ReceivablesHistoryDO receivablesHistory = BeanUtils.toBean(createReqVO, ReceivablesHistoryDO.class);
|
@Resource
|
||||||
receivablesHistoryMapper.insert(receivablesHistory);
|
private ContractApi contractApi;
|
||||||
// 返回
|
|
||||||
return receivablesHistory.getId();
|
@Resource
|
||||||
}
|
private ProjectScheduleService projectScheduleService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateReceivablesHistory(ReceivablesHistorySaveReqVO updateReqVO) {
|
public void updateReceivablesHistory(Long loginUserId, ReceivablesHistorySaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateReceivablesHistoryExists(updateReqVO.getId());
|
validateReceivablesHistoryExists(updateReqVO.getId());
|
||||||
|
projectScheduleService.validateProjectExists(updateReqVO.getProjectId());
|
||||||
|
contractApi.validContractExists(updateReqVO.getContractId());
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
ReceivablesHistoryDO updateObj = BeanUtils.toBean(updateReqVO, ReceivablesHistoryDO.class);
|
ReceivablesHistoryDO updateObj = BeanUtils.toBean(updateReqVO, ReceivablesHistoryDO.class);
|
||||||
|
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||||
|
if (userName == null) {
|
||||||
|
throw exception(USER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
updateObj.setUpdater(userName);
|
||||||
receivablesHistoryMapper.updateById(updateObj);
|
receivablesHistoryMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteReceivablesHistory(Long id) {
|
public ReceivablesHistoryDetailDO getReceivablesHistoryDetail(Long id) {
|
||||||
// 校验存在
|
// 校验
|
||||||
validateReceivablesHistoryExists(id);
|
if (id == null) {
|
||||||
// 删除
|
throw exception(RECEIVABLES_NOT_EXISTS);
|
||||||
receivablesHistoryMapper.deleteById(id);
|
}
|
||||||
|
ReceivablesHistoryDO receivablesHistoryDO = receivablesHistoryMapper.selectById(id);
|
||||||
|
if (receivablesHistoryDO == null) {
|
||||||
|
throw exception(RECEIVABLES_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long contractId = receivablesHistoryDO.getContractId();
|
||||||
|
Long projectId = receivablesHistoryDO.getProjectId();
|
||||||
|
projectScheduleService.validateProjectExists(projectId);
|
||||||
|
contractApi.validContractExists(contractId);
|
||||||
|
|
||||||
|
ReceivablesHistoryDetailDO receivablesHistoryDetailDO = new ReceivablesHistoryDetailDO();
|
||||||
|
|
||||||
|
ProjectScheduleDO projectSchedule = projectScheduleService.getProjectSchedule(projectId);
|
||||||
|
ContractDTO contractDTO = contractApi.getContractDTO(contractId);
|
||||||
|
|
||||||
|
receivablesHistoryDetailDO.setPreStage(projectSchedule.getPreStage());
|
||||||
|
|
||||||
|
BeanUtil.copyProperties(receivablesHistoryDO,receivablesHistoryDetailDO);
|
||||||
|
BeanUtil.copyProperties(projectSchedule,receivablesHistoryDetailDO);
|
||||||
|
BeanUtil.copyProperties(contractDTO,receivablesHistoryDetailDO);
|
||||||
|
|
||||||
|
return receivablesHistoryDetailDO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ReceivablesHistoryRespVO> getReceivablesHistoryPage(ReceivablesHistoryPageReqVO pageReqVO) {
|
||||||
|
|
||||||
|
// 校验
|
||||||
|
if (pageReqVO == null) {
|
||||||
|
throw exception(PARAM_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
PageResult<ReceivablesHistoryDO> receivablesHistoryDOPageResult = receivablesHistoryMapper.selectPage(pageReqVO);
|
||||||
|
List<ReceivablesHistoryDO> receivablesHistoryDOList = receivablesHistoryDOPageResult.getList();
|
||||||
|
List<ReceivablesHistoryDetailDO> receivablesHistoryDetailDOList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (ReceivablesHistoryDO receivablesHistoryDO : receivablesHistoryDOList) {
|
||||||
|
Long id = receivablesHistoryDO.getId();
|
||||||
|
ReceivablesHistoryDetailDO receivablesHistoryDetail = getReceivablesHistoryDetail(id);
|
||||||
|
receivablesHistoryDetailDOList.add(receivablesHistoryDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ReceivablesHistoryRespVO> respVOList = BeanUtils.toBean(receivablesHistoryDetailDOList, ReceivablesHistoryRespVO.class);
|
||||||
|
PageResult<ReceivablesHistoryRespVO> pageResult = new PageResult<>();
|
||||||
|
pageResult.setList(respVOList);
|
||||||
|
|
||||||
|
return pageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateReceivablesHistoryExists(Long id) {
|
private void validateReceivablesHistoryExists(Long id) {
|
||||||
@ -61,14 +123,4 @@ public class ReceivablesHistoryServiceImpl implements ReceivablesHistoryService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ReceivablesHistoryDO getReceivablesHistory(Long id) {
|
|
||||||
return receivablesHistoryMapper.selectById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageResult<ReceivablesHistoryDO> getReceivablesHistoryPage(ReceivablesHistoryPageReqVO pageReqVO) {
|
|
||||||
return receivablesHistoryMapper.selectPage(pageReqVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user