待我审核
parent
969b044daa
commit
c6a59d58a9
|
@ -1,6 +1,10 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.ExampleMatcher;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -27,7 +31,6 @@ import java.util.Map;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.TypedQuery;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
@ -42,8 +45,11 @@ import cn.palmte.work.model.enums.ProcessStatus;
|
|||
import cn.palmte.work.model.enums.ProcessType;
|
||||
import cn.palmte.work.model.enums.ProjectType;
|
||||
import cn.palmte.work.model.enums.SealType;
|
||||
import cn.palmte.work.model.process.SaleContractProcess;
|
||||
import cn.palmte.work.model.process.ProjectProcess;
|
||||
import cn.palmte.work.model.process.ProjectProcessRepository;
|
||||
import cn.palmte.work.model.process.SaleContract;
|
||||
import cn.palmte.work.model.process.SealTypeArray;
|
||||
import cn.palmte.work.model.process.form.ProcessQueryForm;
|
||||
import cn.palmte.work.model.process.form.SaleContractDetailForm;
|
||||
import cn.palmte.work.model.process.form.SaleContractProcessForm;
|
||||
import cn.palmte.work.service.ProjectBudgetService;
|
||||
|
@ -69,6 +75,8 @@ public class ProcessController {
|
|||
private final JdbcTemplate jdbcTemplate;
|
||||
private final EntityManager entityManager;
|
||||
|
||||
private final ProjectProcessRepository repository;
|
||||
|
||||
static class FormMetadata {
|
||||
// 部门
|
||||
|
||||
|
@ -188,7 +196,7 @@ public class ProcessController {
|
|||
@PostMapping
|
||||
@Transactional
|
||||
public void post(@RequestBody @Valid SaleContractProcessForm form) {
|
||||
SaleContractProcess entity = new SaleContractProcess();
|
||||
ProjectProcess entity = new ProjectProcess();
|
||||
BeanUtils.copyProperties(form, entity, "sealTypes", "applyDate", "applyDept");
|
||||
entity.setApplyDate(LocalDate.parse(form.getApplyDate(), formatter));
|
||||
entity.setSealTypes(SealTypeArray.of(form.getSealTypes()));
|
||||
|
@ -196,6 +204,12 @@ public class ProcessController {
|
|||
|
||||
entityManager.persist(entity);
|
||||
|
||||
SaleContract saleContract = new SaleContract();
|
||||
BeanUtils.copyProperties(form, saleContract);
|
||||
|
||||
saleContract.setProcessId(entity.getId());
|
||||
entityManager.persist(saleContract);
|
||||
|
||||
List<SaleContractDetailForm> incomeDetails = form.getIncomeDetails();
|
||||
if (!CollectionUtils.isEmpty(incomeDetails)) {
|
||||
jdbcTemplate.batchUpdate("update project_budget_income_detail set expiration_date =? where id =? ",
|
||||
|
@ -216,37 +230,41 @@ public class ProcessController {
|
|||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
static class ProcessQueryForm {
|
||||
|
||||
private String projectNo;
|
||||
private String projectTitle;
|
||||
private String applyPersonName;
|
||||
|
||||
private ProcessType processType;
|
||||
private ProcessStatus processStatus;
|
||||
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/query")
|
||||
public List<SaleContractProcess> list(@RequestBody ProcessQueryForm form) {
|
||||
TypedQuery<SaleContractProcess> query = entityManager.createQuery(
|
||||
"from SaleContractProcess ", SaleContractProcess.class);
|
||||
public Page<ProjectProcess> list(@RequestBody ProcessQueryForm form, Pageable pageable) {
|
||||
|
||||
// query.setMaxResults();
|
||||
return query.getResultList();
|
||||
// QueryHelper h = new QueryHelper("select * ", "from project_process ");
|
||||
// h.addCondition(form.projectNo != null, "project_no=?", form.projectNo);
|
||||
// h.addCondition(form.projectTitle != null, "project_title like concat('%',?,'%')", form.projectTitle);
|
||||
// h.addCondition(form.applyPersonName != null, "apply_person_name like concat('%',?,'%')", form.applyPersonName);
|
||||
// h.addCondition(form.processType != null, "process_type = ?", () -> form.processType.getValue());
|
||||
// h.addCondition(form.processStatus != null, "status = ?", () -> form.processStatus.getValue());
|
||||
|
||||
// String sql = h.getSql();
|
||||
ProjectProcess projectProcess = new ProjectProcess();
|
||||
BeanUtils.copyProperties(form, projectProcess);
|
||||
projectProcess.setStatus(form.getProcessStatus());
|
||||
|
||||
ExampleMatcher exampleMatcher = ExampleMatcher.matching()
|
||||
.withMatcher("projectTitle", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("applyPersonName", ExampleMatcher.GenericPropertyMatcher::contains);
|
||||
|
||||
return repository.findAll(Example.of(projectProcess, exampleMatcher), pageable);
|
||||
}
|
||||
|
||||
// 审核
|
||||
@Data
|
||||
static class AuditForm {
|
||||
|
||||
// 流程ID
|
||||
private Integer processId;
|
||||
|
||||
// 审核意见
|
||||
@NotNull
|
||||
private String auditOpinion;
|
||||
|
||||
// 审核状态
|
||||
private ProcessStatus processStatus;
|
||||
|
||||
}
|
||||
|
@ -257,4 +275,11 @@ public class ProcessController {
|
|||
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping("/detail/{id}")
|
||||
public ProjectProcess get(@PathVariable("id") int id, Model model) {
|
||||
// model.addAttribute();
|
||||
return entityManager.find(ProjectProcess.class, id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package cn.palmte.work.model.enums;
|
||||
|
||||
/**
|
||||
* 采购模式
|
||||
*
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/21 11:47
|
||||
*/
|
||||
public enum ProcurementMode implements Enumerable<String> {
|
||||
|
||||
specify_purchase("指定采购"),
|
||||
simple_price_comparison("简单比价"),
|
||||
price_comparison("比价"),
|
||||
competitive_evaluation("竞争性评估");
|
||||
|
||||
private final String description;
|
||||
|
||||
ProcurementMode(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package cn.palmte.work.model.process;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import cn.palmte.work.model.enums.ProcurementMode;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 采购合同
|
||||
*
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/21 11:47
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "procurement_contract")
|
||||
public class ProcurementContract {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
|
||||
private Integer id;
|
||||
|
||||
private ProcurementMode mode;
|
||||
|
||||
private String supplierName;
|
||||
|
||||
// 收款条件
|
||||
private String paymentTerms;
|
||||
|
||||
private Integer processId;
|
||||
}
|
|
@ -15,18 +15,19 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
|
||||
import cn.palmte.work.model.enums.ProcessStatus;
|
||||
import cn.palmte.work.model.enums.ProcessType;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 销售合同流程
|
||||
* 项目相关的流程
|
||||
*
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/14 16:11
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "sale_contract_process")
|
||||
public class SaleContractProcess {
|
||||
@Table(name = "project_process")
|
||||
public class ProjectProcess {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -52,18 +53,12 @@ public class SaleContractProcess {
|
|||
// 申请部门领导
|
||||
private String applyDeptLeaderName;
|
||||
|
||||
// 申请人电话
|
||||
private String applyPersonPhone;
|
||||
|
||||
// 合同编号
|
||||
private String contractNo;
|
||||
|
||||
// 合同名称
|
||||
private String contractName;
|
||||
|
||||
// 客户名称
|
||||
private String clientName;
|
||||
|
||||
// 用印类型
|
||||
@Convert(converter = SealTypeArrayConverter.class)
|
||||
private SealTypeArray sealTypes;
|
||||
|
@ -71,9 +66,6 @@ public class SaleContractProcess {
|
|||
// 税率
|
||||
private String taxRate;
|
||||
|
||||
// 收款条件
|
||||
private String paymentTerms;
|
||||
|
||||
// 状态
|
||||
@Enumerated(EnumType.STRING)
|
||||
private ProcessStatus status;
|
||||
|
@ -86,6 +78,10 @@ public class SaleContractProcess {
|
|||
|
||||
private LocalDateTime createAt;
|
||||
|
||||
private ProcessType processType;
|
||||
|
||||
private String remark;
|
||||
|
||||
// 项目类型
|
||||
// @Enumerated(EnumType.STRING)
|
||||
// private ProjectType projectType;
|
|
@ -0,0 +1,15 @@
|
|||
package cn.palmte.work.model.process;
|
||||
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/14 17:13
|
||||
*/
|
||||
public interface ProjectProcessRepository extends PagingAndSortingRepository<ProjectProcess, Integer> {
|
||||
|
||||
Page<ProjectProcess> findAll(Example<ProjectProcess> example, Pageable pageable);
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package cn.palmte.work.model.process;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 销售合同
|
||||
*
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/21 11:40
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "sale_contract")
|
||||
public class SaleContract {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
|
||||
private Integer id;
|
||||
|
||||
// 客户名称
|
||||
private String clientName;
|
||||
|
||||
// 收款条件
|
||||
private String paymentTerms;
|
||||
|
||||
// 申请人电话
|
||||
private String applyPersonPhone;
|
||||
|
||||
private Integer processId;
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package cn.palmte.work.model.process;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/14 17:13
|
||||
*/
|
||||
public interface SaleContractProcessRepository extends JpaRepository<SaleContractProcess, Integer> {
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package cn.palmte.work.model.process.form;
|
||||
|
||||
import cn.palmte.work.model.enums.ProcessStatus;
|
||||
import cn.palmte.work.model.enums.ProcessType;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/21 17:18
|
||||
*/
|
||||
@Data
|
||||
public class ProcessQueryForm {
|
||||
|
||||
private String projectNo;
|
||||
private String projectTitle;
|
||||
private String applyPersonName;
|
||||
|
||||
private ProcessType processType;
|
||||
private ProcessStatus processStatus;
|
||||
|
||||
}
|
|
@ -34,7 +34,8 @@ multipart.maxRequestSize=20Mb
|
|||
spring.http.multipart.maxFileSize=20Mb
|
||||
spring.http.multipart.maxRequestSize=20Mb
|
||||
|
||||
|
||||
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
||||
spring.data.rest.page-param-name=page
|
||||
|
||||
fourcal.token.api.prefix=fourcalapi
|
||||
fourcal.token.api.expires=60*60*24
|
||||
|
|
|
@ -1,38 +1,52 @@
|
|||
# 创建 流程表
|
||||
create table sale_contract_process
|
||||
# 创建 项目流程表
|
||||
# 针对不通过流程需要创建不同表
|
||||
|
||||
create table project_process
|
||||
(
|
||||
id int auto_increment primary key,
|
||||
apply_date date null,
|
||||
apply_dept varchar(255) null,
|
||||
apply_dept_leader_name varchar(255) null,
|
||||
apply_person_name varchar(255) null,
|
||||
apply_person_phone varchar(255) null,
|
||||
client_name varchar(255) null,
|
||||
contract_name varchar(255) null,
|
||||
contract_no varchar(255) null,
|
||||
payment_terms varchar(255) null,
|
||||
project_id int null,
|
||||
project_no varchar(255) null,
|
||||
id int auto_increment primary key comment 'ID',
|
||||
apply_date date null comment '申请时间',
|
||||
apply_dept varchar(255) null comment '申请部门',
|
||||
apply_dept_leader_name varchar(255) null comment '申请人领导',
|
||||
apply_person_name varchar(255) null comment '申请人姓名',
|
||||
contract_name varchar(255) null comment '合同名称',
|
||||
contract_no varchar(255) null comment '合同编号',
|
||||
project_id int null comment '项目ID',
|
||||
project_no varchar(255) null comment '项目编号',
|
||||
project_title varchar(255) null comment '标题',
|
||||
seal_types varchar(255) null comment '印章类型',
|
||||
`status` varchar(255) null,
|
||||
tax_rate varchar(255) null,
|
||||
`status` varchar(255) null comment '流程状态',
|
||||
tax_rate varchar(255) null comment '税率',
|
||||
process_type varchar(255) null comment '流程类型',
|
||||
remark text null comment '备注',
|
||||
|
||||
current_audit varchar(255) null comment '当前审核人',
|
||||
|
||||
create_at datetime default CURRENT_TIMESTAMP comment '创建时间',
|
||||
last_update_at datetime on update CURRENT_TIMESTAMP comment '最后更新时间'
|
||||
last_update_at datetime default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '最后更新时间'
|
||||
|
||||
);
|
||||
|
||||
alter table project_process
|
||||
modify last_update_at datetime default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '最后更新时间';
|
||||
|
||||
alter table sale_contract_process
|
||||
add current_audit varchar(255) null comment '当前审核人';
|
||||
|
||||
alter table sale_contract_process
|
||||
add create_at datetime default CURRENT_TIMESTAMP comment '创建时间';
|
||||
alter table sale_contract_process
|
||||
add last_update_at datetime on update CURRENT_TIMESTAMP comment '最后更新时间';
|
||||
# 采购合同
|
||||
create table procurement_contract
|
||||
(
|
||||
id int auto_increment primary key comment 'ID',
|
||||
`mode` varchar(255) null comment '采购模式',
|
||||
payment_terms text null comment '付款条件',
|
||||
process_id int null comment '流程ID',
|
||||
supplier_name varchar(255) null comment '供应商名称'
|
||||
);
|
||||
|
||||
# 销售合同
|
||||
create table sale_contract
|
||||
(
|
||||
id int auto_increment primary key comment 'ID',
|
||||
apply_person_phone varchar(255) null comment '申请人电话',
|
||||
client_name varchar(255) null comment '客户名称',
|
||||
payment_terms text null comment '收款条件',
|
||||
process_id int null comment '流程ID'
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
<el-form-item label="流程类型">
|
||||
<el-select v-model="queryForm.processType" placeholder="请选择">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option label="全部" :value="null"></el-option>
|
||||
<#list processTypes as processType>
|
||||
<el-option label="${processType.description}"
|
||||
value="${processType.name()}"></el-option>
|
||||
|
@ -225,6 +225,12 @@
|
|||
const form = {
|
||||
...this.queryForm,
|
||||
}
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在查询',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
|
||||
fetch("${base}/process/query", {
|
||||
method: 'POST', // or 'PUT'
|
||||
|
@ -237,8 +243,9 @@
|
|||
this.tableData = data
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error('项目搜索失败');
|
||||
this.$message.error('查询失败');
|
||||
})
|
||||
.finally(() => loading.close())
|
||||
},
|
||||
|
||||
handlePageChange(val) {
|
||||
|
|
Loading…
Reference in New Issue