1.考勤统计模块的所有导出
This commit is contained in:
parent
43712c381c
commit
a6dd3fa008
|
|
@ -1,21 +1,27 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.bonus.bmw.domain.vo.BmWorkerAtt;
|
||||
import com.bonus.bmw.domain.vo.*;
|
||||
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.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 考勤统计
|
||||
|
|
@ -152,6 +158,119 @@ public class BmWorkerAttController extends BaseController {
|
|||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 考勤导出-工程维度
|
||||
*/
|
||||
@RequiresPermissions("att:pro:export")
|
||||
@PostMapping("/attExportByPro")
|
||||
@SysLog(title = "考勤导出-工程维度", businessType = OperaType.EXPORT, logType = 0, module = "施工人员->红绿灯管理->合同管理", details = "考勤导出-工程维度")
|
||||
public void attExportByPro(HttpServletResponse response, BmWorkerAtt o) {
|
||||
try {
|
||||
List<BmWorkerAtt> list = service.getProAttList(o);
|
||||
List<BmWorkerAttProExport> exportList = list.stream()
|
||||
.map(worker -> {
|
||||
BmWorkerAttProExport export = new BmWorkerAttProExport();
|
||||
BeanUtils.copyProperties(export, worker);
|
||||
return export;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
ExcelUtil<BmWorkerAttProExport> util = new ExcelUtil<>(BmWorkerAttProExport.class);
|
||||
util.exportExcel(response, exportList, "考勤导出-工程维度");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 考勤导出-工程维度
|
||||
*/
|
||||
@RequiresPermissions("att:team:export")
|
||||
@PostMapping("/attExportByTeam")
|
||||
@SysLog(title = "考勤导出-班组维度", businessType = OperaType.EXPORT, logType = 0, module = "施工人员->考勤管理->考勤统计", details = "考勤导出-班组维度")
|
||||
public void attExportByTeam(HttpServletResponse response, BmWorkerAtt o) {
|
||||
try {
|
||||
List<BmWorkerAtt> list = service.getTeamAttList(o);
|
||||
List<BmWorkerAttTeamExport> exportList = list.stream()
|
||||
.map(worker -> {
|
||||
BmWorkerAttTeamExport export = new BmWorkerAttTeamExport();
|
||||
BeanUtils.copyProperties(export, worker);
|
||||
return export;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
ExcelUtil<BmWorkerAttTeamExport> util = new ExcelUtil<>(BmWorkerAttTeamExport.class);
|
||||
util.exportExcel(response, exportList, "考勤导出-工程维度");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 考勤导出-人员统计维度
|
||||
*/
|
||||
@RequiresPermissions("att:worker:export")
|
||||
@PostMapping("/attExportByWorker")
|
||||
@SysLog(title = "考勤导出-人员统计维度", businessType = OperaType.EXPORT, logType = 0, module = "施工人员->考勤管理->考勤统计", details = "考勤导出-人员统计维度")
|
||||
public void attExportByWorker(HttpServletResponse response, BmWorkerAtt o) {
|
||||
try {
|
||||
List<BmWorkerAtt> list = service.getWorkerAttList(o);
|
||||
List<BmWorkerAttWorkerExport> exportList = list.stream()
|
||||
.map(worker -> {
|
||||
BmWorkerAttWorkerExport export = new BmWorkerAttWorkerExport();
|
||||
BeanUtils.copyProperties(export, worker);
|
||||
return export;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
ExcelUtil<BmWorkerAttWorkerExport> util = new ExcelUtil<>(BmWorkerAttWorkerExport.class);
|
||||
util.exportExcel(response, exportList, "考勤导出-人员统计维度");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 考勤导出-人员统计维度
|
||||
*/
|
||||
@RequiresPermissions("att:worker:export")
|
||||
@PostMapping("/attExportByWorkerMsg")
|
||||
@SysLog(title = "考勤导出-人员详情维度", businessType = OperaType.EXPORT, logType = 0, module = "施工人员->考勤管理->考勤统计", details = "考勤导出-人员详情维度")
|
||||
public void attExportByWorkerMsg(HttpServletResponse response, BmWorkerAtt o) {
|
||||
try {
|
||||
List<BmWorkerAtt> list = service.getWorkerAttListById(o);
|
||||
List<BmWorkerAttWorkerMsgExport> exportList = list.stream()
|
||||
.map(worker -> {
|
||||
BmWorkerAttWorkerMsgExport export = new BmWorkerAttWorkerMsgExport();
|
||||
BeanUtils.copyProperties(export, worker);
|
||||
return export;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
ExcelUtil<BmWorkerAttWorkerMsgExport> util = new ExcelUtil<>(BmWorkerAttWorkerMsgExport.class);
|
||||
util.exportExcel(response, exportList, "考勤导出-人员详情维度");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 考勤导出-连续七天未打卡
|
||||
*/
|
||||
@RequiresPermissions("att:worker:export")
|
||||
@PostMapping("/attExportBySevenNotAtt")
|
||||
@SysLog(title = "考勤导出-连续七天未打卡", businessType = OperaType.EXPORT, logType = 0, module = "施工人员->考勤管理->考勤统计", details = "考勤导出-连续七天未打卡")
|
||||
public void attExportBySevenNotAtt(HttpServletResponse response, BmWorkerAtt o) {
|
||||
try {
|
||||
List<BmWorkerAtt> list = service.getSevenNotAttListByTeam(o);
|
||||
List<BmWorkerAttSevenNoAttExport> exportList = list.stream()
|
||||
.map(worker -> {
|
||||
BmWorkerAttSevenNoAttExport export = new BmWorkerAttSevenNoAttExport();
|
||||
BeanUtils.copyProperties(export, worker);
|
||||
return export;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
ExcelUtil<BmWorkerAttSevenNoAttExport> util = new ExcelUtil<>(BmWorkerAttSevenNoAttExport.class);
|
||||
util.exportExcel(response, exportList, "考勤导出-连续七天未打卡");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,4 +162,11 @@ public class BmWorkerAtt {
|
|||
|
||||
private String phone;
|
||||
|
||||
private String proStatus;
|
||||
|
||||
/**
|
||||
* 班组在场状态
|
||||
*/
|
||||
private Integer teamEinStatus;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 所有在场人员实时信息表-离场就删除
|
||||
*/
|
||||
@Data
|
||||
public class BmWorkerAttProExport {
|
||||
|
||||
//用于excel导出的序号一列,不需要业务逻辑处理
|
||||
@Excel(name = "序号", isSequence = true, type = Excel.Type.EXPORT,sort = 1)
|
||||
int sequence;
|
||||
|
||||
/**
|
||||
* 工程
|
||||
*/
|
||||
@Excel(name = "工程", type = Excel.Type.EXPORT,sort = 2)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 工程状态
|
||||
*/
|
||||
@Excel(name = "工程状态", type = Excel.Type.EXPORT,sort = 3,readConverterExp = "在建=1,筹建=3,停工=2,完工=5,遗留收尾=4")
|
||||
private String proStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 分包数量
|
||||
*/
|
||||
@Excel(name = "分包数量", type = Excel.Type.EXPORT,sort = 4)
|
||||
private Integer subNum;
|
||||
|
||||
/**
|
||||
* 班组数量
|
||||
*/
|
||||
@Excel(name = "班组数量", type = Excel.Type.EXPORT,sort = 5)
|
||||
private Integer teamNum;
|
||||
|
||||
/**
|
||||
* 在场人员数量
|
||||
*/
|
||||
@Excel(name = "在场人员数量", type = Excel.Type.EXPORT,sort = 6)
|
||||
private Integer einNum;
|
||||
|
||||
/**
|
||||
* 考勤人数
|
||||
*/
|
||||
@Excel(name = "考勤人数", type = Excel.Type.EXPORT,sort = 7)
|
||||
private Integer attNum;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 七天未打卡
|
||||
*/
|
||||
@Data
|
||||
public class BmWorkerAttSevenNoAttExport {
|
||||
|
||||
//用于excel导出的序号一列,不需要业务逻辑处理
|
||||
@Excel(name = "序号", isSequence = true, type = Excel.Type.EXPORT,sort = 1)
|
||||
int sequence;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Excel(name = "姓名", type = Excel.Type.EXPORT,sort = 2)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@Excel(name = "身份证号", type = Excel.Type.EXPORT,sort = 3)
|
||||
private String idNumber;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Excel(name = "手机号", type = Excel.Type.EXPORT,sort = 4)
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 工种
|
||||
*/
|
||||
@Excel(name = "工种", type = Excel.Type.EXPORT,sort = 5)
|
||||
private String postName;
|
||||
|
||||
/**
|
||||
* 工程
|
||||
*/
|
||||
@Excel(name = "工程", type = Excel.Type.EXPORT,sort = 6)
|
||||
private String proName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分包
|
||||
*/
|
||||
@Excel(name = "分包", type = Excel.Type.EXPORT,sort = 7)
|
||||
private String subName;
|
||||
|
||||
|
||||
/**
|
||||
* 班组
|
||||
*/
|
||||
@Excel(name = "班组", type = Excel.Type.EXPORT,sort = 8)
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 最后考勤日期
|
||||
*/
|
||||
@Excel(name = "最后考勤日期", type = Excel.Type.EXPORT,sort = 9)
|
||||
private String attDay;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 所有在场人员实时信息表-离场就删除
|
||||
*/
|
||||
@Data
|
||||
public class BmWorkerAttTeamExport {
|
||||
|
||||
//用于excel导出的序号一列,不需要业务逻辑处理
|
||||
@Excel(name = "序号", isSequence = true, type = Excel.Type.EXPORT,sort = 1)
|
||||
int sequence;
|
||||
|
||||
/**
|
||||
* 工程
|
||||
*/
|
||||
@Excel(name = "工程", type = Excel.Type.EXPORT,sort = 2)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 分包
|
||||
*/
|
||||
@Excel(name = "分包", type = Excel.Type.EXPORT,sort = 3)
|
||||
private String subName;
|
||||
|
||||
/**
|
||||
* 班组
|
||||
*/
|
||||
@Excel(name = "班组", type = Excel.Type.EXPORT,sort = 4)
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 班组在场状态
|
||||
*/
|
||||
@Excel(name = "班组在场状态", type = Excel.Type.EXPORT,sort = 5,readConverterExp = "已入场=1,已离场=2")
|
||||
private Integer teamEinStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 在场人员数量
|
||||
*/
|
||||
@Excel(name = "在场人员数量", type = Excel.Type.EXPORT,sort = 6)
|
||||
private Integer einNum;
|
||||
|
||||
/**
|
||||
* 考勤人数
|
||||
*/
|
||||
@Excel(name = "考勤人数", type = Excel.Type.EXPORT,sort = 7)
|
||||
private Integer attNum;
|
||||
|
||||
/**
|
||||
* 七天未打卡数量
|
||||
*/
|
||||
@Excel(name = "七天未打卡数量", type = Excel.Type.EXPORT,sort = 8)
|
||||
private Integer sevenNotAttNum;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 人员统计维度导出
|
||||
*/
|
||||
@Data
|
||||
public class BmWorkerAttWorkerExport {
|
||||
|
||||
//用于excel导出的序号一列,不需要业务逻辑处理
|
||||
@Excel(name = "序号", isSequence = true, type = Excel.Type.EXPORT,sort = 1)
|
||||
int sequence;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Excel(name = "姓名", type = Excel.Type.EXPORT,sort = 2)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@Excel(name = "身份证号", type = Excel.Type.EXPORT,sort = 3)
|
||||
private String idNumber;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Excel(name = "手机号", type = Excel.Type.EXPORT,sort = 4)
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 工种
|
||||
*/
|
||||
@Excel(name = "工种", type = Excel.Type.EXPORT,sort = 5)
|
||||
private String postName;
|
||||
|
||||
/**
|
||||
* 工程
|
||||
*/
|
||||
@Excel(name = "工程", type = Excel.Type.EXPORT,sort = 6)
|
||||
private String proName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分包
|
||||
*/
|
||||
@Excel(name = "分包", type = Excel.Type.EXPORT,sort = 7)
|
||||
private String subName;
|
||||
|
||||
|
||||
/**
|
||||
* 班组
|
||||
*/
|
||||
@Excel(name = "班组", type = Excel.Type.EXPORT,sort = 8)
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 在场人员数量
|
||||
*/
|
||||
@Excel(name = "在场人员数量", type = Excel.Type.EXPORT,sort = 9)
|
||||
private Integer einNum;
|
||||
|
||||
/**
|
||||
* 考勤人数
|
||||
*/
|
||||
@Excel(name = "考勤人数", type = Excel.Type.EXPORT,sort = 10)
|
||||
private Integer attNum;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 人员统计维度导出
|
||||
*/
|
||||
@Data
|
||||
public class BmWorkerAttWorkerMsgExport {
|
||||
|
||||
//用于excel导出的序号一列,不需要业务逻辑处理
|
||||
@Excel(name = "序号", isSequence = true, type = Excel.Type.EXPORT,sort = 1)
|
||||
int sequence;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Excel(name = "姓名", type = Excel.Type.EXPORT,sort = 2)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@Excel(name = "身份证号", type = Excel.Type.EXPORT,sort = 3)
|
||||
private String idNumber;
|
||||
|
||||
/**
|
||||
* 考勤日期
|
||||
*/
|
||||
@Excel(name = "考勤日期", type = Excel.Type.EXPORT,sort = 4)
|
||||
private String currentDay;
|
||||
|
||||
/**
|
||||
* 考勤状态
|
||||
*/
|
||||
@Excel(name = "考勤状态", type = Excel.Type.EXPORT,sort = 5,readConverterExp = "未考勤=1,已考勤=1,补卡=2,未入场=3")
|
||||
private Integer isAtt;
|
||||
|
||||
/**
|
||||
* 考勤时间
|
||||
*/
|
||||
@Excel(name = "考勤时间", type = Excel.Type.EXPORT,sort = 6)
|
||||
private String addTime;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 工程
|
||||
*/
|
||||
@Excel(name = "工程", type = Excel.Type.EXPORT,sort = 7)
|
||||
private String proName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 考勤机名称
|
||||
*/
|
||||
@Excel(name = "考勤机名称", type = Excel.Type.EXPORT,sort = 8)
|
||||
private String deviceName;
|
||||
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ public class BmWorkerAttServiceImpl implements BmWorkerAttService {
|
|||
List<BmWorkerAtt> teamAttList = mapper.getTeamAttList(o);
|
||||
//查询班组七天未打卡人员
|
||||
List<BmWorkerAtt> sevenNotAttList = mapper.getTeamAttListBySevenNotAtt(o);
|
||||
// 将 teamAttList2 转为 Map<teamId, num>,方便查找
|
||||
// 将 teamAttList2 转为 Map<teamId, num>,方便查找
|
||||
Map<Integer, Integer> sevenNotAttMap = sevenNotAttList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
BmWorkerAtt::getTeamId, // key: teamId
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
<result column="phone" property="phone" />
|
||||
<result column="post_name" property="postName" />
|
||||
<result column="sevenNotAttNum" property="sevenNotAttNum" />
|
||||
<result column="pro_status" property="proStatus" />
|
||||
<result column="team_ein_status" property="teamEinStatus" />
|
||||
</resultMap>
|
||||
|
||||
<select id="getSubComAttList" resultMap="BaseResultMap">
|
||||
|
|
@ -63,6 +65,7 @@
|
|||
SELECT
|
||||
pp.id as pro_id,
|
||||
pp.pro_name,
|
||||
pp.pro_status,
|
||||
ps.sub_name,
|
||||
pst.id as team_id,
|
||||
pst.team_name,
|
||||
|
|
@ -97,6 +100,7 @@
|
|||
ps.sub_name,
|
||||
pst.id as team_id,
|
||||
pst.team_name,
|
||||
bstc.team_ein_status,
|
||||
COUNT(DISTINCT bwem.worker_id) AS einNum,
|
||||
COUNT(DISTINCT bap.worker_id) AS attNum
|
||||
FROM
|
||||
|
|
@ -174,20 +178,24 @@
|
|||
<select id="getWorkerAttListById" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
bwedr.worker_id,
|
||||
pw.name,
|
||||
pw.id_number,
|
||||
bwedr.pro_name,
|
||||
bwedr.ein_day,
|
||||
bap.att_day,
|
||||
bap.att_time,
|
||||
bap.dev_name as device_name,
|
||||
bap.is_repair,
|
||||
IF(bap.att_day is null,0,1) is_att
|
||||
bap.dev_name as device_name,
|
||||
bap.is_repair,
|
||||
IF(bap.att_day is null,0,if(bap.is_repair = 0,1,2)) is_att
|
||||
FROM
|
||||
bm_worker_ein_day_record bwedr
|
||||
LEFT JOIN bm_att_person bap ON bwedr.worker_id = bap.worker_id
|
||||
AND bap.att_day = bwedr.ein_day
|
||||
left join pm_worker pw on bwedr.worker_id = pw.id
|
||||
WHERE
|
||||
bwedr.ein_day >= #{startDate}
|
||||
AND bwedr.ein_day <= #{endDate}
|
||||
AND bwedr.worker_id = #{workerId}
|
||||
<if test="teamId != null and teamId != ''">
|
||||
and bwedr.team_id = #{teamId}
|
||||
</if>
|
||||
|
|
@ -222,7 +230,7 @@
|
|||
|
||||
<select id="getSevenNotAttListByTeam" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
pw.NAME,
|
||||
pw.`name`,
|
||||
pw.id_number,
|
||||
pw.phone,
|
||||
bwem.post_name,
|
||||
|
|
|
|||
Loading…
Reference in New Issue