1.添加权限的尝试
This commit is contained in:
parent
f9e2dd0ce7
commit
45ecb4c3ee
|
|
@ -19,6 +19,12 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-beanutils</groupId>
|
||||||
|
<artifactId>commons-beanutils</artifactId>
|
||||||
|
<version>1.9.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!--加密依赖包-->
|
<!--加密依赖包-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.ulisesbocchio</groupId>
|
<groupId>com.github.ulisesbocchio</groupId>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.bonus.bmw.controller;
|
||||||
|
|
||||||
import com.bonus.bmw.domain.vo.*;
|
import com.bonus.bmw.domain.vo.*;
|
||||||
import com.bonus.bmw.service.BmWorkerAttService;
|
import com.bonus.bmw.service.BmWorkerAttService;
|
||||||
import com.bonus.bmw.service.BmWorkerAttService;
|
|
||||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.page.TableDataInfo;
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
|
|
@ -20,9 +19,13 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.bonus.bmw.utils.OwnPermissionUtil.dealWithPermission;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考勤统计
|
* 考勤统计
|
||||||
*
|
*
|
||||||
|
|
@ -48,6 +51,12 @@ public class BmWorkerAttController extends BaseController {
|
||||||
@SysLog(title = "考勤统计", businessType = OperaType.QUERY, logType = 0, module = "施工人员->考勤管理->考勤统计", details = "分公司考勤统计")
|
@SysLog(title = "考勤统计", businessType = OperaType.QUERY, logType = 0, module = "施工人员->考勤管理->考勤统计", details = "分公司考勤统计")
|
||||||
public TableDataInfo getSubComAttList(BmWorkerAtt o) {
|
public TableDataInfo getSubComAttList(BmWorkerAtt o) {
|
||||||
try {
|
try {
|
||||||
|
Map<String,Integer> map= dealWithPermission();
|
||||||
|
if(!map.isEmpty()){
|
||||||
|
// 3. 将 map 中的值复制到 o 对象中
|
||||||
|
// 一行代码搞定!自动将 map 的 key 匹配到 bean 的属性并赋值
|
||||||
|
org.apache.commons.beanutils.BeanUtils.populate(o, map);
|
||||||
|
}
|
||||||
startPage();
|
startPage();
|
||||||
List<BmWorkerAtt> list = service.getSubComAttList(o);
|
List<BmWorkerAtt> list = service.getSubComAttList(o);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -57,7 +66,6 @@ public class BmWorkerAttController extends BaseController {
|
||||||
return getDataTableError(new ArrayList<>());
|
return getDataTableError(new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询列表-工程
|
* 查询列表-工程
|
||||||
* @param o
|
* @param o
|
||||||
|
|
@ -68,6 +76,11 @@ public class BmWorkerAttController extends BaseController {
|
||||||
@SysLog(title = "工程考勤统计", businessType = OperaType.QUERY, logType = 0, module = "施工人员->考勤管理->考勤统计", details = "工程考勤统计")
|
@SysLog(title = "工程考勤统计", businessType = OperaType.QUERY, logType = 0, module = "施工人员->考勤管理->考勤统计", details = "工程考勤统计")
|
||||||
public TableDataInfo getProAttList(BmWorkerAtt o) {
|
public TableDataInfo getProAttList(BmWorkerAtt o) {
|
||||||
try {
|
try {
|
||||||
|
Map<String,Integer> map=dealWithPermission();
|
||||||
|
if(!map.isEmpty()){
|
||||||
|
// 3. 将 map 中的值复制到 o 对象中
|
||||||
|
BeanUtils.copyProperties(map, o);
|
||||||
|
}
|
||||||
startPage();
|
startPage();
|
||||||
List<BmWorkerAtt> list = service.getProAttList(o);
|
List<BmWorkerAtt> list = service.getProAttList(o);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -161,6 +174,11 @@ public class BmWorkerAttController extends BaseController {
|
||||||
@SysLog(title = "考勤导出-工程维度", businessType = OperaType.EXPORT, logType = 0, module = "施工人员->红绿灯管理->合同管理", details = "考勤导出-工程维度")
|
@SysLog(title = "考勤导出-工程维度", businessType = OperaType.EXPORT, logType = 0, module = "施工人员->红绿灯管理->合同管理", details = "考勤导出-工程维度")
|
||||||
public void attExportByPro(HttpServletResponse response, BmWorkerAtt o) {
|
public void attExportByPro(HttpServletResponse response, BmWorkerAtt o) {
|
||||||
try {
|
try {
|
||||||
|
Map<String,Integer> map=dealWithPermission();
|
||||||
|
if(!map.isEmpty()){
|
||||||
|
// 3. 将 map 中的值复制到 o 对象中
|
||||||
|
BeanUtils.copyProperties(map, o);
|
||||||
|
}
|
||||||
List<BmWorkerAtt> list = service.getProAttList(o);
|
List<BmWorkerAtt> list = service.getProAttList(o);
|
||||||
List<BmWorkerAttProExport> exportList = list.stream()
|
List<BmWorkerAttProExport> exportList = list.stream()
|
||||||
.map(worker -> {
|
.map(worker -> {
|
||||||
|
|
|
||||||
|
|
@ -169,4 +169,6 @@ public class BmWorkerAtt {
|
||||||
*/
|
*/
|
||||||
private Integer teamEinStatus;
|
private Integer teamEinStatus;
|
||||||
|
|
||||||
|
private Integer orgId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -124,7 +124,7 @@ public class BmWorkerAttServiceImpl implements BmWorkerAttService {
|
||||||
@Override
|
@Override
|
||||||
public List<BmWorkerAtt> getWorkerAttList(BmWorkerAtt o) {
|
public List<BmWorkerAtt> getWorkerAttList(BmWorkerAtt o) {
|
||||||
//1.查询 工程 班组 时间区间 姓名 身份证号码
|
//1.查询 工程 班组 时间区间 姓名 身份证号码
|
||||||
//根据区间产讯处最新的人员基础数据
|
//根据区间查询最新的人员基础数据
|
||||||
List<BmWorkerAtt> list = mapper.getWorkerEinMsgListByDateRange(o);
|
List<BmWorkerAtt> list = mapper.getWorkerEinMsgListByDateRange(o);
|
||||||
//查询考勤天数 根据 时间区间 工程 班组 查询
|
//查询考勤天数 根据 时间区间 工程 班组 查询
|
||||||
List<BmWorkerAtt> listAtt = mapper.getWorkerAttDayNumByDateRange(o);
|
List<BmWorkerAtt> listAtt = mapper.getWorkerAttDayNumByDateRange(o);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.bonus.bmw.utils;
|
||||||
|
|
||||||
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
import com.bonus.system.api.domain.SysUser;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class OwnPermissionUtil {
|
||||||
|
|
||||||
|
public static Map<String, Integer> dealWithPermission() {
|
||||||
|
Map<String,Integer> map=new HashMap<>();
|
||||||
|
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
|
||||||
|
if("公司级".equals(sysUser.getRoleLevel())){
|
||||||
|
|
||||||
|
}else if("分公司级".equals(sysUser.getRoleLevel())){
|
||||||
|
map.put("subComId", Math.toIntExact(sysUser.getBandId()));
|
||||||
|
}else if("项目部级".equals(sysUser.getRoleLevel())){
|
||||||
|
map.put("subComId", Math.toIntExact(sysUser.getAffCompany()));
|
||||||
|
map.put("orgId", Math.toIntExact(sysUser.getBandId()));
|
||||||
|
}else if("分包商级".equals(sysUser.getRoleLevel())){
|
||||||
|
|
||||||
|
}else if("施工人员级".equals(sysUser.getRoleLevel())){
|
||||||
|
map.put("subComId", Math.toIntExact(sysUser.getAffCompany()));
|
||||||
|
map.put("proId", Math.toIntExact(sysUser.getBandId()));
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -57,6 +57,9 @@
|
||||||
LEFT JOIN bm_att_person bap ON bap.pro_id = pp.id AND bap.att_day = #{startDate}
|
LEFT JOIN bm_att_person bap ON bap.pro_id = pp.id AND bap.att_day = #{startDate}
|
||||||
WHERE
|
WHERE
|
||||||
psc.is_active = 1
|
psc.is_active = 1
|
||||||
|
<if test="subComId != null and subComId != ''">
|
||||||
|
AND psc.id = #{subComId}
|
||||||
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
psc.id
|
psc.id
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -65,7 +68,7 @@
|
||||||
SELECT
|
SELECT
|
||||||
pp.id as pro_id,
|
pp.id as pro_id,
|
||||||
pp.pro_name,
|
pp.pro_name,
|
||||||
pp.pro_status,
|
pp.pro_status,
|
||||||
ps.sub_name,
|
ps.sub_name,
|
||||||
pst.id as team_id,
|
pst.id as team_id,
|
||||||
pst.team_name,
|
pst.team_name,
|
||||||
|
|
@ -80,7 +83,6 @@
|
||||||
AND bsc.pro_id = bstc.pro_id
|
AND bsc.pro_id = bstc.pro_id
|
||||||
AND bstc.is_active = 1
|
AND bstc.is_active = 1
|
||||||
LEFT JOIN pm_sub_team pst ON pst.id = bstc.team_id
|
LEFT JOIN pm_sub_team pst ON pst.id = bstc.team_id
|
||||||
<!-- LEFT JOIN bm_worker_ein_msg bwem ON pp.id = bwem.pro_id-->
|
|
||||||
LEFT JOIN bm_worker_ein_day_record bwem ON pp.id = bwem.pro_id and bwem.ein_day = #{startDate}
|
LEFT JOIN bm_worker_ein_day_record bwem ON pp.id = bwem.pro_id and bwem.ein_day = #{startDate}
|
||||||
LEFT JOIN bm_att_person bap ON bap.pro_id = pp.id AND bap.att_day = #{startDate}
|
LEFT JOIN bm_att_person bap ON bap.pro_id = pp.id AND bap.att_day = #{startDate}
|
||||||
WHERE
|
WHERE
|
||||||
|
|
@ -89,6 +91,9 @@
|
||||||
<if test="proName != null and proName !=''">
|
<if test="proName != null and proName !=''">
|
||||||
AND pp.pro_name LIKE CONCAT('%',#{proName},'%')
|
AND pp.pro_name LIKE CONCAT('%',#{proName},'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="orgId != null and orgId !=''">
|
||||||
|
AND pp.org_id = #{orgId}
|
||||||
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
bstc.id
|
bstc.id
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -123,7 +128,6 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getWorkerEinMsgListByDateRange" resultMap="BaseResultMap">
|
<select id="getWorkerEinMsgListByDateRange" resultMap="BaseResultMap">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
bwedr.worker_id,
|
bwedr.worker_id,
|
||||||
bwedr.id_number,
|
bwedr.id_number,
|
||||||
|
|
@ -171,6 +175,12 @@
|
||||||
WHERE
|
WHERE
|
||||||
a.att_day >= #{startDate}
|
a.att_day >= #{startDate}
|
||||||
AND a.att_day <= #{endDate}
|
AND a.att_day <= #{endDate}
|
||||||
|
<if test="proId != null and proId != ''">
|
||||||
|
and a.pro_id = #{proId}
|
||||||
|
</if>
|
||||||
|
<if test="teamId != null and teamId != ''">
|
||||||
|
and a.team_id = #{teamId}
|
||||||
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
a.worker_id
|
a.worker_id
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -203,7 +213,7 @@
|
||||||
and bwedr.pro_id = #{proId}
|
and bwedr.pro_id = #{proId}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
bwedr.worker_id
|
bwedr.worker_id,bwedr.ein_day
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getTeamAttListBySevenNotAtt" resultMap="BaseResultMap">
|
<select id="getTeamAttListBySevenNotAtt" resultMap="BaseResultMap">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue