Merge branch 'temp'

master
xxssyyyyssxx 2021-12-08 17:24:55 +08:00
commit 3f406e603b
18 changed files with 907 additions and 603 deletions

View File

@ -36,6 +36,8 @@ import java.util.concurrent.ConcurrentHashMap;
@RequestMapping("/project")
public class ProjectController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProjectController.class);
private static final String PROJECT_ID = "projectId";
private static final String DETAILS = "details";
@Autowired
private DeptService deptService;
@ -230,16 +232,16 @@ public class ProjectController extends BaseController {
@ResponseBody
public ResponseMsg budgetEditSaveIncomeDetail(@RequestBody String body) {
JSONObject jsonObject = JSON.parseObject(body);
JSONArray details = jsonObject.getJSONArray("details");
List<ProjectBudgetIncomeDetail> detailList = new ArrayList<>(details.size());
JSONArray details = jsonObject.getJSONArray(DETAILS);
List<ProjectBudgetIncomeDetailTemp> detailList = new ArrayList<>(details.size());
for (int i = 0; i < details.size(); i++) {
ProjectBudgetIncomeDetail detail = details.getObject(i, ProjectBudgetIncomeDetail.class);
ProjectBudgetIncomeDetailTemp detail = details.getObject(i, ProjectBudgetIncomeDetailTemp.class);
detailList.add(detail);
}
Project project = projectService.getProject(jsonObject.getInteger("projectId"));
Project project = projectService.getProject(jsonObject.getInteger(PROJECT_ID));
projectBudgetService.saveBudgetIncomeDetail(project, detailList);
projectBudgetService.saveBudgetIncomeDetailTemp(project, detailList);
return ResponseMsg.buildSuccessMsg("成功");
}
@ -251,16 +253,16 @@ public class ProjectController extends BaseController {
@ResponseBody
public ResponseMsg budgetEditSaveCostDetail(@RequestBody String body) {
JSONObject jsonObject = JSON.parseObject(body);
JSONArray details = jsonObject.getJSONArray("details");
List<ProjectBudgetCostDetail> detailList = new ArrayList<>(details.size());
JSONArray details = jsonObject.getJSONArray(DETAILS);
List<ProjectBudgetCostDetailTemp> detailList = new ArrayList<>(details.size());
for (int i = 0; i < details.size(); i++) {
ProjectBudgetCostDetail detail = details.getObject(i, ProjectBudgetCostDetail.class);
ProjectBudgetCostDetailTemp detail = details.getObject(i, ProjectBudgetCostDetailTemp.class);
detailList.add(detail);
}
Project project = projectService.getProject(jsonObject.getInteger("projectId"));
Project project = projectService.getProject(jsonObject.getInteger(PROJECT_ID));
projectBudgetService.saveBudgetCostDetail(project, detailList);
projectBudgetService.saveBudgetCostDetailTemp(project, detailList);
return ResponseMsg.buildSuccessMsg("成功");
}
@ -272,16 +274,16 @@ public class ProjectController extends BaseController {
@ResponseBody
public ResponseMsg budgetEditSaveCostProjectManageDetail(@RequestBody String body) {
JSONObject jsonObject = JSON.parseObject(body);
JSONArray details = jsonObject.getJSONArray("details");
List<ProjectBudgetCostProjectManageDetail> detailList = new ArrayList<>(details.size());
JSONArray details = jsonObject.getJSONArray(DETAILS);
List<ProjectBudgetCostProjectManageDetailTemp> detailList = new ArrayList<>(details.size());
for (int i = 0; i < details.size(); i++) {
ProjectBudgetCostProjectManageDetail detail = details.getObject(i, ProjectBudgetCostProjectManageDetail.class);
ProjectBudgetCostProjectManageDetailTemp detail = details.getObject(i, ProjectBudgetCostProjectManageDetailTemp.class);
detailList.add(detail);
}
Project project = projectService.getProject(jsonObject.getInteger("projectId"));
Project project = projectService.getProject(jsonObject.getInteger(PROJECT_ID));
projectBudgetService.saveBudgetCostProjectManageDetail(project, detailList);
projectBudgetService.saveBudgetCostProjectManageDetailTemp(project, detailList);
return ResponseMsg.buildSuccessMsg("成功");
}
@ -293,16 +295,16 @@ public class ProjectController extends BaseController {
@ResponseBody
public ResponseMsg budgetEditSaveBudgetPlanDetail(@RequestBody String body) {
JSONObject jsonObject = JSON.parseObject(body);
JSONArray details = jsonObject.getJSONArray("details");
List<ProjectBudgetPlanDetail> detailList = new ArrayList<>(details.size());
JSONArray details = jsonObject.getJSONArray(DETAILS);
List<ProjectBudgetPlanDetailTemp> detailList = new ArrayList<>(details.size());
for (int i = 0; i < details.size(); i++) {
ProjectBudgetPlanDetail detail = details.getObject(i, ProjectBudgetPlanDetail.class);
ProjectBudgetPlanDetailTemp detail = details.getObject(i, ProjectBudgetPlanDetailTemp.class);
detailList.add(detail);
}
Project project = projectService.getProject(jsonObject.getInteger("projectId"));
Project project = projectService.getProject(jsonObject.getInteger(PROJECT_ID));
projectBudgetService.saveBudgetPlanDetail(project, detailList);
projectBudgetService.saveBudgetPlanDetailTemp(project, detailList);
return ResponseMsg.buildSuccessMsg("成功");
}
@ -426,7 +428,7 @@ public class ProjectController extends BaseController {
*/
@RequestMapping("/taskRecords/{projectId}")
public String taskRecords(@PathVariable int projectId, Map<String, Object> model) {
model.put("projectId", projectId);
model.put(PROJECT_ID, projectId);
List<ProjectTaskRecord> list = projectTaskRecordService.list(projectId);
if (list != null && !list.isEmpty()) {
model.put("list", list);
@ -452,7 +454,7 @@ public class ProjectController extends BaseController {
*
*/
@RequestMapping("/procInsPng/{projectId}")
public void png(HttpServletResponse response, @PathVariable("projectId") int projectId) throws Exception {
public void png(HttpServletResponse response, @PathVariable(PROJECT_ID) int projectId) throws Exception {
List<ProjectInstanceRelation> relationList = projectInstanceRelationRepository.findByProjectIdOrderByCreateTimeDesc(projectId);
if (relationList == null || relationList.isEmpty()) {
return;
@ -499,7 +501,7 @@ public class ProjectController extends BaseController {
{ id:22, pId:2, name:"随意勾选 2-2", open:true},
{ id:23, pId:2, name:"随意勾选 2-3"}*/
JSONObject jsonObject = JSON.parseObject(body);
Integer projectId = jsonObject.getInteger("projectId");
Integer projectId = jsonObject.getInteger(PROJECT_ID);
JSONArray array = jsonObject.getJSONArray("ids");
String[] ids = new String[array.size()];
for (int i = 0; i < array.size(); i++) {

View File

@ -1,129 +1,11 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
/**
*
*/
@Entity
@Table(name = "project_budget_cost_detail")
public class ProjectBudgetCostDetail {
public static final int TYPE_DEVICE = 1;
public static final int TYPE_BUILD = 2;
public static final int TYPE_SERVICE = 3;
public static final int TYPE_OHTER = 4;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private int type;
private int category;
private String name;
private String unit;
private int amount;
private BigDecimal price;
@Column(name = "tax_rate")
private BigDecimal taxRate;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getCategory() {
return category;
}
public void setCategory(int category) {
this.category = category;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getTaxRate() {
return taxRate;
}
public void setTaxRate(BigDecimal taxRate) {
this.taxRate = taxRate;
}
public BigDecimal getTotalTaxInclude(){
if(null == price){
return null;
}
return price.multiply(new BigDecimal(amount));
}
public BigDecimal getTotalTaxExclude(){
BigDecimal totalTaxInclude = getTotalTaxInclude();
if(null == totalTaxInclude || taxRate == null){
return null;
}
//不含税总金额=含税总金额/1+税率)
return totalTaxInclude.divide(taxRate.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(1)), 2, BigDecimal.ROUND_HALF_UP);
}
public class ProjectBudgetCostDetail extends ProjectBudgetCostDetailBase{
}

View File

@ -0,0 +1,125 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
@MappedSuperclass
public class ProjectBudgetCostDetailBase {
public static final int TYPE_DEVICE = 1;
public static final int TYPE_BUILD = 2;
public static final int TYPE_SERVICE = 3;
public static final int TYPE_OHTER = 4;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private int type;
private int category;
private String name;
private String unit;
private int amount;
private BigDecimal price;
@Column(name = "tax_rate")
private BigDecimal taxRate;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getCategory() {
return category;
}
public void setCategory(int category) {
this.category = category;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getTaxRate() {
return taxRate;
}
public void setTaxRate(BigDecimal taxRate) {
this.taxRate = taxRate;
}
public BigDecimal getTotalTaxInclude(){
if(null == price){
return null;
}
return price.multiply(new BigDecimal(amount));
}
public BigDecimal getTotalTaxExclude(){
BigDecimal totalTaxInclude = getTotalTaxInclude();
if(null == totalTaxInclude || taxRate == null){
return null;
}
//不含税总金额=含税总金额/1+税率)
return totalTaxInclude.divide(taxRate.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(1)), 2, BigDecimal.ROUND_HALF_UP);
}
}

View File

@ -0,0 +1,25 @@
package cn.palmte.work.model;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
*
*/
@Entity
@Table(name = "project_budget_cost_detail_temp")
public class ProjectBudgetCostDetailTemp extends ProjectBudgetCostDetailBase{
public ProjectBudgetCostDetail toProjectBudgetCostDetail(){
ProjectBudgetCostDetail detail = new ProjectBudgetCostDetail();
detail.setProjectId(getProjectId());
detail.setType(getType());
detail.setCategory(getCategory());
detail.setName(getName());
detail.setUnit(getUnit());
detail.setAmount(getAmount());
detail.setPrice(getPrice());
detail.setTaxRate(getTaxRate());
return detail;
}
}

View File

@ -0,0 +1,9 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProjectBudgetCostDetailTempRepository extends JpaRepository<ProjectBudgetCostDetailTemp,Integer> {
List<ProjectBudgetCostDetailTemp> findAllByProjectIdEquals(int id);
}

View File

@ -1,151 +1,12 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
/**
*
*/
@Entity
@Table(name = "project_budget_cost_project_manage_detail")
public class ProjectBudgetCostProjectManageDetail {
public static final int TYPE_PERSON = 1;
public static final int TYPE_BUSINESS = 2;
public static final int TYPE_OHTER = 3;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private int type;
private String name;
private String detail;
private String unit;
private int amount;
private BigDecimal price;
@Column(name = "predict_method")
private String predictMethod;
@Column(name = "predict_why")
private String predictWhy;
private String remark;
/**
*
*/
private int deletable;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public String getPredictMethod() {
return predictMethod;
}
public void setPredictMethod(String predictMethod) {
this.predictMethod = predictMethod;
}
public String getPredictWhy() {
return predictWhy;
}
public void setPredictWhy(String predictWhy) {
this.predictWhy = predictWhy;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public BigDecimal getTotal(){
if(null == price){
return null;
}
return price.multiply(new BigDecimal(amount));
}
public int getDeletable() {
return deletable;
}
public void setDeletable(int deletable) {
this.deletable = deletable;
}
public class ProjectBudgetCostProjectManageDetail extends ProjectBudgetCostProjectManageDetailBase{
}

View File

@ -0,0 +1,147 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
@MappedSuperclass
public class ProjectBudgetCostProjectManageDetailBase {
public static final int TYPE_PERSON = 1;
public static final int TYPE_BUSINESS = 2;
public static final int TYPE_OHTER = 3;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private int type;
private String name;
private String detail;
private String unit;
private int amount;
private BigDecimal price;
@Column(name = "predict_method")
private String predictMethod;
@Column(name = "predict_why")
private String predictWhy;
private String remark;
/**
*
*/
private int deletable;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public String getPredictMethod() {
return predictMethod;
}
public void setPredictMethod(String predictMethod) {
this.predictMethod = predictMethod;
}
public String getPredictWhy() {
return predictWhy;
}
public void setPredictWhy(String predictWhy) {
this.predictWhy = predictWhy;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public BigDecimal getTotal(){
if(null == price){
return null;
}
return price.multiply(new BigDecimal(amount));
}
public int getDeletable() {
return deletable;
}
public void setDeletable(int deletable) {
this.deletable = deletable;
}
}

View File

@ -0,0 +1,27 @@
package cn.palmte.work.model;
import javax.persistence.*;
/**
*
*/
@Entity
@Table(name = "project_budget_cost_project_manage_detail_temp")
public class ProjectBudgetCostProjectManageDetailTemp extends ProjectBudgetCostProjectManageDetailBase{
public ProjectBudgetCostProjectManageDetail toProjectBudgetCostProjectManageDetail(){
ProjectBudgetCostProjectManageDetail detail = new ProjectBudgetCostProjectManageDetail();
detail.setProjectId(getProjectId());
detail.setType(getType());
detail.setName(getName());
detail.setDetail(getDetail());
detail.setUnit(getUnit());
detail.setAmount(getAmount());
detail.setPrice(getPrice());
detail.setPredictMethod(getPredictMethod());
detail.setPredictWhy(getPredictWhy());
detail.setRemark(getRemark());
detail.setDeletable(getDeletable());
return detail;
}
}

View File

@ -0,0 +1,9 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProjectBudgetCostProjectManageDetailTempRepository extends JpaRepository<ProjectBudgetCostProjectManageDetailTemp,Integer> {
List<ProjectBudgetCostProjectManageDetailTemp> findAllByProjectIdEquals(int id);
}

View File

@ -1,120 +1,11 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
/**
*
*/
@Entity
@Table(name = "project_budget_income_detail")
public class ProjectBudgetIncomeDetail {
public static final int TYPE_DEVICE = 1;
public static final int TYPE_ENGINEER = 2;
public static final int TYPE_SERVICE = 3;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private int type;
private String name;
private String unit;
private int amount;
private BigDecimal price;
@Column(name = "tax_rate")
private BigDecimal taxRate;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getTaxRate() {
return taxRate;
}
public void setTaxRate(BigDecimal taxRate) {
this.taxRate = taxRate;
}
public BigDecimal getTotalTaxInclude(){
if(null == price){
return null;
}
return price.multiply(new BigDecimal(amount));
}
public BigDecimal getTotalTaxExclude(){
BigDecimal totalTaxInclude = getTotalTaxInclude();
if(null == totalTaxInclude || taxRate == null){
return null;
}
//不含税总金额=含税总金额/1+税率)
BigDecimal bigDecimal = taxRate.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(1));
return totalTaxInclude.divide(bigDecimal, 2, BigDecimal.ROUND_HALF_UP);
}
public class ProjectBudgetIncomeDetail extends ProjectBudgetIncomeDetailBase{
}

View File

@ -0,0 +1,116 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
@MappedSuperclass
public class ProjectBudgetIncomeDetailBase {
public static final int TYPE_DEVICE = 1;
public static final int TYPE_ENGINEER = 2;
public static final int TYPE_SERVICE = 3;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private int type;
private String name;
private String unit;
private int amount;
private BigDecimal price;
@Column(name = "tax_rate")
private BigDecimal taxRate;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getTaxRate() {
return taxRate;
}
public void setTaxRate(BigDecimal taxRate) {
this.taxRate = taxRate;
}
public BigDecimal getTotalTaxInclude(){
if(null == price){
return null;
}
return price.multiply(new BigDecimal(amount));
}
public BigDecimal getTotalTaxExclude(){
BigDecimal totalTaxInclude = getTotalTaxInclude();
if(null == totalTaxInclude || taxRate == null){
return null;
}
//不含税总金额=含税总金额/1+税率)
BigDecimal bigDecimal = taxRate.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(1));
return totalTaxInclude.divide(bigDecimal, 2, BigDecimal.ROUND_HALF_UP);
}
}

View File

@ -0,0 +1,23 @@
package cn.palmte.work.model;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
*
*/
@Entity
@Table(name = "project_budget_income_detail_temp")
public class ProjectBudgetIncomeDetailTemp extends ProjectBudgetIncomeDetailBase{
public ProjectBudgetIncomeDetail toProjectBudgetIncomeDetail(){
ProjectBudgetIncomeDetail projectBudgetIncomeDetail = new ProjectBudgetIncomeDetail();
projectBudgetIncomeDetail.setProjectId(getProjectId());
projectBudgetIncomeDetail.setName(getName());
projectBudgetIncomeDetail.setType(getType());
projectBudgetIncomeDetail.setUnit(getUnit());
projectBudgetIncomeDetail.setAmount(getAmount());
projectBudgetIncomeDetail.setPrice(getPrice());
projectBudgetIncomeDetail.setTaxRate(getTaxRate());
return projectBudgetIncomeDetail;
}
}

View File

@ -0,0 +1,9 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProjectBudgetIncomeDetailTempRepository extends JpaRepository<ProjectBudgetIncomeDetailTemp,Integer> {
List<ProjectBudgetIncomeDetailTemp> findAllByProjectIdEquals(int id);
}

View File

@ -1,220 +1,11 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
/**
*
*/
@Entity
@Table(name = "project_budget_plan_detail")
public class ProjectBudgetPlanDetail {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private String month;
/**
*
*/
@Column(name = "device_cost")
private BigDecimal deviceCost;
/**
*
*/
@Column(name = "engineer_cost")
private BigDecimal engineerCost;
/**
*
*/
@Column(name = "project_manage_cost")
private BigDecimal projectManageCost;
/**
*
*/
@Column(name = "earnest_money_cost")
private BigDecimal earnestMoneyCost;
/**
*
*/
@Column(name = "total_cost")
private BigDecimal totalCost;
/**
*
*/
@Column(name = "sale_income")
private BigDecimal saleIncome;
/**
*
*/
@Column(name = "earnest_money_income")
private BigDecimal earnestMoneyIncome;
/**
*
*/
@Column(name = "total_income")
private BigDecimal totalIncome;
/**
*
*/
@Column(name = "fund_balance")
private BigDecimal fundBalance;
/**
*
*/
@Column(name = "underwritten_tax_rate")
private BigDecimal underwrittenTaxRate;
/**
*
*/
@Column(name = "capital_interest")
private BigDecimal capitalInterest;
/**
*
*/
@Column(name = "underwritten_plan")
private BigDecimal underwrittenPlan;
/**
*
*/
@Column(name = "repayment_plan")
private BigDecimal repaymentPlan;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
}
public BigDecimal getDeviceCost() {
return deviceCost;
}
public void setDeviceCost(BigDecimal deviceCost) {
this.deviceCost = deviceCost;
}
public BigDecimal getEngineerCost() {
return engineerCost;
}
public void setEngineerCost(BigDecimal engineerCost) {
this.engineerCost = engineerCost;
}
public BigDecimal getProjectManageCost() {
return projectManageCost;
}
public void setProjectManageCost(BigDecimal projectManageCost) {
this.projectManageCost = projectManageCost;
}
public BigDecimal getEarnestMoneyCost() {
return earnestMoneyCost;
}
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
this.earnestMoneyCost = earnestMoneyCost;
}
public BigDecimal getTotalCost() {
return totalCost;
}
public void setTotalCost(BigDecimal totalCost) {
this.totalCost = totalCost;
}
public BigDecimal getSaleIncome() {
return saleIncome;
}
public void setSaleIncome(BigDecimal saleIncome) {
this.saleIncome = saleIncome;
}
public BigDecimal getEarnestMoneyIncome() {
return earnestMoneyIncome;
}
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
this.earnestMoneyIncome = earnestMoneyIncome;
}
public BigDecimal getTotalIncome() {
return totalIncome;
}
public void setTotalIncome(BigDecimal totalIncome) {
this.totalIncome = totalIncome;
}
public BigDecimal getFundBalance() {
return fundBalance;
}
public void setFundBalance(BigDecimal fundBalance) {
this.fundBalance = fundBalance;
}
public BigDecimal getUnderwrittenTaxRate() {
return underwrittenTaxRate;
}
public void setUnderwrittenTaxRate(BigDecimal underwrittenTaxRate) {
this.underwrittenTaxRate = underwrittenTaxRate;
}
public BigDecimal getCapitalInterest() {
return capitalInterest;
}
public void setCapitalInterest(BigDecimal capitalInterest) {
this.capitalInterest = capitalInterest;
}
public BigDecimal getUnderwrittenPlan() {
return underwrittenPlan;
}
public void setUnderwrittenPlan(BigDecimal underwrittenPlan) {
this.underwrittenPlan = underwrittenPlan;
}
public BigDecimal getRepaymentPlan() {
return repaymentPlan;
}
public void setRepaymentPlan(BigDecimal repaymentPlan) {
this.repaymentPlan = repaymentPlan;
}
public class ProjectBudgetPlanDetail extends ProjectBudgetPlanDetailBase{
}

View File

@ -0,0 +1,219 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
/**
*
*/
@MappedSuperclass
public class ProjectBudgetPlanDetailBase {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private String month;
/**
*
*/
@Column(name = "device_cost")
private BigDecimal deviceCost;
/**
*
*/
@Column(name = "engineer_cost")
private BigDecimal engineerCost;
/**
*
*/
@Column(name = "project_manage_cost")
private BigDecimal projectManageCost;
/**
*
*/
@Column(name = "earnest_money_cost")
private BigDecimal earnestMoneyCost;
/**
*
*/
@Column(name = "total_cost")
private BigDecimal totalCost;
/**
*
*/
@Column(name = "sale_income")
private BigDecimal saleIncome;
/**
*
*/
@Column(name = "earnest_money_income")
private BigDecimal earnestMoneyIncome;
/**
*
*/
@Column(name = "total_income")
private BigDecimal totalIncome;
/**
*
*/
@Column(name = "fund_balance")
private BigDecimal fundBalance;
/**
*
*/
@Column(name = "underwritten_tax_rate")
private BigDecimal underwrittenTaxRate;
/**
*
*/
@Column(name = "capital_interest")
private BigDecimal capitalInterest;
/**
*
*/
@Column(name = "underwritten_plan")
private BigDecimal underwrittenPlan;
/**
*
*/
@Column(name = "repayment_plan")
private BigDecimal repaymentPlan;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
}
public BigDecimal getDeviceCost() {
return deviceCost;
}
public void setDeviceCost(BigDecimal deviceCost) {
this.deviceCost = deviceCost;
}
public BigDecimal getEngineerCost() {
return engineerCost;
}
public void setEngineerCost(BigDecimal engineerCost) {
this.engineerCost = engineerCost;
}
public BigDecimal getProjectManageCost() {
return projectManageCost;
}
public void setProjectManageCost(BigDecimal projectManageCost) {
this.projectManageCost = projectManageCost;
}
public BigDecimal getEarnestMoneyCost() {
return earnestMoneyCost;
}
public void setEarnestMoneyCost(BigDecimal earnestMoneyCost) {
this.earnestMoneyCost = earnestMoneyCost;
}
public BigDecimal getTotalCost() {
return totalCost;
}
public void setTotalCost(BigDecimal totalCost) {
this.totalCost = totalCost;
}
public BigDecimal getSaleIncome() {
return saleIncome;
}
public void setSaleIncome(BigDecimal saleIncome) {
this.saleIncome = saleIncome;
}
public BigDecimal getEarnestMoneyIncome() {
return earnestMoneyIncome;
}
public void setEarnestMoneyIncome(BigDecimal earnestMoneyIncome) {
this.earnestMoneyIncome = earnestMoneyIncome;
}
public BigDecimal getTotalIncome() {
return totalIncome;
}
public void setTotalIncome(BigDecimal totalIncome) {
this.totalIncome = totalIncome;
}
public BigDecimal getFundBalance() {
return fundBalance;
}
public void setFundBalance(BigDecimal fundBalance) {
this.fundBalance = fundBalance;
}
public BigDecimal getUnderwrittenTaxRate() {
return underwrittenTaxRate;
}
public void setUnderwrittenTaxRate(BigDecimal underwrittenTaxRate) {
this.underwrittenTaxRate = underwrittenTaxRate;
}
public BigDecimal getCapitalInterest() {
return capitalInterest;
}
public void setCapitalInterest(BigDecimal capitalInterest) {
this.capitalInterest = capitalInterest;
}
public BigDecimal getUnderwrittenPlan() {
return underwrittenPlan;
}
public void setUnderwrittenPlan(BigDecimal underwrittenPlan) {
this.underwrittenPlan = underwrittenPlan;
}
public BigDecimal getRepaymentPlan() {
return repaymentPlan;
}
public void setRepaymentPlan(BigDecimal repaymentPlan) {
this.repaymentPlan = repaymentPlan;
}
}

View File

@ -0,0 +1,30 @@
package cn.palmte.work.model;
import javax.persistence.*;
/**
*
*/
@Entity
@Table(name = "project_budget_plan_detail_temp")
public class ProjectBudgetPlanDetailTemp extends ProjectBudgetPlanDetailBase{
public ProjectBudgetPlanDetail toProjectBudgetPlanDetail(){
ProjectBudgetPlanDetail projectBudgetPlanDetail = new ProjectBudgetPlanDetail();
projectBudgetPlanDetail.setProjectId(getProjectId());
projectBudgetPlanDetail.setMonth(getMonth());
projectBudgetPlanDetail.setDeviceCost(getDeviceCost());
projectBudgetPlanDetail.setEngineerCost(getEngineerCost());
projectBudgetPlanDetail.setProjectManageCost(getProjectManageCost());
projectBudgetPlanDetail.setEarnestMoneyCost(getEarnestMoneyCost());
projectBudgetPlanDetail.setTotalCost(getTotalCost());
projectBudgetPlanDetail.setSaleIncome(getSaleIncome());
projectBudgetPlanDetail.setEarnestMoneyIncome(getEarnestMoneyIncome());
projectBudgetPlanDetail.setTotalIncome(getTotalIncome());
projectBudgetPlanDetail.setFundBalance(getFundBalance());
projectBudgetPlanDetail.setUnderwrittenTaxRate(getUnderwrittenTaxRate());
projectBudgetPlanDetail.setCapitalInterest(getCapitalInterest());
projectBudgetPlanDetail.setUnderwrittenPlan(getUnderwrittenPlan());
projectBudgetPlanDetail.setRepaymentPlan(getRepaymentPlan());
return projectBudgetPlanDetail;
}
}

View File

@ -0,0 +1,13 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface ProjectBudgetPlanDetailTempRepository extends JpaRepository<ProjectBudgetPlanDetailTemp,Integer> {
List<ProjectBudgetPlanDetailTemp> findAllByProjectIdEquals(int id);
@Query(value = "select * from project_budget_plan_detail_temp where project_id in ?1", nativeQuery = true)
List<ProjectBudgetPlanDetailTemp> findAllByProjectIds(List<Integer> projectInt);
}

View File

@ -28,12 +28,20 @@ public class ProjectBudgetService {
@Autowired
private ProjectBudgetIncomeDetailRepository projectBudgetIncomeDetailRepository;
@Autowired
private ProjectBudgetIncomeDetailTempRepository projectBudgetIncomeDetailTempRepository;
@Autowired
private ProjectBudgetCostDetailRepository projectBudgetCostDetailRepository;
@Autowired
private ProjectBudgetCostDetailTempRepository projectBudgetCostDetailTempRepository;
@Autowired
private ProjectBudgetCostProjectManageDetailRepository projectBudgetCostProjectManageDetailRepository;
@Autowired
private ProjectBudgetCostProjectManageDetailTempRepository projectBudgetCostProjectManageDetailTempRepository;
@Autowired
private ProjectBudgetPlanDetailRepository projectBudgetPlanDetailRepository;
@Autowired
private ProjectBudgetPlanDetailTempRepository projectBudgetPlanDetailTempRepository;
@Autowired
private ProjectInstanceService projectInstanceService;
@Autowired
private ActTaskDefService actTaskDefService;
@ -321,6 +329,12 @@ public class ProjectBudgetService {
projectBudgetIncomeDetailRepository.deleteInBatch(incomeDetails);
}
}
public void clearBudgetIncomeDetailTemp(Project project){
List<ProjectBudgetIncomeDetailTemp> incomeDetails = projectBudgetIncomeDetailTempRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(incomeDetails)){
projectBudgetIncomeDetailTempRepository.deleteInBatch(incomeDetails);
}
}
/**
*
@ -335,6 +349,17 @@ public class ProjectBudgetService {
projectBudgetIncomeDetailRepository.save(detailList);
}
}
@Transactional(rollbackFor = RuntimeException.class)
public void saveBudgetIncomeDetailTemp(Project project, List<ProjectBudgetIncomeDetailTemp> detailList){
clearBudgetIncomeDetailTemp(project);
if(CollectionUtil.isNotEmpty(detailList)){
for (ProjectBudgetIncomeDetailTemp projectBudgetIncomeDetail : detailList) {
projectBudgetIncomeDetail.setProjectId(project.getId());
}
projectBudgetIncomeDetailTempRepository.save(detailList);
}
}
/**
*
@ -351,6 +376,12 @@ public class ProjectBudgetService {
projectBudgetCostDetailRepository.deleteInBatch(costDetails);
}
}
public void clearBudgetCostDetailTemp(Project project){
List<ProjectBudgetCostDetailTemp> costDetails = projectBudgetCostDetailTempRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(costDetails)){
projectBudgetCostDetailTempRepository.deleteInBatch(costDetails);
}
}
/**
*
@ -366,6 +397,17 @@ public class ProjectBudgetService {
projectBudgetCostDetailRepository.save(detailList);
}
}
@Transactional(rollbackFor = RuntimeException.class)
public void saveBudgetCostDetailTemp(Project project, List<ProjectBudgetCostDetailTemp> detailList){
clearBudgetCostDetailTemp(project);
if(CollectionUtil.isNotEmpty(detailList)){
for (ProjectBudgetCostDetailTemp projectBudgetCostDetail : detailList) {
projectBudgetCostDetail.setProjectId(project.getId());
}
projectBudgetCostDetailTempRepository.save(detailList);
}
}
/**
*
@ -382,6 +424,12 @@ public class ProjectBudgetService {
projectBudgetCostProjectManageDetailRepository.deleteInBatch(costDetails);
}
}
public void clearBudgetCostProjectManageDetailTemp(Project project){
List<ProjectBudgetCostProjectManageDetailTemp> costDetails = projectBudgetCostProjectManageDetailTempRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(costDetails)){
projectBudgetCostProjectManageDetailTempRepository.deleteInBatch(costDetails);
}
}
/**
*
@ -396,6 +444,16 @@ public class ProjectBudgetService {
projectBudgetCostProjectManageDetailRepository.save(detailList);
}
}
@Transactional(rollbackFor = RuntimeException.class)
public void saveBudgetCostProjectManageDetailTemp(Project project, List<ProjectBudgetCostProjectManageDetailTemp> detailList){
clearBudgetCostProjectManageDetailTemp(project);
if(CollectionUtil.isNotEmpty(detailList)){
for (ProjectBudgetCostProjectManageDetailTemp projectBudgetCostProjectManageDetail : detailList) {
projectBudgetCostProjectManageDetail.setProjectId(project.getId());
}
projectBudgetCostProjectManageDetailTempRepository.save(detailList);
}
}
/**
*
@ -435,6 +493,12 @@ public class ProjectBudgetService {
projectBudgetPlanDetailRepository.deleteInBatch(costDetails);
}
}
public void clearBudgetPlanDetailTemp(Project project){
List<ProjectBudgetPlanDetailTemp> costDetails = projectBudgetPlanDetailTempRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(costDetails)){
projectBudgetPlanDetailTempRepository.deleteInBatch(costDetails);
}
}
/**
*
@ -450,6 +514,17 @@ public class ProjectBudgetService {
projectBudgetPlanDetailRepository.save(detailList);
}
}
@Transactional(rollbackFor = RuntimeException.class)
public void saveBudgetPlanDetailTemp(Project project, List<ProjectBudgetPlanDetailTemp> detailList){
clearBudgetPlanDetailTemp(project);
if(CollectionUtil.isNotEmpty(detailList)){
for (ProjectBudgetPlanDetailTemp projectBudgetPlanDetail : detailList) {
projectBudgetPlanDetail.setProjectId(project.getId());
projectBudgetPlanDetail.setUnderwrittenTaxRate(project.getUnderwrittenTaxRate());
}
projectBudgetPlanDetailTempRepository.save(detailList);
}
}
/**
*
@ -553,7 +628,7 @@ public class ProjectBudgetService {
ProjectBudgetPlanDetail projectBudgetPlanDetail = new ProjectBudgetPlanDetail();
projectBudgetPlanDetail.setMonth("合计");
projectBudgetPlanDetail.setMonth("数据代入");
projectBudgetPlanDetail.setDeviceCost(deviceCost);
projectBudgetPlanDetail.setEngineerCost(engineerCost);
projectBudgetPlanDetail.setProjectManageCost(projectManageCost);
@ -707,6 +782,56 @@ public class ProjectBudgetService {
//清空重新保存概算信息
clearBudget(p);
saveBudget(p, budgetBean);
clearBudgetDetail(p);
saveBudgetDetail(p);
return p;
}
private void saveBudgetDetail(Project p) {
//临时表中始终是最新的详情,不管是本次修改还是以前保持的
//收入明细
List<ProjectBudgetIncomeDetailTemp> projectBudgetIncomeDetailTemps = projectBudgetIncomeDetailTempRepository.findAllByProjectIdEquals(p.getId());
if(CollectionUtil.isNotEmpty(projectBudgetIncomeDetailTemps)){
List<ProjectBudgetIncomeDetail> incomeDetails = projectBudgetIncomeDetailTemps.stream()
.map(ProjectBudgetIncomeDetailTemp::toProjectBudgetIncomeDetail)
.collect(Collectors.toList());
projectBudgetIncomeDetailRepository.save(incomeDetails);
}
//成本明细
List<ProjectBudgetCostDetailTemp> projectBudgetCostDetailTemps = projectBudgetCostDetailTempRepository.findAllByProjectIdEquals(p.getId());
if(CollectionUtil.isNotEmpty(projectBudgetCostDetailTemps)){
List<ProjectBudgetCostDetail> costDetails = projectBudgetCostDetailTemps.stream()
.map(ProjectBudgetCostDetailTemp::toProjectBudgetCostDetail)
.collect(Collectors.toList());
projectBudgetCostDetailRepository.save(costDetails);
}
//项目管理明细
List<ProjectBudgetCostProjectManageDetailTemp> projectBudgetCostProjectManageDetailTemps = projectBudgetCostProjectManageDetailTempRepository.findAllByProjectIdEquals(p.getId());
if(CollectionUtil.isNotEmpty(projectBudgetCostProjectManageDetailTemps)){
List<ProjectBudgetCostProjectManageDetail> costProjectManageDetails = projectBudgetCostProjectManageDetailTemps.stream()
.map(ProjectBudgetCostProjectManageDetailTemp::toProjectBudgetCostProjectManageDetail)
.collect(Collectors.toList());
projectBudgetCostProjectManageDetailRepository.save(costProjectManageDetails);
}
//资金计划明细
List<ProjectBudgetPlanDetailTemp> projectBudgetPlanDetailTemps = projectBudgetPlanDetailTempRepository.findAllByProjectIdEquals(p.getId());
if(CollectionUtil.isNotEmpty(projectBudgetPlanDetailTemps)){
List<ProjectBudgetPlanDetail> budgetPlanDetails = projectBudgetPlanDetailTemps.stream()
.map(ProjectBudgetPlanDetailTemp::toProjectBudgetPlanDetail)
.collect(Collectors.toList());
projectBudgetPlanDetailRepository.save(budgetPlanDetails);
}
}
private void clearBudgetDetail(Project p) {
//收入明细
clearBudgetIncomeDetail(p);
//成本明细
clearBudgetCostDetail(p);
//项目管理明细
clearBudgetCostProjectManageDetail(p);
//资金计划明细
clearBudgetPlanDetail(p);
}
}