Commit 7520d971 authored by nie'hong's avatar nie'hong

导出完成

parent dcf5c10b
......@@ -21,6 +21,11 @@
<artifactId>wisenergy-model</artifactId>
<version>${moduleVersion.wisenergy-model}</version>
</dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<!-- MAVEN构建 -->
......
package cn.wisenergy.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
@ApiModel(value="CalendarDto", description="日历展示类")
public class CalendarDto implements Serializable {
private static final long serialVersionUID = -1678604782365034642L;
@ApiModelProperty(name = "userId",value = "填报工时人员")
private Integer userId;
@ApiModelProperty(name = "status",value = "状态: 1:已填报 ,2:已审核,3:被驳回")
private Integer status;
@ApiModelProperty(name = "workDay",value = "工时的日期")
private Date workDay;
}
......@@ -17,7 +17,7 @@ public class DayWorkTimeAndType implements Serializable {
private Integer day;
/**
* 工时类型
* 工时类型,0:正常,1:请假,2:调休
*/
private Integer type;
......
package cn.wisenergy.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @description: 获取部门员工一个月每天工时接口参数
* @author: nh
* @create: 2021-01-20 16:04
**/
@Data
@ApiModel(value = "GetMonthlyCollectParam", description = "获取部门员工一个月每天工时接口参数")
public class GetMonthlyCollectParam {
/**
* 年
*/
@ApiModelProperty(name = "year", value = "年")
private Integer year;
/**
* 月
*/
@ApiModelProperty(name = "month", value = "月")
private Integer month;
/**
* 用户主键
*/
@ApiModelProperty(name = "userId", value = "用户主键")
private Integer userId;
/**
* 部门主键
*/
@ApiModelProperty(name = "deptId", value = "部门主键")
private Integer deptId;
/**
* 当前页码
*/
@ApiModelProperty(name = "currentPage", value = "当前页码")
private Integer currentPage;
/**
* 每页的数量
*/
@ApiModelProperty(name = "size", value = "每页的数量")
private Integer size;
}
......@@ -13,6 +13,11 @@ import java.io.Serializable;
public class MonthlyWorkingHoursStatistics implements Serializable {
private static final long serialVersionUID = -8216457470821285624L;
/**
* 商机/项目
*/
private Integer projectType;
/**
* 填报次数
*/
......@@ -23,9 +28,5 @@ public class MonthlyWorkingHoursStatistics implements Serializable {
*/
private Integer workTime;
/**
* 审核情况(非审核人员为空)
*/
private ApprovalStatistics approvalStatistics;
}
package cn.wisenergy.model.enums;
public enum WorkOrderType {
PROJECT(1, "项目"),
BUSINESS(2, "商机"),
LEAVE(3, "请假"),
CONMPENSATORY_LEAVE(4, "调休"),
EXTERNAL_WORK(5, "外部商务、技术交流"),
INTERNAL_WORK(6, "内部培训、技术准备、管理"),
OTHER_NOT_PROJECT_BUSINESS(7, "其他非项目、商机工作");
private Integer code;
private String desc;
WorkOrderType(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package cn.wisenergy.service;
import cn.wisenergy.model.dto.StatisticsTableDto;
import java.util.List;
import cn.wisenergy.model.dto.GetMonthlyCollectParam;
import com.github.pagehelper.PageInfo;
public interface StatisticsService {
/**
* 获取部门所有员工每天工时
* @param year
* @param month
* @param deptId
* @param param 参数对象
* @return
*/
List<StatisticsTableDto> getMonthlyCollect(Integer year, Integer month,Integer userId, Integer deptId);
PageInfo getMonthlyCollect(GetMonthlyCollectParam param);
}
......@@ -7,11 +7,14 @@ import cn.wisenergy.mapper.WorkTimeOrderMapper;
import cn.wisenergy.mapper.WorkUserDeptMapper;
import cn.wisenergy.model.app.WorkUser;
import cn.wisenergy.model.dto.DayWorkTimeAndType;
import cn.wisenergy.model.dto.GetMonthlyCollectParam;
import cn.wisenergy.model.dto.StatisticsTableDto;
import cn.wisenergy.model.enums.ManagerEnum;
import cn.wisenergy.service.StatisticsService;
import cn.wisenergy.service.WorkUserService;
import com.alibaba.excel.util.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -39,36 +42,49 @@ public class StatisticsServiceImpl implements StatisticsService {
WorkUserDeptMapper workUserDeptMapper;
@Override
public List<StatisticsTableDto> getMonthlyCollect(Integer year, Integer month, Integer userId, Integer deptId) {
log.info("StatisticsServiceImpl[]getMonthlyCollect[]input.param" + year + month + userId, deptId);
if (userId == null) {
public PageInfo getMonthlyCollect(GetMonthlyCollectParam param) {
log.info("StatisticsServiceImpl[]getMonthlyCollect[]input.param" + param);
if (param == null) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
//管理员用户
WorkUser user = workUserService.getUserById(userId);
WorkUser user = workUserService.getUserById(param.getUserId());
if (user.getLevel() != ManagerEnum.IS_SYSTEM_MANAGER.getCode()) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN);
}
//默认时间为当月
if (StringUtils.isEmpty(year) || StringUtils.isEmpty(month)) {
Integer year = param.getYear();
Integer month = param.getMonth();
if (StringUtils.isEmpty(param.getYear()) || StringUtils.isEmpty(param.getMonth())) {
Date now = new Date();
year = DateUtil.getYear(now);
month = DateUtil.getMonth(now)+1;
}
//默认部门主键为1
if (deptId == null) {
Integer deptId = param.getDeptId();
if (param.getDeptId() == null) {
deptId = 1;
}
//默认当前页码为1,每页数量为10
if (param.getCurrentPage() == null) {
param.setCurrentPage(1);
}
if (param.getSize() == null) {
param.setSize(10);
}
//获取部门下所有员工主键
//分页获取部门下所有员工主键
PageHelper.startPage(param.getCurrentPage(), param.getSize());
List<Integer> userIdList = workUserDeptMapper.listByDeptId(deptId);
PageInfo pageInfo = new PageInfo(userIdList);
//获取员工一个月中已审核、自动审核的工单单日汇总汇总
ArrayList<StatisticsTableDto> statisticsTableDtos = new ArrayList<>();
for (Integer id : userIdList) {
//获取部门下用户信息
WorkUser workUser = workUserService.getUserById(id);
//获取当月每天工时信息
List<DayWorkTimeAndType> dayWorkTimeAndTypes = workOrderMapper.listByDateAndUserId(year, month, id);
//将一天中类型不为请假和调休的工时累加
//封装成对象
StatisticsTableDto statisticsTableDto = new StatisticsTableDto();
statisticsTableDto.setUserId(id);
......@@ -76,6 +92,8 @@ public class StatisticsServiceImpl implements StatisticsService {
statisticsTableDto.setDayWorkTimeAndTypeList(dayWorkTimeAndTypes);
statisticsTableDtos.add(statisticsTableDto);
}
return statisticsTableDtos;
pageInfo.setList(statisticsTableDtos);
return pageInfo;
}
}
......@@ -3,10 +3,11 @@ package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.model.app.WorkDept;
import cn.wisenergy.model.dto.StatisticsTableDto;
import cn.wisenergy.model.dto.GetMonthlyCollectParam;
import cn.wisenergy.service.StatisticsService;
import cn.wisenergy.service.WorkDeptService;
import cn.wisenergy.web.admin.controller.common.BaseController;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -36,21 +37,19 @@ public class StatisticsController extends BaseController {
WorkDeptService workDeptService;
@ApiOperation(value = "获取部门员工一个月每天的工时", notes = "获取部门员工一个月每天的工时")
@ApiImplicitParams({
@ApiImplicitParam(name = "year", value = "年"),
@ApiImplicitParam(name = "month", value = "月"),
@ApiImplicitParam(name = "userId", value = "用户主键", required = true),
@ApiImplicitParam(name = "deptId", value = "部门编号")
})
@GetMapping("/getMonthlyCollect")
public List<StatisticsTableDto> getMonthlyCollect(Integer year, Integer month, Integer userId, Integer deptId) {
log.info("StatisticsController[]getMonthlyCollect[]input.param" + year + month + userId + deptId);
public PageInfo getMonthlyCollect(GetMonthlyCollectParam param) {
log.info("StatisticsController[]getMonthlyCollect[]input.param" + param);
List<StatisticsTableDto> statisticsTableDtos = statisticsService.getMonthlyCollect(year, month, userId, deptId);
return statisticsTableDtos;
PageInfo monthlyCollect = statisticsService.getMonthlyCollect(param);
return monthlyCollect;
}
@ApiOperation(value = "")
@ApiOperation(value = "获取部门信息", notes = "获取部门信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户主键", required = true),
@ApiImplicitParam(name = "deptId", value = "部门主键", required = true)
})
@GetMapping("getDeptInfo")
public List<WorkDept> getDeptInfo(Integer userId, Integer deptId) {
log.info("StatisticsController[]getDeptInfo[]input.param" + userId + deptId);
......
package cn.wisenergy.web.admin.controller.app;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;
/**
* @description:
* @author: nh
* @create: 2021-01-20 16:47
**/
@RestController
@Api(tags = "项目模块")
@Slf4j
public class WorkProjectController {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment