Ver código fonte

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 1 ano atrás
pai
commit
4375a5d36d

+ 80 - 75
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceServiceImpl.java

@@ -775,65 +775,65 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                     if (userFinance.getCustomField3() != null) {
                         field3Item = userFinance.getCustomField3().multiply(new BigDecimal(workingTime)).divide(userTime.get(creatorId).workingTime, 4, BigDecimal.ROUND_HALF_UP);
                     }
-                } else {
-//                    System.out.println("财务数据中未找到用户:"+creatorId);
-                }
 
-                //改成按照projectId匹配,之前projectname可能存在重名问题。
-                if (projectId.equals(item.projectId)) {
-                    item.workingTime += workingTime;
-                    item.cost = item.cost.add(cost);
-                    item.salary = item.salary.add(salary);
-                    item.bonus = item.bonus.add(bonus);
-                    item.allowance = item.allowance.add(allowance);
-                    item.old = item.old.add(old);
-                    item.medical = item.medical.add(medical);
-                    item.loseJob = item.loseJob.add(loseJob);
-                    item.injury = item.injury.add(injury);
-                    item.house = item.house.add(house);
+                    //改成按照projectId匹配,之前projectname可能存在重名问题。
+                    if (projectId.equals(item.projectId)) {
+                        item.workingTime += workingTime;
+                        item.cost = item.cost.add(cost);
+                        item.salary = item.salary.add(salary);
+                        item.bonus = item.bonus.add(bonus);
+                        item.allowance = item.allowance.add(allowance);
+                        item.old = item.old.add(old);
+                        item.medical = item.medical.add(medical);
+                        item.loseJob = item.loseJob.add(loseJob);
+                        item.injury = item.injury.add(injury);
+                        item.house = item.house.add(house);
 //                    item.other = item.other.add(other);
-                    item.field1 = item.field1.add(field1Item);
-                    item.field2 = item.field2.add(field2Item);
-                    item.field3 = item.field3.add(field3Item);
-                } else {
-                    item = new ProjectSumItem();
-                    pList.add(item);
-                    item.project = curProject;
-                    item.projectId = projectId;
-                    item.projectCode = curProjectCode;
-                    item.categoryName = categoryName;
-                    item.workingTime = workingTime;
-                    item.cost = cost;
-                    item.salary = salary;
-                    item.bonus = bonus;
-                    item.allowance = allowance;
-                    item.old = old;
-                    item.medical = medical;
-                    item.loseJob = loseJob;
-                    item.injury = injury;
-                    item.house = house;
-                    item.field1 = field1Item;
-                    item.field2 = field2Item;
-                    item.field3 = field3Item;
-                }
-                totalMoneyCost = totalMoneyCost.add(cost);
-                totalSalary = totalSalary.add(salary);
-                totalBonus = totalBonus.add(bonus);
-                totalAllowance = totalAllowance.add(allowance);
-                totalOld = totalOld.add(old);
-                totalMedical = totalMedical.add(medical);
-                totalLoseJob = totalLoseJob.add(loseJob);
-                totalInjury = totalInjury.add(injury);
-                totalHouse = totalHouse.add(house);
+                        item.field1 = item.field1.add(field1Item);
+                        item.field2 = item.field2.add(field2Item);
+                        item.field3 = item.field3.add(field3Item);
+                    } else {
+                        item = new ProjectSumItem();
+                        pList.add(item);
+                        item.project = curProject;
+                        item.projectId = projectId;
+                        item.projectCode = curProjectCode;
+                        item.categoryName = categoryName;
+                        item.workingTime = workingTime;
+                        item.cost = cost;
+                        item.salary = salary;
+                        item.bonus = bonus;
+                        item.allowance = allowance;
+                        item.old = old;
+                        item.medical = medical;
+                        item.loseJob = loseJob;
+                        item.injury = injury;
+                        item.house = house;
+                        item.field1 = field1Item;
+                        item.field2 = field2Item;
+                        item.field3 = field3Item;
+                    }
+                    totalMoneyCost = totalMoneyCost.add(cost);
+                    totalSalary = totalSalary.add(salary);
+                    totalBonus = totalBonus.add(bonus);
+                    totalAllowance = totalAllowance.add(allowance);
+                    totalOld = totalOld.add(old);
+                    totalMedical = totalMedical.add(medical);
+                    totalLoseJob = totalLoseJob.add(loseJob);
+                    totalInjury = totalInjury.add(injury);
+                    totalHouse = totalHouse.add(house);
 //                totalOther = totalOther.add(other);
-                if (totalField1 != null) {
-                    totalField1 = totalField1.add(field1Item);
-                }
-                if (totalField2 != null) {
-                    totalField2 = totalField2.add(field2Item);
-                }
-                if (totalField3 != null) {
-                    totalField3 = totalField3.add(field3Item);
+                    if (totalField1 != null) {
+                        totalField1 = totalField1.add(field1Item);
+                    }
+                    if (totalField2 != null) {
+                        totalField2 = totalField2.add(field2Item);
+                    }
+                    if (totalField3 != null) {
+                        totalField3 = totalField3.add(field3Item);
+                    }
+                } else {
+//                    System.out.println("财务数据中未找到用户:"+creatorId);
                 }
             }
 
@@ -841,7 +841,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
             if (assignNoProUser != null && assignNoProUser) {
                 List<FinanceProjects> notInFPList = new ArrayList<FinanceProjects>();
                 financeProjects.forEach(f->{
-                    if (!projectTimeList.stream().anyMatch(map->(((Long)map.get("projectId"))).intValue() == f.getProjectId())) {
+                    if (!pList.stream().anyMatch(pItem->pItem.getProjectId().intValue() == f.getProjectId())) {
                         notInFPList.add(f);
                     }
                 });
@@ -1296,7 +1296,12 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
             endDate = endDate.plusMonths(1);
 
             List<Map<String, Object>> projectTimeList = reportMapper.getRealProjectTime(startDate, endDate, companyId);
-
+            for (Map<String, Object> map : projectTimeList) {
+                String p = (String) map.get("project");
+                if (p.equals("10G OLT Driver-XGs combo")) {
+                    System.out.println("找到项目 10G OLT Driver-XGs combo");
+                }
+            }
             BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
             //计算每个项目的时间和成本
             ProjectSumItem item = new ProjectSumItem();
@@ -1363,27 +1368,27 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                 BigDecimal cost = new BigDecimal(0);
                 if (first.isPresent()) {
                     cost = first.get().getHourCost().multiply(new BigDecimal(workingTime));
+                    if (curProject == null) {
+                        System.out.println("projectId="+projectId+", creatorId="+creatorId);
+                    }
+                    //改成按照projectId匹配,之前projectname可能存在重名问题。
+                    if (projectId.equals(item.projectId)) {
+                        item.workingTime += workingTime;
+                        item.cost = item.cost.add(cost);
+                    } else {
+                        item = new ProjectSumItem();
+                        pList.add(item);
+                        item.projectId = projectId;
+                        item.project = curProject;
+                        item.workingTime = workingTime;
+                        item.cost = cost;
+                    }
+                    totalMoneyCost = totalMoneyCost.add(cost);
                 } else {
                     if (!missingFinanceUserIds.contains(creatorId)) {
                         missingFinanceUserIds.add(creatorId);
                     }
-                    continue;
-                }
-                if (curProject == null) {
-                    System.out.println("projectId="+projectId+", creatorId="+creatorId);
                 }
-                if (projectId.equals(item.projectId)) {
-                    item.workingTime += workingTime;
-                    item.cost = item.cost.add(cost);
-                } else {
-                    item = new ProjectSumItem();
-                    pList.add(item);
-                    item.projectId = projectId;
-                    item.project = curProject;
-                    item.workingTime = workingTime;
-                    item.cost = cost;
-                }
-                totalMoneyCost = totalMoneyCost.add(cost);
             }
             BigDecimal bgCostTotal = new BigDecimal(0);
             for (ProjectSumItem p : pList) {
@@ -1441,7 +1446,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
 
                 List<FinanceProjects> notInFPList = new ArrayList<FinanceProjects>();
                 financeProjects.forEach(f->{
-                    if (!projectTimeList.stream().anyMatch(map->(((Long)map.get("projectId"))).intValue() == f.getProjectId())) {
+                    if (!pList.stream().anyMatch(pItem->pItem.getProjectId().intValue() == f.getProjectId())) {
                         notInFPList.add(f);
                     }
                 });

+ 6 - 20
fhKeeper/formulahousekeeper/timesheet/src/views/project/finance.vue

@@ -227,7 +227,7 @@
                     <el-radio-button label="1" >{{ $t('Apportionmentofpersonnelcosts') }}</el-radio-button>
                     <el-radio-button label="2">{{ $t('Spreadallpersonnelcosts') }}</el-radio-button>
                 </el-radio-group>
-                <span v-if="missingFinanceUserList.length > 0" style="color:red;">检测到有 <el-link @click="showMissingDialog = true">&nbsp;{{ missingFinanceUserList.length }}&nbsp;</el-link> 名已填工时人员在薪资表中无记录</span>
+                <span v-if="missingFinanceUserList.length > 0" style="color:red;">检测到有 <el-link @click="showMissingDialog = true">&nbsp;{{ missingFinanceUserList.length }}&nbsp;</el-link> 名已填工时人员在薪资表中无记录,不参与成本分摊</span>
             </el-form-item>
 
             <el-form-item style="float:right;margin-right:20px;" v-if="permissions.financialShare">
@@ -662,7 +662,6 @@ import { error } from 'dingtalk-jsapi';
                 })
             },
             chosenProjectsCheckedClick() {
-                console.log(this.chosenProjects, '数据')
                 if(this.chosenProjectsChecked) {
                     let arr = []
                     for(let i in this.allProjectList) {
@@ -898,11 +897,9 @@ import { error } from 'dingtalk-jsapi';
                             } else {
                                 this.financialFlg = false
                             }
-                            console.log(this.financialFlg, '看看返回的数据是什么')
                             //上次如果没有配置过,需要初始化
                             for (var i=0;i<this.noReportUserList.length; i++) {
                                 var rUser = this.noReportUserList[i];
-                                // console.log('userId====='+rUser.userId);
                                 //检查当前列表中的无项目人员是否在之前的里面存在,如果不在需要加上去
                                 if (this.userCostSettingList.filter(c=>c.id == rUser.userId).length == 0) {
                                     var item = {name: rUser.name, id: rUser.userId};
@@ -1054,7 +1051,6 @@ import { error } from 'dingtalk-jsapi';
             downloadByA(row) {
                 const a = document.createElement('a'); // 创建a标签
                 a.setAttribute('download', row.name);// download属性
-                // console.log(row.url);
                 if (row.url.indexOf('upload/') == -1) {
                     row.url = '/upload/' +row.url;
                 }
@@ -1124,29 +1120,14 @@ import { error } from 'dingtalk-jsapi';
                this.$forceUpdate();
             },
             showItemDialog() {
-                // console.log(this.customColsi, '后台纯的')
-                // console.log(this.customCols, '用来编辑的')
                 this.customCols = JSON.parse(JSON.stringify(this.customColsi))
-                // console.log(this.customColsi, '后台纯的')
-                // console.log(this.customCols, '用来编辑的')
                 this.itemDialog = true;
-                // this.customFieldList = {field1:null,field2:null, field3:null};
-                // if (this.customCols.field1 !== undefined) {
-                //     this.customFieldList.field1 = this.customCols.field1;
-                // } else if (this.customCols.field2 !== undefined) {
-                //     this.customFieldList.field2 = this.customCols.field2;
-                // } else if (this.customCols.field3 !== undefined) {
-                //     this.customFieldList.field3 = this.customCols.field3;
-                // }
-                
-                
             },
             //获取自定义的字段
             getCustomColumn() {
                 this.http.post('/finance-tblcuscol/getAll', {companyId: this.user.companyId},
                     res => {
                         if (res.code == "ok") {
-                            // console.log("获取自定义字段",res.data);
                             this.customColsi = res.data;
                             this.tblCols = [];
                             this.tblCols.push(this.customColsi.monthCost);
@@ -1206,6 +1187,11 @@ import { error } from 'dingtalk-jsapi';
                         // console.log(res.data, '图表数据', this.widthHtval)
 
                         var xList = [], yList = [], list = res.data.costList, totalMoneyCost = res.data.totalMoneyCost;
+                        //计算costList合计的成本
+                        var totalC = 0;
+                        for (var i=0;i<list.length; i++) {
+                            totalC += list[i].cost;
+                        }
                         this.missingFinanceUserList = res.data.missingFinanceUserList;
                         var nopCost = 0;
                         if (res.data.noProjectItem.project != null) {