Jelajahi Sumber

erp 添加注释

xs 5 tahun lalu
induk
melakukan
df9372154d

+ 3 - 0
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/entity/ErpAccount.java

@@ -5,6 +5,9 @@ import org.dozer.Mapping;
 
 import java.io.Serializable;
 
+/**
+ * 导入实体类
+ */
 public class ErpAccount implements Serializable {
     private static final long serialVersionUID = 1L;
 //    private String companyCode;//公司代码

+ 72 - 39
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ErpInfo.java

@@ -60,6 +60,11 @@ public  class ErpInfo {
         return true;
     }
 
+    /**
+     * 获取表格数据
+     * @param importUtil
+     * @return List<ErpAccount> 导入表格数据
+     */
     public static List<ErpAccount> getErpAccount(ImportUtil importUtil)  {
         int lastRow = importUtil.getLastDataRowNum();
         List<ErpAccount> list = new ArrayList<ErpAccount>();
@@ -92,7 +97,7 @@ public  class ErpInfo {
      * @return 返回List<ErpCredit>
      */
     public static List<ErpCredit> getAllErpCreditList(List<ErpAccount> list){
-        boolean flag; //设备费开关
+        boolean flag; //设备费开关:施工费中 建筑费 安装判断 true-建筑费 false-安装费
         //获取erpCredit对象 list集合
         List<ErpCredit> erpCredits = getListErpCredit(list);
         //获取ErpCreditChild1对象 list集合 (设备费)
@@ -103,7 +108,7 @@ public  class ErpInfo {
         List<ErpCreditChild3> erpCreditChild3s = getListErpCreditChild3(list);
         //循环erpCredit对象 list集合
         for (ErpCredit erpCredit:erpCredits){
-            flag = true;
+            flag = true;//赋初始值
             //设备费 集合 循环
             for (ErpCreditChild1 erpCreditChild1:erpCreditChild1s){
                 //判断 erpCredit对象项目定义编号  与  ErpCreditChild1对象项目定义编号
@@ -130,21 +135,27 @@ public  class ErpInfo {
                     erpCredit.getErpCreditChild3s().add(erpCreditChild3);
                 }
             }
-            if (flag){
+            if (flag){//如果为true
+                //施工费合计 赋值为 建筑费(无 设备费入账金额 以及 材料费入账金额)
                 erpCredit.setConsBuildingFee(erpCredit.getConsTotalFee());
             }else {
+                //施工费合计 赋值为安装费(有 设备费入账金额 或者 材料费入账金额)
                 erpCredit.setConsInstallFee(erpCredit.getConsTotalFee());
             }
         }
         return erpCredits;
     }
 
-
+    /**
+     * 获取单独 唯一 的 数据集合(项目定义编号——其他费用合计)
+     * @param list 读取表格获得的列表
+     * @return List<ErpCredit> 主类 集合(单独唯一的数据集合)
+     */
     public static List<ErpCredit> getListErpCredit(List<ErpAccount> list){
-        List<ErpCredit> erpCredits = new ArrayList<ErpCredit>();
-        ErpCredit erpCredit=null;
-        ErpAccount erpAccount=null;
-        boolean flag = true;
+        List<ErpCredit> erpCredits = new ArrayList<ErpCredit>();//定义集合
+        ErpCredit erpCredit=null;//要获取集合对象
+        ErpAccount erpAccount=null;//导入表格对象
+        boolean flag = true;//判断 项目定义编号是否相同 true-不相同 false-相同
         double actualInvestment = 0.0;//实际投资
         double consTotalFee=0.0;//施工费:合计
         double otherSupervisorFee=0.0;//其他费用:监理费:入账金额
@@ -154,36 +165,45 @@ public  class ErpInfo {
         double otherLegalManage=0.0;//法人管理费
         double otherTotalFee=0.0;//其他费用合计
         double lineItemAmount;//行项目金额合计
+        //循环导入表格对象
         for (int i = 0; i < list.size(); i++) {
-            flag = true;
+            flag = true;//默认值为true (默认项目定义编号不相同)
             erpAccount=list.get(i);//获取erpAccount对象
+            //判断 导入表格 对象 的行项目金额是否为空
             if(erpAccount.getLineItemAmount().isEmpty()){
-                lineItemAmount=0.0;
+                lineItemAmount=0.0;//如果为空  默认值为0.0;
             }else {
+                //否则 获取行羡慕金额
                 lineItemAmount = Double.parseDouble(erpAccount.getLineItemAmount());
             }
-            //判断当前集合存在
+            //判断当前 集合有数据
             if (null!=erpCredits&&erpCredits.size()>0){
+                //循环 当前得到的ErpCredits对象
                 for (int j = 0; j < erpCredits.size(); j++) {
                     erpCredit = erpCredits.get(j);//获取 erpCredit对象
                     //判断项目定义号相同
                     if (erpAccount.getProjectDefinitionCode().equals(erpCredit.getItemId())){
-                        //实际投资
+                        //筛选(科目名称)中包含(工程成本-)的所有内容,统计行项目金额合计
                         if (erpAccount.getSubjectName().contains(ErpInfo.CON_PROJECT)){
+                            //当前实际投资+获取到的行项目金额
                             actualInvestment=erpCredit.getActualInvestment()+lineItemAmount;
+                            //替换 实际投资金额
                             erpCredit.setActualInvestment(actualInvestment);
                         }
                         //施工费:合计:入账金额 判断物料描述是否为空
                         if (erpAccount.getMaterialDetails().isEmpty()) {
+                            //筛选物料描述为空的(科目名称)中包含(工程成本-安装工程支出)的所有内容,统计行项目金额合计
                             if (erpAccount.getSubjectName().contains(ErpInfo.CON_PROJECT + ErpInfo.CON_lINE + ErpInfo.CON_IPE)) {
-                                //得到施工费:合计
+                                //当前施工费:合计+获取到的行项目金额
                                 consTotalFee = erpCredit.getConsTotalFee()+ lineItemAmount;
+                                //替换 施工费:合计金额
                                 erpCredit.setConsTotalFee(consTotalFee);
                             }
+                            //筛选物料描述为空的先筛选(科目名称)中包含(工程成本-待摊支出-其他/工程成本-待摊支出-项目法人管理费-其他/项目管理经费 - 会议费)
                             if (erpAccount.getSubjectName().contains(ErpInfo.CON_PlPlQ)||
                                     erpAccount.getSubjectName().contains(ErpInfo.CON_PLPLPLQ)||
                                     erpAccount.getSubjectName().contains(ErpInfo.CON_PLM)){
-                                //判断WBS描述为工程监理费
+                                //筛选(WBS描述)为工程监理费的行项目金额合计
                                 if (erpAccount.getWbsDetails().equals(ErpInfo.CON_PSF)){
                                     otherSupervisorFee = erpCredit.getOtherSupervisorFee()+lineItemAmount;//监理费
                                     erpCredit.setOtherSupervisorFee(otherSupervisorFee);
@@ -203,6 +223,7 @@ public  class ErpInfo {
                                     otherLineDamages = erpCredit.getOtherLineDamages()+lineItemAmount;//建设期贷款利息
                                     erpCredit.setOtherLineDamages(otherLineDamages);
                                 }
+                                //其他费用:法人管理费
                                 otherLegalManage=erpCredit.getOtherLegalManage()+lineItemAmount;
                                 erpCredit.setOtherLegalManage(otherLegalManage);
                                 //其他费用:合计
@@ -217,29 +238,32 @@ public  class ErpInfo {
             }
             //第一次,或者项目定义编码不同 进行如下方法计算
             if (flag){
-                erpCredit = new ErpCredit();
+                erpCredit = new ErpCredit();//获取ErpCredit对象
                 erpCredit.setItemId(erpAccount.getProjectDefinitionCode());//添加项目定义编号
-                erpCredit.setItemName(erpAccount.getProjectDefinitionDetails());//
-                //预先赋值,防止空指针
-                erpCredit.setConsTotalFee(lineItemAmount);
-                erpCredit.setOtherSupervisorFee(lineItemAmount);
-                erpCredit.setOtherDesignFee(lineItemAmount);
-                erpCredit.setOtherBuildLoan(lineItemAmount);
-                erpCredit.setOtherLineDamages(lineItemAmount);
-                erpCredit.setOtherLegalManage(lineItemAmount);
+                erpCredit.setItemName(erpAccount.getProjectDefinitionDetails());//项目名称
+                erpCredit.setConsTotalFee(lineItemAmount);//添加施工费合计
+                erpCredit.setOtherSupervisorFee(lineItemAmount);//添加其他:监理费
+                erpCredit.setOtherDesignFee(lineItemAmount);//添加 其他设计费
+//                erpCredit.setOtherBeWorkFee(lineItemAmount); // 添加 项目前期工作费 (暂不确定)
+                erpCredit.setOtherBuildLoan(lineItemAmount);//添加 建设期贷款利息
+                erpCredit.setOtherLineDamages(lineItemAmount);//添加 线路施工赔偿费
+                erpCredit.setOtherLegalManage(lineItemAmount);//添加 法人管理费
                 //其他费用:合计
                 erpCredit.setOtherTotalFee(lineItemAmount);
 
-                //实际投资
+                //筛选(科目名称)中包含(工程成本-)的所有内容,统计行项目金额合计
                 if (erpAccount.getSubjectName().contains(ErpInfo.CON_PROJECT)){
-                    erpCredit.setActualInvestment(lineItemAmount);//添加实际金额
+                    //添加行项目金额 到 ErpCredit对象中的实际投资金额
+                    erpCredit.setActualInvestment(lineItemAmount);
                 }
                 //施工费:合计:入账金额 判断物料描述是否为空
                 if (erpAccount.getMaterialDetails().isEmpty()) {
+                    //筛选物料描述为空的(科目名称)中包含(工程成本-安装工程支出)的所有内容,统计行项目金额合计
                     if (erpAccount.getSubjectName().contains(ErpInfo.CON_PROJECT + ErpInfo.CON_lINE + ErpInfo.CON_IPE)) {
                         //得到施工费
                         erpCredit.setConsTotalFee(lineItemAmount);
                     }
+                    //筛选物料描述为空的先筛选(科目名称)中包含(工程成本-待摊支出-其他/工程成本-待摊支出-项目法人管理费-其他/项目管理经费 - 会议费)
                     if (erpAccount.getSubjectName().contains(ErpInfo.CON_PlPlQ)||
                             erpAccount.getSubjectName().contains(ErpInfo.CON_PLPLPLQ)||
                             erpAccount.getSubjectName().contains(ErpInfo.CON_PLM)){
@@ -259,6 +283,7 @@ public  class ErpInfo {
                         if (erpAccount.getWbsDetails().equals(ErpInfo.CON_OLD)){
                             erpCredit.setOtherLineDamages(lineItemAmount);
                         }
+                        //其他费用:法人管理费
                         erpCredit.setOtherLegalManage(lineItemAmount);
                         //其他费用:合计
                         erpCredit.setOtherTotalFee(lineItemAmount);
@@ -279,7 +304,7 @@ public  class ErpInfo {
         Double eqmNumbers=0.0;//设备台数
         Double eqmBookedFee=0.0;//设备入账金额
         String materialDetails="";//筛选kva
-        boolean flag = true;//开关:判断集合是否重复
+        boolean flag = true;//开关:判断集合是否重复 true-物料描述不同 false-项目定义编号相同且物料描述相同
         ErpCreditChild1 erpCreditChild1;//设备对象
         ErpCredit erpCredit;//设备父类
         ErpAccount erpAccount;//数据集合
@@ -287,16 +312,19 @@ public  class ErpInfo {
         for (int i = 0; i < list.size(); i++) {
             flag=true;
             erpAccount=list.get(i);
+            //判断设备台数是否为空
             if (erpAccount.getTheNumber().isEmpty()){//设备台数
-                eqmNumbers=0.0;
+                eqmNumbers=0.0; //为空时 赋初始值0.0
             }else {
-                eqmNumbers = Double.parseDouble(erpAccount.getTheNumber());
+                eqmNumbers = Double.parseDouble(erpAccount.getTheNumber()); //否则 获取设备台数 信息
             }
-            if (erpAccount.getLineItemAmount().isEmpty()){//入账金额
-                eqmBookedFee=0.0;
+            //判断如行项目金额是否为空
+            if (erpAccount.getLineItemAmount().isEmpty()){
+                eqmBookedFee=0.0;//入账金额赋初始值
             }else {
-                eqmBookedFee = Double.parseDouble(erpAccount.getLineItemAmount());
+                eqmBookedFee = Double.parseDouble(erpAccount.getLineItemAmount());//行项目金额赋值费入账金额
             }
+            //判断当前 设备费 集合是否存在
             if (null!=creditListChild1&&creditListChild1.size()>0){
                 for (int j = 0; j < creditListChild1.size(); j++) {
                     erpCreditChild1 = creditListChild1.get(j);//获取设备对象
@@ -305,10 +333,10 @@ public  class ErpInfo {
                         //判断物料描述是否相同
                         if (erpAccount.getMaterialDetails().equals(erpCreditChild1.getEqmMaterialDetails1())) {
                             eqmBookedFee += erpCreditChild1.getEqmBookedFee1();//累加 入账金额
-                            erpCreditChild1.setEqmBookedFee1(eqmBookedFee);
+                            erpCreditChild1.setEqmBookedFee1(eqmBookedFee);//替换
                             eqmNumbers += erpCreditChild1.getEqmNumbers();//累计 数量
-                            erpCreditChild1.setEqmNumbers(eqmNumbers);
-                            flag = false;
+                            erpCreditChild1.setEqmNumbers(eqmNumbers);//替换
+                            flag = false;// 项目定义编号相同且物料描述相同(当前ErpAccount对象在ErpCreditChild1对象中存在且相同 跳过下面方法)
                             break;
                         }
                     }
@@ -323,6 +351,7 @@ public  class ErpInfo {
                     erpCreditChild1 = new ErpCreditChild1();//获取设备对象
                     erpCredit=new ErpCredit();//获取设备 父类 主类
                     materialDetails = erpAccount.getMaterialDetails();//获取物料描述
+                    //截取总容量kVA前数字
                     if (materialDetails.contains("kVA")){
                         String str[] =  materialDetails.split(",");
                         for (int k = 0; k < str.length; k++) {
@@ -352,19 +381,22 @@ public  class ErpInfo {
      */
     public static List<ErpCreditChild2> getListErpCreditChild2(List<ErpAccount> erpAccounts){
         List<ErpCreditChild2> creditListChild2 = new ArrayList<ErpCreditChild2>();
-        boolean flag = true;//判断 材料费
+        boolean flag = true;//判断 材料费 true-物料描述不同或者项目定义编号不同 false-仙姑定义编号物料描述相同
         double eqmBookedFee2=0.0;//材料入账金额
         ErpCreditChild2 erpCreditChild2=null;
         ErpCredit erpCredit = null;
         ErpAccount erpAccount=null;
         for (int i = 0; i < erpAccounts.size(); i++) {
-            flag=true;
+            flag=true;//默认初始值 项目定义编号不同
             erpAccount = erpAccounts.get(i);
+            //判断行项目金额是否为空
             if (erpAccount.getLineItemAmount().isEmpty()){
-                eqmBookedFee2 = 0.0;
+                eqmBookedFee2 = 0.0;//材料入账金额初始值为0.0
             }else {
+                //赋值材料入账金额为行项目金额
                 eqmBookedFee2 = Double.parseDouble(erpAccount.getLineItemAmount());
             }
+            //判断creditListChild2对象集合 是否存在
             if (null!=creditListChild2&&creditListChild2.size()>0){
                 for (int j = 0; j < creditListChild2.size(); j++) {
                     erpCreditChild2 = creditListChild2.get(j);
@@ -405,7 +437,7 @@ public  class ErpInfo {
     /**
      * 获取 10kv数据集合
      * @param erpAccounts
-     * @return
+     * @return List<ErpCreditChild3> 10KV线路信息
      */
     public static List<ErpCreditChild3> getListErpCreditChild3(List<ErpAccount> erpAccounts){
         List<ErpCreditChild3> creditChild3s = new ArrayList<ErpCreditChild3>();
@@ -422,6 +454,7 @@ public  class ErpInfo {
             }else {
                 tenKvLength = Double.parseDouble(erpAccount.getTheNumber());
             }
+            //相同判断
             if (null!=creditChild3s&&creditChild3s.size()>0){
                 for (int j = 0; j < creditChild3s.size(); j++) {
                     erpCreditChild3 = creditChild3s.get(j);
@@ -438,7 +471,7 @@ public  class ErpInfo {
                     }
                 }
             }
-            if (flag){
+            if (flag){//赋值初始值
                 if (erpAccount.getMaterialDetails().contains(ErpInfo.CON_OICAC10)||
                         erpAccount.getMaterialDetails().contains(ErpInfo.CON_OICAC20)||
                         erpAccount.getMaterialDetails().contains(ErpInfo.CON_PRCAC10)||

+ 3 - 3
src/main/webapp/webpage/modules/sg/financial/erp/erpCreditForm.jsp

@@ -151,11 +151,11 @@
 		</table>
 		<div class="tabs-container">
             <ul class="nav nav-tabs">
-				<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">设备费</a>
+				<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">设备费</a>
                 </li>
-				<li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">材料费</a>
+				<li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">材料费</a>
                 </li>
-				<li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">10KV线路信息</a>
+				<li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">10KV线路信息</a>
                 </li>
             </ul>
             <div class="tab-content">