فهرست منبع

判断权限进行遍历替换,有查看日报,查看填报情况,导出日报等地方,工时报告模块涉及到工时数显示的地方都改成 * 显示

yusm 2 هفته پیش
والد
کامیت
54cf7429d2

+ 11 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -112,6 +112,8 @@ public class ReportController {
     private UserCustomMapper userCustomMapper;
     @Resource
     private UserGroupMapper userGroupMapper;
+    @Resource
+    private SysRoleFunctionService sysRoleFunctionService;
 
     @Resource
     private FinancialAuditMapper financialAuditMapper;
@@ -3217,8 +3219,16 @@ public class ReportController {
         LocalDate firstDay = LocalDate.parse(date + "-01");
         LocalDate lastDay = firstDay.with(TemporalAdjusters.lastDayOfMonth());
         User user = userMapper.selectById(request.getHeader("TOKEN"));
+        Integer hideTimeCount= sysRoleFunctionService.selectHideTimeCount(user.getRoleId());
         HttpRespMsg msg = new HttpRespMsg();
-        msg.setData(reportService.getReportTimeLessThanCardTimeList(firstDay, lastDay, deptId, userId, user.getCompanyId(), false));
+        List<Map<String, Object>> mapList = reportService.getReportTimeLessThanCardTimeList(firstDay, lastDay, deptId, userId, user.getCompanyId(), false);
+        if (!mapList.isEmpty()&&hideTimeCount>0){
+            mapList.forEach(m->{
+                m.put("reportTime","*");
+                m.put("workHours","*");
+            });
+        }
+        msg.setData(mapList);
         return msg;
     }
 

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/SysRoleFunctionMapper.java

@@ -15,4 +15,6 @@ import java.util.List;
  */
 public interface SysRoleFunctionMapper extends BaseMapper<SysRoleFunction> {
     public List<SysRoleFunction> getRoleFunctionNames(Integer roleId);
+
+    Integer selectHideTimeCount(Integer roleId);
 }

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

@@ -13,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface SysRoleFunctionService extends IService<SysRoleFunction> {
 
+    Integer selectHideTimeCount(Integer roleId);
 }

+ 47 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -246,6 +246,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     private BustripProjectMapper bustripProjectMapper;
     @Resource
     private CompanyDingdingMapper companyDingdingMapper;
+    @Resource
+    private SysRoleFunctionService sysRoleFunctionService;
 
 
     //获取报告列表
@@ -262,6 +264,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             //首先根据日期获取当天所有提交过日志的人
             String userId = request.getHeader("Token");
             User user = userMapper.selectById(userId);
+            Integer hideTimeCount= sysRoleFunctionService.selectHideTimeCount(user.getRoleId());
             String viewUserId = user.getId();
             Integer companyId = user.getCompanyId();
             TimeType timeType = timeTypeMapper.selectById(companyId);
@@ -578,6 +581,22 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     }
                 }
             }
+            if (hideTimeCount>0){
+                for (Map<String, Object> map : nameList) {
+                    if (map.get("state").equals(1)){
+                        map.put("cardTime","*");
+                        map.put("reportTime","*");
+                        List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
+                        for (Map<String, Object> reportMap : reportList) {
+                            reportMap.put("endTime","");
+                            reportMap.put("customText","*");
+                            reportMap.put("startTime","");
+                            reportMap.put("time","*");
+                            reportMap.put("overtimeHours","*");
+                        }
+                    }
+                }
+            }
 
             if (pageStart == null) {
                 //老版本,不带分页的情况
@@ -5127,6 +5146,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     public HttpRespMsg getUserDailyWorkTime(HttpServletRequest request, String startDate, String endDate,Integer hasReportDeptId) throws Exception {
         String token = request.getHeader("TOKEN");
         User user = userMapper.selectById(token);
+        Integer hideTimeCount= sysRoleFunctionService.selectHideTimeCount(user.getRoleId());
         Integer companyId = user.getCompanyId();
         Company company = companyMapper.selectById(companyId);
         //准备部门数据
@@ -5399,6 +5419,18 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             days.add(mapItem);
         }
         map.put("days", days);
+        if (hideTimeCount>0){
+            for (UserMonthWork work : userMonthWorks) {
+                List<Map<String, Object>> worktimeList = work.worktimeList;
+                if (!worktimeList.isEmpty()){
+                    worktimeList.forEach(w->{
+                        if (w.get("state")!=null&&w.get("state").equals(1)){
+                            w.put("workingTime","*");
+                        }
+                    });
+                }
+            }
+        }
         map.put("list", userMonthWorks);
         msg.data = map;
         return msg;
@@ -6376,6 +6408,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         try {
             String userId = request.getHeader("Token");
             User user = userMapper.selectById(userId);
+            Integer hideTimeCount= sysRoleFunctionService.selectHideTimeCount(user.getRoleId());
             //检查模式,是否是一个项目多个工作事项的情况
             TimeType timeType = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", user.getCompanyId()));
             Company company = companyMapper.selectById(user.getCompanyId());
@@ -6804,7 +6837,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                         item.add((String) map.get("detail"));
                     }
                 }
-                item.add(map.get("duration").toString());
+                if (hideTimeCount>0){
+                    item.add("*");
+                }else {
+                    item.add(map.get("duration").toString());
+                }
+
                 if (timeType.getMultiWorktime() == 1) {
                     if ((Integer)map.get("multiWorktime") == 1) {
                         item.add(map.get("startTime").toString()+"-"+map.get("endTime").toString());
@@ -6813,11 +6851,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     }
                     //加班情况
                     int isOverTime = (Integer) map.get("isOvertime");
-                    item.add(isOverTime==1?(df.format((double)map.get("overtimeHours"))):"-");
+                    item.add(isOverTime==1?(hideTimeCount>0?"*":df.format((double)map.get("overtimeHours"))):"-");
                 }
                 if (timeType.getMultiWorktime() == 0) {
                     int isOverTime = (Integer) map.get("isOvertime");
-                    item.add(isOverTime==1?(df.format((double)map.get("overtimeHours"))):"-");
+                    item.add(isOverTime==1?(hideTimeCount>0?"*":df.format((double)map.get("overtimeHours"))):"-");
                 }
                 //是否启用自定义的维度了
                 if (timeType.getCustomDegreeActive() == 1) {
@@ -7027,7 +7065,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                             }
                         }
                     }
-                    item.add(cellValue);
+                    if (hideTimeCount>0){
+                        item.add("*");
+                    }else {
+                        item.add(cellValue);
+                    }
+
                 }
                 //审核流程状态
                 if (exportType==0) {

+ 9 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/SysRoleFunctionServiceImpl.java

@@ -4,8 +4,11 @@ import com.management.platform.entity.SysRoleFunction;
 import com.management.platform.mapper.SysRoleFunctionMapper;
 import com.management.platform.service.SysRoleFunctionService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+
 /**
  * <p>
  * 角色菜单关联表 服务实现类
@@ -16,5 +19,11 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class SysRoleFunctionServiceImpl extends ServiceImpl<SysRoleFunctionMapper, SysRoleFunction> implements SysRoleFunctionService {
+    @Resource
+    private SysRoleFunctionMapper sysRoleFunctionMapper;
 
+    @Override
+    public Integer selectHideTimeCount(Integer roleId) {
+        return sysRoleFunctionMapper.selectHideTimeCount(roleId);
+    }
 }

+ 5 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/SysRoleFunctionMapper.xml

@@ -23,4 +23,9 @@
         left join sys_function on sys_function.id = sys_role_function.function_id
         where role_id = #{roleId}
     </select>
+    <select id="selectHideTimeCount" resultType="java.lang.Integer">
+        select count(*) total from sys_role_function
+        left join sys_function on sys_function.id = sys_role_function.function_id
+        where role_id = #{roleId} and sys_function.name='隐藏工时数'
+    </select>
 </mapper>

+ 1 - 1
fhKeeper/formulahousekeeper/ops-platform/src/main/resources/application.yml

@@ -14,7 +14,7 @@ spring:
       location: C:/upload/
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://1.94.62.58:17089/man_dev?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
+    url: jdbc:mysql://1.94.62.58:17089/man_dev?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&useSSL=false
     username: root
     password: P011430@Huoshi*
     hikari: