소스 검색

Merge remote-tracking branch 'origin/master'

yurk 2 년 전
부모
커밋
9aa0c6258d

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

@@ -400,6 +400,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
             List<Map<String, Object>> list = departmentMapper
                     .getCostByUser(null, startDate, endDate, companyId, allUserIds);
             Map<String, List<Map<String, Object>>> tempMap = new HashMap<>();
+            List<String> names = new ArrayList<>();
             BigDecimal totalCostMoney = new BigDecimal(0);
             for (Map<String, Object> map : list) {
                 if (tempMap.containsKey(map.get("user"))) {
@@ -414,6 +415,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
                     dataMap.put("time", time);
                     tempList.add(dataMap);
                 } else {
+                    names.add((String)map.get("user"));
                     //这个名字尚未装进数组中
                     List<Map<String, Object>> tempList = new ArrayList<>();
                     if (map.containsKey("project")) {
@@ -438,7 +440,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
             dataList.add(titleList);
             BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
             double totalCostTime = 0;
-            for (String key : tempMap.keySet()) {
+            for (String key : names) {
                 Map<String, Object> map = new HashMap<>();
                 map.put("name", key);
                 map.put("project", tempMap.get(key));
@@ -652,14 +654,23 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
             Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
             User user = userMapper.selectById(request.getHeader("TOKEN"));
             List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全公司工时");
+            boolean hasDeptWorktimePriv = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看本部门工时").size() > 0;
             List<Integer> deptIds = null;
             if (functionList.size() == 0) {
                 deptIds = new ArrayList<>();
                 deptIds.add(-1);
-                if (user.getManageDeptId() != 0) {
+                if (hasDeptWorktimePriv || (user.getManageDeptId() != null && user.getManageDeptId() != 0)) {
                     //有负责的部门
                     List<Department> myDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", user.getId()));
                     List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
+                    if (hasDeptWorktimePriv && user.getDepartmentId() != null) {
+                        Department ownerDept = departmentMapper.selectById(user.getDepartmentId());
+                        //要加上自己的部门,如果没有的话
+                        if (!myDeptList.stream().anyMatch(d->d.getDepartmentId().equals(ownerDept.getDepartmentId()))) {
+                            myDeptList.add(ownerDept);
+                        }
+                    }
+
                     for (Department dept: myDeptList) {
                         deptIds.add(dept.getDepartmentId());
                         deptIds.addAll(getBranchDepartment(dept.getDepartmentId(), allDeptList));

+ 29 - 12
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -207,9 +207,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     map.put("cost", total);
                     map.put("state", state);
                 }
-
-                //部门经理需要看本部门的所有人员的日报
-                if (user.getManageDeptId() != null &&  user.getManageDeptId() > 0) {
+                boolean hasDeptWorktimePriv = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看本部门工时").size() > 0;
+                //需要看本部门的所有人员的日报
+                if (hasDeptWorktimePriv || (user.getManageDeptId() != null &&  user.getManageDeptId() > 0)) {
                     //找到该部门的所有子部门
                     List<Department> allDepts = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
                     //查找当前部门经理负责的部门
@@ -218,7 +218,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                         queryDeptList = allDepts.stream().filter(dp->dp.getDepartmentId().equals(deptId)).collect(Collectors.toList());
                     } else {
                         queryDeptList = allDepts.stream().filter(
-                                dp -> user.getId().equals(dp.getManagerId())).collect(Collectors.toList());
+                                dp -> user.getId().equals(dp.getManagerId()) || (hasDeptWorktimePriv && dp.getDepartmentId().equals(user.getDepartmentId()))).collect(Collectors.toList());
                     }
 
                     if (queryDeptList.size() > 0) {
@@ -231,7 +231,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
 
                         List ids = deptList.stream().map(Department::getDepartmentId).collect(Collectors.toList());
                         nameList = reportMapper.getReportNameByDateAndDept(date,
-                                ids, null, null);
+                                ids, targetUid, null);
 
                         if (nameList.size() > 0) {
                             List<String> userIds = new ArrayList<>();
@@ -1479,6 +1479,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         HttpRespMsg departmentList = departmentService.getDepartmentList(request);
         List<DepartmentVO> list = (List<DepartmentVO>) departmentList.data;
         List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(curUser.getRoleId(), "查看全公司工时");
+        boolean hasDeptWorktimePriv = sysFunctionMapper.getRoleFunctions(curUser.getRoleId(), "查看本部门工时").size() > 0;
         if (functionList.size() > 0) {
             //查看全部的
             //加上未分配的部门
@@ -1486,9 +1487,20 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             unAssignedDept.setId(0);
             unAssignedDept.setLabel("未分配");
             list.add(unAssignedDept);
-        } else if (manageDeptId != null && manageDeptId > 0) {
+        } else if (hasDeptWorktimePriv || (manageDeptId != null && manageDeptId > 0)) {
             //指定查看某个部门下的,一个人可能负责多个部门
             List<Department> allMDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", token));
+            if (hasDeptWorktimePriv && curUser.getDepartmentId() != null) {
+                Department ownerDept = departmentMapper.selectById(curUser.getDepartmentId());
+                //要加上自己的部门,如果没有的话
+                if (!allMDeptList.stream().anyMatch(d->d.getDepartmentId().equals(ownerDept.getDepartmentId()))) {
+                    allMDeptList.add(ownerDept);
+                }
+                if (manageDeptId == null || manageDeptId == 0) {
+                    manageDeptId = curUser.getDepartmentId();
+                }
+            }
+
             if (allMDeptList.size() == 1) {
                 list = getSpecifiedDept(list, manageDeptId);
             } else {
@@ -1514,6 +1526,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             
             if (first.isPresent()) {
                 user.put("state", first.get().get("state"));
+                user.put("workingTime", first.get().get("workingTime"));
             }
             userMapList.add(user);
         }
@@ -2085,10 +2098,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         //分角色权限:管理员看全部的,部门负责人看自己部门的,个人只能看自己的。
         List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全公司工时");
         if (functionList.size() == 0) {
+            boolean hasDeptWorktimePriv = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看本部门工时").size() > 0;
             //检查是不是部门负责人
-            if (user.getManageDeptId() != null && user.getManageDeptId() != 0) {
+            if (hasDeptWorktimePriv || (user.getManageDeptId() != null && user.getManageDeptId() != 0)) {
                 List<Department> allDepts = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
-                List<Department> myDeptList = allDepts.stream().filter(d->user.getId().equals(d.getManagerId())).collect(Collectors.toList());
+                List<Department> myDeptList = allDepts.stream().filter(d->user.getId().equals(d.getManagerId()) || (hasDeptWorktimePriv && d.getDepartmentId().equals(user.getDepartmentId()))).collect(Collectors.toList());
                 List<Department> subDepts = new ArrayList<>();
                 for (Department dp : myDeptList) {
                     subDepts.addAll(getSubDepts(dp, allDepts));
@@ -2699,11 +2713,13 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             int rowNum = 1;
             List<HashMap<String, Object>> allReportByDate = null;
             List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全公司工时");
+            boolean hasDeptWorktimePriv = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看本部门工时").size() > 0;
+
             if (functionList.size() == 0) {
                 //检查是否是部门负责人
-                if (user.getManageDeptId() > 0) {
+                if (hasDeptWorktimePriv || (user.getManageDeptId() != null && user.getManageDeptId() > 0)) {
                     List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
-                    List<Department> deptList = allDeptList.stream().filter(dept->user.getId().equals(dept.getManagerId())).collect(Collectors.toList());
+                    List<Department> deptList = allDeptList.stream().filter(dept->user.getId().equals(dept.getManagerId())|| (hasDeptWorktimePriv && dept.getDepartmentId().equals(user.getDepartmentId()))).collect(Collectors.toList());
                     List<Department> allSubDepts = new ArrayList<>();
                     allSubDepts.addAll(deptList);
                     for (Department dept: deptList) {
@@ -3061,11 +3077,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         List<Map<String, Object>> list = null;
         //分角色权限:管理员看全部的,部门负责人看自己部门的,个人只能看自己的。
         List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全公司工时");
+        boolean hasDeptWorktimePriv = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看本部门工时").size() > 0;
         if (functionList.size() == 0) {
             //检查是不是部门负责人
-            if (user.getManageDeptId() != null && user.getManageDeptId() != 0) {
+            if (hasDeptWorktimePriv || (user.getManageDeptId() != null && user.getManageDeptId() != 0)) {
                 List<Department> allDepts = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
-                List<Department> myDeptList = allDepts.stream().filter(d->user.getId().equals(d.getManagerId())).collect(Collectors.toList());
+                List<Department> myDeptList = allDepts.stream().filter(d->user.getId().equals(d.getManagerId())|| (hasDeptWorktimePriv && d.getDepartmentId().equals(user.getDepartmentId()))).collect(Collectors.toList());
                 List<Department> subDepts = new ArrayList<>();
                 for (Department dp : myDeptList) {
                     subDepts.addAll(getSubDepts(dp, allDepts));

+ 106 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/application-mld.yml

@@ -0,0 +1,106 @@
+# 重庆美莱德服务器配置
+server:
+  port: 10010
+  tomcat:
+    uri-encoding: utf-8
+    max-http-form-post-size: -1
+    connection-timeout: 18000000s
+spring:
+  servlet:
+    multipart:
+      # 配置上传文件的大小设置
+      # Single file max size  即单个文件大小
+      max-file-size: 100MB
+      max-request-size: 100MB
+  datasource:
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    url: jdbc:mysql://10.1.10.33:3306/man_mld?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
+    username: root
+    password: Mld2022@#
+    hikari:
+      maximum-pool-size: 10
+      minimum-idle: 3
+      max-lifetime: 30000
+      connection-test-query: SELECT 1
+    #######redis配置######
+    # redis
+    redis:
+      host: 127.0.0.1
+      port: 6379
+      timeout: 3
+      # password:
+      pool:
+        minIdle: 1
+        maxIdle: 10
+        maxWait: 3
+        maxActive: 8
+    ####全局配置时间返回格式#####
+  jackson:
+    #参数意义:
+    #JsonInclude.Include.ALWAYS       默认
+    #JsonInclude.Include.NON_DEFAULT   属性为默认值不序列化
+    #JsonInclude.Include.NON_EMPTY     属性为 空(””) 或者为 NULL 都不序列化
+    #JsonInclude.Include.NON_NULL      属性为NULL  不序列化
+    default-property-inclusion: ALWAYS
+    time-zone: GMT+8
+    date-format: yyyy-MM-dd HH:mm:ss
+
+##########日志配置
+logging:
+  level:
+    root: info
+    org.mybatis: error
+    java.sql: error
+    org.springframework.web: error
+    #打印sql语句
+    com.management.platform.mapper: error
+  path: /log/
+  file: worktime.log
+##########
+mybatis-plus:
+  #  mapper-locations: classpath:mapper/*/*.xml
+  #  #实体扫描,多个package用逗号或者分号分隔
+  #  typeAliasesPackage: com.hssx.cloudmodel
+  global-config:
+    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+    id-type: 0
+    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+    field-strategy: 2
+    db-column-underline: true
+    refresh-mapper:
+    #################插入和更新非null判断
+    db-config:
+      insert-strategy: not_null
+      update-strategy: not_null
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+######mybstis配置#######
+mybatis:
+  type-aliases-package: com.management.platform.entity
+  mapper-locations: mappers/*Mapper.xml
+#####配置图片上传路径####
+upload:
+  path: /www/staticproject/timesheet/upload/
+
+
+
+
+
+##actuator健康检查配置
+management:
+  security:
+    enabled:false:
+  server:
+    port: 10011
+  #  endpoints:
+  #    web:
+  #      exposure:
+  #        include: "*"
+
+  health:
+    redis:
+      enabled: false
+
+configEnv:
+  isDev: false

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

@@ -58,7 +58,7 @@
         <if test="startDate != null and endDate != null">
             AND b.create_date between #{startDate} and #{endDate}
         </if>
-        GROUP BY b.project_id, a.id
+        GROUP BY b.project_id, a.id order by a.department_id
     </select>
 
     <!-- 根据人员获取自定义的日报数值 -->

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -368,7 +368,7 @@
 
     <!--根据日期获取报告上传人-->
     <select id="getReportNameByDate" resultType="java.util.Map">
-        SELECT DISTINCT b.id, b.name, a.state, a.department_audit_state as departmentAuditState
+        SELECT DISTINCT b.id, b.name, a.state, a.department_audit_state as departmentAuditState, IFNULL(sum(a.working_time),0) as workingTime
         FROM report AS a
         JOIN user AS b ON a.creator_id=b.id
         left join project on project.id = a.project_id
@@ -382,6 +382,7 @@
         <if test="leaderId != null and leaderId != ''">
             AND (a.project_auditor_id = #{leaderId} or project.incharger_id = #{leaderId})
         </if>
+        group by a.creator_id
     </select>
 
     <!--根据日期,部门,指定人员获取报告上传人-->

+ 2 - 0
fhKeeper/formulahousekeeper/timesheet/src/permissions.js

@@ -28,6 +28,7 @@ const StringUtil = {
         reportsFillOut: false, // 代填日报 //
         reportsDeleteAll: false, // 删除全公司日报
         importReport: false, //导入工时lij
+        reportsDept: false, //查看本部门工时
 
         // 财务核算成本 
         financialCustom: false, // 自定义薪资项 // 
@@ -95,6 +96,7 @@ const StringUtil = {
         arr[i] == '导出人员' ? obj.structureExport = true : ''
         arr[i] == '导入人员' ? obj.structureImport = true : ''
         arr[i] == '查看全公司工时' ? obj.reportsCompany = true : ''
+        arr[i] == '查看本部门工时' ? obj.reportsDept = true : ''
         arr[i] == '查看相关人员工时' ? obj.reportsPersonnel = true : ''
         arr[i] == '代填日报' ? obj.reportsFillOut = true : ''
         arr[i] == '自定义薪资项' ? obj.financialCustom = true : ''

+ 10 - 5
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -257,8 +257,8 @@
                     <el-cascader v-model="insertForm.departmentId" placeholder="请选择部门" style="width: 100%"
                     :options="option" :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false"  clearable></el-cascader>
                 </el-form-item>
-                <el-form-item label="直属上">
-                    <el-select v-model="insertForm.superiorId" placeholder="请选择角色" style="width: 100%">
+                <el-form-item label="直属上">
+                    <el-select v-model="insertForm.superiorId" placeholder="请选择角色" style="width: 100%" filterable>
                         <el-option v-for="item in users" :label="item.name" :value="item.id" :key="item.id">
                             <span style="float: left">{{item.name}}</span>
                             <span style="float: right; color: #8492a6; font-size: 13px">{{item.departmentName}}</span>
@@ -275,7 +275,7 @@
                 </el-form-item>
                 <el-form-item :label="item.name" v-for="item,index in userCustomConfig" :key="item.id">
                     <el-select v-if="item.type == 0" v-model="insertForm[suoying[index]]" placeholder="请选择" clearable style="width: 100%">
-                        <el-option v-for="option in item.itemList" :label="option.name" :value="option.id" :key="option.id">
+                        <el-option v-for="option in item.itemList" :label="option.name" :value="option.name" :key="option.id">
                         </el-option>
                     </el-select>
                     <el-input v-else v-model="insertForm[suoying[index]]" placeholder="请输入" clearable></el-input>
@@ -794,7 +794,8 @@
                 // jsonStr = jsonStr.substring(0,jsonStr.length - 1)
                 // let jsonStr = []
                 for(let i in this.customConfigList){
-                    if(!this.customConfigList[i].name){
+                    let text = this.customConfigList[i].name.trim()
+                    if(!text){
                         this.customConfigList.splice(i,1)
                     }
                 }
@@ -922,7 +923,7 @@
                         this.userCustomConfig = JSON.parse(JSON.stringify(res.data))
                         for(let i in this.userCustomConfig){
                             if(this.userCustomConfig[i].type == 0){
-                                if(this.insertForm[this.suoying[i]]){this.insertForm[this.suoying[i]] = this.insertForm[this.suoying[i]]*1}
+                                
                                 this.http.post('/sub-user-custom/list',{
                                     userCustomId: this.userCustomConfig[i].id
                                 },res => {
@@ -1537,6 +1538,7 @@
                                 position: res.data.position,
                                 certJson: res.data.certList,
                                 plateMap: {},
+                                superiorId: res.data.superiorId,
                                 plate1: res.data.plate1,
                                 plate2: res.data.plate2,
                                 plate3: res.data.plate3,
@@ -1649,6 +1651,9 @@
                         if (this.insertForm.id != null) {
                             form.id = this.insertForm.id;
                         }
+                        if (this.insertForm.superiorId){
+                            form.superiorId = this.insertForm.superiorId
+                        }
                         if (this.insertForm.costApplyDate != null) {
                             form.costApplyDate = this.insertForm.costApplyDate;
                         }

+ 3 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -34,7 +34,7 @@
                 </div>
                 </div>
                 <div style="display:flex;">
-                <div v-if="permissions.reportsCompany || user.manageDeptId != 0" :style="'overflow-x:hidden;overflow-y:auto;height:' + tableHeight + 'px;'">
+                <div v-if="permissions.reportsCompany || user.manageDeptId != 0 || permissions.reportsDept" :style="'overflow-x:hidden;overflow-y:auto;height:' + tableHeight + 'px;'">
                     <div style="width:205px;">
                         <el-select v-model="selectState" size="small" @change="stateChange" >
                         <el-option value="-1" label="全部状态" >全部状态</el-option>
@@ -77,7 +77,7 @@
                     <div class="report_title" >
                         
                         <span>工作日报 </span>
-                        <span v-if="permissions.reportsCompany||user.manageDeptId != 0">| {{depData != null ?depData.label:""}}
+                        <span v-if="permissions.reportsCompany||user.manageDeptId != 0 || permissions.reportsDept">| {{depData != null ?depData.label:""}}
                         <span v-if="targetUid == null">
                          - 已填写
                         <el-link :underline="false" @click="showMembList(1)"><span style="margin-left:5px;margin-right:5px;color:green;">{{reportList.length}}</span></el-link>人,
@@ -3059,7 +3059,7 @@
             getDepartment() {
                 let day = (this.choseDay+1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
                 var param = {date:this.date + day};
-                if (this.user.manageDeptId != 0 && !this.permissions.reportsCompany) {
+                if (this.user.manageDeptId != 0 && !this.permissions.reportsCompany && !this.permissions.reportsDept) {
                     param.manageDeptId = this.user.manageDeptId; 
                 }
                 this.http.post("/report/getMembList", param,

+ 10 - 3
fhKeeper/formulahousekeeper/timesheet_h5/public/index.html

@@ -35,10 +35,17 @@
             }
             return flag;
         }
+        var urls = window.location.href
+        console.log(urls, '当前的页面地址')
         var flag = IsPC(); //true为PC端,false为手机端
-        if (flag) {
-            //跳转到PC登录页面
-            location.href = 'https://worktime.ttkuaiban.com';
+        // if (flag && urls.indexOf('mobworktime.ttkuaiban') != '-1') {
+        if(flag) {
+            // 当前地址为工时管家移动端就跳转到工时管家官网
+            if(urls.indexOf('mobworktime.ttkuaiban') != '-1') {
+                location.href = 'https://worktime.ttkuaiban.com';
+            } else {
+                location.href = 'http://183.66.166.222:9097/';
+            }
         }
     </script>
 </head>