采购合同流程 创建时保存供应商比选材料
parent
62f3574609
commit
b87cc40094
|
@ -14,6 +14,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
@ -61,6 +62,7 @@ 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.SupplierMaterial;
|
||||
import cn.palmte.work.model.process.form.ProcessQueryForm;
|
||||
import cn.palmte.work.model.process.form.ProcessUpdateForm;
|
||||
import cn.palmte.work.model.process.form.ProcessCreationForm;
|
||||
|
@ -289,6 +291,9 @@ public class ProcessController {
|
|||
return processService.isProjectPrepaid(project) ? "是" : "否";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程详情,不同类型字段有不同
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/{id}")
|
||||
public ProjectReturnValue get(@PathVariable int id) {
|
||||
|
@ -329,7 +334,7 @@ public class ProcessController {
|
|||
.build();
|
||||
}
|
||||
|
||||
// 销售合同流程
|
||||
// 合同流程
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping
|
||||
|
@ -356,6 +361,11 @@ public class ProcessController {
|
|||
ProcurementContract procurementContract = ProcurementContract.from(form);
|
||||
procurementContract.setProcessId(entity.getId());
|
||||
entityManager.persist(procurementContract);
|
||||
|
||||
List<SupplierMaterial> supplierMaterials = form.getSupplierMaterials();
|
||||
if (!CollectionUtils.isEmpty(supplierMaterials)) {
|
||||
supplierMaterials.forEach(entityManager::persist);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("还不支持");
|
||||
|
|
|
@ -1,20 +1,28 @@
|
|||
package cn.palmte.work.model.process;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 供应商比选材料
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/26 17:34
|
||||
*/
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Entity
|
||||
@Table(name = "procurement_contract_supplier_material")
|
||||
public class SupplierMaterial {
|
||||
|
@ -33,4 +41,19 @@ public class SupplierMaterial {
|
|||
|
||||
private String attachment;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o))
|
||||
return false;
|
||||
SupplierMaterial that = (SupplierMaterial) o;
|
||||
return id != null && Objects.equals(id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getClass().hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue