feat(project-budget): 优化成本详情模板
- 为 ProjectBudgetCostDetailTemp 类添加 Lombok 的 @Data 注解,简化代码 - 新增 categoryStr 字段用于存储采购类别字符串 - 修改 ProjectBudgetService 中的成本详情保存逻辑,更新类别信息 - 修复类型判断逻辑,将"施工"改为"工程"dev_2.0.2
parent
c202756962
commit
f011584e57
|
@ -1,6 +1,8 @@
|
||||||
package cn.palmte.work.model;
|
package cn.palmte.work.model;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@ -9,7 +11,9 @@ import javax.persistence.Table;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "project_budget_cost_detail_temp")
|
@Table(name = "project_budget_cost_detail_temp")
|
||||||
|
@Data
|
||||||
public class ProjectBudgetCostDetailTemp extends ProjectBudgetCostDetailBase{
|
public class ProjectBudgetCostDetailTemp extends ProjectBudgetCostDetailBase{
|
||||||
|
private String categoryStr;
|
||||||
public ProjectBudgetCostDetail toProjectBudgetCostDetail(){
|
public ProjectBudgetCostDetail toProjectBudgetCostDetail(){
|
||||||
ProjectBudgetCostDetail detail = new ProjectBudgetCostDetail();
|
ProjectBudgetCostDetail detail = new ProjectBudgetCostDetail();
|
||||||
detail.setProjectId(getProjectId());
|
detail.setProjectId(getProjectId());
|
||||||
|
|
|
@ -1282,6 +1282,7 @@ public class ProjectBudgetService {
|
||||||
// }
|
// }
|
||||||
// projectBudgetCostDetailRepository.save(CostDetailList);
|
// projectBudgetCostDetailRepository.save(CostDetailList);
|
||||||
final ResponseMsg msg = ResponseMsg.buildSuccessMsg(String.format("成功:%d, 失败:%d", successCount, errorCount));
|
final ResponseMsg msg = ResponseMsg.buildSuccessMsg(String.format("成功:%d, 失败:%d", successCount, errorCount));
|
||||||
|
costDetailTempList.forEach(item->item.setCategory(item.getCategoryStr()));
|
||||||
msg.setData(new HashMap<String,List>(){{put("errorList",errorList);put("successList",costDetailTempList);}});
|
msg.setData(new HashMap<String,List>(){{put("errorList",errorList);put("successList",costDetailTempList);}});
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
@ -1296,7 +1297,7 @@ public class ProjectBudgetService {
|
||||||
String type = (String) o1;
|
String type = (String) o1;
|
||||||
if ("设备".equals(type)) {
|
if ("设备".equals(type)) {
|
||||||
temp.setType(1);
|
temp.setType(1);
|
||||||
} else if ("施工".equals(type)) {
|
} else if ("工程".equals(type)) {
|
||||||
temp.setType(2);
|
temp.setType(2);
|
||||||
} else if ("服务".equals(type)) {
|
} else if ("服务".equals(type)) {
|
||||||
temp.setType(3);
|
temp.setType(3);
|
||||||
|
@ -1311,6 +1312,7 @@ public class ProjectBudgetService {
|
||||||
ProcurementType procurementType = procurementTypeRepository.findByName(category);
|
ProcurementType procurementType = procurementTypeRepository.findByName(category);
|
||||||
if (procurementType != null && (procurementType.getType() == temp.getType() && temp.getType()!=4)) {
|
if (procurementType != null && (procurementType.getType() == temp.getType() && temp.getType()!=4)) {
|
||||||
temp.setCategory(procurementType.getId().toString());
|
temp.setCategory(procurementType.getId().toString());
|
||||||
|
temp.setCategoryStr(category);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("该采购类别不存在或者与采购成本项目不匹配");
|
throw new Exception("该采购类别不存在或者与采购成本项目不匹配");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue