收入、成本、项目管理成本接口
parent
51c89d5de9
commit
57f5401fb9
|
@ -3,15 +3,17 @@ package cn.palmte.work.controller.backend;
|
|||
import cn.palmte.work.bean.ApproveStatusEnum;
|
||||
import cn.palmte.work.bean.BudgetBean;
|
||||
import cn.palmte.work.bean.EstimateBean;
|
||||
import cn.palmte.work.model.Dept;
|
||||
import cn.palmte.work.model.DeptRepository;
|
||||
import cn.palmte.work.model.Project;
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.service.ProjectBudgetService;
|
||||
import cn.palmte.work.service.ProjectEstimateService;
|
||||
import cn.palmte.work.service.ProjectService;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
import cn.palmte.work.utils.excel.ExportUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -19,11 +21,15 @@ import org.springframework.format.datetime.DateFormatter;
|
|||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import top.jfunc.common.utils.CollectionUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
@ -154,6 +160,73 @@ public class ProjectController extends BaseController{
|
|||
projectService.budgetEditSave(project, budgetBean, InterfaceUtil.getAdmin(), ApproveStatusEnum.APPROVAL_UNCOMMIT);
|
||||
return "redirect:/project/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存收入明细
|
||||
*/
|
||||
@RequestMapping("/budgetEditSaveIncomeDetail")
|
||||
public ResponseMsg budgetEditSaveIncomeDetail(@RequestBody String body) {
|
||||
JSONObject jsonObject = JSON.parseObject(body);
|
||||
JSONArray incomeDetails = jsonObject.getJSONArray("incomeDetails");
|
||||
if(CollectionUtil.isNotEmpty(incomeDetails)){
|
||||
List<ProjectBudgetIncomeDetail> incomeDetailList = new ArrayList<>(incomeDetails.size());
|
||||
for (int i = 0; i < incomeDetails.size(); i++) {
|
||||
ProjectBudgetIncomeDetail incomeDetail = incomeDetails.getObject(i, ProjectBudgetIncomeDetail.class);
|
||||
incomeDetailList.add(incomeDetail);
|
||||
}
|
||||
|
||||
Project project = projectService.getProject(jsonObject.getInteger("projectId"));
|
||||
|
||||
projectBudgetService.clearBudgetIncomeDetail(project);
|
||||
projectBudgetService.saveBudgetIncomeDetail(project, incomeDetailList);
|
||||
|
||||
}
|
||||
return ResponseMsg.buildSuccessMsg("成功");
|
||||
}
|
||||
/**
|
||||
* 保存成本明细
|
||||
*/
|
||||
@RequestMapping("/budgetEditSaveCostDetail")
|
||||
public ResponseMsg budgetEditSaveCostDetail(@RequestBody String body) {
|
||||
JSONObject jsonObject = JSON.parseObject(body);
|
||||
JSONArray costDetails = jsonObject.getJSONArray("costDetails");
|
||||
if(CollectionUtil.isNotEmpty(costDetails)){
|
||||
List<ProjectBudgetCostDetail> costDetailList = new ArrayList<>(costDetails.size());
|
||||
for (int i = 0; i < costDetails.size(); i++) {
|
||||
ProjectBudgetCostDetail costDetail = costDetails.getObject(i, ProjectBudgetCostDetail.class);
|
||||
costDetailList.add(costDetail);
|
||||
}
|
||||
|
||||
Project project = projectService.getProject(jsonObject.getInteger("projectId"));
|
||||
|
||||
projectBudgetService.clearBudgetCostDetail(project);
|
||||
projectBudgetService.saveBudgetCostDetail(project, costDetailList);
|
||||
|
||||
}
|
||||
return ResponseMsg.buildSuccessMsg("成功");
|
||||
}
|
||||
/**
|
||||
* 保存项目管理成本明细
|
||||
*/
|
||||
@RequestMapping("/budgetEditSaveCostProjectManageDetail")
|
||||
public ResponseMsg budgetEditSaveCostProjectManageDetail(@RequestBody String body) {
|
||||
JSONObject jsonObject = JSON.parseObject(body);
|
||||
JSONArray costDetails = jsonObject.getJSONArray("costProjectManageDetails");
|
||||
if(CollectionUtil.isNotEmpty(costDetails)){
|
||||
List<ProjectBudgetCostProjectManageDetail> costDetailList = new ArrayList<>(costDetails.size());
|
||||
for (int i = 0; i < costDetails.size(); i++) {
|
||||
ProjectBudgetCostProjectManageDetail costDetail = costDetails.getObject(i, ProjectBudgetCostProjectManageDetail.class);
|
||||
costDetailList.add(costDetail);
|
||||
}
|
||||
|
||||
Project project = projectService.getProject(jsonObject.getInteger("projectId"));
|
||||
|
||||
projectBudgetService.clearBudgetCostProjectManageDetail(project);
|
||||
projectBudgetService.saveBudgetCostProjectManageDetail(project, costDetailList);
|
||||
|
||||
}
|
||||
return ResponseMsg.buildSuccessMsg("成功");
|
||||
}
|
||||
@InitBinder
|
||||
public void initBinder(WebDataBinder webDataBinder){
|
||||
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
|
||||
|
|
Loading…
Reference in New Issue