1. 待审核合同列表
This commit is contained in:
parent
736cabee9a
commit
044d8e49e9
|
|
@ -80,7 +80,11 @@ public enum BusinessType
|
|||
/**
|
||||
* 预览
|
||||
*/
|
||||
PREVIEW(15, "预览")
|
||||
PREVIEW(15, "预览"),
|
||||
/**
|
||||
* 审核
|
||||
*/
|
||||
AUDIT(16, "审核"),
|
||||
;
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.chushang.inspection.project.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 合同返回 所需参数
|
||||
* @auther: zhao
|
||||
* @date: 2024/7/4 16:25
|
||||
*/
|
||||
@Data
|
||||
public class WrkAuditVO {
|
||||
}
|
||||
|
|
@ -25,35 +25,28 @@ public class WrkAuditController {
|
|||
@Resource
|
||||
WrkAuditService auditService;
|
||||
|
||||
/**
|
||||
* 审核列表
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
@RequiresPermissions("project:audit:list")
|
||||
public AjaxResult pageList(@Validated PageAuditDTO auditDTO){
|
||||
return AjaxResult.success(auditService.pageList(auditDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
* 传递合同id
|
||||
*/
|
||||
@PostMapping(value = "/audit/{auditId}")
|
||||
@PostMapping(value = "/audit/{contractId}")
|
||||
@RequiresPermissions("project:audit:audit")
|
||||
public AjaxResult audit(@PathVariable Long auditId,
|
||||
public AjaxResult audit(@PathVariable Long contractId,
|
||||
@RequestBody@Validated AuditDTO auditDTO)
|
||||
{
|
||||
auditService.audit(auditId, auditDTO);
|
||||
auditService.audit(contractId, auditDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 审核记录
|
||||
* 审核
|
||||
* 传递合同id
|
||||
*/
|
||||
@SysLog(value = "审核记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping(value = "/del/{auditId}")
|
||||
@RequiresPermissions(value = "project:audit:del")
|
||||
public AjaxResult del(@PathVariable Long auditId){
|
||||
auditService.removeById(auditId);
|
||||
@PostMapping(value = "/revoke/{contractId}")
|
||||
@RequiresPermissions("project:audit:revoke")
|
||||
public AjaxResult revoke(@PathVariable Long contractId)
|
||||
{
|
||||
auditService.revoke(contractId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ public class WrkProjectController {
|
|||
|
||||
/**
|
||||
* 合同新增
|
||||
* 续签
|
||||
*/
|
||||
@PostMapping(value = "/contract/save")
|
||||
@SysLog(value = "合同", businessType = BusinessType.INSERT)
|
||||
|
|
@ -134,6 +135,9 @@ public class WrkProjectController {
|
|||
CommonParam commonParam = CommonParam.buildPageRequest();
|
||||
return AjaxResult.success(contractService.pageList(contract, commonParam));
|
||||
}
|
||||
/**
|
||||
* 待审核 合同 列表 -->
|
||||
*/
|
||||
|
||||
// /**
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.chushang.inspection.project.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
|
@ -26,59 +27,49 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @auther: zhao
|
||||
* @date: 2024/6/15 10:51
|
||||
*/
|
||||
* @auther: zhao
|
||||
* @date: 2024/6/15 10:51
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WrkAuditService extends ServiceImpl<WrkAuditMapper, WrkAudit> implements IService<WrkAudit> {
|
||||
|
||||
@Resource
|
||||
WrkProjectContractService contractService;
|
||||
@Resource
|
||||
WrkProjectService wrkProjectService;
|
||||
|
||||
@DataScope
|
||||
public PageResult pageList(PageAuditDTO auditDTO)
|
||||
{
|
||||
CommonParam commonParam = CommonParam.buildPageRequest();
|
||||
LambdaQueryWrapper<WrkAudit> auditSql = WrapperUtils.builder(auditDTO,commonParam);
|
||||
IPage<WrkAudit> page = this.page(
|
||||
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
|
||||
auditSql
|
||||
);
|
||||
return new PageResult(page);
|
||||
}
|
||||
|
||||
@DataScope
|
||||
public List<WrkAudit> allList(PageAuditDTO auditDTO)
|
||||
{
|
||||
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||
LambdaQueryWrapper<WrkAudit> auditSql = WrapperUtils.builder(auditDTO,commonParam);
|
||||
return this.list(auditSql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同 或者 项目 审核
|
||||
* 合同 只有 初审
|
||||
*/
|
||||
@Transactional
|
||||
public void audit(Long auditId, AuditDTO audit)
|
||||
{
|
||||
|
||||
WrkAudit byId = getById(auditId);
|
||||
AssertUtil.invalidate(null == byId, "审核记录不存在");
|
||||
Integer thirdAuditStatus = audit.getAuditStatus();
|
||||
AssertUtil.invalidate(Objects.equals(byId.getAuditStatus(), thirdAuditStatus), "审核状态不能重复审核");
|
||||
|
||||
// 更新审核状态
|
||||
public void audit(Long contractId, AuditDTO audit) {
|
||||
// 去查询合同信息, 需要确保合同存在,
|
||||
// 合同信息
|
||||
WrkProjectContract contract = contractService.getById(contractId);
|
||||
AssertUtil.invalidate(ObjectUtil.isEmpty(contract), "待审核合同为空");
|
||||
Long projectId = contract.getProjectId();
|
||||
// 当前审核状态
|
||||
Integer currAuditStatus = contract.getAuditStatus();
|
||||
// 审核状态
|
||||
Integer auditStatus = audit.getAuditStatus();
|
||||
// 待 初审
|
||||
if (1 == currAuditStatus) {
|
||||
AssertUtil.invalidate(3 != auditStatus && 5 != auditStatus, "待初审时, 审核状态应当为初审通过或者初审驳回");
|
||||
}
|
||||
WrkAudit wrkAudit = new WrkAudit();
|
||||
// 此处为 新增一条 审核信息
|
||||
// wrkAudit.setAuditId(auditId);
|
||||
wrkAudit.setThirdId(contractId);
|
||||
wrkAudit.setThirdType(1);
|
||||
wrkAudit.setAuditStatus(audit.getAuditStatus());
|
||||
wrkAudit.setAuditName(SecurityUtils.getUsername());
|
||||
wrkAudit.setAuditUserId(SecurityUtils.getUserId());
|
||||
wrkAudit.setRemark(audit.getRemark());
|
||||
wrkAudit.setAuditTime(LocalDateTime.now());
|
||||
wrkAudit.setThirdId(byId.getThirdId());
|
||||
wrkAudit.setThirdType(byId.getThirdType());
|
||||
|
||||
// 同时需要更新 合同内的审核状态
|
||||
save(wrkAudit);
|
||||
// 此处需要判断 审核状态
|
||||
/**
|
||||
* 未提交 0
|
||||
|
|
@ -90,29 +81,38 @@ public class WrkAuditService extends ServiceImpl<WrkAuditMapper, WrkAudit> imple
|
|||
* 复审驳回 6
|
||||
* 已撤销 7
|
||||
*/
|
||||
if (Objects.equals(byId.getThirdType(), 0)) {
|
||||
// 项目审核
|
||||
// projectService.updateState(byId.getThirdId(), auditStatus);
|
||||
} else {
|
||||
// 合同审核
|
||||
contractService.updateAuditStatus(byId.getThirdId(), thirdAuditStatus);
|
||||
}
|
||||
// 同时需要更新 合同内的审核状态
|
||||
updateById(wrkAudit);
|
||||
// if (Objects.equals(wrkAudit.getThirdType(), 0)) {
|
||||
// // 项目审核
|
||||
//// projectService.updateState(byId.getThirdId(), auditStatus);
|
||||
// } else {
|
||||
// 合同审核
|
||||
contractService.updateAuditStatus(wrkAudit.getThirdId(), auditStatus);
|
||||
wrkProjectService.updateAuditStatus(projectId, auditStatus);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 合同以及合同对应的 审核列表
|
||||
*/
|
||||
public WrkProjectContract getContractInfo(Long contractId)
|
||||
{
|
||||
public WrkProjectContract getContractInfo(Long contractId) {
|
||||
// 合同信息
|
||||
WrkProjectContract contract = contractService.getById(contractId);
|
||||
if (null != contract){
|
||||
if (null != contract) {
|
||||
PageAuditDTO pageAuditDTO = new PageAuditDTO();
|
||||
pageAuditDTO.setThirdIds(Collections.singletonList(contractId));
|
||||
contract.setAudits(allList(pageAuditDTO));
|
||||
}
|
||||
return contract;
|
||||
}
|
||||
|
||||
@DataScope
|
||||
public List<WrkAudit> allList(PageAuditDTO auditDTO) {
|
||||
CommonParam commonParam = CommonParam.buildAllRequest();
|
||||
LambdaQueryWrapper<WrkAudit> auditSql = WrapperUtils.builder(auditDTO, commonParam);
|
||||
return this.list(auditSql);
|
||||
}
|
||||
|
||||
public void revoke(Long contractId) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.chushang.common.core.exception.utils.AssertUtil;
|
|||
import com.chushang.common.mybatis.page.CommonParam;
|
||||
import com.chushang.common.mybatis.utils.PageResult;
|
||||
import com.chushang.common.mybatis.utils.WrapperUtils;
|
||||
import com.chushang.inspection.project.dto.PageAuditDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
@ -14,6 +15,8 @@ import com.chushang.inspection.project.mapper.WrkProjectContractMapper;
|
|||
import com.chushang.inspection.project.po.WrkProjectContract;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @auther: zhao
|
||||
* @date: 2024/6/15 10:51
|
||||
|
|
@ -54,8 +57,6 @@ public class WrkProjectContractService extends ServiceImpl<WrkProjectContractMap
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改 合同的 审核状态
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -152,20 +152,24 @@ public class WrkProjectService extends ServiceImpl<WrkProjectMapper, WrkProject>
|
|||
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
projectContract.setDeptId(deptId);
|
||||
// 新增合同的时候, 为待初审状态
|
||||
projectContract.setAuditStatus(1);
|
||||
contractService.save(projectContract);
|
||||
updateState(contract.getProjectId(), projectEffect ? 1 : 0 );
|
||||
// 新增合同的时候, 项目状态为待初审状态
|
||||
// updateAuditStatus(contract.getProjectId(), 1);
|
||||
|
||||
Integer auditStatus = contract.getAuditStatus();
|
||||
if (null != auditStatus && (1 == auditStatus || 2 == auditStatus)){
|
||||
// 新增合同的审核记录
|
||||
WrkAudit audit = new WrkAudit();
|
||||
audit.setThirdType(1);
|
||||
audit.setDeptId(deptId);
|
||||
audit.setAuditStatus(auditStatus);
|
||||
audit.setThirdId(projectContract.getContractId());
|
||||
audit.setRemark(contract.getRemark());
|
||||
auditService.save(audit);
|
||||
}
|
||||
// Integer auditStatus = contract.getAuditStatus();
|
||||
// if (null != auditStatus && (1 == auditStatus || 2 == auditStatus)){
|
||||
// // 新增合同的审核记录
|
||||
// WrkAudit audit = new WrkAudit();
|
||||
// audit.setThirdType(1);
|
||||
// audit.setDeptId(deptId);
|
||||
// audit.setAuditStatus(auditStatus);
|
||||
// audit.setThirdId(projectContract.getContractId());
|
||||
// audit.setRemark(contract.getRemark());
|
||||
// auditService.save(audit);
|
||||
// }
|
||||
return projectContract.getContractId();
|
||||
}
|
||||
|
||||
|
|
@ -222,4 +226,11 @@ public class WrkProjectService extends ServiceImpl<WrkProjectMapper, WrkProject>
|
|||
}
|
||||
return wrkProject;
|
||||
}
|
||||
|
||||
public void updateAuditStatus(Long projectId, Integer auditStatus) {
|
||||
WrkProject project = new WrkProject();
|
||||
project.setProjectId(projectId);
|
||||
project.setAuditStatus(auditStatus);
|
||||
updateById(project);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,38 @@
|
|||
package com.chushang.inspection.work.controller;
|
||||
import com.chushang.common.core.web.AjaxResult;
|
||||
import com.chushang.common.log.annotation.SysLog;
|
||||
import com.chushang.common.log.enums.BusinessType;
|
||||
import com.chushang.inspection.project.dto.AuditDTO;
|
||||
import com.chushang.inspection.project.service.WrkAuditService;
|
||||
import com.chushang.inspection.work.service.WrkInfoAuditService;
|
||||
import com.chushang.security.annotation.RequiresPermissions;
|
||||
import lombok.extern.java.Log;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 工单审核表(wrk_info_audit)表控制层
|
||||
*
|
||||
* 工单审核相关接口
|
||||
* @author xxxxx
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wrk_info_audit")
|
||||
@RequestMapping("/wrk/audit")
|
||||
public class WrkInfoAuditController {
|
||||
|
||||
@Resource
|
||||
private WrkInfoAuditService wrkInfoAuditService;
|
||||
|
||||
|
||||
/**
|
||||
* 工单审核
|
||||
*/
|
||||
@PostMapping ("/audit")
|
||||
@RequiresPermissions("wrk:info:audit")
|
||||
@SysLog(value = "工单审核", businessType = BusinessType.AUDIT)
|
||||
public AjaxResult audit(@Validated @RequestBody AuditDTO audit) {
|
||||
wrkInfoAuditService.audit(audit);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
package com.chushang.inspection.work.service;
|
||||
|
||||
import com.chushang.inspection.project.dto.AuditDTO;
|
||||
import com.chushang.inspection.work.po.WrkInfoAudit;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
/**
|
||||
* @auther: zhao
|
||||
* @date: 2024/6/27 18:13
|
||||
*/
|
||||
public interface WrkInfoAuditService extends IService<WrkInfoAudit>{
|
||||
|
||||
/**
|
||||
* @auther: zhao
|
||||
* @date: 2024/6/27 18:13
|
||||
*/
|
||||
public interface WrkInfoAuditService extends IService<WrkInfoAudit> {
|
||||
|
||||
|
||||
void audit(AuditDTO audit);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.chushang.inspection.work.service.impl;
|
||||
|
||||
import com.chushang.inspection.project.dto.AuditDTO;
|
||||
import com.chushang.inspection.work.service.WrkInfoAuditService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
@ -12,5 +13,12 @@ import com.chushang.inspection.work.po.WrkInfoAudit;
|
|||
*/
|
||||
@Service
|
||||
public class WrkInfoAuditServiceImpl extends ServiceImpl<WrkInfoAuditMapper, WrkInfoAudit> implements WrkInfoAuditService {
|
||||
/**
|
||||
* 工单审核
|
||||
* @param audit 审核所需
|
||||
*/
|
||||
@Override
|
||||
public void audit(AuditDTO audit) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue