|
@@ -4,6 +4,8 @@ import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpAccount;
|
|
|
import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpCredit;
|
|
|
import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpCreditEquipment;
|
|
|
import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpCreditMaterial;
|
|
|
+import com.jeeplus.modules.sys.entity.DictValue;
|
|
|
+import com.jeeplus.modules.sys.utils.DictUtils;
|
|
|
import groovy.util.IFileNameFinder;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
@@ -103,13 +105,14 @@ public class ErpInfo {
|
|
|
erpAccount.setProjectDefinitionCode(erpCode);
|
|
|
erpAccount.setProjectDefinitionDetails((String)importUtil.getCellValue(row,11));
|
|
|
erpAccount.setSubjectName((String)importUtil.getCellValue(row,13));
|
|
|
- erpAccount.setLineItemAmount(Double.parseDouble((String) importUtil.getCellValue(row,15)));
|
|
|
- erpAccount.setTheNumber((String)importUtil.getCellValue(row,16));
|
|
|
- erpAccount.setMaterialDetails((String)importUtil.getCellValue(row,19));
|
|
|
- erpAccount.setUnit((String)importUtil.getCellValue(row,20));
|
|
|
+ erpAccount.setLineItemAmount(Double.parseDouble((String) importUtil.getCellValue(row,19)));
|
|
|
+ erpAccount.setTheNumber((String)importUtil.getCellValue(row,20));
|
|
|
+ erpAccount.setMaterialCode((String)importUtil.getCellValue(row,22));
|
|
|
+ erpAccount.setMaterialDetails((String)importUtil.getCellValue(row,23));
|
|
|
+ erpAccount.setUnit((String)importUtil.getCellValue(row,24));
|
|
|
erpAccount.setWbsDetails((String)importUtil.getCellValue(row,9));
|
|
|
- erpAccount.setTheInputTax(Double.parseDouble((String) importUtil.getCellValue(row,21)));
|
|
|
- erpAccount.setSupplierName((String)importUtil.getCellValue(row,26));
|
|
|
+ erpAccount.setTheInputTax(Double.parseDouble((String) importUtil.getCellValue(row,25)));
|
|
|
+ erpAccount.setSupplierName((String)importUtil.getCellValue(row,30));
|
|
|
list.add(erpAccount);
|
|
|
}
|
|
|
}
|
|
@@ -125,11 +128,11 @@ public class ErpInfo {
|
|
|
Boolean flag = false;
|
|
|
Row row = importUtil.getRow(0);
|
|
|
String erpCode = (String) importUtil.getCellValue(row,10);
|
|
|
- if (!erpCode.contains("编码")){
|
|
|
+ if (!erpCode.contains("项目定义编码")){
|
|
|
flag = true;
|
|
|
}
|
|
|
- String lineItem = (String)importUtil.getCellValue(row,15);
|
|
|
- if (!lineItem.contains("金额")){
|
|
|
+ String lineItem = (String)importUtil.getCellValue(row,11);
|
|
|
+ if (!lineItem.contains("项目定义描述")){
|
|
|
flag = true;
|
|
|
}
|
|
|
return flag;
|
|
@@ -192,6 +195,7 @@ public class ErpInfo {
|
|
|
ErpAccount erpAccount = list.get(i);
|
|
|
String projectId = erpAccount.getProjectDefinitionCode();//项目定义号
|
|
|
String materialDetail = erpAccount.getMaterialDetails();//物料描述
|
|
|
+ String materialCode = erpAccount.getMaterialCode();//物料编码
|
|
|
String subjectName = erpAccount.getSubjectName();//科目名称
|
|
|
String wbsDetail = erpAccount.getWbsDetails();//wbs描述
|
|
|
Double lineItemAmount = erpAccount.getLineItemAmount();//行项目金额
|
|
@@ -295,6 +299,7 @@ public class ErpInfo {
|
|
|
equipment.setErpCredit(erpCredit);
|
|
|
equipment.setEqmMaterialDetails1(materialDetail);//添加物料描述
|
|
|
equipment.setEqmUnit(unit);//添加的单位
|
|
|
+ equipment.setEqmMaterialCode(materialCode);//添加物料编码
|
|
|
equipment.setEqmSupplierName(supplierName);//添加供应商
|
|
|
//截取总容量kVA前数字
|
|
|
if (materialDetail.toLowerCase().contains("kva")){
|
|
@@ -319,6 +324,7 @@ public class ErpInfo {
|
|
|
material.setEqmMaterialDetails2(materialDetail);//添加物料描述
|
|
|
material.setMtlUnit(unit);//添加设备单位
|
|
|
material.setMtlSupplierName(supplierName);//添加供应商
|
|
|
+ material.setEqmMaterialCode(materialCode);//添加物料编码
|
|
|
material.setErpCredit(erpCredit);
|
|
|
materialMap.put(materialDetail,material);
|
|
|
}
|
|
@@ -348,6 +354,157 @@ public class ErpInfo {
|
|
|
return creditList;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public static List<ErpCredit> getCostErpList(List<ErpAccount> list){
|
|
|
+ //key为项目定义号
|
|
|
+ Map<String,ErpCredit> map = new HashMap<>();
|
|
|
+ for(int i=0;i<list.size();i++){
|
|
|
+ ErpAccount erpAccount = list.get(i);
|
|
|
+ String projectId = erpAccount.getProjectDefinitionCode();//项目定义号
|
|
|
+ String materialDetail = erpAccount.getMaterialDetails();//物料描述
|
|
|
+ String subjectName = erpAccount.getSubjectName();//科目名称
|
|
|
+ String wbsDetail = erpAccount.getWbsDetails();//wbs描述
|
|
|
+ String materialCode = erpAccount.getMaterialCode();//物料编码
|
|
|
+ Double lineItemAmount = erpAccount.getLineItemAmount();//行项目金额
|
|
|
+ Double inputTax = erpAccount.getTheInputTax();//进项税额
|
|
|
+ Double theNumber = null; //数量
|
|
|
+ if (!erpAccount.getTheNumber().isEmpty()){
|
|
|
+ theNumber= Double.parseDouble(erpAccount.getTheNumber());
|
|
|
+ }
|
|
|
+ String unit = erpAccount.getUnit();
|
|
|
+ String supplierName = erpAccount.getSupplierName();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ErpCredit erpCredit = map.get(projectId);
|
|
|
+ if(erpCredit == null){
|
|
|
+ erpCredit = new ErpCredit();
|
|
|
+ map.put(projectId,erpCredit);
|
|
|
+ erpCredit.setItemId(erpAccount.getProjectDefinitionCode());//添加项目定义编号
|
|
|
+ erpCredit.setItemName(erpAccount.getProjectDefinitionDetails());//项目名称
|
|
|
+ }
|
|
|
+
|
|
|
+ //成本项目施工费对应供应商
|
|
|
+ List<DictValue> supCost = DictUtils.getDictList("finance_cost_supervisor");
|
|
|
+ for (DictValue a :
|
|
|
+ supCost) {
|
|
|
+ String label = a.getLabel();
|
|
|
+ if (supplierName.equals(label)) {
|
|
|
+ erpCredit.setConsTotalFee(DoubleUtil.add(erpCredit.getConsTotalFee(),erpAccount.getLineItemAmount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //成本项目设计费对应供应商
|
|
|
+ List<DictValue> desCost = DictUtils.getDictList("finance_cost_design");
|
|
|
+ for (DictValue a :
|
|
|
+ supCost) {
|
|
|
+ String label = a.getLabel();
|
|
|
+ if (supplierName.equals(label)) {
|
|
|
+ erpCredit.setOtherDesignFee(DoubleUtil.add(erpCredit.getOtherDesignFee(),lineItemAmount));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //成本项目监理费对应供应商
|
|
|
+ List<DictValue> conCOst = DictUtils.getDictList("finance_cost_construction");
|
|
|
+ for (DictValue a :
|
|
|
+ supCost) {
|
|
|
+ String label = a.getLabel();
|
|
|
+ if (supplierName.equals(label)) {
|
|
|
+ erpCredit.setOtherSupervisorFee(DoubleUtil.add(erpCredit.getOtherSupervisorFee(),lineItemAmount));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理进项税额
|
|
|
+ erpCredit.setTheInputTax(DoubleUtil.add(erpCredit.getTheInputTax(),inputTax));
|
|
|
+
|
|
|
+ //实际投资、移交生产的资产总值,明细账判断条件:科目名称中包含“工程成本”
|
|
|
+ if (subjectName.contains("工程成本")){
|
|
|
+ erpCredit.setActualInvestment(DoubleUtil.add(erpCredit.getActualInvestment(),lineItemAmount));
|
|
|
+ erpCredit.setTransferAssets(DoubleUtil.add(erpCredit.getTransferAssets(),lineItemAmount));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(materialDetail.isEmpty()){
|
|
|
+ }else{ //这里是物料描述不为空的情况
|
|
|
+ // 10Kv线路
|
|
|
+ if (materialDetail.contains(ErpInfo.CON_OICAC10)||materialDetail.contains(ErpInfo.CON_OICAC20)||
|
|
|
+ materialDetail.contains(ErpInfo.CON_PRCAC10)||materialDetail.contains(ErpInfo.CON_PRCAC20)){
|
|
|
+ erpCredit.setTenKvModel(materialDetail);
|
|
|
+ erpCredit.setTenKvUnit(erpAccount.getUnit());//单位
|
|
|
+ erpCredit.setSupplierName(erpAccount.getSupplierName());//公司
|
|
|
+ erpCredit.setTenKvLineLength(DoubleUtil.add(erpCredit.getTenKvLength(),theNumber));//10kv长度
|
|
|
+ erpCredit.setTenKvItsLine(DoubleUtil.add(erpCredit.getTenKvItsLine(),theNumber));//10kv长度 值一样
|
|
|
+ }
|
|
|
+
|
|
|
+ //400v线路
|
|
|
+ if (materialDetail.contains(ErpInfo.CON_OICAC1)||
|
|
|
+ materialDetail.contains(ErpInfo.CON_PRCAC1)){
|
|
|
+ erpCredit.setTenKvItesFhvFollow(DoubleUtil.add(erpCredit.getTenKvItesFhvFollow(),theNumber));
|
|
|
+ //400v也计入 10kv的长度
|
|
|
+ erpCredit.setTenKvLineLength(DoubleUtil.add(erpCredit.getTenKvLength(),theNumber));
|
|
|
+ erpCredit.setTenKvItsLine(DoubleUtil.add(erpCredit.getTenKvItsLine(),theNumber));
|
|
|
+ }
|
|
|
+
|
|
|
+ //电缆管
|
|
|
+ if (materialDetail.contains(CON_CABLE)){
|
|
|
+ erpCredit.setCableTube(materialDetail);
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理设备和材料
|
|
|
+ //筛选物料描述包含(变压器、环网柜(无“”有“无”字样)、箱式变电站、高压开关柜)为设备, 其余为材料
|
|
|
+ if (materialDetail.contains(ErpInfo.CON_TSF)||materialDetail.contains(ErpInfo.CON_RNB)||
|
|
|
+ materialDetail.contains(ErpInfo.CON_BST)||materialDetail.contains(ErpInfo.CON_HVS)){
|
|
|
+ Map<String,ErpCreditEquipment> equipmentMap = erpCredit.getEquipmentMap();
|
|
|
+ ErpCreditEquipment equipment = equipmentMap.get(materialDetail);
|
|
|
+ if(equipment==null){
|
|
|
+ equipment = new ErpCreditEquipment();
|
|
|
+ equipment.setErpCredit(erpCredit);
|
|
|
+ equipment.setEqmMaterialDetails1(materialDetail);//添加物料描述
|
|
|
+ equipment.setEqmUnit(unit);//添加的单位
|
|
|
+ equipment.setEqmMaterialCode(materialCode);//添加物料编码
|
|
|
+ equipment.setEqmSupplierName(supplierName);//添加供应商
|
|
|
+ //截取总容量kVA前数字
|
|
|
+ if (materialDetail.toLowerCase().contains("kva")){
|
|
|
+ String str[] = materialDetail.split(",");
|
|
|
+ for (int k = 0; k < str.length; k++) {
|
|
|
+ if (str[k].toLowerCase().contains("kva")){
|
|
|
+ equipment.setEqmTotalCapacity(str[k].substring(0,str[k].toLowerCase().indexOf("kva")));//添加总容量
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ equipmentMap.put(materialDetail,equipment);
|
|
|
+ }
|
|
|
+ equipment.setEqmNumbers(DoubleUtil.add(equipment.getEqmNumbers(),theNumber));//添加数量
|
|
|
+ equipment.setEqmBookedFee1(DoubleUtil.add(equipment.getEqmBookedFee1(),lineItemAmount));//添加入账金额
|
|
|
+
|
|
|
+ }else{
|
|
|
+ Map<String,ErpCreditMaterial> materialMap = erpCredit.getMaterialMap();
|
|
|
+ ErpCreditMaterial material = materialMap.get(materialDetail);
|
|
|
+ if(material==null){
|
|
|
+ material = new ErpCreditMaterial();
|
|
|
+ material.setEqmMaterialDetails2(materialDetail);//添加物料描述
|
|
|
+ material.setMtlUnit(unit);//添加设备单位
|
|
|
+ material.setMtlSupplierName(supplierName);//添加供应商
|
|
|
+ material.setEqmMaterialCode(materialCode);//添加物料编码
|
|
|
+ material.setErpCredit(erpCredit);
|
|
|
+ materialMap.put(materialDetail,material);
|
|
|
+ }
|
|
|
+ material.setMtlNumbers(DoubleUtil.add(material.getMtlNumbers(),theNumber));
|
|
|
+ material.setMtlBookedFee2(DoubleUtil.add(material.getMtlBookedFee2(),lineItemAmount));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取erpCredit列表 同时区分安装建筑费
|
|
|
+ List<ErpCredit> creditList = new ArrayList<>(map.values());
|
|
|
+ for(ErpCredit credit:creditList){
|
|
|
+ credit.setErpCreditChild1s(new ArrayList<>(credit.getEquipmentMap().values()));
|
|
|
+ credit.setErpCreditChild2s(new ArrayList<>(credit.getMaterialMap().values()));
|
|
|
+ }
|
|
|
+
|
|
|
+ return creditList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取单独 唯一 的 数据集合(项目定义编号——其他费用合计)
|
|
|
* @param list 读取表格获得的列表
|