xs 5 年之前
父節點
當前提交
dbca005afc
共有 21 個文件被更改,包括 1000 次插入519 次删除
  1. 4 1
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/service/ErpCreditService.java
  2. 120 40
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ErpInfo.java
  3. 149 93
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ExportUtilCalculate.java
  4. 0 178
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/Test.java
  5. 5 22
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/web/ErpCreditController.java
  6. 0 15
      src/main/java/com/jeeplus/modules/sg/financial/settlement/service/DataMaintenanceService.java
  7. 1 1
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/mapper/xml/MaterialInfoMapper.xml
  8. 3 3
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/service/MaterialInfoService.java
  9. 3 2
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/web/MaterialInfoController.java
  10. 10 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/entity/MaterialProject.java
  11. 1 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/mapper/MaterialProjectMapper.java
  12. 97 37
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/mapper/xml/MaterialProjectMapper.xml
  13. 8 1
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/service/MaterialProjectService.java
  14. 394 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/util/ImportUtil.java
  15. 66 0
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/util/MaterialProUtil.java
  16. 79 3
      src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/web/MaterialProjectController.java
  17. 15 15
      src/main/webapp/webpage/modules/sg/managementcenter/materialinfo/importmore.jsp
  18. 6 6
      src/main/webapp/webpage/modules/sg/managementcenter/materialinfo/materialInfoList.js
  19. 2 53
      src/main/webapp/webpage/modules/sg/managementcenter/materialinfo/materialInfoList.jsp
  20. 11 8
      src/main/webapp/webpage/modules/sg/managementcenter/materialproject/materialProjectList.js
  21. 26 41
      src/main/webapp/webpage/modules/sg/managementcenter/materialproject/materialProjectList.jsp

+ 4 - 1
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/service/ErpCreditService.java

@@ -15,6 +15,7 @@ import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpJudge;
 import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditEquipmentMapper;
 import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditMapper;
 import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditMaterialMapper;
+import com.jeeplus.modules.sg.financial.erpcredit.util.ErpInfo;
 import com.jeeplus.modules.sg.financial.erpcredit.util.ExportTemplate;
 import com.jeeplus.modules.sg.financial.erpcredit.util.ExportUtil;
 import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
@@ -88,7 +89,9 @@ public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
     }
     public ErpCredit get(String id) {
         ErpCredit erpCredit = super.get(id);
-        erpCredit.setErpCreditChild1s(erpCreditEquipmentMapper.findList(new ErpCreditEquipment(erpCredit)));
+        List<ErpCreditEquipment> eqmList = erpCreditEquipmentMapper.findList(new ErpCreditEquipment(erpCredit));
+        List<ErpCreditEquipment> equSures = ErpInfo.getEquNumbers(eqmList);//特殊情况处理   物料信息
+        erpCredit.setErpCreditChild1s(equSures);
         erpCredit.setErpCreditChild2s(erpCreditMaterialMapper.findList(new ErpCreditMaterial(erpCredit)));
 //        erpCredit.setErpCreditChild3s(erpCreditChild3Mapper.findList(new ErpCreditChild3(erpCredit)));
         return erpCredit;

+ 120 - 40
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ErpInfo.java

@@ -10,6 +10,7 @@ import org.apache.poi.ss.usermodel.Row;
 
 import java.text.DecimalFormat;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
 
@@ -145,24 +146,17 @@ public  class ErpInfo {
         List<ErpCreditMaterial> erpCreditChild2s = getListErpCreditChild2(list);
         //循环erpCredit对象 list集合
         for (ErpCredit erpCredit:erpCredits){
-            tenKvLineLength=0.0;
-            flag = false;//赋初始值
             //赋值线路长度
             if (null!=erpCredit.getTenKvItesFhvFollow()&&null!=erpCredit.getTenKvItsLine()){
                 tenKvLineLength=erpCredit.getTenKvItesFhvFollow()+erpCredit.getTenKvItsLine();
                 erpCredit.setTenKvLineLength(tenKvLineLength);
             }
-            //判断线路信息是否为空
-            if (null!=erpCredit.getTenKvModel()&&erpCredit.getTenKvModel().length()!=0){
-                flag=true;
-            }
             //设备费 集合 循环
-            for (ErpCreditEquipment erpCreditChild1:erpCreditChild1s){
+            for (ErpCreditEquipment erpCreditEquipment:erpCreditChild1s){
                 //判断 erpCredit对象项目定义编号  与  ErpCreditChild1对象项目定义编号
-                if (erpCredit.getItemId().equals(erpCreditChild1.getErpCredit().getItemId())){
+                if (erpCredit.getItemId().equals(erpCreditEquipment.getErpCredit().getItemId())){
                     //把erpCreditChild1对象 添加到 List<ErpCredit>的List<ErpCreditChild1>中
-                    erpCredit.getErpCreditChild1s().add(erpCreditChild1);
-                    flag =true;
+                    erpCredit.getErpCreditChild1s().add(erpCreditEquipment);
                 }
             }
             //材料费 集合 循环
@@ -173,15 +167,8 @@ public  class ErpInfo {
                     erpCredit.getErpCreditChild2s().add(erpCreditChild2);
                 }
             }
-            if (flag){//如果为true
-                erpCredit.setCableTube("");
-                //施工费合计 赋值为安装费(有 设备费入账金额 或者 材料费入账金额)
-                erpCredit.setConsInstallFee(erpCredit.getConsTotalFee());
-            }else {
-                //施工费合计 赋值为 建筑费(无 设备费入账金额 以及 材料费入账金额)
-                erpCredit.setConsBuildingFee(erpCredit.getConsTotalFee());
-            }
         }
+        getInstallBuild(erpCredits);
         return erpCredits;
     }
 
@@ -602,10 +589,10 @@ public  class ErpInfo {
         Double eqmBookedFee=0.0;//设备入账金额
         String materialDetails="";//筛选kva
         boolean flag = true;//开关:判断集合是否重复 true-物料描述不同 false-项目定义编号相同且物料描述相同
-        ErpCreditEquipment erpCreditChild1;//设备对象
+        ErpCreditEquipment equipment;//设备对象
         ErpCredit erpCredit;//设备父类
         ErpAccount erpAccount;//数据集合
-        List<ErpCreditEquipment> creditListChild1 = new ArrayList<ErpCreditEquipment>();
+        List<ErpCreditEquipment> creditListEquipments = new ArrayList<ErpCreditEquipment>();
         for (int i = 0; i < list.size(); i++) {
             flag=true;
             erpAccount=list.get(i);
@@ -618,17 +605,17 @@ public  class ErpInfo {
                 eqmBookedFee = erpAccount.getLineItemAmount();//行项目金额赋值费入账金额
             }
             //判断当前 设备费 集合是否存在
-            if (null!=creditListChild1&&creditListChild1.size()>0){
-                for (int j = 0; j < creditListChild1.size(); j++) {
-                    erpCreditChild1 = creditListChild1.get(j);//获取设备对象
+            if (null!=creditListEquipments&&creditListEquipments.size()>0){
+                for (int j = 0; j < creditListEquipments.size(); j++) {
+                    equipment = creditListEquipments.get(j);//获取设备对象
                     //判断项目定义号是否相同
-                    if (erpCreditChild1.getErpCredit().getItemId().equals(erpAccount.getProjectDefinitionCode())) {
+                    if (equipment.getErpCredit().getItemId().equals(erpAccount.getProjectDefinitionCode())) {
                         //判断物料描述是否相同
-                        if (erpAccount.getMaterialDetails().equals(erpCreditChild1.getEqmMaterialDetails1())) {
-                            eqmBookedFee = erpCreditChild1.getEqmBookedFee1()+eqmBookedFee;//累加 入账金额
-                            erpCreditChild1.setEqmBookedFee1(eqmBookedFee);//替换
-                            eqmNumbers = erpCreditChild1.getEqmNumbers()+eqmNumbers;//累计 数量
-                            erpCreditChild1.setEqmNumbers(eqmNumbers);//替换
+                        if (erpAccount.getMaterialDetails().equals(equipment.getEqmMaterialDetails1())) {
+                            eqmBookedFee = equipment.getEqmBookedFee1()+eqmBookedFee;//累加 入账金额
+                            equipment.setEqmBookedFee1(eqmBookedFee);//替换
+                            eqmNumbers = equipment.getEqmNumbers()+eqmNumbers;//累计 数量
+                            equipment.setEqmNumbers(eqmNumbers);//替换
                             flag = false;// 项目定义编号相同且物料描述相同(当前ErpAccount对象在ErpCreditChild1对象中存在且相同 跳过下面方法)
                             break;
                         }
@@ -641,7 +628,7 @@ public  class ErpInfo {
                         erpAccount.getMaterialDetails().contains(ErpInfo.CON_RNB)||
                         erpAccount.getMaterialDetails().contains(ErpInfo.CON_BST)||
                         erpAccount.getMaterialDetails().contains(ErpInfo.CON_HVS)){
-                    erpCreditChild1 = new ErpCreditEquipment();//获取设备对象
+                    equipment = new ErpCreditEquipment();//获取设备对象
                     erpCredit=new ErpCredit();//获取设备 父类 主类
                     materialDetails = erpAccount.getMaterialDetails();//获取物料描述
                     //截取总容量kVA前数字
@@ -653,22 +640,63 @@ public  class ErpInfo {
                                 break;
                             }
                         }
-                        erpCreditChild1.setEqmTotalCapacity(materialDetails);//添加总容量
+                        equipment.setEqmTotalCapacity(materialDetails);//添加总容量
                     }
                     erpCredit.setItemId(erpAccount.getProjectDefinitionCode());//添加项目定义编码
-                    erpCreditChild1.setEqmMaterialDetails1(erpAccount.getMaterialDetails());//添加物料描述
-                    erpCreditChild1.setEqmUnit(erpAccount.getUnit());//添加的单位
-                    erpCreditChild1.setEqmNumbers(eqmNumbers);//添加数量
-                    erpCreditChild1.setEqmBookedFee1(eqmBookedFee);//添加入账金额
-                    erpCreditChild1.setEqmSupplierName(erpAccount.getSupplierName());//添加供应商
-                    erpCreditChild1.setErpCredit(erpCredit);
-                    creditListChild1.add(erpCreditChild1);
+                    equipment.setEqmMaterialDetails1(erpAccount.getMaterialDetails());//添加物料描述
+                    equipment.setEqmUnit(erpAccount.getUnit());//添加的单位
+                    equipment.setEqmNumbers(eqmNumbers);//添加数量
+                    equipment.setEqmBookedFee1(eqmBookedFee);//添加入账金额
+                    equipment.setEqmSupplierName(erpAccount.getSupplierName());//添加供应商
+                    equipment.setErpCredit(erpCredit);
+                    creditListEquipments.add(equipment);
                 }
             }
         }
-        return creditListChild1;
+        return creditListEquipments;
     }
-
+    /*
+        总的设备费合计:对特殊情况处理方法:(配电数量为0的设备费)
+     */
+//    public static List<ErpCreditEquipment> getListErpCreditEquipments(List<ErpAccount> list){
+//        Double eqmBookedFeel = 0.0;
+//        boolean flag = false;
+//        List<ErpCreditEquipment> listErpCreditEquipments = getListErpCreditChild1(list);
+//        List<ErpCreditEquipment> erpCreditEquipmentList = new ArrayList<ErpCreditEquipment>();
+//        for (ErpCreditEquipment equ:listErpCreditEquipments){
+//            erpCreditEquipmentList.add(equ);
+//        }
+//        for (ErpCreditEquipment erpCreditEquipment:listErpCreditEquipments){
+//            eqmBookedFeel = 0.0;//设备费
+//            flag = false;
+//            //如果台数不等于0
+//            if (erpCreditEquipment.getEqmNumbers().equals("0")){
+//                //循环
+//                for (ErpCreditEquipment erpEqm:erpCreditEquipmentList){
+//                    //如果项目定义号相同
+//                    if (erpCreditEquipment.getErpCredit().getItemId().equals(erpEqm.getErpCredit().getItemId())){
+//                        if (!erpEqm.getEqmNumbers().equals("0")){//如果台数不为0
+//                            eqmBookedFeel = erpCreditEquipment.getEqmBookedFee1();
+//                            flag = true;
+//                            break;
+//                        }
+//                    }
+//                }
+//            }
+//            if (flag){
+//
+//            }
+//        }
+//        for (ErpCreditEquipment erpCreditEquipment:listErpCreditEquipments){
+//            for (ErpCreditEquipment erpEqm:erpCreditEquipmentList){
+//                equipments = new ArrayList<ErpCreditEquipment>();
+//                if (erpCreditEquipment.getErpCredit().getItemId().equals(erpEqm.getErpCredit().getItemId())){
+//                    equipments.add(erpEqm);
+//                }
+//            }
+//        }
+//        return listErpCreditEquipments;
+//    }
     /**
      * 获取材料的list集合
      * @param erpAccounts 导入的表格 bean对象
@@ -743,4 +771,56 @@ public  class ErpInfo {
         }
         return  (machineId+String.format("%015d",hashCodeV));
     }
+    /*
+        特殊情况处理
+     */
+    public static List<ErpCreditEquipment> getEquNumbers(List<ErpCreditEquipment> equipments){
+        Double eqmBooksFee = 0.0;
+        for (ErpCreditEquipment erpCreditEquipment:equipments){
+            if (erpCreditEquipment.getEqmNumbers()==0.00){
+                eqmBooksFee += erpCreditEquipment.getEqmBookedFee1();//入账金额
+            }
+        }
+        for (ErpCreditEquipment erpCreditEquipment:equipments){
+            if (erpCreditEquipment.getEqmNumbers()!=0.00){
+                eqmBooksFee=eqmBooksFee+erpCreditEquipment.getEqmBookedFee1();
+                erpCreditEquipment.setEqmBookedFee1(eqmBooksFee);
+            }
+        }
+        for (int i = 0; i < equipments.size(); i++) {
+            if (equipments.get(i).getEqmNumbers()==0.00){
+                equipments.remove(i);
+                i--;
+            }
+        }
+        return equipments;
+    }
+    //导入:安装费,建筑费判断,如果无线路,无设备为建筑费,否则为安装费
+    public static void getInstallBuild(List<ErpCredit> erpCredits){
+        Boolean flag = false;
+        List<ErpCreditEquipment> erpCreditEquipmentList = new ArrayList<ErpCreditEquipment>();
+        for (ErpCredit erpCredit:erpCredits){
+            flag = false;
+            erpCreditEquipmentList = ExportUtilCalculate.getEquNumbers(erpCredit.getErpCreditChild1s());
+            //判断线路信息是否为空
+            if (null!=erpCredit.getTenKvModel()&&erpCredit.getTenKvModel().length()!=0){
+                flag=true;
+            }
+            //设备费 集合 循环
+            for (ErpCreditEquipment erpCreditEquipment:erpCreditEquipmentList){
+                //判断 erpCredit对象项目定义编号  与  ErpCreditChild1对象项目定义编号
+                if (erpCredit.getItemId().equals(erpCreditEquipment.getErpCredit().getItemId())){
+                    flag =true;
+                }
+            }
+            if (flag){//如果为true
+                erpCredit.setCableTube("");
+                //施工费合计 赋值为安装费(有 设备费入账金额 或者 材料费入账金额)
+                erpCredit.setConsInstallFee(erpCredit.getConsTotalFee());
+            }else {
+                //施工费合计 赋值为 建筑费(无 设备费入账金额 以及 材料费入账金额)
+                erpCredit.setConsBuildingFee(erpCredit.getConsTotalFee());
+            }
+        }
+    }
 }

+ 149 - 93
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ExportUtilCalculate.java

@@ -3,7 +3,7 @@ package com.jeeplus.modules.sg.financial.erpcredit.util;
 import com.jeeplus.modules.sg.financial.erpcredit.entity.*;
 import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
 
-import java.sql.SQLOutput;
+import java.io.*;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -169,46 +169,37 @@ public class ExportUtilCalculate {
     public static Schedule getScheduleActual(Schedule schedule, ErpCredit erpCredit){
         DecimalFormat decimalFormat   = new DecimalFormat("#0.00");
         boolean flag = false;
-        List<ErpCreditMaterial> erpCreditChild2s = null;//得到材料费金额
-        List<ErpCreditEquipment> erpCreditChild1s = null;//得到设备费金额
+        List<ErpCreditEquipment> erpCreditEquipmentList = null;//得到设备费金额
         double netAmount=0.0;//入账金额:设备费,材料费
         double actualTotalFee=0.0;//合计金额
         //循环erpCredit集合
         schedule.setItemId(erpCredit.getItemId());//得到项目定义编号
         schedule.setItemName(erpCredit.getItemName());//得到项目名称
         netAmount = getErpCreditMaterial(erpCredit);//得到材料费
+        Double eqmOneFlagValue = getEqmOneFlagValue(erpCredit.getErpCreditChild1s());//如果设备仅有一条且配变数量为0
         //设备费&&erpCredit.getTenKvModel()!=null
         if (null!=erpCredit.getConsInstallFee()){
-            schedule.setActualIntallProject(decimalFormat.format(netAmount+erpCredit.getConsInstallFee()));
-            actualTotalFee=actualTotalFee+netAmount+erpCredit.getConsInstallFee();//合计金额累加
+            schedule.setActualIntallProject(decimalFormat.format(netAmount+erpCredit.getConsInstallFee()+eqmOneFlagValue));
+            actualTotalFee=actualTotalFee+netAmount+erpCredit.getConsInstallFee()+eqmOneFlagValue;//合计金额累加
         }
         if (null!=erpCredit.getConsBuildingFee()){//如果建筑费不为空
             //得到实际建筑工程
-            schedule.setActualBuildProject(decimalFormat.format(erpCredit.getConsBuildingFee()+netAmount));
-            actualTotalFee+=erpCredit.getConsBuildingFee()+netAmount;//合计金额加上
+            schedule.setActualBuildProject(decimalFormat.format(erpCredit.getConsBuildingFee()+netAmount+eqmOneFlagValue));
+            actualTotalFee+=erpCredit.getConsBuildingFee()+netAmount+eqmOneFlagValue;//合计金额加上
         }
-        netAmount = 0.0;
-        erpCreditChild1s = erpCredit.getErpCreditChild1s();//得到设备费
+        netAmount = 0.0;//此时变为设备费
+        erpCreditEquipmentList = getEquNumbers(erpCredit.getErpCreditChild1s());//当设备台数为0时处理
         //判断设备费
-        if (null!=erpCreditChild1s&&erpCreditChild1s.size()>0){
-            for (ErpCreditEquipment erpCreditChild1:erpCreditChild1s){
-                if (null!=erpCreditChild1.getEqmBookedFee1()){
-                    netAmount+=erpCreditChild1.getEqmBookedFee1();//得到设备费累加(设备价值)
+        if (null!=erpCreditEquipmentList&&erpCreditEquipmentList.size()>0){
+            for (ErpCreditEquipment erpCreditEquipment:erpCreditEquipmentList){
+                if (null!=erpCreditEquipment.getEqmBookedFee1()){
+                    netAmount+=erpCreditEquipment.getEqmBookedFee1();//得到设备费累加(设备价值)
                     flag=true;
                 }
             }
             if (flag){
                 schedule.setActualEquipmentValue(decimalFormat.format(netAmount));//实际设备价值
                 actualTotalFee+=netAmount;//实际费用累加
-//                if (null!=erpCredit.getConsInstallFee()){
-//                   if (null==erpCredit.getTenKvModel()){
-//                       schedule.setActualEquipmentValue(decimalFormat.format(netAmount+erpCredit.getConsInstallFee()));//实际设备价值
-//                       actualTotalFee+=netAmount+erpCredit.getConsInstallFee();//实际费用累加
-//                   }else {
-//                       schedule.setActualEquipmentValue(decimalFormat.format(netAmount));//实际设备价值
-//                       actualTotalFee+=netAmount;//实际费用累加
-//                   }
-//                }
             }
             flag=false;//数据清0
             netAmount=0.0;
@@ -342,7 +333,25 @@ public class ExportUtilCalculate {
         }
         return scheduleOther;
     }
-
+    /**
+     * 设备材料去重显示2 单价
+     */
+    public static List<MaterialEquipment> getMaterialUnitPrice(List<MaterialEquipment> materialEquipmentList){
+        DecimalFormat decimalFormat   = new DecimalFormat("#0.00");
+        Double meUnitPrice=0.0;//单价
+        for (MaterialEquipment materialEquipment:materialEquipmentList){
+            meUnitPrice=0.0;
+            if (null!=materialEquipment.getMeAllPrice()&&null!=materialEquipment.getMeNumber()){
+                if (!materialEquipment.getMeNumber().equals("0.0")&&!materialEquipment.getMeNumber().equals("0")){
+                    meUnitPrice = Double.valueOf(materialEquipment.getMeAllPrice())/Double.valueOf(materialEquipment.getMeNumber());
+                    materialEquipment.setMeUnitPrice(decimalFormat.format(meUnitPrice));
+                }else {
+                    materialEquipment.setMeUnitPrice("");
+                }
+            }
+        }
+        return materialEquipmentList;
+    }
     /**
      * 设备材料清册去重显示
      */
@@ -357,35 +366,36 @@ public class ExportUtilCalculate {
         List<MaterialEquipment> materialEquipmentList = new ArrayList<MaterialEquipment>();
         List<MaterialEquipment> materialEquipments = getMaterialEquipment(erpCredits);
         for (MaterialEquipment materialEquipment:materialEquipments){
+            meNumber = Double.valueOf(materialEquipment.getMeNumber());
+            meAllPrice = Double.valueOf(materialEquipment.getMeAllPrice());
             flag = true;
             if (null!=materialEquipmentList&&materialEquipmentList.size()>0){
                 for (MaterialEquipment materialEquipment1:materialEquipmentList){
                     if (materialEquipment.getMeSupplierName().equals(materialEquipment1.getMeSupplierName())||
                            materialEquipment.getMeName().equals(materialEquipment1.getMeName())){
-                        meNumber = Double.valueOf(materialEquipment.getMeNumber())+Double.valueOf(materialEquipment1.getMeNumber());
-                        meUnitPrice = Double.valueOf(materialEquipment.getMeUnitPrice())+Double.valueOf(materialEquipment1.getMeUnitPrice());
-                        meAllPrice = Double.valueOf(materialEquipment.getMeAllPrice())+Double.valueOf(materialEquipment1.getMeAllPrice());
+                        meNumber = meNumber+Double.valueOf(materialEquipment1.getMeNumber());
+                        meAllPrice = meAllPrice+Double.valueOf(materialEquipment1.getMeAllPrice());
                         materialEquipment1.setMeNumber(decimalFormat.format(meNumber));
-                        materialEquipment1.setMeUnitPrice(decimalFormat.format(meUnitPrice));
                         materialEquipment1.setMeAllPrice(decimalFormat.format(meAllPrice));
                         flag = false;
+                        break;
                     }
                 }
             }
             if (flag){
                 materialEquipment2 = new MaterialEquipment();
                 materialEquipment2.setMeName(materialEquipment.getMeName());
-                materialEquipment2.setMeSupplierName(materialEquipment.getMeSpecifications());
+                materialEquipment2.setMeSupplierName(materialEquipment.getMeSupplierName());
                 materialEquipment2.setMeAllPrice(materialEquipment.getMeAllPrice());
                 materialEquipment2.setMeNumber(materialEquipment.getMeNumber());
                 materialEquipment2.setMeUnit(materialEquipment.getMeUnit());
                 materialEquipment2.setId(materialEquipment.getId());
-                materialEquipment2.setMeUnitPrice(materialEquipment.getMeUnitPrice());
                 materialEquipment2.setMeAllPrice(materialEquipment.getMeAllPrice());
-                materialEquipment2.setMeSpecifications(materialEquipment.getMeSupplierName());
+                materialEquipment2.setMeSpecifications(materialEquipment.getMeSpecifications());
                 materialEquipmentList.add(materialEquipment2);
             }
         }
+        List<MaterialEquipment> materialUnitPrice = getMaterialUnitPrice(materialEquipmentList);
         return materialEquipmentList;
     }
     /**
@@ -427,12 +437,6 @@ public class ExportUtilCalculate {
                     //得到合计金额
                     if (null!=erpCreditChild1.getEqmBookedFee1()){
                         materialEquipment.setMeAllPrice(String.valueOf(erpCreditChild1.getEqmBookedFee1()));
-                        if (null!=materialEquipment.getMeNumber()&&!materialEquipment.getMeNumber().equals("0.0")){
-                            count=erpCreditChild1.getEqmBookedFee1()/Double.parseDouble(materialEquipment.getMeNumber());
-                            materialEquipment.setMeUnitPrice(decimalFormat.format(count));
-                        }else {
-                            materialEquipment.setMeUnitPrice(decimalFormat.format(erpCreditChild1.getEqmBookedFee1()));
-                        }
                     }else {
                         materialEquipment.setMeAllPrice("0");
                     }
@@ -463,14 +467,6 @@ public class ExportUtilCalculate {
                     //得到合计金额
                     if (null!=erpCreditChild2.getMtlBookedFee2()){
                         materialEquipment.setMeAllPrice(String.valueOf(erpCreditChild2.getMtlBookedFee2()));
-                        if (null!=materialEquipment.getMeNumber()&&!materialEquipment.getMeNumber().equals("0.0")){
-                            count=erpCreditChild2.getMtlBookedFee2()/Double.parseDouble(materialEquipment.getMeNumber());
-                            materialEquipment.setMeUnitPrice(decimalFormat.format(count));
-                        }else {
-                            materialEquipment.setMeUnitPrice(decimalFormat.format(erpCreditChild2.getMtlBookedFee2()));
-                        }
-                    }else {
-                        materialEquipment.setMeUnit("");
                     }
                     materialEquipments.add(materialEquipment);
                 }
@@ -487,19 +483,20 @@ public class ExportUtilCalculate {
         DecimalFormat decimalFormat   = new DecimalFormat("#0.00");
         List<TransferOfPowerLine> transferOfPower1s = new ArrayList<TransferOfPowerLine>();//创建一个线路集合
         TransferOfPowerLine transferOfPower1 = null;//定义线路对象
-        List<ErpCreditEquipment> erpCreditChild1s = null;//定义设备对象
+        List<ErpCreditEquipment> erpCreditEquipmentList = null;//定义设备对象
         Double materialTotal = 0.0;//材料费总计
         Double eqmValue = 0.0;//相同项目定义号合计:所有设备费
         Double standInFee=0.0;//摊入费用
+
+        Double installEqm = 0.0;//特殊情况处理
         for (ErpCredit erpCredit:erpCredits){//循环erp账户项目
-            erpCreditChild1s = erpCredit.getErpCreditChild1s();//获取设备集合
             materialTotal = getErpCreditMaterial(erpCredit);//得到材料费合计
-            if (null!=erpCreditChild1s&&erpCreditChild1s.size()>=0){
-                eqmValue = 0.0;//赋予初始
-                for (ErpCreditEquipment erpCreditEquipment:erpCreditChild1s){//所有设备费合计
-                    eqmValue+=erpCreditEquipment.getEqmBookedFee1();
-                }
-            }
+            erpCreditEquipmentList = erpCredit.getErpCreditChild1s();//获取设备集合
+            installEqm = getEqmOneFlagValue(erpCreditEquipmentList);//得到设备台数都为0的
+
+            erpCreditEquipmentList = getEquNumbers(erpCreditEquipmentList);//特殊情况处理后的集合
+            eqmValue = getEqmValueTotal(erpCreditEquipmentList);//所有设备费合计
+
             //添加固定数据:线路
             transferOfPower1  = new TransferOfPowerLine();//得到线路集合
             transferOfPower1.setPowerId(erpCredit.getItemId());//添加项目定义号
@@ -519,10 +516,10 @@ public class ExportUtilCalculate {
                 transferOfPower1.setPowerTenKvCableType(erpCredit.getCableTube());
             }
             if (null!=erpCredit.getConsBuildingFee()){//建筑费
-                transferOfPower1.setPowerBuildFee(decimalFormat.format(erpCredit.getConsBuildingFee()+materialTotal));
+                transferOfPower1.setPowerBuildFee(decimalFormat.format(erpCredit.getConsBuildingFee()+materialTotal+installEqm));
             }
             if (null!=erpCredit.getConsInstallFee()&&erpCredit.getTenKvModel()!=null){//安装费
-                transferOfPower1.setPowerInstallFee(decimalFormat.format(erpCredit.getConsInstallFee()+materialTotal));//添加安装费
+                transferOfPower1.setPowerInstallFee(decimalFormat.format(erpCredit.getConsInstallFee()+materialTotal+installEqm));//添加安装费
             }else {
                 transferOfPower1.setPowerInstallFee("-");
             }
@@ -623,7 +620,7 @@ public class ExportUtilCalculate {
         DecimalFormat decimalFormat   = new DecimalFormat("#0.00");
         DecimalFormat decimalFormat1   = new DecimalFormat("#0");
         List<TransferOfEquipment> transferOfPower2s =  new ArrayList<TransferOfEquipment>();//得到设备表集合
-        List<ErpCreditEquipment> erpCreditChild1s = null;//定义设备 费对象
+        List<ErpCreditEquipment> erpCreditEquipmentList = null;//定义设备 费对象
         TransferOfEquipment transferOfPower2 = null;//定义设备表对象
         Double powerInstall = 0.0;//安装费
         Double materialTotal = 0.0;//材料费总计
@@ -633,20 +630,14 @@ public class ExportUtilCalculate {
         Double powerInstallFee = 0.0;//安装费用(线路)
         Double powerEqmMater=0.0;//物料材料合计
         Double powerStandInFee = 0.0;//摊入费用
-        Double erpCreditMaterial = 0.0;
         for (ErpCredit erpCredit:erpCredits){
-            erpCreditMaterial = getErpCreditMaterial(erpCredit);
-            erpCreditMaterial = erpCreditMaterial/erpCredit.getErpCreditChild1s().size();
             powerValueTotal = 0.0;//当前erp账户 所有设备费合计 赋值初始值
             //材料费合计
             materialTotal = getErpCreditMaterial(erpCredit);//得到材料费
-
-            erpCreditChild1s = erpCredit.getErpCreditChild1s();//得到设备费集合
+            erpCreditEquipmentList = getEquNumbers(erpCredit.getErpCreditChild1s());//特殊情况处理得到最终设备费
             //所有设备费累加
-            for (ErpCreditEquipment erpCreditEquipment:erpCreditChild1s){
-                powerValueTotal += erpCreditEquipment.getEqmBookedFee1();
-            }
-            //得到安装费用
+            powerValueTotal = getEqmValueTotal(erpCreditEquipmentList);
+            //得到安装费用 移交生产总值 一览表1线路
             if (null!=erpCredit.getConsInstallFee()){ //安装费(x线路表)
                 powerInstallFee = erpCredit.getConsInstallFee()+materialTotal;
             }
@@ -656,44 +647,42 @@ public class ExportUtilCalculate {
             if (null==erpCredit.getTenKvModel()){
                 powerInstallFee = 0.0;
             }
-            if (null!=erpCreditChild1s && erpCreditChild1s.size()>=0){//
-                for (ErpCreditEquipment erpCreditChild1:erpCreditChild1s){
+            if (null!=erpCreditEquipmentList && erpCreditEquipmentList.size()>=0){//
+                for (ErpCreditEquipment erpCreditEquipment:erpCreditEquipmentList){
                     transferOfPower2 = new TransferOfEquipment();//定义设备表对象
                     transferOfPower2.setPowerId(erpCredit.getItemId());//赋值项目定义编号
                     transferOfPower2.setPowerName(erpCredit.getItemName());//添加项目名称
                     transferOfPower2.setPowerArea("-");//线路起始地带
                     transferOfPower2.setPowerDepartment(ExportUtilCalculate.POWER_DEPARTMENT);//添加保管
-                    if (null!=erpCredit.getConsInstallFee()&& null != erpCreditChild1.getEqmBookedFee1()){//得到分摊后安装费
-                        eqmFtIntalls = erpCreditChild1.getEqmBookedFee1()/powerValueTotal;
+                    if (null!=erpCredit.getConsInstallFee()&& null != erpCreditEquipment.getEqmBookedFee1()){//得到分摊后安装费
+                        eqmFtIntalls = erpCreditEquipment.getEqmBookedFee1()/powerValueTotal;
                         eqmFtIntalls = eqmFtIntalls*powerInstallFee;
                     }
-                    if (null!=erpCreditChild1.getEqmNumbers()){//得到配变数量(erp账户中设备台数)
-                        transferOfPower2.setPowerNumber(decimalFormat1.format(erpCreditChild1.getEqmNumbers()));
+                    if (null!=erpCreditEquipment.getEqmNumbers()){//得到配变数量(erp账户中设备台数)
+                        transferOfPower2.setPowerNumber(decimalFormat1.format(erpCreditEquipment.getEqmNumbers()));
                     }
-                    if (null!=erpCreditChild1.getEqmUnit()){//计量单位
-                        transferOfPower2.setPowerUnit(erpCreditChild1.getEqmUnit());
+                    if (null!=erpCreditEquipment.getEqmUnit()){//计量单位
+                        transferOfPower2.setPowerUnit(erpCreditEquipment.getEqmUnit());
                     }
                     //配电容量
-                    transferOfPower2.setPowerCapacity(erpCreditChild1.getEqmMaterialDetails1());
+                    transferOfPower2.setPowerCapacity(erpCreditEquipment.getEqmMaterialDetails1());
                     //安装费用
                     if (null!=transferOfPower2.getPowerCapacity()&&null==erpCredit.getTenKvModel()){
-                        powerInstall= erpCreditChild1.getEqmBookedFee1()/powerValueTotal*materialTotal;
+                        powerInstall= erpCreditEquipment.getEqmBookedFee1()/powerValueTotal*materialTotal;
                         if (null!=erpCredit.getConsInstallFee()){
-                            powerInstall = powerInstall+(erpCreditChild1.getEqmBookedFee1()/powerValueTotal*erpCredit.getConsInstallFee());
+                            powerInstall = powerInstall+(erpCreditEquipment.getEqmBookedFee1()/powerValueTotal*erpCredit.getConsInstallFee());
                         }else {
                             powerInstall = 0.0;
                         }
                         transferOfPower2.setPowerInstallFee(decimalFormat.format(powerInstall));
                     }else {
-                        powerInstall = 0.0;
+//                        powerInstall = 0.0;
                         transferOfPower2.setPowerInstallFee("0");
                     }
                     //设备价值
-                    if (null!=erpCreditChild1.getEqmBookedFee1()){
-                        powerValue = erpCreditChild1.getEqmBookedFee1();
+                    if (null!=erpCreditEquipment.getEqmBookedFee1()){
+                        powerValue = erpCreditEquipment.getEqmBookedFee1();
                         transferOfPower2.setPowerValue(decimalFormat.format(powerValue));//赋值设备价值
-                    }else {
-                        powerValue = erpCreditChild1.getEqmBookedFee1();
                     }
                     //摊入
                     powerEqmMater = powerValueTotal+powerInstallFee;//===所有的设备价值+安装费+材料费
@@ -721,8 +710,6 @@ public class ExportUtilCalculate {
                 }
             }
         }
-//        List<TransferOfEquipment> powerDeliveredAssets2 = getPowerDeliveredAssets2(transferOfPower2s);
-//        List<TransferOfEquipment> transferOfPowerTotal = getTransferOfPowerTotal(powerDeliveredAssets2);
         return transferOfPower2s;
     }
     //移交生产资产2 - 设备表 交付使用价值 安装费+设备费+摊入费用
@@ -970,7 +957,7 @@ public class ExportUtilCalculate {
         return mCompletionProject;
     }
 
-    //设备分摊
+    //设备分摊(差额)
     public static List<TransferOfEquipment> getTransFerEquipmentStandin(List<ErpCredit> erpCreditList, List<MaintainData> maintainDataList){
         DecimalFormat decimalFormat   = new DecimalFormat("#0.00");
         Double installDiff = 0.0;//安装差额
@@ -986,11 +973,9 @@ public class ExportUtilCalculate {
         Double totalInstallLineEqu = 0.0;//线路设备的合计金额
         Double totalStandLineEqu = 0.0;//线路设备的合计金额
         List<Schedule> scheduleList = getScheduleList(erpCreditList, maintainDataList);//得到一览表
-        System.out.println(scheduleList);
         List<TransferOfPowerLine> transFerPowerLines = getTransFerPower1(erpCreditList);//得到线路表
         List<TransferOfEquipment> transferOfPowerEquipments = getTransferOfPowerEquList(erpCreditList);//得到设备表
         for (Schedule schedule:scheduleList){
-            System.out.println(schedule.getItemId());
             if (null!=schedule.getItemId()){
                 if (!schedule.getItemId().equals("")){
                     installDiff = 0.0;//安装差额
@@ -1103,7 +1088,9 @@ public class ExportUtilCalculate {
             }
         }
     }
-
+    /*
+        设备费统计
+     */
     public static List<TransferOfEquipment> getTransferOfPower2(List<ErpCredit> erpCreditList, List<MaintainData> maintainDataList){
         List<TransferOfEquipment> transFerEquipmentStandin = getTransFerEquipmentStandin(erpCreditList, maintainDataList);
         List<TransferOfEquipment> powerDeliveredAssets2 = getPowerDeliveredAssets2(transFerEquipmentStandin);
@@ -1111,13 +1098,6 @@ public class ExportUtilCalculate {
         return transferOfPowerTotal;
     }
 
-
-
-
-
-
-
-
     //材料费合计
     public  static Double getErpCreditMaterial(ErpCredit erpCredit){
         Double materialTotal = 0.0;
@@ -1129,4 +1109,80 @@ public class ExportUtilCalculate {
         }
         return materialTotal;
     }
+
+    /*
+        所有设备费合计
+     */
+    public static Double getEqmValueTotal(List<ErpCreditEquipment> erpCreditEquipments){
+        Double eqmValue = 0.0;
+        if (null!=erpCreditEquipments&&erpCreditEquipments.size()>=0){
+            eqmValue = 0.0;//赋予初始值
+            for (ErpCreditEquipment erpCreditEquipment:erpCreditEquipments){//所有设备费合计
+                eqmValue+=erpCreditEquipment.getEqmBookedFee1();
+            }
+        }
+        return eqmValue;
+    }
+    /*
+        特殊清理处理:得到只且中只有一条的配变数量为0的设备费合计
+     */
+    public static Double getEqmOneFlagValue(List<ErpCreditEquipment> erpCreditEquipments){
+        Double d = 0.0;//定义初始值
+        boolean flag = false;
+        for (ErpCreditEquipment erpCreditEquipment:erpCreditEquipments){
+            if (erpCreditEquipment.getEqmNumbers()==0.00){//如果台数为0
+                d+=erpCreditEquipment.getEqmBookedFee1();//设备金额累加
+            }
+        }
+        for (ErpCreditEquipment erpCreditEquipment:erpCreditEquipments){
+            if (erpCreditEquipment.getEqmNumbers()!=0.00){//如果台数不为0
+                flag = true;//设置为true
+            }
+        }
+        if (flag){
+            d = 0.0;
+        }
+        return d;
+    }
+    //得到大于一条的设备费合计
+    public static List<ErpCreditEquipment> getEquNumbers(List<ErpCreditEquipment> equipments) {
+//        List<ErpCreditEquipment> erpCreditEquipmentList = new ArrayList<ErpCreditEquipment>();
+        List<ErpCreditEquipment> erpCreditEquipmentList = new ArrayList<ErpCreditEquipment>();
+        try {
+            erpCreditEquipmentList = deepCopy(equipments);
+            Double eqmBooksFee = 0.0;
+            for (ErpCreditEquipment erpCreditEquipment:erpCreditEquipmentList){
+                if (erpCreditEquipment.getEqmNumbers()==0.00){
+                    eqmBooksFee += erpCreditEquipment.getEqmBookedFee1();//入账金额
+                }
+            }
+            for (ErpCreditEquipment erpCreditEquipment1:erpCreditEquipmentList){
+                if (erpCreditEquipment1.getEqmNumbers()!=0.00){
+                    eqmBooksFee=eqmBooksFee+erpCreditEquipment1.getEqmBookedFee1();
+                    erpCreditEquipment1.setEqmBookedFee1(eqmBooksFee);
+                    break;
+                }
+            }
+            for (int i = 0; i < erpCreditEquipmentList.size(); i++) {
+                if (erpCreditEquipmentList.get(i).getEqmNumbers()==0.00){
+                    erpCreditEquipmentList.remove(i);
+                    i--;
+                }
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        return erpCreditEquipmentList;
+    }
+    public static List deepCopy(List src) throws IOException, ClassNotFoundException{
+        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
+        ObjectOutputStream out = new ObjectOutputStream(byteOut);
+        out.writeObject(src);
+        ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
+        ObjectInputStream in =new ObjectInputStream(byteIn);
+        List dest = (List)in.readObject();
+        return dest;
+    }
 }

+ 0 - 178
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/Test.java

@@ -1,178 +0,0 @@
-package com.jeeplus.modules.sg.financial.erpcredit.util;
-
-import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpCredit;
-import com.jeeplus.modules.sg.financial.erpcredit.entity.ScheduleOther;
-import org.apache.poi.xssf.usermodel.XSSFCell;
-import org.apache.poi.xssf.usermodel.XSSFRow;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.*;
-import java.net.URLEncoder;
-import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-public class Test {
-    public void getTest() {
-        String content = "10kV箱式变电站,400kva,美式,硅钢片,普通,无环网柜,600kVA";
-        String str[] = content.split(",");
-        for (int i = 0; i < str.length; i++) {
-//                System.out.println(str[i]);
-            if (str[i].toLowerCase().contains("kva")) {
-                System.out.println(str[i].substring(0, str[i].toLowerCase().indexOf("kva")));
-                break;
-            }
-        }
-    }
-
-    public void getTest1() {
-        String str = "架空绝缘导线,AC10kV,JKLYJ,150";
-        String[] split = str.split(",");
-        System.out.println(split[split.length - 1]);
-    }
-
-    @org.junit.Test
-    public void getExcel(){
-            // 读取模板,并赋值到新文件
-            // 文件模板路径
-        ExportTemplate exportTemplate = new ExportTemplate();
-        String path = (exportTemplate.getSispPath() + "excelmodel/");
-        File file = new File(path);
-        // 保存文件的路径
-        String realPath = (exportTemplate.getSispPath() + "newexcelmodel");
-        // 新的文件名
-        String newFileName = "竣工决算" + System.currentTimeMillis() + ".xlsx";
-        System.out.println(newFileName);
-        // 判断路径是否存在
-        File createNewFile = new File(realPath);
-        if (!createNewFile.exists()) {
-            createNewFile.mkdirs();
-            System.out.println("创建了");
-        }
-        // 写入到新的excel
-        File newFile = new File(realPath, newFileName);
-        try {
-            newFile.createNewFile();
-            System.out.println();
-            // 复制模板到新文件
-            exportTemplate.fileChannelCopy(file, newFile);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-    }
-    @org.junit.Test
-    public void getPath(){
-        String sispPath = this.getClass().getResource("/").getPath()+ "freemarker/excelmodel/daochu.xlsx";
-        System.out.println(sispPath);
-    }
-    @org.junit.Test
-    public void exportExcel() {
-        ExportTemplate exportTemplate = new ExportTemplate();
-        File newFile = exportTemplate.createNewFile();
-        // 新文件写入数据,并下载
-        InputStream inputStream = null;
-        XSSFWorkbook workbook = null;
-        XSSFSheet sheet = null;
-        try {
-            inputStream = new FileInputStream(newFile);// 将excel文件转为输入流
-            workbook = new XSSFWorkbook(inputStream);// 创建个workbook,
-            // 获取第一个sheet
-            sheet = workbook.getSheetAt(3);
-        } catch (Exception e1) {
-            e1.printStackTrace();
-        }
-
-        if (sheet != null) {
-            try {
-                // 写数据
-                FileOutputStream fos = new FileOutputStream(newFile);
-                XSSFRow row = sheet.getRow(0);
-                XSSFCell cell = row.getCell(3);
-                for (int i = 0; i < 10; i++) {
-                    row =sheet.getRow((int)i+6);
-                    cell=row.getCell(3);
-                    cell.setCellValue(i);
-                }
-                workbook.write(fos);
-                fos.flush();
-                fos.close();
-                // 定义一个list集合假数据
-//                List<Map<String, Object>> lst = new ArrayList();
-//                Map<String, Object> map1 = new HashMap<String, Object>();
-//                for (int i = 0; i < 42; i++) {
-//                    map1.put("id" + i, i);
-//                    lst.add(map1);
-//                }
-//                for (int m = 0; m < lst.size(); m++) {
-//                    Map<String, Object> map = lst.get(m);
-//                    row = sheet.createRow((int) m + 3);
-//                    for (int i = 0; i < 42; i++) {
-//                        String value = map.get("id" + m) + "";
-//                        if (value.equals("null")) {
-//                            value = "0";
-//                        }
-//                        cell = row.createCell(i);
-//                        cell.setCellValue(value);
-//                    }
-//                }
-//                // 下载
-//                InputStream fis = new BufferedInputStream(new FileInputStream(
-//                        newFile));
-////                HttpServletResponse response = ServletActionContext.getResponse();
-//                HttpServletResponse response = null;
-//                byte[] buffer = new byte[fis.available()];
-//                fis.read(buffer);
-//                fis.close();
-//                response.reset();
-//                response.setContentType("text/html;charset=UTF-8");
-//                OutputStream toClient = new BufferedOutputStream(
-//                        response.getOutputStream());
-//                response.setContentType("application/x-msdownload");
-//                String newName = URLEncoder.encode(
-//                        "违法案件报表" + System.currentTimeMillis() + ".xlsx",
-//                        "UTF-8");
-//                response.addHeader("Content-Disposition",
-//                        "attachment;filename=\"" + newName + "\"");
-//                response.addHeader("Content-Length", "" + newFile.length());
-//                toClient.write(buffer);
-//                toClient.flush();
-            } catch (Exception e) {
-                e.printStackTrace();
-            } finally {
-                try {
-                    if (null != inputStream) {
-                        inputStream.close();
-                    }
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        // 删除创建的新文件
-        // this.deleteFile(newFile);
-    }
-    @org.junit.Test
-    public void getTest5(){
-         int machineId = 1;
-         int hashCodeV = UUID.randomUUID().toString().hashCode();
-         if (hashCodeV<0){
-             hashCodeV=-hashCodeV;
-          }
-            System.out.println(machineId+String.format("%010d",hashCodeV));
-
-    }
-
-    @org.junit.Test
-    public void getTest6(){
-        String s = "电缆保护管,MPP,φ200";
-        String[] split = s.split(",");
-        String s1 = split[split.length-1];
-        System.out.println(s1);
-        String substring = s1.substring(1, s1.length());
-        System.out.println(substring);
-    }
-}

+ 5 - 22
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/web/ErpCreditController.java

@@ -155,23 +155,6 @@ public class ErpCreditController extends BaseController {
 			erpJudge.setInfoFlag(strings3[10]);
 			erpJudges.add(erpJudge);
 		}
-//		List<ErpJudge> erpJudges = new ArrayList<ErpJudge>();
-//		ErpJudge erpJudge= null;
-//		for (int i = 0; i < list.length; i+=11) {
-//			erpJudge = new ErpJudge();
-//			erpJudge.setItemId(list[i]);
-//			erpJudge.setMainFlag(URLEncoder.encode(list[i+1],"UTF-8"));
-//			erpJudge.setMainStartDate(list[i+2]);
-//			erpJudge.setMainEndDate(list[i+3]);
-//			erpJudge.setMainApprovalNumber(list[i+4]);
-//			erpJudge.setMainDesign(list[i+5]);
-//			erpJudge.setMainSupervision(list[i+6]);
-//			erpJudge.setMainConstructionUnits(list[i+7]);
-//			erpJudge.setMainDesignUnits(list[i+8]);
-//			erpJudge.setMainInvestmen(list[i+9]);
-//			erpJudge.setInfoFlag(list[i+10]);
-//			erpJudges.add(erpJudge);
-//		}
 		model.addAttribute("erpList",erpJudges);
 		return "modules/sg/financial/erp/erpCreditTips";
 	}
@@ -294,7 +277,7 @@ public class ErpCreditController extends BaseController {
 	public Result importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request,Model model) throws IOException, InvalidFormatException {
 		Result j = new Result();
 		String str = "";
-		try {
+//		try {
 			int successNum = 0;
 			int failureNum = 0;
 			StringBuilder failureMsg = new StringBuilder();
@@ -344,10 +327,10 @@ public class ErpCreditController extends BaseController {
 			}
 			j.setMsg( "已成功导入 "+successNum+" 条送审决算记录"+failureMsg);
 			j.setList(str);
-		} catch (Exception e) {
-			j.setSuccess(false);
-			j.setMsg("导入送审决算失败!失败信息:"+e.getMessage());
-		}
+//		} catch (Exception e) {
+//			j.setSuccess(false);
+//			j.setMsg("导入送审决算失败!失败信息:"+e.getMessage());
+//		}
 		return j;
 	}
 }

+ 0 - 15
src/main/java/com/jeeplus/modules/sg/financial/settlement/service/DataMaintenanceService.java

@@ -70,23 +70,8 @@ public class DataMaintenanceService extends CrudService<DataMaintenanceMapper, M
 
     //判断erp是否存在
     public List<MaintainData> getJudge(){
-//		boolean flagCount = true;
 		MaintainData maintainData1 = new MaintainData();
-//		Boolean flag = false;
-//		List<String> list = new ArrayList<>();//定义一个集合
 		List<MaintainData> maintainDatas = dataMaintenanceMapper.findList(maintainData1);//得到维护表所有数据
-//		for (String str :strings){
-//			flag = true;
-//			for (MaintainData maintainData:maintainDatas){
-//				if (str.equals(maintainData.getProjectId())){
-//					flag = false;
-//					break;
-//				}
-//			}
-//			if (flag){
-//				list.add(str);
-//			}
-//		}
 		return maintainDatas;
 	}
 

+ 1 - 1
src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/mapper/xml/MaterialInfoMapper.xml

@@ -39,7 +39,7 @@
 			a.del_flag = #{DEL_FLAG_NORMAL}
 			${dataScope}
 			<if test="projectName != null and projectName != '' ">
-				AND project_name = #{projectName}
+				AND project_name LIKE CONCAT(CONCAT('%',#{projectName},'%'))
 			</if>
 		</where>
 		ORDER BY a.material_code DESC

+ 3 - 3
src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/service/MaterialInfoService.java

@@ -101,9 +101,9 @@ public class MaterialInfoService extends CrudService<MaterialInfoMapper, Materia
 		List<MaterialInfo> materialInfos = getData(importExcel,projectName);   //sheet页数据
 //		List<MaterialInfo> list = replaceDate(materialInfos);          //对比替换数据
 		List<MaterialInfo> list = getNewData(materialInfos);      //合并后数据
-		List<MaterialInfo> standardList = materialInfoMapper.findSat(batch);     //标准库数据
-		List<MaterialInfo> newList = compareData(list,standardList);    //比对之后的数据
-		saveList(newList);
+//		List<MaterialInfo> standardList = materialInfoMapper.findSat(batch);     //标准库数据
+//		List<MaterialInfo> newList = compareData(list,standardList);    //比对之后的数据
+		saveList(list);
 		MaterialProject materialProject = new MaterialProject();
 		materialProject.setReserveProjectName(projectName);
 		materialProject.setSuppliesBatch(batch);

+ 3 - 2
src/main/java/com/jeeplus/modules/sg/managementcenter/materialinfo/web/MaterialInfoController.java

@@ -247,12 +247,13 @@ public class MaterialInfoController extends BaseController {
      */
     @ResponseBody
     @RequestMapping(value = "importValidations")
-    public AjaxJson importValidations(@RequestParam("file")MultipartFile[] file,String batch,String itemBatch){
+    public AjaxJson importValidations(@RequestParam("file")MultipartFile[] file,String batch,String itemBatch) {
         AjaxJson j = new AjaxJson();
         List<MaterialProject> materialProjects = new ArrayList<>();
         try {
             for(int i = 0;i<file.length;i++) {
                 ImportExcel mo = new ImportExcel(file[i], 1, "模块表");
+				ImportExcel m1 = new ImportExcel(file[i], 1, "领料清单");
                 Row row = mo.getRow(0);
                 String projectName1 = (String) mo.getCellValue(row, 1);
                 String projectName = projectName1.trim();
@@ -277,7 +278,7 @@ public class MaterialInfoController extends BaseController {
                 j.setMsg("导入成功");
             }
         } catch (Exception e) {
-            j.setSuccess(false);
+            j.setSuccess(true);
             j.setMsg("导入失败!失败信息:"+e.getMessage());
         }
         return j;

+ 10 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/entity/MaterialProject.java

@@ -13,6 +13,15 @@ public class MaterialProject extends DataEntity<MaterialProject> {
     private String projectBatch;       //项目批次
     private String suppliesBatch;       //物料批次
 
+    private String projectStatus;
+
+    public String getProjectStatus() {
+        return projectStatus;
+    }
+
+    public void setProjectStatus(String projectStatus) {
+        this.projectStatus = projectStatus;
+    }
 
     @ExcelField(title="储备项目名称", align=2, sort=1)
     public String getReserveProjectName() {
@@ -84,4 +93,5 @@ public class MaterialProject extends DataEntity<MaterialProject> {
     public void setSuppliesBatch(String suppliesBatch) {
         this.suppliesBatch = suppliesBatch;
     }
+
 }

+ 1 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/mapper/MaterialProjectMapper.java

@@ -16,4 +16,5 @@ public interface MaterialProjectMapper extends BaseMapper<MaterialProject> {
     List<MaterialProject> findBatch();
     List<MaterialProject> findByList(@Param("list") List<MaterialProject> list);
 
+    Integer insertList(@Param("list") List<MaterialProject> list);
 }

+ 97 - 37
src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/mapper/xml/MaterialProjectMapper.xml

@@ -16,8 +16,7 @@
 		a.project_code AS "projectCode",
 		a.project_define AS "projectDefine",
 		a.project_attribute AS "projectAttribute",
-		a.project_batch AS "projectBatch",
-		a.supplies_batch AS "suppliesBatch"
+		a.project_batch AS "projectBatch"
 	</sql>
 
     
@@ -35,31 +34,58 @@
 		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
 			${dataScope}
-			<if test="reserveProjectName != null and reserveProjectName != ''">
-				AND a.reserve_project_name = #{reserveProjectName}
+			<if test="projectStatus == '' ">
+				<if test="reserveProjectName != null and reserveProjectName != ''">
+					AND a.reserve_project_name LIKE CONCAT(CONCAT('%',#{reserveProjectName},'%'))
+				</if>
+				<if test="projectName != null and projectName != ''">
+					AND a.project_name LIKE CONCAT(CONCAT('%',#{projectName},'%'))
+				</if>
+				<if test="reserveCode != null and reserveCode != ''">
+					AND a.reserve_code LIKE CONCAT(CONCAT('%',#{reserveCode},'%'))
+				</if>
+				<if test="projectCode != null and projectCode != ''">
+					AND a.project_code LIKE CONCAT(CONCAT('%',#{projectCode},'%'))
+				</if>
+				<if test="projectDefine != null and projectDefine !=''">
+					AND a.project_define LIKE CONCAT(CONCAT('%',#{projectDefine},'%'))
+				</if>
+				<if test="projectAttribute != null and projectAttribute != ''">
+					AND a.project_attribute LIKE CONCAT(CONCAT('%',#{projectAttribute},'%'))
+				</if>
+				<if test="projectBatch != null and projectBatch != ''">
+					AND a.project_batch LIKE CONCAT(CONCAT('%',#{projectBatch},'%'))
+				</if>
+				<if test="suppliesBatch != null and suppliesBatch !=''">
+					AND a.supplies_batch LIKE CONCAT(CONCAT('%',#{suppliesBatch},'%'))
+				</if>
 			</if>
-			<if test="projectName != null and projectName != ''">
-				AND a.project_name = #{projectName}
+			<if test="projectStatus != '' ">
+				<if test="reserveProjectName != null and reserveProjectName != ''">
+					AND a.reserve_project_name =  #{reserveProjectName}
+				</if>
+				<if test="projectName != null and projectName != ''">
+					AND a.project_name = #{projectName}
+				</if>
+				<if test="reserveCode != null and reserveCode != ''">
+					AND a.reserve_code = #{reserveCode}
+				</if>
+				<if test="projectCode != null and projectCode != ''">
+					AND a.project_code = #{projectCode}
+				</if>
+				<if test="projectDefine != null and projectDefine !=''">
+					AND a.project_define = #{projectDefine}
+				</if>
+				<if test="projectAttribute != null and projectAttribute != ''">
+					AND a.project_attribute = #{projectAttribute}
+				</if>
+				<if test="projectBatch != null and projectBatch != ''">
+					AND a.project_batch = #{projectBatch}
+				</if>
+				<if test="suppliesBatch != null and suppliesBatch !=''">
+					AND a.supplies_batch = #{suppliesBatch}
+				</if>
 			</if>
-			<if test="reserveCode != null and reserveCode != ''">
-				AND a.reserve_code = #{reserveCode}
-			</if>
-			<if test="projectCode != null and projectCode != ''">
-				AND a.project_code = #{projectCode}
-			</if>
-			<if test="projectDefine != null and projectDefine !=''">
-				AND a.project_define = #{projectDefine}
-			</if>
-			<if test="projectAttribute != null and projectAttribute != ''">
-				AND a.project_attribute = #{projectAttribute}
-			</if>
-			<if test="projectBatch != null and projectBatch != ''">
-				AND a.project_batch = #{projectBatch}
-			</if>
-			<if test="suppliesBatch != null and suppliesBatch !=''">
-				AND a.supplies_batch = #{suppliesBatch}
-			</if>
-
 		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -115,14 +141,13 @@
 			update_date,
 			remarks,
 			del_flag,
-			reserve_project_name ,
-		    project_name ,
-		    reserve_code ,
-		    project_code ,
-		    project_define ,
-		    project_attribute ,
-		    project_batch ,
-		    supplies_batch
+			reserve_project_name,
+		    project_name,
+		    reserve_code,
+		    project_code,
+		    project_define,
+		    project_attribute,
+		    project_batch
 		) VALUES (
 			#{id},
 			#{createBy.id},
@@ -137,11 +162,47 @@
 			#{projectCode},
 			#{projectDefine},
 			#{projectAttribute},
-			#{projectBatch},
-			#{suppliesBatch}
+			#{projectBatch}
 		)
 	</insert>
 
+	<insert id="insertList">
+		INSERT INTO xm_material_project(
+		id,
+		create_by,
+		create_date,
+		update_by,
+		update_date,
+		remarks,
+		del_flag,
+		reserve_project_name,
+		project_name,
+		reserve_code,
+		project_code,
+		project_define,
+		project_attribute,
+		project_batch
+		) VALUES
+		<foreach collection="list" item="item" index="index" separator=",">
+		  (
+			#{item.id},
+			#{item.createBy.id},
+			#{item.createDate},
+			#{item.updateBy.id},
+			#{item.updateDate},
+			#{item.remarks},
+			#{item.delFlag},
+			#{item.reserveProjectName},
+			#{item.projectName},
+			#{item.reserveCode},
+			#{item.projectCode},
+			#{item.projectDefine},
+			#{item.projectAttribute},
+			#{item.projectBatch}
+		  )
+		</foreach>
+	</insert>
+
 	<update id="update">
 		UPDATE xm_material_project SET
 			update_by = #{updateBy.id},
@@ -153,8 +214,7 @@
 			project_code = #{projectCode},
 			project_define = #{projectDefine},
 			project_attribute = #{projectAttribute},
-			project_batch = #{projectBatch},
-			supplies_batch = #{suppliesBatch}
+			project_batch = #{projectBatch}
 		WHERE id = #{id}
 	</update>
 	

+ 8 - 1
src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/service/MaterialProjectService.java

@@ -53,5 +53,12 @@ public class MaterialProjectService extends CrudService<MaterialProjectMapper, M
 		super.delete(materialProject);
 		materialInfoService.deleteByPro(materialProject.getReserveProjectName());
 	}
-	
+	//文件导入
+	@Transactional(readOnly = false)
+	public void savaList(List<MaterialProject> list){
+		for (MaterialProject materialProject:list){
+			materialProject.preInsert();
+		}
+		materialProjectMapper.insertList(list);
+	}
 }

+ 394 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/util/ImportUtil.java

@@ -0,0 +1,394 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.managementcenter.materialproject.util;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.Reflections;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Area;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.DictUtils;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.text.NumberFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 导入Excel文件(支持“XLS”和“XLSX”格式)
+ * @author jeeplus
+ * @version 2016-03-10
+ */
+public class ImportUtil {
+
+	private static Logger log = LoggerFactory.getLogger(ImportUtil.class);
+
+	/**
+	 * 工作薄对象
+	 */
+	private Workbook wb;
+
+	/**
+	 * 工作表对象
+	 */
+	private Sheet sheet;
+
+	/**
+	 * 标题行号
+	 */
+	private int headerNum;
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件,读取第一个工作表
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(String fileName, int headerNum)
+			throws InvalidFormatException, IOException {
+		this(new File(fileName), headerNum);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件对象,读取第一个工作表
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(File file, int headerNum)
+			throws InvalidFormatException, IOException {
+		this(file, headerNum, 0);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(String fileName, int headerNum, int sheetIndex)
+			throws InvalidFormatException, IOException {
+		this(new File(fileName), headerNum, sheetIndex);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件对象
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(File file, int headerNum, int sheetIndex)
+			throws InvalidFormatException, IOException {
+		this(file.getName(), new FileInputStream(file), headerNum, sheetIndex);
+	}
+
+	/**
+	 * 构造函数
+	 * @param file 导入文件对象
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(MultipartFile multipartFile, int headerNum, int sheetIndex)
+			throws InvalidFormatException, IOException {
+		this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件对象
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(String fileName, InputStream is, int headerNum, int sheetIndex)
+			throws InvalidFormatException, IOException {
+		if (StringUtils.isBlank(fileName)){
+			throw new RuntimeException("导入文档为空!");
+		}else if(fileName.toLowerCase().endsWith("xls")){    
+			this.wb = new HSSFWorkbook(is);    
+        }else if(fileName.toLowerCase().endsWith("xlsx")){  
+        	this.wb = new XSSFWorkbook(is);
+        }else{  
+        	throw new RuntimeException("文档格式不正确!");
+        }  
+		if (this.wb.getNumberOfSheets()<sheetIndex){
+			throw new RuntimeException("文档中没有工作表!");
+		}
+		this.sheet = this.wb.getSheetAt(sheetIndex);
+		this.headerNum = headerNum;
+		log.debug("Initialize success.");
+	}
+	
+	/**
+	 * 获取行对象
+	 * @param rownum
+	 * @return
+	 */
+	public Row getRow(int rownum){
+		return this.sheet.getRow(rownum);
+	}
+
+	/**
+	 * 获取数据行号
+	 * @return
+	 */
+	public int getDataRowNum(){
+		return headerNum+1;
+	}
+	
+	/**
+	 * 获取最后一个数据行号
+	 * @return
+	 */
+	public int getLastDataRowNum(){
+		return this.sheet.getLastRowNum()+headerNum;
+	}
+	
+	/**
+	 * 获取最后一个列号
+	 * @return
+	 */
+	public int getLastCellNum(){
+		return this.getRow(headerNum).getLastCellNum();
+	}
+	
+	/**
+	 * 获取单元格值
+	 * @param row 获取的行
+	 * @param column 获取单元格列号
+	 * @return 单元格值
+	 */
+	public Object getCellValue(Row row, int column) {
+		Object val = "";
+		try {
+			Cell cell = row.getCell(column);
+			if (cell != null) {
+				if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
+					// val = cell.getNumericCellValue();
+					// 当excel 中的数据为数值或日期是需要特殊处理
+					if (HSSFDateUtil.isCellDateFormatted(cell)) {
+						double d = cell.getNumericCellValue();
+						Date date = HSSFDateUtil.getJavaDate(d);
+						SimpleDateFormat dformat = new SimpleDateFormat(
+								"yyyy-MM-dd");
+						val = dformat.format(date);
+					} else {
+						NumberFormat nf = NumberFormat.getInstance();
+						nf.setGroupingUsed(false);// true时的格式:1,234,567,890
+						val = nf.format(cell.getNumericCellValue());// 数值类型的数据为double,所以需要转换一下
+					}
+				} else if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
+					val = cell.getStringCellValue();
+				} else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
+					val = cell.getCellFormula();
+				} else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) {
+					val = cell.getBooleanCellValue();
+				} else if (cell.getCellType() == Cell.CELL_TYPE_ERROR) {
+					val = cell.getErrorCellValue();
+				}
+			}
+		} catch (Exception e) {
+			return val;
+		}
+		return val;
+	}
+	
+	/**
+	 * 获取导入数据列表
+	 * @param cls 导入对象类型
+	 * @param groups 导入分组
+	 */
+	public <E> List<E> getDataList(Class<E> cls, int... groups) throws InstantiationException, IllegalAccessException{
+		List<Object[]> annotationList = Lists.newArrayList();
+		// Get annotation field 
+		Field[] fs = cls.getDeclaredFields();
+		for (Field f : fs){
+			ExcelField ef = f.getAnnotation(ExcelField.class);
+			if (ef != null && (ef.type()==0 || ef.type()==2)){
+				if (groups!=null && groups.length>0){
+					boolean inGroup = false;
+					for (int g : groups){
+						if (inGroup){
+							break;
+						}
+						for (int efg : ef.groups()){
+							if (g == efg){
+								inGroup = true;
+								annotationList.add(new Object[]{ef, f});
+								break;
+							}
+						}
+					}
+				}else{
+					annotationList.add(new Object[]{ef, f});
+				}
+			}
+		}
+		// Get annotation method
+		Method[] ms = cls.getDeclaredMethods();
+		for (Method m : ms){
+			ExcelField ef = m.getAnnotation(ExcelField.class);
+			if (ef != null && (ef.type()==0 || ef.type()==2)){
+				if (groups!=null && groups.length>0){
+					boolean inGroup = false;
+					for (int g : groups){
+						if (inGroup){
+							break;
+						}
+						for (int efg : ef.groups()){
+							if (g == efg){
+								inGroup = true;
+								annotationList.add(new Object[]{ef, m});
+								break;
+							}
+						}
+					}
+				}else{
+					annotationList.add(new Object[]{ef, m});
+				}
+			}
+		}
+		// Field sorting
+		Collections.sort(annotationList, new Comparator<Object[]>() {
+			public int compare(Object[] o1, Object[] o2) {
+				return new Integer(((ExcelField)o1[0]).sort()).compareTo(
+						new Integer(((ExcelField)o2[0]).sort()));
+			};
+		});
+		//log.debug("Import column count:"+annotationList.size());
+		// Get excel data
+		List<E> dataList = Lists.newArrayList();
+		for (int i = this.getDataRowNum(); i < this.getLastDataRowNum(); i++) {
+			E e = (E)cls.newInstance();
+			int column = 0;
+			Row row = this.getRow(i);
+			StringBuilder sb = new StringBuilder();
+			for (Object[] os : annotationList){
+				Object val = this.getCellValue(row, column++);
+				if (val != null){
+					ExcelField ef = (ExcelField)os[0];
+					// If is dict type, get dict value
+					if (StringUtils.isNotBlank(ef.dictType())){
+						val = DictUtils.getDictValue(val.toString(), ef.dictType(), "");
+						//log.debug("Dictionary type value: ["+i+","+colunm+"] " + val);
+					}
+					// Get param type and type cast
+					Class<?> valType = Class.class;
+					if (os[1] instanceof Field){
+						valType = ((Field)os[1]).getType();
+					}else if (os[1] instanceof Method){
+						Method method = ((Method)os[1]);
+						if ("get".equals(method.getName().substring(0, 3))){
+							valType = method.getReturnType();
+						}else if("set".equals(method.getName().substring(0, 3))){
+							valType = ((Method)os[1]).getParameterTypes()[0];
+						}
+					}
+					//log.debug("Import value type: ["+i+","+column+"] " + valType);
+					try {
+						//如果导入的java对象,需要在这里自己进行变换。
+						if (valType == String.class){
+							String s = String.valueOf(val.toString());
+							if(StringUtils.endsWith(s, ".0")){
+								val = StringUtils.substringBefore(s, ".0");
+							}else{
+								val = String.valueOf(val.toString());
+							}
+						}else if (valType == Integer.class){
+							val = Double.valueOf(val.toString()).intValue();
+						}else if (valType == Long.class){
+							val = Double.valueOf(val.toString()).longValue();
+						}else if (valType == Double.class){
+							val = Double.valueOf(val.toString());
+						}else if (valType == Float.class){
+							val = Float.valueOf(val.toString());
+						}else if (valType == Date.class){
+							SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
+							val=sdf.parse(val.toString()); 
+						}else if (valType == User.class){
+							val = UserUtils.getByUserName(val.toString());
+						}else if (valType == Office.class){
+							val = UserUtils.getByOfficeName(val.toString());
+						}else if (valType == Area.class){
+							val = UserUtils.getByAreaName(val.toString());
+						}else{
+							if (ef.fieldType() != Class.class){
+								val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
+							}else{
+								val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(), 
+										"fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString());
+							}
+						}
+					} catch (Exception ex) {
+						log.info("Get cell value ["+i+","+column+"] error: " + ex.toString());
+						val = null;
+					}
+					// set entity value
+					if (os[1] instanceof Field){
+						Reflections.invokeSetter(e, ((Field)os[1]).getName(), val);
+					}else if (os[1] instanceof Method){
+						String mthodName = ((Method)os[1]).getName();
+						if ("get".equals(mthodName.substring(0, 3))){
+							mthodName = "set"+StringUtils.substringAfter(mthodName, "get");
+						}
+						Reflections.invokeMethod(e, mthodName, new Class[] {valType}, new Object[] {val});
+					}
+				}
+				sb.append(val+", ");
+			}
+			dataList.add(e);
+			log.debug("Read success: ["+i+"] "+sb.toString());
+		}
+		return dataList;
+	}
+
+//	/**
+//	 * 导入测试
+//	 */
+//	public static void main(String[] args) throws Throwable {
+//		
+//		ImportExcel ei = new ImportExcel("target/export.xlsx", 1);
+//		
+//		for (int i = ei.getDataRowNum(); i < ei.getLastDataRowNum(); i++) {
+//			Row row = ei.getRow(i);
+//			for (int j = 0; j < ei.getLastCellNum(); j++) {
+//				Object val = ei.getCellValue(row, j);
+//				System.out.print(val+", ");
+//			}
+//			System.out.print("\n");
+//		}
+//		
+//	}
+}

+ 66 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/util/MaterialProUtil.java

@@ -0,0 +1,66 @@
+package com.jeeplus.modules.sg.managementcenter.materialproject.util;
+import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.Row;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+public  class MaterialProUtil {
+    /**
+     * 获取表格数据
+     * @param importUtil
+     * @return List<MaterialProjectMapper> 导入表格数据
+     */
+    public static List<MaterialProject> getProjectUtil(ImportUtil importUtil)  {
+        int lastRow = importUtil.getLastDataRowNum();
+        List<MaterialProject> list = new ArrayList<MaterialProject>();
+        MaterialProject materialProject = null;
+        String costEstimate="";//费用估算
+        for(int i=1; i<=lastRow;i++){
+            materialProject = new MaterialProject();
+            Row row = importUtil.getRow(i);
+            String reserveProjectName = (String) importUtil.getCellValue(row,0);
+            if(StringUtils.isNotBlank(reserveProjectName)) {
+                materialProject.setReserveProjectName(reserveProjectName);
+                materialProject.setProjectName((String)importUtil.getCellValue(row,1));//项目名称
+                materialProject.setReserveCode((String)importUtil.getCellValue(row,2));//储备编码
+                materialProject.setProjectCode((String)importUtil.getCellValue(row,3));//项目编码
+                materialProject.setProjectDefine((String)importUtil.getCellValue(row,4));//项目定义
+                materialProject.setProjectAttribute((String)importUtil.getCellValue(row,5));//项目属性
+                materialProject.setProjectBatch((String)importUtil.getCellValue(row,6));//项目批次
+//                materialProject.setSuppliesBatch((String)importUtil.getCellValue(row,7));//物料批次
+                list.add(materialProject);
+            }
+        }
+        return list;
+    }
+    //验证表格数据是否正确
+    public static Boolean getMaterialProjectFlag(ImportUtil importUtil){
+        Boolean flag = false;
+        Row row = importUtil.getRow(0);
+        String index =  (String)importUtil.getCellValue(row,0);
+        String two = (String)importUtil.getCellValue(row,1);
+        if (!index.contains("储备")){
+            flag = true;
+        }
+        if (!two.contains("项目")){
+            flag = true;
+        }
+        return flag;
+    }
+    /**
+     * 生成随机数
+     * @return
+     */
+    public static String getStatus(){
+        int machineId = 1;
+        int hashCodeV = UUID.randomUUID().toString().hashCode();
+        if (hashCodeV<0){
+            hashCodeV=-hashCodeV;
+        }
+        return  (machineId+String.format("%015d",hashCodeV));
+    }
+}

+ 79 - 3
src/main/java/com/jeeplus/modules/sg/managementcenter/materialproject/web/MaterialProjectController.java

@@ -15,6 +15,9 @@ import com.jeeplus.modules.sg.managementcenter.materialinfo.entity.MaterialInfo;
 import com.jeeplus.modules.sg.managementcenter.materialinfo.service.MaterialInfoService;
 import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
 import com.jeeplus.modules.sg.managementcenter.materialproject.service.MaterialProjectService;
+import com.jeeplus.modules.sg.managementcenter.materialproject.util.ImportUtil;
+import com.jeeplus.modules.sg.managementcenter.materialproject.util.MaterialProUtil;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,8 +31,10 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 import javax.validation.ConstraintViolationException;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -72,6 +77,35 @@ public class MaterialProjectController extends BaseController {
 	@RequiresPermissions("managementcenter:materialproject:list")
 	@RequestMapping(value = "data")
 	public Map<String, Object> data(MaterialProject materialProject, HttpServletRequest request, HttpServletResponse response, Model model) {
+		materialProject.setProjectStatus("");
+		String strProject = "";
+		if (!materialProject.getReserveProjectName().equals("")){
+			strProject+=materialProject.getReserveProjectName()+",";
+		}
+		if (!materialProject.getProjectName().equals("")){
+			strProject+=materialProject.getReserveProjectName()+",";
+		}
+		if (!materialProject.getProjectCode().equals("")){
+			strProject+=materialProject.getProjectCode()+",";
+		}
+		if (!materialProject.getReserveCode().equals("")){
+			strProject+=materialProject.getReserveCode()+",";
+		}
+		if (!materialProject.getProjectAttribute().equals("")){
+			strProject+=materialProject.getProjectAttribute()+",";
+		}
+		if (!materialProject.getProjectDefine().equals("")){
+			strProject+=materialProject.getProjectDefine()+",";
+		}
+		if (!materialProject.getProjectBatch().equals("")){
+			strProject+=materialProject.getProjectBatch()+",";
+		}
+		String[] split = strProject.split(",");
+		if (split.length>1){
+			materialProject.setProjectStatus("0");
+		}
+		HttpSession session = request.getSession();
+		session.setAttribute("materialPro",materialProject);
 		Page<MaterialProject> page = materialProjectService.findPage(new Page<MaterialProject>(request, response), materialProject);
 		return getBootstrapData(page);
 	}
@@ -150,8 +184,17 @@ public class MaterialProjectController extends BaseController {
     public AjaxJson exportFile(MaterialProject materialProject, HttpServletRequest request, HttpServletResponse response) throws IOException {
 		AjaxJson j = new AjaxJson();
 		try {
+			HttpSession session = request.getSession();
+			MaterialProject materialProject1 = (MaterialProject)session.getAttribute("materialPro");
             String fileName = "物料"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
-            List<MaterialProject> list = materialProjectService.findList(materialProject);
+			List<MaterialProject> list = null;
+			if (!materialProject1.getReserveProjectName().equals("")||!materialProject1.getProjectName().equals("")||!materialProject1.getProjectCode().equals("")||
+					!materialProject1.getReserveCode().equals("")||!materialProject1.getProjectAttribute().equals("")||!materialProject1.getProjectDefine().equals("")){
+				list = materialProjectService.findList(materialProject1);
+			}else {
+				list = materialProjectService.findList(materialProject);
+			}
+//            List<MaterialProject> list = materialProjectService.findList(materialProject);
             List<MaterialInfo> materialInfos = materialInfoService.findByBatch(list);
     		new ExportExcel(null, MaterialInfo.class).setDataList(materialInfos).write(response, fileName).dispose();
     		j.setSuccess(true);
@@ -177,9 +220,17 @@ public class MaterialProjectController extends BaseController {
 	public AjaxJson exportPro(MaterialProject materialProject, HttpServletRequest request, HttpServletResponse response) {
 		AjaxJson j = new AjaxJson();
 		try {
-			String fileName = "项目列表"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+			HttpSession session = request.getSession();
+			MaterialProject materialProject1 = (MaterialProject)session.getAttribute("materialPro");
+			String fileName = "项目表"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
 //			Page<MaterialProject> page = materialProjectService.findPage(new Page<MaterialProject>(request, response, -1), materialProject);
-			List<MaterialProject> list = materialProjectService.findList(materialProject);
+			List<MaterialProject> list = null;
+			if (!materialProject1.getReserveProjectName().equals("")||!materialProject1.getProjectName().equals("")||!materialProject1.getProjectCode().equals("")||
+			!materialProject1.getReserveCode().equals("")||!materialProject1.getProjectAttribute().equals("")||!materialProject1.getProjectDefine().equals("")){
+				list = materialProjectService.findList(materialProject1);
+			}else {
+				list = materialProjectService.findList(materialProject);
+			}
 			new ExportExcel(null, MaterialProject.class).setDataList(list).write(response, fileName).dispose();
 			j.setSuccess(true);
 			j.setMsg("导出成功!");
@@ -191,7 +242,32 @@ public class MaterialProjectController extends BaseController {
 		return j;
 	}
 
+	/**
+	 * 导入Excel数据
 
+	 */
+	@ResponseBody
+	@RequiresPermissions("managementcenter:materialproject:import")
+	@RequestMapping(value = "import")
+	public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) throws IOException, InvalidFormatException {
+		AjaxJson j = new AjaxJson();
+//		try {
+			ImportUtil importUtil = new ImportUtil(file, 0, 0);
+			Boolean materialProjectFlag = MaterialProUtil.getMaterialProjectFlag(importUtil);
+			if (materialProjectFlag){
+				j.setSuccess(false);
+				j.setMsg("表不符合规范");
+				return j;
+			}
+			List<MaterialProject> materialProjects = MaterialProUtil.getProjectUtil(importUtil);
+			materialProjectService.savaList(materialProjects);
+			j.setMsg( "已成功导入 "+materialProjects.size()+" 条项目表单记录");
+//		} catch (Exception e) {
+//			j.setSuccess(false);
+//			j.setMsg("导入项目表单失败!失败信息:"+e.getMessage());
+//		}
+		return j;
+	}
 	
 
 

+ 15 - 15
src/main/webapp/webpage/modules/sg/managementcenter/materialinfo/importmore.jsp

@@ -37,17 +37,17 @@
                                         <input type="text" id="myinput" autocomplete="off" placeholder=""  class="layui-input">
                                     </div>
                                 </div>
-                                <div class="layui-inline">
-                                    <label class="layui-form-label">*物料批次</label>
-                                    <div class="layui-input-inline">
-                                        <select name="suppliesBatch"  id="suppliesBatch">
-                                            <option value="">请选择</option>
-                                            <c:forEach var="item" items="${batch}">
-                                                <option value="${item.suppliesBatch}">${item.suppliesBatch}</option>
-                                            </c:forEach>
-                                        </select>
-                                    </div>
-                                </div>
+                                <%--<div class="layui-inline">--%>
+                                    <%--<label class="layui-form-label">*物料批次</label>--%>
+                                    <%--<div class="layui-input-inline">--%>
+                                        <%--<select name="suppliesBatch"  id="suppliesBatch">--%>
+                                            <%--<option value="">请选择</option>--%>
+                                            <%--<c:forEach var="item" items="${batch}">--%>
+                                                <%--<option value="${item.suppliesBatch}">${item.suppliesBatch}</option>--%>
+                                            <%--</c:forEach>--%>
+                                        <%--</select>--%>
+                                    <%--</div>--%>
+                                <%--</div>--%>
                             </div>
                             </form>
                             <div class="layui-upload">
@@ -176,10 +176,10 @@
             layer.msg("请输入项目批次",{icon: 3,offset:['40%','40%']});
             return false;
         }
-        if(suppliesBatch == null || suppliesBatch === ''){
-            layer.msg("请选择物料批次",{icon: 3,offset:['40%','40%']});
-            return false;
-        }
+        // if(suppliesBatch == null || suppliesBatch === ''){
+        //     layer.msg("请选择物料批次",{icon: 3,offset:['40%','40%']});
+        //     return false;
+        // }
         var td_id=document.getElementsByClassName("td_id");
         //存放id的数组
         var array_id = [];

+ 6 - 6
src/main/webapp/webpage/modules/sg/managementcenter/materialinfo/materialInfoList.js

@@ -244,12 +244,12 @@ $(document).ready(function() {
 
 
     function getTdValue(){
-            var tableId = document.getElementById("dataTable");
-             for(var i = 1;i < tableId.rows.length;i++) {
-                 if(tableId.rows[i].cells[10].innerHTML.indexOf("0") != -1 ){
-                   tableId.rows[i].setAttribute("style","color: red;");
-                   }
-             }
+            // var tableId = document.getElementById("dataTable");
+            //  for(var i = 1;i < tableId.rows.length;i++) {
+            //      if(tableId.rows[i].cells[10].innerHTML.indexOf("0") != -1 ){
+            //        tableId.rows[i].setAttribute("style","color: red;");
+            //        }
+            //  }
     }
 
   

+ 2 - 53
src/main/webapp/webpage/modules/sg/managementcenter/materialinfo/materialInfoList.jsp

@@ -21,38 +21,10 @@
 	<div id="search-collapse" class="collapse">
 		<div class="accordion-inner">
 			<form:form id="searchForm" modelAttribute="materialInfo" 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="reserveProjectName" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
-			    <%--</div>--%>
 				<div class="col-xs-12 col-sm-6 col-md-4">
 					<label class="label-item single-overflow pull-left" title="项目名称:">项目名称:</label>
 					<form:input path="projectName" htmlEscape="false" maxlength="64"  class=" form-control"/>
 				</div>
-				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
-					<%--<label class="label-item single-overflow pull-left" title="储备编码:">储备编码:</label>--%>
-					<%--<form:input path="reserveCode" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
-				<%--</div>--%>
-				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
-					<%--<label class="label-item single-overflow pull-left" title="项目编码:">项目编码:</label>--%>
-					<%--<form:input path="projectCode" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
-				<%--</div>--%>
-				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
-					<%--<label class="label-item single-overflow pull-left" title="项目定义:">项目定义:</label>--%>
-					<%--<form:input path="projectDefine" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
-				<%--</div>--%>
-				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
-					<%--<label class="label-item single-overflow pull-left" title="项目属性:">项目属性:</label>--%>
-					<%--<form:input path="projectAttribute" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
-				<%--</div>--%>
-				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
-					<%--<label class="label-item single-overflow pull-left" title="项目批次:">项目批次:</label>--%>
-					<%--<form:input path="projectBatch" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
-				<%--</div>--%>
-				<%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
-					<%--<label class="label-item single-overflow pull-left" title="项目批次:">物料批次:</label>--%>
-					<%--<form:input path="suppliesBatch" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
-				<%--</div>--%>
 		 <div class="col-xs-12 col-sm-6 col-md-4">
 			<div style="margin-top:26px">
 			  <a  id="search" class="btn btn-primary btn-rounded  btn-bordered btn-sm"><i class="fa fa-search"></i> 查询</a>
@@ -64,25 +36,7 @@
 	</div>
 	
 	<!-- 工具栏 -->
-	<div id="toolbar">
-			<%--<shiro:hasPermission name="managementcenter:materialinfo:add">--%>
-				<%--<button id="add" class="btn btn-primary" onclick="add()">--%>
-					<%--<i class="glyphicon glyphicon-plus"></i> 新建--%>
-				<%--</button>--%>
-			<%--</shiro:hasPermission>--%>
-			<%--<shiro:hasPermission name="managementcenter:materialinfo:edit">--%>
-			    <%--<button id="edit" class="btn btn-success" disabled onclick="edit()">--%>
-	            	<%--<i class="glyphicon glyphicon-edit"></i> 修改--%>
-	        	<%--</button>--%>
-			<%--</shiro:hasPermission>--%>
-			<%--<shiro:hasPermission name="managementcenter:materialinfo:del">--%>
-				<%--<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">--%>
-	            	<%--<i class="glyphicon glyphicon-remove"></i> 删除--%>
-	        	<%--</button>--%>
-			<%--</shiro:hasPermission>--%>
-		<%--<shiro:hasPermission name="managementcenter:materialinfo:import">--%>
-			<%--<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>--%>
-		<%--</shiro:hasPermission>--%>
+		<div id="toolbar">
 			<shiro:hasPermission name="managementcenter:materialinfo:import">
 	        		<button id="moreImport" class="btn btn-info">
 					<i class="fa fa-file-excel-o"></i> 多文件导入
@@ -93,12 +47,7 @@
 						<i class="fa fa-file-excel-o"></i> 导出
 					</button>
 				</shiro:hasPermission>
-	                 <%--<shiro:hasPermission name="managementcenter:materialinfo:view">--%>
-				<%--<button id="view" class="btn btn-default" disabled onclick="view()">--%>
-					<%--<i class="fa fa-search-plus"></i> 查看--%>
-				<%--</button>--%>
-			<%--</shiro:hasPermission>--%>
-		    </div>
+		</div>
 		
 	<!-- 表格 -->
 	<table id="dataTable"  style="table-layout:fixed"   data-toolbar="#toolbar"></table>

+ 11 - 8
src/main/webapp/webpage/modules/sg/managementcenter/materialproject/materialProjectList.js

@@ -2,7 +2,6 @@
 <script>
 $(document).ready(function() {
 	$('#dataTable').bootstrapTable({
-		 
 		  //请求方法
                method: 'post',
                //类型json
@@ -165,7 +164,7 @@ $(document).ready(function() {
             btn: ['确定', '关闭'],
             btn1: function(index, layero){
                 var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
-                iframeWin.contentWindow.importExcel('${ctx}/sg/managementcenter/project/import', function (data) {
+                iframeWin.contentWindow.importExcel('${ctx}/managementcenter/materialproject/import', function (data) {
                     if(data.success){
                         jp.success(data.msg);
                         refresh();
@@ -185,14 +184,18 @@ $(document).ready(function() {
 
 		
 		
-	 $("#export").click(function(){//导出Excel文件
-            var batch = $("#bat").val();
-			jp.downloadFile('${ctx}/managementcenter/materialproject/export?projectBatch='+batch);
+	 $("#export").click(function(){//导出Excel文件物料
+            var reserveProjectName = $("#reserveProjectName").val();//储备项目暂定名称:
+            var projectName = $("#projectName").val();//项目名称
+            var reserveCode = $("#reserveCode").val();//储备编码
+            var projectCode = $("#projectCode").val();//项目编码
+            var projectAttribute = $("#projectAttribute").val();//项目属性
+            var projectDefine = $("#projectDefine").val();//项目定义
+            var bat = $("#bat").val();//项目批次
+			jp.downloadFile('${ctx}/managementcenter/materialproject/export?reserveProjectName='+reserveProjectName+'&projectName='+projectName+'&reserveCode='+reserveCode+'&projectCode='+projectCode+'&projectAttribute='+projectAttribute+'&projectBatch='+bat+'&projectDefine='+projectDefine);
 	  });
-
     $("#exportpro").click(function(){//导出Excel文件
-         var batch = $("#bat").val();
-         jp.downloadFile('${ctx}/managementcenter/materialproject/exportpro?projectBatch='+batch);
+         jp.downloadFile('${ctx}/managementcenter/materialproject/exportpro');
     });
 
 		    

+ 26 - 41
src/main/webapp/webpage/modules/sg/managementcenter/materialproject/materialProjectList.jsp

@@ -53,54 +53,39 @@
 					<%--<label class="label-item single-overflow pull-left" title="物料批次:">物料批次:</label>--%>
 					<%--<form:input path="suppliesBatch" htmlEscape="false" maxlength="64"  class=" form-control"/>--%>
 				<%--</div>--%>
-		 <div class="col-xs-12 col-sm-6 col-md-4">
-			<div style="margin-top:26px">
-			  <a  id="search" class="btn btn-primary btn-rounded  btn-bordered btn-sm"><i class="fa fa-search"></i> 查询</a>
-			  <a  id="reset" class="btn btn-primary btn-rounded  btn-bordered btn-sm" ><i class="fa fa-refresh"></i> 重置</a>
-			 </div>
-	    </div>	
-	</form:form>
-	</div>
+				 <div class="col-xs-12 col-sm-6 col-md-4">
+					<div style="margin-top:26px">
+					  <a  id="search" class="btn btn-primary btn-rounded  btn-bordered btn-sm"><i class="fa fa-search"></i> 查询</a>
+					  <a  id="reset" class="btn btn-primary btn-rounded  btn-bordered btn-sm" ><i class="fa fa-refresh"></i> 重置</a>
+					 </div>
+				</div>
+			</form:form>
+		</div>
 	</div>
 	
-	<!-- 工具栏 -->
-	<div id="toolbar">
-			<%--<shiro:hasPermission name="managementcenter:materialproject:add">--%>
-				<%--<button id="add" class="btn btn-primary" onclick="add()">--%>
-					<%--<i class="glyphicon glyphicon-plus"></i> 新建--%>
-				<%--</button>--%>
-			<%--</shiro:hasPermission>--%>
-			<%--<shiro:hasPermission name="managementcenter:materialproject:edit">--%>
-			    <%--<button id="edit" class="btn btn-success" disabled onclick="edit()">--%>
-	            	<%--<i class="glyphicon glyphicon-edit"></i> 修改--%>
-	        	<%--</button>--%>
-			<%--</shiro:hasPermission>--%>
-			<shiro:hasPermission name="managementcenter:materialproject:del">
-				<button id="btnImport" class="btn btn-info">
-					<i class="fa fa-folder-open-o"></i> 导入
-				</button>
-			</shiro:hasPermission>
-			<shiro:hasPermission name="managementcenter:materialproject:del">
-				<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
-	            	<i class="glyphicon glyphicon-remove"></i> 删除
-	        	</button>
-			</shiro:hasPermission>
-			<shiro:hasPermission name="managementcenter:materialproject:export">
-	        		<button id="export" class="btn btn-warning">
-					<i class="fa fa-file-excel-o"></i> 导出物料
-				</button>
-			 </shiro:hasPermission>
-	       <%--<shiro:hasPermission name="managementcenter:materialproject:view">--%>
-				<%--<button id="view" class="btn btn-default" disabled onclick="view()">--%>
-					<%--<i class="fa fa-search-plus"></i> 查看--%>
-				<%--</button>--%>
-			<%--</shiro:hasPermission>--%>
+		<!-- 工具栏 -->
+			<div id="toolbar">
+				<shiro:hasPermission name="managementcenter:materialproject:import">
+					<button id="btnImport" class="btn btn-info">
+						<i class="fa fa-folder-open-o"></i> 导入
+					</button>
+				</shiro:hasPermission>
+				<shiro:hasPermission name="managementcenter:materialproject:del">
+					<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
+						<i class="glyphicon glyphicon-remove"></i> 删除
+					</button>
+				</shiro:hasPermission>
+				<shiro:hasPermission name="managementcenter:materialproject:export">
+						<button id="export" class="btn btn-warning">
+						<i class="fa fa-file-excel-o"></i> 导出物料
+					</button>
+				 </shiro:hasPermission>
 				<shiro:hasPermission name="managementcenter:materialproject:export">
 					<button id="exportpro" class="btn btn-warning">
 						<i class="fa fa-file-excel-o"></i> 导出项目
 					</button>
 				</shiro:hasPermission>
-		    </div>
+			</div>
 		
 	<!-- 表格 -->
 	<table id="dataTable"  style="table-layout:fixed"   data-toolbar="#toolbar"></table>