Forráskód Böngészése

项目立项信息导出模板文件,资金计划设置项目费率,通过费率得到项目应付金额,算出不同差额

lem 4 éve
szülő
commit
e466f0cdb2

+ 30 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/project/entity/CapitalPlan.java

@@ -5,6 +5,8 @@ import com.jeeplus.core.persistence.DataEntity;
  * 资金计划管理实体类
  * */
 public class CapitalPlan extends DataEntity<CapitalPlan> {
+    //储备项目暂定名称
+    private String reserveProjectName;
     //项目名称
     private String projectName;
     //项目定义号
@@ -57,6 +59,18 @@ public class CapitalPlan extends DataEntity<CapitalPlan> {
     private String actualOtherCost;
     //其它差额
     private String otherDifference;
+    //设计费费率
+    private String designRate;
+    //监理费费率
+    private String supervisionRate;
+
+    public String getReserveProjectName() {
+        return reserveProjectName;
+    }
+
+    public void setReserveProjectName(String reserveProjectName) {
+        this.reserveProjectName = reserveProjectName;
+    }
 
     public String getProjectName() {
         return projectName;
@@ -265,4 +279,20 @@ public class CapitalPlan extends DataEntity<CapitalPlan> {
     public void setOtherDifference(String otherDifference) {
         this.otherDifference = otherDifference;
     }
+
+    public String getDesignRate() {
+        return designRate;
+    }
+
+    public void setDesignRate(String designRate) {
+        this.designRate = designRate;
+    }
+
+    public String getSupervisionRate() {
+        return supervisionRate;
+    }
+
+    public void setSupervisionRate(String supervisionRate) {
+        this.supervisionRate = supervisionRate;
+    }
 }

+ 2 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/project/mapper/CapitalPlanMapper.java

@@ -17,4 +17,6 @@ public interface CapitalPlanMapper extends BaseMapper<CapitalPlan> {
     void insertList(List<CapitalPlan> capitalPlanList);
 
     void updateList(List<CapitalPlan> capitalPlanList);
+
+    void saveEdit(CapitalPlan capitalPlan);
 }

+ 13 - 3
src/main/java/com/jeeplus/modules/sg/managementcenter/project/mapper/xml/CapitalPlanMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.jeeplus.modules.sg.managementcenter.project.mapper.CapitalPlanMapper">
 
     <sql id="projectColumns">
-        a.id,
+        a.reserveProjectName,
         a.projectId,
         a.projectName
     </sql>
@@ -19,6 +19,7 @@
     </sql>
 
     <sql id="capitalPlanColumns">
+        b.id,
         b.projectBatch,
         b.actualCost,
         b.projectDifference,
@@ -35,7 +36,9 @@
         b.ActualManagementFee,
         b.policyDifference,
         b.actualOtherCost,
-        b.otherDifference
+        b.otherDifference,
+        b.designRate,
+        b.supervisionRate
     </sql>
 
     <select id="get" resultType="CapitalPlan">
@@ -45,7 +48,7 @@
         FROM xm_material_project a
         left join xm_capital_plan b
         on a.projectId = b.projectId
-        WHERE a.id = #{id}
+        WHERE b.id = #{id}
     </select>
 
     <select id="findList" resultType="CapitalPlan">
@@ -62,6 +65,7 @@
             a.del_flag = #{DEL_FLAG_NORMAL}
             ${dataScope}
             and a.projectid != ''
+            and a.secondPower = '0'
         </where>
         <choose>
             <when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -175,4 +179,10 @@
             where projectId =#{item.projectId}
         </foreach>
     </update>
+    <update id="saveEdit">
+        update xm_capital_plan
+        set designRate = #{designRate},
+            supervisionRate = #{supervisionRate}
+        where id  = #{id}
+    </update>
 </mapper>

+ 1 - 1
src/main/java/com/jeeplus/modules/sg/managementcenter/project/mapper/xml/ProjectMapper.xml

@@ -770,7 +770,7 @@
     <select id="allProjectId" resultType="java.lang.String">
         select projectId
         from xm_material_project
-        where projectId != ''
+        where projectId != '' and secondPower = '0'
     </select>
 
     <select id="findProByName" resultType="com.jeeplus.modules.sg.managementcenter.project.entity.Project">

+ 6 - 1
src/main/java/com/jeeplus/modules/sg/managementcenter/project/service/CapitalPlanService.java

@@ -26,7 +26,7 @@ import java.util.List;
 @Transactional(readOnly = true)
 public class CapitalPlanService extends CrudService<CapitalPlanMapper, CapitalPlan> {
     @Autowired
-	private CapitalPlanMapper capitalPlanMapper;
+    private CapitalPlanMapper capitalPlanMapper;
 
     @Autowired
     private ProjectMapper projectMapper;
@@ -51,4 +51,9 @@ public class CapitalPlanService extends CrudService<CapitalPlanMapper, CapitalPl
     public void updateList(List<CapitalPlan> capitalPlanList) {
         capitalPlanMapper.updateList(capitalPlanList);
     }
+
+    @Transactional(readOnly = false)
+    public void saveEdit(CapitalPlan capitalPlan) {
+        capitalPlanMapper.saveEdit(capitalPlan);
+    }
 }

+ 72 - 34
src/main/java/com/jeeplus/modules/sg/managementcenter/project/web/CapitalPlanController.java

@@ -70,11 +70,20 @@ public class CapitalPlanController extends BaseController {
      * 资金计划管理页面
      */
     @RequestMapping(value = "capitalPlanList")
-    public String basicInformation(Project project, Model model) {
-        model.addAttribute("project", project);
+    public String basicInformation(CapitalPlan capitalPlan, Model model) {
+        model.addAttribute("capitalPlan", capitalPlan);
         return "modules/sg/capitalPlan/capitalPlanList";
     }
 
+    /**
+     * 修改项目费率页面
+     */
+    @RequestMapping(value = "editRate")
+    public String editRate(CapitalPlan capitalPlan, Model model) {
+        model.addAttribute("capitalPlan", capitalPlan);
+        return "modules/sg/capitalPlan/editRate";
+    }
+
 
 
     /**
@@ -86,26 +95,48 @@ public class CapitalPlanController extends BaseController {
         Page<CapitalPlan> page = capitalPlanService.findPage(new Page<CapitalPlan>(request, response), capitalPlan);
         List<CapitalPlan> list = page.getList();
         for (CapitalPlan c:list) {
+            //项目预算
             String projectBudget = c.getProjectBudget();
+            //项目实际费用
             String actualCost = c.getActualCost();
-
+            //施工费
             String constructionCost = c.getConstructionCost();
+            //实际施工费
             String actualConstructionCost = c.getActualConstructionCost();
-
+            //物资费
             String materialCost = c.getMaterialCost();
+            //项目实际物资费
             String actualMaterialCost = c.getActualMaterialCost();
-
+            //设计费
             String designFee = c.getDesignFee();
+            //项目实际设计费
             String actualDesignCost = c.getActualDesignCost();
-
+            //监理费
+            String supervisionFee = c.getSupervisionFee();
+            //应付监理费
             String supervisionPayFee = c.getSupervisionPayFee();
+            //项目实际监理费
             String actualSupervisionCost = c.getActualSupervisionCost();
-
+            //政策处理费用
             String policyProcessingFee = c.getPolicyProcessingFee();
+            //项目实际管理费
             String actualManagementFee = c.getActualManagementFee();
-
+            //其他费用
             String otherExpenses = c.getOtherExpenses();
+            //实际其他费用
             String actualOtherCost = c.getActualOtherCost();
+            //设计费费率
+            String designRate = c.getDesignRate();
+            //监理费费率
+            String supervisionRate = c.getSupervisionRate();
+            //判断费率是否为空值,为空值,自动配置为0
+            if (null == designRate || "".equals(designRate)) {
+                designRate = "0";
+            }
+            if (null==supervisionRate || "".equals(supervisionRate)) {
+                supervisionRate = "0";
+            }
+
             //将空值初始化
             projectBudget = getString(projectBudget);
             actualCost = getString(actualCost);
@@ -122,21 +153,42 @@ public class CapitalPlanController extends BaseController {
             otherExpenses = getString(otherExpenses);
             actualOtherCost = getString(actualOtherCost);
 
+
             BigDecimal projectDifference = new BigDecimal(projectBudget);
             BigDecimal constructionDifference = new BigDecimal(constructionCost);
             BigDecimal costDifference = new BigDecimal(materialCost);
-            BigDecimal designDifference = new BigDecimal(designFee);
-            BigDecimal supervisionDifference = new BigDecimal(supervisionPayFee);
+            //设计费
+            BigDecimal designFeeDiff = new BigDecimal(designFee);
+            //监理费
+            BigDecimal supervisionPayFeeDiff = new BigDecimal(supervisionPayFee);
             BigDecimal policyDifference = new BigDecimal(policyProcessingFee);
             BigDecimal otherDifference = new BigDecimal(otherExpenses);
-
+            //设计费费率
+            BigDecimal designRateDiff = new BigDecimal(designRate);
+            //监理费费率
+            BigDecimal supervisionRateDiff = new BigDecimal(supervisionRate);
+            //监理费
+            BigDecimal supervisionFeeDiff = new BigDecimal(supervisionFee);
+
+            //项目预算-项目实际费用
             projectDifference = projectDifference.subtract(new BigDecimal(actualCost));
+            //施工费-实际施工费
             constructionDifference = constructionDifference.subtract(new BigDecimal(actualConstructionCost));
+            //物资费-项目实际物资费
             costDifference = costDifference.subtract(new BigDecimal(actualMaterialCost));
-            designDifference = designDifference.subtract(new BigDecimal(actualDesignCost));
-            supervisionDifference = supervisionDifference.subtract(new BigDecimal(actualSupervisionCost));
+            //应付设计费=设计费*费率
+            BigDecimal multiply = designRateDiff.multiply(designFeeDiff);
+            //应付设计费-实际设计费
+            BigDecimal designDifference = multiply.subtract(new BigDecimal(actualDesignCost));
+//            supervisionDifference = supervisionDifference.subtract();
             policyDifference = policyDifference.subtract(new BigDecimal(actualManagementFee));
             otherDifference = otherDifference.subtract(new BigDecimal(actualOtherCost));
+            designRateDiff = designRateDiff.multiply(new BigDecimal(designFee));
+            //应付监理费=监理费*监理费费率
+            BigDecimal multiply1 = supervisionFeeDiff.multiply(supervisionRateDiff);
+            //应付-实际,监理差额
+            BigDecimal supervisionDifference = multiply1.subtract(new BigDecimal(actualSupervisionCost));
+
 
             c.setProjectDifference(projectDifference.toString());
             c.setConstructionDifference(constructionDifference.toString());
@@ -145,6 +197,8 @@ public class CapitalPlanController extends BaseController {
             c.setSupervisionDifference(supervisionDifference.toString());
             c.setPolicyDifference(policyDifference.toString());
             c.setOtherDifference(otherDifference.toString());
+            c.setDesignPayFee(designRateDiff.toString());
+            c.setSupervisionPayFee(multiply1.toString());
 
         }
         return getBootstrapData(page);
@@ -159,31 +213,15 @@ public class CapitalPlanController extends BaseController {
 
 
     /**
-     * 查看,增加,编辑表单表单页面
-     */
-    @RequestMapping(value = "capitalPlanForm")
-    public String basicInformationForm(Project project, Model model) {
-        model.addAttribute("project", project);
-        return "modules/sg/capitalPlan/basicInformationForm";
-    }
-
-
-
-    /**
      * 保存表单
      */
     @ResponseBody
-    @RequestMapping(value = "saveCapitalPlan")
-    public AjaxJson savePlan(Project project, Model model) throws Exception {
+    @RequestMapping(value = "saveEdit")
+    public AjaxJson saveEdit(CapitalPlan capitalPlan, Model model) throws Exception {
         AjaxJson j = new AjaxJson();
-        Boolean flag = false;
-
-        String str = "";
-        /**
-         * 后台hibernate-validation插件校验
-         */
-            j.setSuccess(false);
-            j.setMsg("项目流程运行中不可修改信息");
+        capitalPlanService.saveEdit(capitalPlan);
+        j.setSuccess(true);
+        j.setMsg("修改费率成功");
         return j;
     }
 

+ 41 - 2
src/main/java/com/jeeplus/modules/sg/managementcenter/project/web/ProjectController.java

@@ -3,12 +3,14 @@
  */
 package com.jeeplus.modules.sg.managementcenter.project.web;
 
+import java.io.*;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
 import javax.persistence.Basic;
+import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
@@ -839,10 +841,8 @@ public class ProjectController extends BaseController {
         try {
 //			project1.setProjectManageRole(UserUtils.getUser().getLoginName());
             String fileName = "需求基本信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
-
             HttpSession session = request.getSession();
 //			Project projectEpo = (Project)session.getAttribute("projectEpo");
-
             Page<Project> page = projectService.findPage(new Page<Project>(request, response, -1), project);
             new ExportExcel("需求基本信息", Project.class).setDataList(page.getList()).write(response, fileName).dispose();
             j.setSuccess(true);
@@ -856,6 +856,45 @@ public class ProjectController extends BaseController {
     }
 
     /**
+     * 下载工程量模板文件
+     */
+    @RequestMapping(value = "approvalTemplate")
+    public void approvalTemplate(HttpServletRequest request,
+                                 HttpServletResponse response) throws IOException {
+        String fileName = "establishment.xlsx";
+        String filePath = getClass().getResource("/freemarker/" + fileName).getPath();
+        File f = new File(filePath);
+        // 设置response参数,可以打开下载页面
+        response.reset();
+        response.setContentType("application/vnd.ms-excel;charset=utf-8");
+        try {
+            response.setHeader("Content-Disposition", "attachment;filename=" + new String(("项目立项信息模板" + ".xlsx").getBytes(), "iso-8859-1"));//下载文件的名称
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        ServletOutputStream out = response.getOutputStream();
+        BufferedInputStream bis = null;
+        BufferedOutputStream bos = null;
+        try {
+            bis = new BufferedInputStream(new FileInputStream(f));
+            bos = new BufferedOutputStream(out);
+            byte[] buff = new byte[2048];
+            int bytesRead;
+            while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
+                bos.write(buff, 0, bytesRead);
+            }
+        } catch (final IOException e) {
+            throw e;
+        } finally {
+            if (bis != null)
+                bis.close();
+            if (bos != null)
+                bos.close();
+        }
+    }
+
+
+    /**
      * 导入Excel数据
      */
     @ResponseBody

BIN
src/main/resources/freemarker/establishment.xlsx


+ 12 - 28
src/main/webapp/webpage/modules/sg/capitalPlan/capitalPlanList.js

@@ -147,7 +147,7 @@ $(document).ready(function () {
                 width:150,
                 title: '设计费',
             }, {
-                field: 'DesignPayFee',
+                field: 'designPayFee',
                 width:150,
                 title: '应付设计费',
             }
@@ -210,6 +210,14 @@ $(document).ready(function () {
                 field: 'otherDifference',
                 width:150,
                 title: '其它差额',
+            }, {
+                field: 'designRate',
+                width:150,
+                title: '设计费费率',
+            }, {
+                field: 'supervisionRate',
+                width:150,
+                title: '监理费费率',
             }
             ]
     });
@@ -252,32 +260,8 @@ $(document).ready(function () {
             }
         });
     });
-    $("#btnImportPicking").click(function () {
-        jp.open({
-            type: 2,
-            area: [500, 200],
-            auto: true,
-            title: "导入领料单",
-            content: "${ctx}/tag/importExcel",
-            btn: ['确定', '关闭'],
-            btn1: function (index, layero) {
-                var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
-                iframeWin.contentWindow.importExcel('${ctx}/sg/managementcenter/project/importPicking', function (data) {
-                    if (data.success) {
-                        jp.success(data.msg);
-                        refresh();
-                    } else {
-                        jp.error(data.msg);
-                    }
-                    jp.close(index);
-                });//调用保存事件
-                return false;
-            },
-            btn2: function (index) {
-                //  jp.close(index);
-            }
-        });
-    });
+
+;
 
     $("#export").click(function () {//导出Excel文件
         jp.downloadFile('${ctx}/sg/managementcenter/project/export');
@@ -326,7 +310,7 @@ function edit(id) {//没有权限时,不显示确定按钮
     if (id == undefined) {
         id = getIdSelections();
     }
-    jp.openSaveDialog('编辑交底计划安排表单', "${ctx}/sg/managementcenter/project/approvalForm?id=" + id, '800px', '500px');
+    jp.openSaveDialog('修改项目费率', "${ctx}/sg/capitalPlan/editRate?id=" + id, '800px', '500px');
 }
 
 function view(id) {//没有权限时,不显示确定按钮

+ 8 - 5
src/main/webapp/webpage/modules/sg/capitalPlan/capitalPlanList.jsp

@@ -19,7 +19,7 @@
 		<!-- 搜索 -->
 		<div id="search-collapse" class="collapse">
 			<div class="accordion-inner">
-				<form:form id="searchForm" modelAttribute="project" class="form form-horizontal well clearfix">
+				<form:form id="searchForm" modelAttribute="capitalPlan" class="form form-horizontal well clearfix">
 					<div class="col-xs-12 col-sm-6 col-md-4">
 						<label class="label-item single-overflow pull-left" title="项目定义号:">项目定义号:</label>
 						<form:input path="projectId" htmlEscape="false" maxlength="100"  class=" form-control"/>
@@ -36,10 +36,13 @@
 	
 	<!-- 工具栏 -->
 	<div id="toolbar">
-			<shiro:hasPermission name="sg:managementcenter:project:import">
-				<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>
-			</shiro:hasPermission>
-		    </div>
+			<button id="btnImport" class="btn btn-info">
+				<i class="fa fa-folder-open-o"></i> 导入项目明细账
+			</button>
+			<button id="edit" class="btn btn-primary" onclick="edit()">
+				<i class="glyphicon glyphicon-edit"></i> 修改项目费率
+			</button>
+	</div>
 		
 	<!-- 表格 -->
 	<table id="projectTable"  style="table-layout:fixed"  data-toolbar="#toolbar"></table>

+ 82 - 0
src/main/webapp/webpage/modules/sg/capitalPlan/editRate.jsp

@@ -0,0 +1,82 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>修改项目费率</title>
+	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
+	<meta name="decorator" content="ani"/>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			$('#beginDate').datetimepicker({
+				format: "YYYY-MM-DD HH:mm:ss"
+			});
+			$('#endDate').datetimepicker({
+				format: "YYYY-MM-DD HH:mm:ss"
+			});
+		});
+		function save() {
+			var designRate = $("#designRate").val();
+			var supervisionRate = $("#supervisionRate").val();
+			if (designRate == "" || supervisionRate == "") {
+				jp.error("请先填写项目费率");
+				return;
+			}
+			jp.loading();
+			jp.post("${ctx}/sg/capitalPlan/saveEdit",$('#inputForm').serialize(),function(data){
+				function extracted() {
+					jp.getParent().refresh();
+					var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
+					parent.layer.close(dialogIndex);
+				}
+				if(data.success){
+					extracted();
+					jp.success(data.msg)
+				}else{
+					jp.error(data.msg);
+				}
+			})
+		}
+	</script>
+</head>
+<body>
+	<div class="wrapper wrapper-content">
+		<div class="panel panel-primary">
+			<div class="panel-body">
+				<form:form id="inputForm" modelAttribute="capitalPlan" class="form-horizontal">
+				<form:hidden path="id"/>
+				<table class="table table-bordered">
+					<tbody>
+					<tr>
+						<td class="width-15 active"><label class=""><font color="red">*</font>储备项目名称:</label></td>
+						<td class="width-35">
+							<form:input path="reserveProjectName"   htmlEscape="false"  readonly="true"   class="form-control"/>
+						</td>
+					</tr>
+					<tr>
+						<td class="width-15 active"><label class=""><font color="red">*</font>项目定义号:</label></td>
+						<td class="width-35">
+							<form:input path="projectId"   htmlEscape="false"  readonly="true"   class="form-control"/>
+						</td>
+						<td class="width-15 active"><label class=""><font color="red">*</font>项目名称:</label></td>
+						<td class="width-35">
+							<form:input path="projectName"   htmlEscape="false"  readonly="true"  class="form-control"/>
+						</td>
+					</tr>
+					<tr>
+						<td class="width-15 active"><label class=""><font color="red">*</font>设计费费率:</label></td>
+						<td class="width-35">
+							<form:input path="designRate"   htmlEscape="false"  class="form-control required"/>
+						</td>
+						<td class="width-15 active"><label class=""><font color="red">*</font>监理费费率:</label></td>
+						<td class="width-35">
+							<form:input path="supervisionRate"   htmlEscape="false"  class="form-control required"/>
+						</td>
+					</tr>
+					</tbody>
+				</table>
+				</form:form>
+			</div>
+		</div>
+	</div>
+</body>
+</html>

+ 6 - 30
src/main/webapp/webpage/modules/sg/managementcenter/project/projectApproval.js

@@ -172,37 +172,13 @@ $(document).ready(function () {
             auto: true,
             title: "导入数据",
             content: "${ctx}/tag/importExcel",
-            btn: ['确定', '关闭'],
-            btn1: function (index, layero) {
-                var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
-                iframeWin.contentWindow.importExcel('${ctx}/sg/managementcenter/project/importApproval', function (data) {
-                    if (data.success) {
-                        jp.success(data.msg);
-                        refresh();
-                    } else {
-                        jp.error(data.msg);
-                    }
-                    jp.close(index);
-                });//调用保存事件
-                return false;
+            btn: ['导出模板','确定', '关闭'],
+            btn1:function(){
+                jp.downloadFile('${ctx}/sg/managementcenter/project/approvalTemplate')
             },
-
-            btn2: function (index) {
-                //  jp.close(index);
-            }
-        });
-    });
-    $("#btnImportPicking").click(function () {
-        jp.open({
-            type: 2,
-            area: [500, 200],
-            auto: true,
-            title: "导入领料单",
-            content: "${ctx}/tag/importExcel",
-            btn: ['确定', '关闭'],
-            btn1: function (index, layero) {
+            btn2: function (index, layero) {
                 var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
-                iframeWin.contentWindow.importExcel('${ctx}/sg/managementcenter/project/importPicking', function (data) {
+                iframeWin.contentWindow.importExcel('${ctx}/sg/managementcenter/project/importApproval', function (data) {
                     if (data.success) {
                         jp.success(data.msg);
                         refresh();
@@ -213,7 +189,7 @@ $(document).ready(function () {
                 });//调用保存事件
                 return false;
             },
-            btn2: function (index) {
+            btn3: function (index) {
                 //  jp.close(index);
             }
         });