Browse Source

财务核算成本模块显示信息优化

seyason 1 year ago
parent
commit
235d2bd7fb

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java

@@ -598,8 +598,8 @@ public class ProjectController {
      * @param projectId 项目id, 可不传
      */
     @RequestMapping("/getDegreeCost")
-    public HttpRespMsg getDegreeCost(String startDate, String endDate, Integer projectId) {
-        return projectService.getDegreeCost(startDate, endDate, projectId, request);
+    public HttpRespMsg getDegreeCost(String startDate, String endDate, Integer projectId,String userId) {
+        return projectService.getDegreeCost(startDate, endDate, projectId, userId,request);
     }
 
     //导出自定义维度的工时成本

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ProjectMapper.java

@@ -79,7 +79,7 @@ public interface ProjectMapper extends BaseMapper<Project> {
 
 //    List<Map<String, Object>> getOvertimeList(String userId, Integer companyId, String startDate, String endDate, Integer projectId);
 
-    List<Map<String, Object>> getDegreeCost(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectId") Integer projectId, @Param("companyId") Integer companyId,List<Integer> departmentIds);
+    List<Map<String, Object>> getDegreeCost(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectId") Integer projectId,@Param("userId") String userId, @Param("companyId") Integer companyId,List<Integer> departmentIds);
 
     //获取导出的项目数据
     List<HashMap<String, Object>> getExportData(Integer companyId, String userId);

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ProjectService.java

@@ -119,7 +119,7 @@ public interface ProjectService extends IService<Project> {
 
     HttpRespMsg exportOvertimeList(OvertimeListVO overtimeListVO, HttpServletRequest request);
 
-    HttpRespMsg getDegreeCost(String startDate, String endDate, Integer projectId, HttpServletRequest request);
+    HttpRespMsg getDegreeCost(String startDate, String endDate, Integer projectId, String userId,HttpServletRequest request);
 
     HttpRespMsg exportData(String keyword,
                            @RequestParam(required = false, defaultValue = "1") Integer searchField,

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -5646,7 +5646,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     }
 
     @Override
-    public HttpRespMsg getDegreeCost(String startDate, String endDate, Integer projectId, HttpServletRequest request) {
+    public HttpRespMsg getDegreeCost(String startDate, String endDate, Integer projectId,String userId, HttpServletRequest request) {
         HttpRespMsg msg = new HttpRespMsg();
         String token = request.getHeader("TOKEN");
         User user = userMapper.selectById(token);
@@ -5675,7 +5675,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 }
             }
         }
-        msg.data = projectMapper.getDegreeCost(startDate, endDate, projectId, user.getCompanyId(),deptIds);
+        msg.data = projectMapper.getDegreeCost(startDate, endDate, projectId,userId, user.getCompanyId(),deptIds);
         return msg;
     }
 

+ 17 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml

@@ -879,6 +879,9 @@
         <if test="projectId != null">
             and a.project_id = #{projectId}
         </if>
+        <if test="userId != null and userId!=''">
+            and a.creator_id = #{userId}
+        </if>
         <if test="startDate != null and endDate != null">
             AND a.create_date between #{startDate} and #{endDate}
         </if>
@@ -1658,7 +1661,20 @@
             WHERE report.state = 1
             AND p.is_public = 0
             AND report.company_id=#{companyId}
-            AND report.create_date BETWEEN #{startDate} AND #{endDate}
+            AND
+            (
+            IF(user.induction_date is not null AND user.induction_date &gt; #{startDate} and user.inactive_date is not null AND user.inactive_date &lt; #{endDate}
+            ,report.create_date BETWEEN user.induction_date AND user.inactive_date
+            ,report.create_date BETWEEN #{startDate} AND #{endDate} )
+            and
+            IF(user.induction_date is not null AND user.induction_date &gt; #{startDate}
+            ,report.create_date BETWEEN user.induction_date AND #{endDate}
+            ,report.create_date BETWEEN #{startDate} AND #{endDate} )
+            and
+            IF(user.inactive_date is not null AND user.inactive_date &lt; #{endDate}
+            ,report.create_date BETWEEN #{startDate} AND user.inactive_date
+            ,report.create_date BETWEEN #{startDate} AND #{endDate} )
+            )
             GROUP BY user.id,p.id,user.plate1,p.project_name,p.project_code
         ) r
         ON u.id = r.creator_id

+ 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) {