Преглед на файлове

修改批产任务详情

LLL преди 1 година
родител
ревизия
e578b5f58f

+ 37 - 8
module_kzks/src/main/java/org/jeecg/modules/projectCost/controller/ProjectCostController.java

@@ -10,9 +10,9 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.modules.projectChbSwf.entity.ProjectChbSwf;
 import org.jeecg.modules.projectCost.entity.ProjectCost;
 import org.jeecg.modules.projectCost.service.IProjectCostService;
+import org.jeecg.modules.projectCost.vo.ProjectCostListVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
@@ -20,7 +20,6 @@ import org.springframework.web.servlet.ModelAndView;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
@@ -43,15 +42,18 @@ public class ProjectCostController extends JeecgController<ProjectCost, IProject
 	/**项目成本——批产任务的各种费用详情——根据批产任务号查询*/
 	@ApiOperation("项目成本——批产任务的各种费用详情")
 	@GetMapping("/getPCCostDetailList")
-	public List<ProjectCost> getPCCostDetailList(String pccode, BigDecimal proportion){
-		List<ProjectCost> list = new ArrayList<>();
+	public ProjectCostListVO getPCCostDetailList(String pccode, BigDecimal proportion){
+		ProjectCostListVO vo = new ProjectCostListVO();
 		if(!Objects.equals(pccode,"") && !Objects.equals(proportion,"")){
-			list = projectCostService.getPCRWList(pccode);
-			for (ProjectCost cost : list){
-				cost = jisuan(cost,proportion);
+			vo = projectCostService.getPCRWList(pccode);
+			vo = jisuan(vo,proportion);
+			if(vo.getChildren()!=null && !vo.getChildren().isEmpty()){
+				for (ProjectCost cost : vo.getChildren()){
+					cost = jisuan(cost,proportion);
+				}
 			}
 		}
-		return list;
+		return vo;
 	}
 
 	public ProjectCost jisuan(ProjectCost cost,BigDecimal proportion){
@@ -81,6 +83,33 @@ public class ProjectCostController extends JeecgController<ProjectCost, IProject
 		if(cost.getWxys()!=null) cost.setWxys(cost.getWxys().multiply(proportion));
 		return cost;
 	}
+	public ProjectCostListVO jisuan(ProjectCostListVO cost,BigDecimal proportion){
+		if(cost.getOneIncome()!=null) cost.setOneIncome(cost.getOneIncome().multiply(proportion));
+		if(cost.getOneIncome()!=null) cost.setOneCost(cost.getOneCost().multiply(proportion));
+		if(cost.getOneProfit()!=null) cost.setOneProfit(cost.getOneProfit().multiply(proportion));
+		if(cost.getLre()!=null) cost.setLre(cost.getLre().multiply(proportion));
+		if(cost.getLrl()!=null) cost.setLrl(cost.getLrl().multiply(proportion));
+		if(cost.getEstimationcoat()!=null) cost.setEstimationcoat(cost.getEstimationcoat().multiply(proportion));
+		if(cost.getContractfpe()!=null) cost.setContractfpe(cost.getContractfpe().multiply(proportion));
+		if(cost.getTaskmoney()!=null) cost.setTaskmoney(cost.getTaskmoney().multiply(proportion));
+		if(cost.getZcb()!=null) cost.setZcb(cost.getZcb().multiply(proportion));
+		if(cost.getClf()!=null) cost.setClf(cost.getClf().multiply(proportion));
+		if(cost.getZyf()!=null) cost.setZyf(cost.getZyf().multiply(proportion));
+		if(cost.getSwf()!=null) cost.setSwf(cost.getSwf().multiply(proportion));
+		if(cost.getWxf()!=null) cost.setWxf(cost.getWxf().multiply(proportion));
+		if(cost.getRldlf()!=null) cost.setRldlf(cost.getRldlf().multiply(proportion));
+		if(cost.getGdzczj()!=null) cost.setGdzczj(cost.getGdzczj().multiply(proportion));
+		if(cost.getGzjlwf()!=null) cost.setGzjlwf(cost.getGzjlwf().multiply(proportion));
+		if(cost.getGlf()!=null) cost.setGlf(cost.getGlf().multiply(proportion));
+		if(cost.getZjcb()!=null) cost.setZjcb(cost.getZjcb().multiply(proportion));
+		if(cost.getLbsy()!=null) cost.setLbsy(cost.getLbsy().multiply(proportion));
+		if(cost.getWorkhour()!=null) cost.setWorkhour(cost.getWorkhour().multiply(proportion));
+		if(cost.getSjgs()!=null) cost.setSjgs(cost.getSjgs().multiply(proportion));
+		if(cost.getScgs()!=null) cost.setScgs(cost.getScgs().multiply(proportion));
+		if(cost.getClys()!=null) cost.setClys(cost.getClys().multiply(proportion));
+		if(cost.getWxys()!=null) cost.setWxys(cost.getWxys().multiply(proportion));
+		return cost;
+	}
 
 	/**
 	* 对比

+ 2 - 1
module_kzks/src/main/java/org/jeecg/modules/projectCost/service/IProjectCostService.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.projectCost.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.projectCost.entity.ProjectCost;
+import org.jeecg.modules.projectCost.vo.ProjectCostListVO;
 
 import java.util.List;
 
@@ -14,7 +15,7 @@ import java.util.List;
 public interface IProjectCostService extends IService<ProjectCost> {
 
     /**根据批产任务号查询项目成本(批产主任务和批产子任务)*/
-    public List<ProjectCost> getPCRWList(String pccode);
+    public ProjectCostListVO getPCRWList(String pccode);
 
     /**根据任务号查询项目成本的主任务及组批后的主任务*/
     public List<ProjectCost> costListByTaskNoMain(String taskno);

+ 11 - 11
module_kzks/src/main/java/org/jeecg/modules/projectCost/service/impl/ProjectCostServiceImpl.java

@@ -3,13 +3,15 @@ package org.jeecg.modules.projectCost.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.modules.dataSourceSwitch.annotation.TargetDataSource;
+import org.jeecg.modules.dataSourceSwitch.enums.DataSourceType;
+import org.jeecg.modules.projectCost.convert.ProjectCostConvert;
 import org.jeecg.modules.projectCost.entity.ProjectCost;
 import org.jeecg.modules.projectCost.mapper.ProjectCostMapper;
 import org.jeecg.modules.projectCost.service.IProjectCostService;
+import org.jeecg.modules.projectCost.vo.ProjectCostListVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -26,33 +28,31 @@ public class ProjectCostServiceImpl extends ServiceImpl<ProjectCostMapper, Proje
     private ProjectCostMapper projectCostMapper;
 
     /**根据批产任务号查询项目成本(批产主任务和批产子任务)*/
-    public List<ProjectCost> getPCRWList(String pccode){
-        List<ProjectCost> list = new ArrayList<>();
-
+    public ProjectCostListVO getPCRWList(String pccode){
         QueryWrapper<ProjectCost> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("taskno",pccode);
-        List<ProjectCost> list1 = projectCostMapper.selectList(queryWrapper);
+        queryWrapper.eq("status","0");
+        ProjectCost cost = projectCostMapper.selectOne(queryWrapper);
 
         queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("reftaskno",pccode);
-        List<ProjectCost> list2 = projectCostMapper.selectList(queryWrapper);
+        List<ProjectCost> children = projectCostMapper.selectList(queryWrapper);
 
-        list.addAll(list1);
-        list.addAll(list2);
-        return list;
+        ProjectCostListVO vo = ProjectCostConvert.INSTANCE.toProjectCostListVO(cost,children);
+        return vo;
     }
 
     /**根据任务号查询项目成本的主任务及组批后的主任务
      * */
     // 将注解标注在方法上,表示此方法使用数据源2
-    @TargetDataSource()
+    @TargetDataSource(value = DataSourceType.SLAVE)
     public List<ProjectCost> costListByTaskNoMain(String taskno){
         return projectCostMapper.costListByTaskNoMain(taskno);
     }
 
     /**根据任务号查询项目成本的子任务及组批后的子任务*/
     // 将注解标注在方法上,表示此方法使用数据源2
-    @TargetDataSource()
+    @TargetDataSource(value = DataSourceType.SLAVE)
     public List<ProjectCost> costListByTaskNoSub(String taskno){
         return projectCostMapper.costListByTaskNoSub(taskno);
     }