Merge remote-tracking branch 'origin/1.2.0' into 1.2.0
commit
0549cba65e
|
@ -163,6 +163,10 @@ public class ProcessController {
|
|||
*/
|
||||
@GetMapping("/completed")
|
||||
public String completed(Model model) {
|
||||
Admin admin = getLoginUser();
|
||||
// 超级管理员,只有查看权限,不能编辑和删除除非是自己的
|
||||
model.addAttribute("adminId", admin.getId());
|
||||
model.addAttribute("isAdmin", isAdministrator(admin));
|
||||
model.addAttribute("processTypes", ProcessType.values());
|
||||
model.addAttribute("processStatus", ProcessStatus.values());
|
||||
return "/admin/business/process-completed";
|
||||
|
@ -534,12 +538,16 @@ public class ProcessController {
|
|||
|
||||
Integer contractId = contract.getId();
|
||||
|
||||
// 本次表单的数据为全量数据 需要删除
|
||||
List<SupplierMaterial> supplierMaterialsToRemove = processService.getSupplierMaterials(processId);
|
||||
if (!CollectionUtils.isEmpty(form.supplierMaterials)) {
|
||||
for (SupplierMaterial material : form.supplierMaterials) {
|
||||
material.setProcessId(processId);
|
||||
material.setContractId(contractId);
|
||||
// 更新或者新增
|
||||
if (material.getId() != null) {
|
||||
// 更新了某个ID的数据就不删除了
|
||||
supplierMaterialsToRemove.remove(material);
|
||||
entityManager.merge(material);
|
||||
}
|
||||
else {
|
||||
|
@ -548,16 +556,21 @@ public class ProcessController {
|
|||
}
|
||||
}
|
||||
|
||||
for (SupplierMaterial material : supplierMaterialsToRemove) {
|
||||
entityManager.remove(material);
|
||||
}
|
||||
|
||||
List<BudgetPurchaseAmount> purchaseAmountToRemove = processService.getProcessPurchaseAmount(processId);
|
||||
List<BudgetPurchaseDetail> purchaseDetailToRemove = processService.getProcessPurchaseDetail(processId);
|
||||
|
||||
if (!CollectionUtils.isEmpty(form.purchaseAmount)) {
|
||||
for (BudgetPurchaseAmountModel amountForm : form.purchaseAmount) {
|
||||
// 草稿模式也不允许为空 (基础数据), 更新ID不能为空
|
||||
Assert.notNull(amountForm.amount, "合同明细填写不完整");
|
||||
Assert.notNull(amountForm.amountId, "合同明细填写不完整");
|
||||
Assert.notNull(amountForm.budgetCostId, "合同明细填写不完整");
|
||||
|
||||
// 新建
|
||||
BudgetPurchaseAmount purchaseAmount = new BudgetPurchaseAmount();
|
||||
purchaseAmount.setId(amountForm.amountId);
|
||||
purchaseAmount.setProcessId(processId);
|
||||
purchaseAmount.setContractId(contractId);
|
||||
purchaseAmount.setAmount(amountForm.amount);
|
||||
|
@ -571,7 +584,15 @@ public class ProcessController {
|
|||
purchaseAmount.setSubmit(true);
|
||||
}
|
||||
|
||||
entityManager.merge(purchaseAmount);
|
||||
if (amountForm.amountId != null) {
|
||||
// 更新了某个ID的数据就不删除了
|
||||
purchaseAmount.setId(amountForm.amountId);
|
||||
purchaseAmountToRemove.remove(purchaseAmount);
|
||||
entityManager.merge(purchaseAmount);
|
||||
}
|
||||
else {
|
||||
entityManager.persist(purchaseAmount);
|
||||
}
|
||||
|
||||
Integer amountId = purchaseAmount.getId(); // ID 自动生成或者使用之前已经有的
|
||||
// 保存成本对应的 明细
|
||||
|
@ -579,19 +600,35 @@ public class ProcessController {
|
|||
for (BudgetPurchaseDetailModel detail : amountForm.details) {
|
||||
BudgetPurchaseDetail purchaseDetail = new BudgetPurchaseDetail();
|
||||
// 关联主键
|
||||
purchaseDetail.setId(detail.id);
|
||||
purchaseDetail.setAmountId(amountId);
|
||||
purchaseDetail.setProcessId(processId);
|
||||
purchaseDetail.setContractId(contractId);
|
||||
purchaseDetail.setBudgetCostId(amountForm.budgetCostId);
|
||||
|
||||
BeanUtils.copyProperties(detail, purchaseDetail, "details");
|
||||
entityManager.merge(purchaseDetail);
|
||||
|
||||
if (detail.id != null) {
|
||||
// 更新了某个ID的数据就不删除了
|
||||
purchaseDetail.setId(detail.id);
|
||||
purchaseDetailToRemove.remove(purchaseDetail);
|
||||
entityManager.merge(purchaseDetail);
|
||||
}
|
||||
else {
|
||||
entityManager.persist(purchaseDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
for (BudgetPurchaseAmount amount : purchaseAmountToRemove) {
|
||||
entityManager.remove(amount);
|
||||
}
|
||||
|
||||
for (BudgetPurchaseDetail detail : purchaseDetailToRemove) {
|
||||
entityManager.remove(detail);
|
||||
}
|
||||
}
|
||||
|
||||
if (form.getStatus() == ProcessStatus.to_be_audit) {
|
||||
|
@ -703,8 +740,7 @@ public class ProcessController {
|
|||
}
|
||||
|
||||
private boolean isStartAuditProgress(ProjectTaskRecord record) {
|
||||
return Objects.equals("提交申请", record.getTaskName())
|
||||
&& Objects.equals("提交销售合同流程", record.getTaskComment());
|
||||
return Objects.equals("提交申请", record.getTaskName());
|
||||
}
|
||||
|
||||
private ProjectProcess obtainProjectProcess(int id) {
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package cn.palmte.work.model.process;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
@ -12,7 +14,10 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 采购合同流程预算采购明细的数量记录
|
||||
|
@ -25,7 +30,10 @@ import lombok.Data;
|
|||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/28 14:15
|
||||
*/
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@Entity
|
||||
@Table(name = "procurement_contract_budget_purchase_amount")
|
||||
public class BudgetPurchaseAmount implements Serializable {
|
||||
|
@ -60,4 +68,19 @@ public class BudgetPurchaseAmount implements Serializable {
|
|||
return submit != null && submit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o))
|
||||
return false;
|
||||
BudgetPurchaseAmount that = (BudgetPurchaseAmount) o;
|
||||
return id != null && Objects.equals(id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getClass().hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package cn.palmte.work.model.process;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
@ -12,6 +14,10 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 采购合同流程预算采购明细的详情
|
||||
|
@ -21,7 +27,10 @@ import lombok.Data;
|
|||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/28 11:41
|
||||
*/
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@Entity
|
||||
@Table(name = "procurement_contract_budget_purchase_detail")
|
||||
public class BudgetPurchaseDetail implements Serializable {
|
||||
|
@ -62,4 +71,19 @@ public class BudgetPurchaseDetail implements Serializable {
|
|||
// 项目的成本明细ID
|
||||
private Integer budgetCostId;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o))
|
||||
return false;
|
||||
BudgetPurchaseDetail that = (BudgetPurchaseDetail) o;
|
||||
return id != null && Objects.equals(id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getClass().hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -384,7 +384,7 @@ public class ProjectProcessService {
|
|||
return amountQuery.getResultList();
|
||||
}
|
||||
catch (NoResultException e) {
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -408,6 +408,18 @@ public class ProjectProcessService {
|
|||
return amountQuery.getResultList();
|
||||
}
|
||||
|
||||
public List<BudgetPurchaseDetail> getProcessPurchaseDetail(Integer processId) {
|
||||
TypedQuery<BudgetPurchaseDetail> amountQuery = entityManager.createQuery(
|
||||
"from BudgetPurchaseDetail where processId=:processId", BudgetPurchaseDetail.class);
|
||||
amountQuery.setParameter("processId", processId);
|
||||
try {
|
||||
return amountQuery.getResultList();
|
||||
}
|
||||
catch (NoResultException e) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算当前已经提交的采购数量
|
||||
*/
|
||||
|
|
|
@ -124,19 +124,30 @@
|
|||
|
||||
<el-table-column label="操作" fixed="right" width="230">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="scope.row.status==='audit_passed' || scope.row.status==='audit_not_passed' || scope.row.status==='to_be_audit'"
|
||||
type="text" @click="showDetail(scope.row, scope)">查看详情
|
||||
</el-button>
|
||||
<el-button type="text" @click="showDetail(scope.row, scope)">查看详情</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.status==='audit_passed' || scope.row.status==='audit_not_passed' || scope.row.status==='to_be_audit'"
|
||||
type="text" @click="showAuditDetail(scope.row, scope)">查看审核流程
|
||||
</el-button>
|
||||
<el-button v-if="scope.row.status==='draft' || scope.row.status==='audit_not_passed'"
|
||||
type="text" @click="editProcess(scope.row, scope)">编辑
|
||||
</el-button>
|
||||
<#if isAdmin>
|
||||
<#--判断是不是管理员本人的-->
|
||||
<el-button v-if="scope.row.applyPersonId==='${adminId}'" type="text" @click="editProcess(scope.row, scope)">编辑
|
||||
</el-button>
|
||||
<#else>
|
||||
<el-button v-if="scope.row.status==='draft' || scope.row.status==='audit_not_passed'"
|
||||
type="text" @click="editProcess(scope.row, scope)">编辑
|
||||
</el-button>
|
||||
</#if>
|
||||
<el-button v-if="scope.row.status==='to_be_audit'" type="text" @click="revokeProcess(scope.row, scope)">撤回</el-button>
|
||||
<el-button v-if="scope.row.status==='draft'" type="text" @click="deleteProcess(scope.row, scope)">删除</el-button>
|
||||
|
||||
<#if isAdmin>
|
||||
<#--判断是不是管理员本人的-->
|
||||
<el-button v-if="scope.row.applyPersonId==='${adminId}'" type="text"
|
||||
@click="deleteProcess(scope.row, scope)">删除
|
||||
</el-button>
|
||||
<#else>
|
||||
<el-button v-if="scope.row.status==='draft'" type="text" @click="deleteProcess(scope.row, scope)">删除</el-button>
|
||||
</#if>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -204,6 +215,21 @@
|
|||
return response.json()
|
||||
}
|
||||
|
||||
/**
|
||||
* 给定一个数字,保留两位小数输出,格式化为包含分隔符
|
||||
* @param f
|
||||
* @returns {string}
|
||||
*/
|
||||
function numberFixed(f) {
|
||||
if (!f) {
|
||||
return "0.00";
|
||||
}
|
||||
//return Number(f).toFixed(2);
|
||||
//格式化413,423,423.24
|
||||
f = Number(f).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2, useGrouping: true });
|
||||
return f;
|
||||
}
|
||||
|
||||
const data = () => {
|
||||
return {
|
||||
auditForm: {
|
||||
|
|
|
@ -355,6 +355,21 @@
|
|||
return /\w.(png|jpg|jpeg|svg|webp|gif|bmp)$/i.test(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给定一个数字,保留两位小数输出,格式化为包含分隔符
|
||||
* @param f
|
||||
* @returns {string}
|
||||
*/
|
||||
function numberFixed(f) {
|
||||
if (!f) {
|
||||
return "0.00";
|
||||
}
|
||||
//return Number(f).toFixed(2);
|
||||
//格式化413,423,423.24
|
||||
f = Number(f).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2, useGrouping: true });
|
||||
return f;
|
||||
}
|
||||
|
||||
const data = () => {
|
||||
return {
|
||||
process: {},
|
||||
|
|
|
@ -521,6 +521,21 @@
|
|||
".png", ".jpg", ".jpeg", ".gif", ".bmp", ".webp"
|
||||
]
|
||||
|
||||
/**
|
||||
* 给定一个数字,保留两位小数输出,格式化为包含分隔符
|
||||
* @param f
|
||||
* @returns {string}
|
||||
*/
|
||||
function numberFixed(f) {
|
||||
if (!f) {
|
||||
return "0.00";
|
||||
}
|
||||
//return Number(f).toFixed(2);
|
||||
//格式化413,423,423.24
|
||||
f = Number(f).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2, useGrouping: true });
|
||||
return f;
|
||||
}
|
||||
|
||||
const isEmpty = (obj) => {
|
||||
if (!obj) {
|
||||
return true
|
||||
|
|
|
@ -685,6 +685,21 @@
|
|||
return response.json()
|
||||
}
|
||||
|
||||
/**
|
||||
* 给定一个数字,保留两位小数输出,格式化为包含分隔符
|
||||
* @param f
|
||||
* @returns {string}
|
||||
*/
|
||||
function numberFixed(f) {
|
||||
if (!f) {
|
||||
return "0.00";
|
||||
}
|
||||
//return Number(f).toFixed(2);
|
||||
//格式化413,423,423.24
|
||||
f = Number(f).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2, useGrouping: true });
|
||||
return f;
|
||||
}
|
||||
|
||||
const data = () => {
|
||||
return {
|
||||
mode: "btn", // btn , procurementContractProcess
|
||||
|
|
|
@ -190,7 +190,20 @@
|
|||
function parseJSON(response) {
|
||||
return response.json()
|
||||
}
|
||||
|
||||
/**
|
||||
* 给定一个数字,保留两位小数输出,格式化为包含分隔符
|
||||
* @param f
|
||||
* @returns {string}
|
||||
*/
|
||||
function numberFixed(f) {
|
||||
if (!f) {
|
||||
return "0.00";
|
||||
}
|
||||
//return Number(f).toFixed(2);
|
||||
//格式化413,423,423.24
|
||||
f = Number(f).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2, useGrouping: true });
|
||||
return f;
|
||||
}
|
||||
const data = () => {
|
||||
return {
|
||||
auditForm: {
|
||||
|
|
Loading…
Reference in New Issue