feat:项目管理 日志管理 项目执行表等功能初始化
parent
a887e668f1
commit
14dcc69fe9
|
@ -48,6 +48,11 @@
|
|||
<groupId>tech.unissense</groupId>
|
||||
<artifactId>pms-framework</artifactId>
|
||||
</dependency>
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>tech.unissense</groupId>
|
||||
<artifactId>pms-business</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
package tech.unissense.pms.web.controller.business.project;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.unissense.pms.business.projectteam.domain.ProjectTeam;
|
||||
import tech.unissense.pms.business.projectteam.service.IProjectTeamService;
|
||||
import tech.unissense.pms.business.work.logger.domain.WorkLogger;
|
||||
import tech.unissense.pms.common.annotation.Log;
|
||||
import tech.unissense.pms.common.core.controller.BaseController;
|
||||
import tech.unissense.pms.common.core.domain.AjaxResult;
|
||||
import tech.unissense.pms.common.enums.BusinessType;
|
||||
import tech.unissense.pms.common.utils.uuid.IdUtils;
|
||||
import tech.unissense.pms.common.utils.uuid.UUID;
|
||||
import tech.unissense.pms.business.project.domain.Project;
|
||||
import tech.unissense.pms.business.project.service.IProjectService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/project")
|
||||
public class ProjectController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IProjectService service;
|
||||
@Autowired
|
||||
private IProjectTeamService teamService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(Project project)
|
||||
{
|
||||
startPage();
|
||||
List<Project> depts = service.permissisonList(project);
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@PostMapping("/add")
|
||||
@Log(title = "项目管理", businessType = BusinessType.INSERT)
|
||||
public AjaxResult addData(@RequestBody Project project)
|
||||
{
|
||||
service.insert(project);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目编号
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getCode")
|
||||
public AjaxResult getCode(){
|
||||
return AjaxResult.success("",IdUtils.fastUUID());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@Log(title = "项目人员管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/team/{teamId}")
|
||||
public AjaxResult teamRemove(@PathVariable Integer teamId)
|
||||
{
|
||||
return toAjax(teamService.deleteById(teamId));
|
||||
}
|
||||
/**
|
||||
* 更新项目
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@Log(title = "项目人员管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/team")
|
||||
public AjaxResult personnelChanges(@RequestBody ProjectTeam team)
|
||||
{
|
||||
return toAjax(teamService.personnelChanges(team));
|
||||
}
|
||||
/**
|
||||
* 删除项目
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@Log(title = "项目管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{projectId}")
|
||||
public AjaxResult remove(@PathVariable Integer projectId)
|
||||
{
|
||||
return toAjax(service.deleteById(projectId));
|
||||
}
|
||||
/**
|
||||
* 根据项目获取人员信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@GetMapping("/{projectId}")
|
||||
public AjaxResult getTeamInfo(@PathVariable Integer projectId)
|
||||
{
|
||||
return success(service.getTeamInfo(projectId));
|
||||
}
|
||||
/**
|
||||
* 项目执行表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@PostMapping("/executionInfo")
|
||||
public AjaxResult executionInfo(@RequestBody WorkLogger workLogger)
|
||||
{
|
||||
return success(service.executionInfo(workLogger));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package tech.unissense.pms.web.controller.business.work;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.unissense.pms.business.project.domain.Project;
|
||||
import tech.unissense.pms.business.project.service.IProjectService;
|
||||
import tech.unissense.pms.business.work.logger.domain.WorkLogger;
|
||||
import tech.unissense.pms.business.work.logger.service.IWorkLoggerService;
|
||||
import tech.unissense.pms.common.annotation.Log;
|
||||
import tech.unissense.pms.common.core.controller.BaseController;
|
||||
import tech.unissense.pms.common.core.domain.AjaxResult;
|
||||
import tech.unissense.pms.common.enums.BusinessType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/work/hour")
|
||||
public class WorkHourController extends BaseController {
|
||||
@Autowired
|
||||
private IWorkLoggerService service;
|
||||
@Autowired
|
||||
private IProjectService projectService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@PostMapping("/add")
|
||||
@Log(title = "工作日志", businessType = BusinessType.INSERT)
|
||||
public AjaxResult addData(@RequestBody WorkLogger workLogger) {
|
||||
service.insert(workLogger);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看工作日志
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@PostMapping("/getInfo")
|
||||
public AjaxResult getInfo(@RequestBody WorkLogger workLogger) {
|
||||
|
||||
return success(service.getInfo(workLogger));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看日历记录
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@PostMapping("/calendar")
|
||||
public AjaxResult calendar(@RequestBody WorkLogger workLogger) {
|
||||
|
||||
return success(service.calendar(workLogger));
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目工时统计
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/project/{userId}")
|
||||
public AjaxResult project(@PathVariable String userId ) {
|
||||
List<Project> projects = projectService.listProjectByUser(userId);
|
||||
return success(service.projectStatics(projects, userId));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -51,6 +51,9 @@ spring:
|
|||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
profiles:
|
||||
active: dev
|
||||
# 文件上传
|
||||
|
|
|
@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
|||
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||
<setting name="logImpl" value="SLF4J" />
|
||||
<!-- 使用驼峰命名法转换字段 -->
|
||||
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||
<setting name="mapUnderscoreToCamelCase" value="true"/>
|
||||
</settings>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
package tech.unissense.pms.business.project.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import tech.unissense.pms.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import tech.unissense.pms.business.projectteam.domain.ProjectTeam;
|
||||
|
||||
/**
|
||||
* (Project)实体类
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-08 17:22:38
|
||||
*/
|
||||
@Data
|
||||
public class Project extends BaseEntity {
|
||||
private static final long serialVersionUID = -57644380048647254L;
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Integer projectId;
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
private Integer tenantId;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String projectName;
|
||||
/**
|
||||
* 项目编码
|
||||
*/
|
||||
private String projectCode;
|
||||
/**
|
||||
* 项目负责人
|
||||
*/
|
||||
private String projectLeader;
|
||||
/**
|
||||
* 项目负责人名称
|
||||
*/
|
||||
private String projectLeaderName;
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
private Date startDate;
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
private Date endDate;
|
||||
/**
|
||||
* 预估天数
|
||||
*/
|
||||
private Integer budgetDate;
|
||||
/**
|
||||
* 0 -正常; 1-停用
|
||||
*/
|
||||
private String state;
|
||||
/**
|
||||
* 项目状态 0-待启动 1-进行中 2-已完成
|
||||
*/
|
||||
private String projectState;
|
||||
|
||||
/**
|
||||
* 更新人名称
|
||||
*/
|
||||
private String updateByName;
|
||||
/**
|
||||
* 创建人名称
|
||||
*/
|
||||
private String createByName;
|
||||
/**
|
||||
* 项目人数
|
||||
*/
|
||||
private Integer teamNum;
|
||||
/**
|
||||
* 项目人员
|
||||
*/
|
||||
private List<ProjectTeam> projectTeamList;
|
||||
|
||||
private Long queryUserId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package tech.unissense.pms.business.project.mapper;
|
||||
|
||||
import tech.unissense.pms.business.project.domain.Project;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (Project)表数据库访问层
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-08 11:46:59
|
||||
*/
|
||||
public interface ProjectMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param projectId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
Project queryById(Integer projectId);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param project 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<Project> list(Project project);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param project 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(Project project);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param project 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(Project project);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<Project> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<Project> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<Project> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<Project> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param project 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(Project project);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param projectId 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer projectId);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package tech.unissense.pms.business.project.service;
|
||||
|
||||
import tech.unissense.pms.business.project.domain.Project;
|
||||
import tech.unissense.pms.business.project.vo.ProjectExecutionVo;
|
||||
import tech.unissense.pms.business.projectteam.vo.TeamStaticsVo;
|
||||
import tech.unissense.pms.business.work.logger.domain.WorkLogger;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* (Project)表服务接口
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-08 11:47:00
|
||||
*/
|
||||
public interface IProjectService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param projectId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
Project queryById(Integer projectId);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param project 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<Project> permissisonList(Project project);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param project 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
Project insert(Project project);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param project 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
Project update(Project project);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param projectId 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer projectId);
|
||||
|
||||
List<Project> listProjectByUser(String createBy);
|
||||
|
||||
List<TeamStaticsVo> getTeamInfo(Integer projectId);
|
||||
|
||||
List<ProjectExecutionVo> executionInfo(WorkLogger workLogger);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
package tech.unissense.pms.business.project.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tech.unissense.pms.business.project.domain.Project;
|
||||
import tech.unissense.pms.business.project.mapper.ProjectMapper;
|
||||
import tech.unissense.pms.business.project.service.IProjectService;
|
||||
import tech.unissense.pms.business.project.vo.ProjectExecutionVo;
|
||||
import tech.unissense.pms.business.projectteam.domain.ProjectTeam;
|
||||
import tech.unissense.pms.business.projectteam.service.IProjectTeamService;
|
||||
import tech.unissense.pms.business.projectteam.vo.TeamStaticsVo;
|
||||
import tech.unissense.pms.business.work.logger.domain.WorkLogger;
|
||||
import tech.unissense.pms.business.work.logger.service.IWorkLoggerService;
|
||||
import tech.unissense.pms.business.work.logger.vo.StaticsHourVo;
|
||||
import tech.unissense.pms.common.core.domain.entity.SysUser;
|
||||
import tech.unissense.pms.common.utils.DateUtils;
|
||||
import tech.unissense.pms.common.utils.SecurityUtils;
|
||||
import tech.unissense.pms.common.utils.StringUtils;
|
||||
import tech.unissense.pms.common.utils.bean.BeanUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* (Project)表服务实现类
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-08 11:47:01
|
||||
*/
|
||||
@Service("projectService")
|
||||
public class ProjectServiceImpl implements IProjectService {
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
@Autowired
|
||||
private IProjectTeamService teamService;
|
||||
|
||||
@Autowired
|
||||
private IWorkLoggerService workLoggerService;
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param projectId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public Project queryById(Integer projectId) {
|
||||
return this.projectMapper.queryById(projectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param project 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
public List<Project> permissisonList(Project project) {
|
||||
dataPermissions(project);
|
||||
return this.projectMapper.list(project);
|
||||
}
|
||||
|
||||
private void dataPermissions(Project project) {
|
||||
SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||
StringBuilder sql = new StringBuilder();
|
||||
if (CollUtil.isEmpty(user.getRoles())){
|
||||
sql.append(" and 1=2");
|
||||
project.getParams().put("dataScope",sql);
|
||||
return;
|
||||
}
|
||||
if (user.getRoles().stream().anyMatch(item-> "企业管理员".equals(item.getRoleName())|| "公司领导".equals(item.getRoleName()))){
|
||||
|
||||
}else if (user.getRoles().stream().anyMatch(item -> "项目管理员".equals(item.getRoleName()))){
|
||||
sql.append("and (t1.project_id in (select project_id from pms_project_team where user_id={} ) or t1.project_leader={})");
|
||||
project.getParams().put("dataScope", StringUtils.format(sql.toString(), user.getUserId(), user.getUserId()));
|
||||
}else{
|
||||
sql.append("and (t1.project_id in (select project_id from pms_project_team where user_id={} ))");
|
||||
project.getParams().put("dataScope", StringUtils.format(sql.toString(), user.getUserId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param project 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public Project insert(Project project) {
|
||||
// 新增项目
|
||||
this.projectMapper.insert(project);
|
||||
project.getProjectTeamList().forEach(item -> item.setProjectId(project.getProjectId()));
|
||||
// 新增项目人员
|
||||
teamService.insertBatch(project.getProjectTeamList());
|
||||
return project;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param project 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public Project update(Project project) {
|
||||
this.projectMapper.update(project);
|
||||
return this.queryById(project.getProjectId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param projectId 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer projectId) {
|
||||
return this.projectMapper.deleteById(projectId) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Project> listProjectByUser(String createBy) {
|
||||
Project project = new Project();
|
||||
project.setQueryUserId(Long.valueOf(createBy));
|
||||
return this.permissisonList(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TeamStaticsVo> getTeamInfo(Integer projectId) {
|
||||
ProjectTeam projectTeam = new ProjectTeam();
|
||||
projectTeam.setProjectId(projectId);
|
||||
List<ProjectTeam> projectTeamList = teamService.list(projectTeam);
|
||||
|
||||
// 获取每个成员的工时统计并转换为Map
|
||||
Map<String, BigDecimal> workHourVo = workLoggerService.personStatics(projectId).stream()
|
||||
.collect(Collectors.toMap(StaticsHourVo::getName, StaticsHourVo::getWorkDay,(v1, v2)->v1));
|
||||
|
||||
// 返回每个成员的工时信息
|
||||
return projectTeamList.stream().map(item -> {
|
||||
String userIdStr = String.valueOf(item.getUserId());
|
||||
BigDecimal workDay = workHourVo.getOrDefault(userIdStr, BigDecimal.ZERO);
|
||||
|
||||
TeamStaticsVo teamStaticsVo = new TeamStaticsVo();
|
||||
teamStaticsVo.setTeamId(item.getTeamId());
|
||||
teamStaticsVo.setUserName(item.getUserName());
|
||||
teamStaticsVo.setPostId(item.getPostId());
|
||||
teamStaticsVo.setWorkDay(workDay);
|
||||
return teamStaticsVo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProjectExecutionVo> executionInfo(WorkLogger workLogger) {
|
||||
List<Project> projects = this.permissisonList(new Project());
|
||||
workLogger.setProjectIdList(projects.stream()
|
||||
.map(Project::getProjectId)
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
List<WorkLogger> workLoggers = workLoggerService.list(workLogger);
|
||||
Map<String, BigDecimal> workTimeMap = workLoggers.stream()
|
||||
.collect(Collectors.toMap(
|
||||
item -> item.getProjectId() + "_" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, item.getLoggerDate()),
|
||||
WorkLogger::getWorkDay,
|
||||
BigDecimal::add));
|
||||
|
||||
LocalDate startDate = workLogger.getStartDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate endDate = workLogger.getEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
return projects.stream().map(project -> {
|
||||
List<BigDecimal> tempList = Stream.iterate(startDate, date -> date.plusDays(1))
|
||||
.limit(ChronoUnit.DAYS.between(startDate, endDate) + 1)
|
||||
.map(localDate -> workTimeMap.getOrDefault(project.getProjectId() + "_" + localDate, BigDecimal.ZERO))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
ProjectExecutionVo vo = new ProjectExecutionVo();
|
||||
BeanUtils.copyBeanProp(vo, project);
|
||||
vo.setDetailList(tempList);
|
||||
vo.setAllWorkTime(tempList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package tech.unissense.pms.business.project.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : ProjectExecutionVo
|
||||
* @Description : TODO(用一句话描述该类做什么)
|
||||
* @DATE : Created in 11:20 2024/10/10
|
||||
* <pre> Copyright: Copyright(c)2024 </pre>
|
||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||
* Modification History:
|
||||
* Date Author Version Discription
|
||||
* --------------------------------------------------------------------------
|
||||
* 2024/10/10 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||
*/
|
||||
@Data
|
||||
public class ProjectExecutionVo {
|
||||
private Integer projectId;
|
||||
private String projectName;
|
||||
private Integer budgetDate;
|
||||
private BigDecimal allWorkTime;
|
||||
private List<BigDecimal> detailList;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package tech.unissense.pms.business.projectteam.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import tech.unissense.pms.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* (ProjectTeam)实体类
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-08 14:27:22
|
||||
*/
|
||||
@Data
|
||||
public class ProjectTeam extends BaseEntity {
|
||||
private static final long serialVersionUID = 914719977909116089L;
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Integer projectId;
|
||||
/**
|
||||
* 组成员id
|
||||
*/
|
||||
private Integer teamId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
private String userName;
|
||||
/**
|
||||
* 项目职位
|
||||
*/
|
||||
private String postId;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package tech.unissense.pms.business.projectteam.mapper;
|
||||
|
||||
import tech.unissense.pms.business.projectteam.domain.ProjectTeam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (ProjectTeam)表数据库访问层
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-08 14:27:22
|
||||
*/
|
||||
public interface ProjectTeamMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param teamId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
ProjectTeam queryById(Integer teamId);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param projectTeam 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<ProjectTeam> list(ProjectTeam projectTeam);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param projectTeam 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(ProjectTeam projectTeam);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param projectTeam 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(ProjectTeam projectTeam);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<ProjectTeam> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<ProjectTeam> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<ProjectTeam> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<ProjectTeam> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param projectTeam 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(ProjectTeam projectTeam);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param teamId 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer teamId);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package tech.unissense.pms.business.projectteam.service;
|
||||
|
||||
import tech.unissense.pms.business.projectteam.domain.ProjectTeam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (ProjectTeam)表服务接口
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-08 14:27:23
|
||||
*/
|
||||
public interface IProjectTeamService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param teamId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
ProjectTeam queryById(Integer teamId);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param projectTeam 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<ProjectTeam> list(ProjectTeam projectTeam);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param projectTeam 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
ProjectTeam insert(ProjectTeam projectTeam);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param projectTeam 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
ProjectTeam update(ProjectTeam projectTeam);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param teamId 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer teamId);
|
||||
|
||||
void insertBatch(List<ProjectTeam> projectTeamList);
|
||||
|
||||
int personnelChanges(ProjectTeam teamList);
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package tech.unissense.pms.business.projectteam.service.impl;
|
||||
|
||||
import tech.unissense.pms.business.projectteam.domain.ProjectTeam;
|
||||
import tech.unissense.pms.business.projectteam.mapper.ProjectTeamMapper;
|
||||
import tech.unissense.pms.business.projectteam.service.IProjectTeamService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tech.unissense.pms.common.utils.DateUtils;
|
||||
import tech.unissense.pms.common.utils.SecurityUtils;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* (ProjectTeam)表服务实现类
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-08 14:27:23
|
||||
*/
|
||||
@Service("projectTeamService")
|
||||
public class ProjectTeamServiceImpl implements IProjectTeamService {
|
||||
@Resource
|
||||
private ProjectTeamMapper projectTeamMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param teamId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ProjectTeam queryById(Integer teamId) {
|
||||
return this.projectTeamMapper.queryById(teamId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param projectTeam 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public List<ProjectTeam> list(ProjectTeam projectTeam) {
|
||||
|
||||
return this.projectTeamMapper.list(projectTeam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param projectTeam 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ProjectTeam insert(ProjectTeam projectTeam) {
|
||||
this.projectTeamMapper.insert(projectTeam);
|
||||
return projectTeam;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param projectTeam 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ProjectTeam update(ProjectTeam projectTeam) {
|
||||
this.projectTeamMapper.update(projectTeam);
|
||||
return this.queryById(projectTeam.getTeamId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param teamId 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer teamId) {
|
||||
return this.projectTeamMapper.deleteById(teamId) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertBatch(List<ProjectTeam> projectTeamList) {
|
||||
this.projectTeamMapper.insertBatch(projectTeamList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int personnelChanges(ProjectTeam team) {
|
||||
if (team.getTeamId()!=null){
|
||||
return projectTeamMapper.update(team);
|
||||
}else {
|
||||
return projectTeamMapper.insert(team);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package tech.unissense.pms.business.projectteam.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : TeamStaticsVo
|
||||
* @Description : TODO(用一句话描述该类做什么)
|
||||
* @DATE : Created in 15:25 2024/10/9
|
||||
* <pre> Copyright: Copyright(c)2024 </pre>
|
||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||
* Modification History:
|
||||
* Date Author Version Discription
|
||||
* --------------------------------------------------------------------------
|
||||
* 2024/10/9 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||
*/
|
||||
@Data
|
||||
public class TeamStaticsVo {
|
||||
private Integer teamId;
|
||||
private String userName;
|
||||
private String postId;
|
||||
private BigDecimal workDay;
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package tech.unissense.pms.business.work.logger.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import tech.unissense.pms.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* (WorkLogger)实体类
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-09 09:51:45
|
||||
*/
|
||||
@Data
|
||||
public class WorkLogger extends BaseEntity {
|
||||
private static final long serialVersionUID = -94126267083500772L;
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Integer loggerId;
|
||||
/**
|
||||
* 填报日期
|
||||
*/
|
||||
private Date loggerDate;
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Integer projectId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 工作时长
|
||||
*/
|
||||
private Integer workTime;
|
||||
/**
|
||||
* 工作日志
|
||||
*/
|
||||
private String workContent;
|
||||
/**
|
||||
* 0 -正常; 1-补填
|
||||
*/
|
||||
private String state;
|
||||
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
private List<Integer> projectIdList;
|
||||
public BigDecimal getWorkDay(){
|
||||
if (workTime==null){
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return new BigDecimal(workTime).divide(new BigDecimal(8),1,BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package tech.unissense.pms.business.work.logger.mapper;
|
||||
|
||||
import tech.unissense.pms.business.work.logger.domain.WorkLogger;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (WorkLogger)表数据库访问层
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-09 09:51:44
|
||||
*/
|
||||
public interface WorkLoggerMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
WorkLogger queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param workLogger 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<WorkLogger> list(WorkLogger workLogger);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param workLogger 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(WorkLogger workLogger);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param workLogger 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(WorkLogger workLogger);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<WorkLogger> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<WorkLogger> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<WorkLogger> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<WorkLogger> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param workLogger 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(WorkLogger workLogger);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
List<WorkLogger> calendar(WorkLogger workLogger);
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package tech.unissense.pms.business.work.logger.service;
|
||||
|
||||
import tech.unissense.pms.business.project.domain.Project;
|
||||
import tech.unissense.pms.business.work.logger.domain.WorkLogger;
|
||||
import tech.unissense.pms.business.work.logger.vo.CalendarVo;
|
||||
import tech.unissense.pms.business.work.logger.vo.StaticsHourVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (WorkLogger)表服务接口
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-09 09:51:46
|
||||
*/
|
||||
public interface IWorkLoggerService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
WorkLogger queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param workLogger 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<WorkLogger> list(WorkLogger workLogger);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param workLogger 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
WorkLogger insert(WorkLogger workLogger);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param workLogger 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
WorkLogger update(WorkLogger workLogger);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
WorkLogger getInfo(WorkLogger workLogger);
|
||||
|
||||
List<CalendarVo> calendar(WorkLogger workLogger);
|
||||
|
||||
List<StaticsHourVo> projectStatics(List<Project> projects, String workHour);
|
||||
List<StaticsHourVo> personStatics(Integer projectId);
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
package tech.unissense.pms.business.work.logger.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tech.unissense.pms.business.project.domain.Project;
|
||||
import tech.unissense.pms.business.work.logger.domain.WorkLogger;
|
||||
import tech.unissense.pms.business.work.logger.mapper.WorkLoggerMapper;
|
||||
import tech.unissense.pms.business.work.logger.service.IWorkLoggerService;
|
||||
import tech.unissense.pms.business.work.logger.vo.CalendarVo;
|
||||
import tech.unissense.pms.business.work.logger.vo.StaticsHourVo;
|
||||
import tech.unissense.pms.common.utils.DateUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* (WorkLogger)表服务实现类
|
||||
*
|
||||
* @author ch
|
||||
* @since 2024-10-09 09:51:46
|
||||
*/
|
||||
@Service("workHourService")
|
||||
public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
||||
@Resource
|
||||
private WorkLoggerMapper workLoggerMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public WorkLogger queryById(Integer id) {
|
||||
return this.workLoggerMapper.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param workLogger 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public List<WorkLogger> list(WorkLogger workLogger) {
|
||||
|
||||
return this.workLoggerMapper.list(workLogger);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param workLogger 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public WorkLogger insert(WorkLogger workLogger) {
|
||||
this.workLoggerMapper.insert(workLogger);
|
||||
return workLogger;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param workLogger 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public WorkLogger update(WorkLogger workLogger) {
|
||||
this.workLoggerMapper.update(workLogger);
|
||||
return this.queryById(workLogger.getLoggerId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.workLoggerMapper.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkLogger getInfo(WorkLogger workLogger) {
|
||||
List<WorkLogger> list = this.workLoggerMapper.list(workLogger);
|
||||
|
||||
return CollUtil.isNotEmpty(list) ? list.get(0) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CalendarVo> calendar(WorkLogger workLogger) {
|
||||
List<WorkLogger> calendar = workLoggerMapper.calendar(workLogger);
|
||||
Map<String, WorkLogger> calendarMap = calendar.stream().collect(Collectors.toMap(
|
||||
item -> DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, item.getLoggerDate()), Function.identity(), (v1, v2) -> v1));
|
||||
|
||||
LocalDate startDate = workLogger.getStartDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate endDate = workLogger.getEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
List<CalendarVo> result = new ArrayList<>();
|
||||
for (LocalDate localDate = startDate; !localDate.isAfter(endDate); localDate = localDate.plusDays(1)) {
|
||||
CalendarVo calendarVo = new CalendarVo();
|
||||
String key = localDate.toString();
|
||||
WorkLogger temp = calendarMap.get(key);
|
||||
calendarVo.setDate(DateUtils.toDate(localDate));
|
||||
calendarVo.setState(temp != null ? temp.getState() : "-1");
|
||||
result.add(calendarVo);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaticsHourVo> projectStatics(List<Project> projects, String userId) {
|
||||
// 提取项目ID列表
|
||||
List<Integer> projectIds = projects.stream()
|
||||
.map(Project::getProjectId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 创建WorkHour对象并设置查询条件
|
||||
WorkLogger workLogger = new WorkLogger();
|
||||
workLogger.setProjectIdList(projectIds);
|
||||
workLogger.setCreateBy(userId);
|
||||
|
||||
// 查询与项目ID和用户ID相关的工时记录
|
||||
List<WorkLogger> list = workLoggerMapper.list(workLogger);
|
||||
|
||||
// 按项目ID汇总工时
|
||||
Map<Integer, BigDecimal> workHourMap = list.stream()
|
||||
.collect(Collectors.toMap(
|
||||
WorkLogger::getProjectId,
|
||||
WorkLogger::getWorkDay,
|
||||
BigDecimal::add
|
||||
));
|
||||
|
||||
// 生成StaticsHourVo列表
|
||||
return generateStaticsHourVoList(projects, workHourMap, Project::getProjectId, Project::getProjectName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaticsHourVo> personStatics(Integer projectId) {
|
||||
// 创建WorkHour对象并设置查询条件
|
||||
WorkLogger workLogger = new WorkLogger();
|
||||
workLogger.setProjectId(projectId);
|
||||
|
||||
// 查询与项目ID相关的工时记录
|
||||
List<WorkLogger> workLoggers = workLoggerMapper.list(workLogger);
|
||||
|
||||
// 按创建者(用户ID)汇总工时
|
||||
Map<String, BigDecimal> personWorkHourMap = workLoggers.stream()
|
||||
.collect(Collectors.toMap(
|
||||
WorkLogger::getCreateBy,
|
||||
WorkLogger::getWorkDay,
|
||||
BigDecimal::add
|
||||
));
|
||||
|
||||
// 生成StaticsHourVo列表
|
||||
return generateStaticsHourVoList(personWorkHourMap);
|
||||
}
|
||||
|
||||
// 泛型方法,用于生成统计工时的列表,适用于项目统计
|
||||
private <T> List<StaticsHourVo> generateStaticsHourVoList(List<T> items, Map<Integer, BigDecimal> workDayMap,
|
||||
Function<T, Integer> idExtractor, Function<T, String> nameExtractor) {
|
||||
return items.stream()
|
||||
// 对每个项目项创建一个StaticsHourVo对象
|
||||
.map(item -> createStaticsHourVo(nameExtractor.apply(item), workDayMap.getOrDefault(idExtractor.apply(item), BigDecimal.ZERO)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 用于生成统计工时的列表,适用于个人统计
|
||||
private List<StaticsHourVo> generateStaticsHourVoList(Map<String, BigDecimal> workDayMap) {
|
||||
return workDayMap.entrySet().stream()
|
||||
// 对每个用户创建一个StaticsHourVo对象
|
||||
.map(entry -> createStaticsHourVo(entry.getKey(), entry.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 创建StaticsHourVo对象,计算工时并格式化为字符串
|
||||
private StaticsHourVo createStaticsHourVo(String name, BigDecimal workDay) {
|
||||
StaticsHourVo vo = new StaticsHourVo();
|
||||
vo.setName(name);
|
||||
// 将总工时除以8,表示为工作日,并保留两位小数
|
||||
vo.setWorkDay(workDay);
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package tech.unissense.pms.business.work.logger.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : CalendarVo
|
||||
* @Description : TODO(用一句话描述该类做什么)
|
||||
* @DATE : Created in 11:40 2024/10/9
|
||||
* <pre> Copyright: Copyright(c)2024 </pre>
|
||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||
* Modification History:
|
||||
* Date Author Version Discription
|
||||
* --------------------------------------------------------------------------
|
||||
* 2024/10/9 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||
*/
|
||||
@Data
|
||||
public class CalendarVo {
|
||||
private Date date;
|
||||
|
||||
private String state;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package tech.unissense.pms.business.work.logger.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : CalendarVo
|
||||
* @Description : TODO(用一句话描述该类做什么)
|
||||
* @DATE : Created in 11:40 2024/10/9
|
||||
* <pre> Copyright: Copyright(c)2024 </pre>
|
||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||
* Modification History:
|
||||
* Date Author Version Discription
|
||||
* --------------------------------------------------------------------------
|
||||
* 2024/10/9 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||
*/
|
||||
@Data
|
||||
public class StaticsHourVo {
|
||||
private String name;
|
||||
|
||||
private BigDecimal workDay;
|
||||
}
|
|
@ -0,0 +1,279 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="tech.unissense.pms.business.project.mapper.ProjectMapper">
|
||||
|
||||
<resultMap type="tech.unissense.pms.business.project.domain.Project" id="ProjectMap">
|
||||
<result property="projectId" column="project_id" jdbcType="INTEGER"/>
|
||||
<result property="tenantId" column="tenant_id" jdbcType="INTEGER"/>
|
||||
<result property="projectName" column="project_name" jdbcType="VARCHAR"/>
|
||||
<result property="projectCode" column="project_code" jdbcType="VARCHAR"/>
|
||||
<result property="projectLeader" column="project_leader" jdbcType="VARCHAR"/>
|
||||
<result property="projectLeaderName" column="project_leader_name" jdbcType="VARCHAR"/>
|
||||
<result property="startDate" column="start_date" jdbcType="TIMESTAMP"/>
|
||||
<result property="endDate" column="end_date" jdbcType="TIMESTAMP"/>
|
||||
<result property="budgetDate" column="budget_date" jdbcType="INTEGER"/>
|
||||
<result property="state" column="state" jdbcType="VARCHAR"/>
|
||||
<result property="projectState" column="project_state" jdbcType="VARCHAR"/>
|
||||
<result property="createBy" column="create_by" jdbcType="INTEGER"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="INTEGER"/>
|
||||
<result property="updateByName" column="update_by_name" jdbcType="VARCHAR"/>
|
||||
<result property="createByName" column="create_by_name" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="teamNum" column="team_num" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
<sql id="base_query">
|
||||
select project_id,
|
||||
tenant_id,
|
||||
project_name,
|
||||
project_code,
|
||||
project_leader,
|
||||
start_date,
|
||||
end_date,
|
||||
budget_date,
|
||||
state,
|
||||
project_state,
|
||||
create_by,
|
||||
update_by,
|
||||
update_time,
|
||||
create_time
|
||||
from pms_project
|
||||
</sql>
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="ProjectMap">
|
||||
select project_id,
|
||||
tenant_id,
|
||||
project_name,
|
||||
project_code,
|
||||
project_leader,
|
||||
start_date,
|
||||
end_date,
|
||||
budget_date,
|
||||
state,
|
||||
project_state,
|
||||
create_by,
|
||||
update_by,
|
||||
update_time,
|
||||
create_time
|
||||
from pms_project
|
||||
where project_id = #{projectId}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="list" resultMap="ProjectMap">
|
||||
select
|
||||
t1.project_id, t1.tenant_id, t1.project_name, t1.project_code, t1.project_leader,t4.nick_name project_leader_name, t1.start_date, t1.end_date, t1.budget_date, t1.state,
|
||||
t1.project_state, t1.create_by, t1.update_by, t1.update_time, t1.create_time,t2.team_num,t3.nick_name create_by_name
|
||||
from pms_project t1 left join (select count(1) team_num,project_id from pms_project_team group by project_id) t2 on t1.project_id=t2.project_id
|
||||
left join sys_user t3 on t1.create_by=t3.user_id
|
||||
left join sys_user t4 on t1.project_leader=t4.user_id
|
||||
where state=0
|
||||
<if test="projectId != null">
|
||||
and t1.project_id = #{projectId}
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
and t1.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="projectName != null and projectName != ''">
|
||||
and t1.project_name = #{projectName}
|
||||
</if>
|
||||
<if test="projectCode != null and projectCode != ''">
|
||||
and t1.project_code = #{projectCode}
|
||||
</if>
|
||||
<if test="projectLeader != null and projectLeader != ''">
|
||||
and t1.project_leader = #{projectLeader}
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
and t1.start_date = #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
and t1.end_date = #{endDate}
|
||||
</if>
|
||||
<if test="budgetDate != null">
|
||||
and t1.budget_date = #{budgetDate}
|
||||
</if>
|
||||
<if test="state != null and state != ''">
|
||||
and t1.state = #{state}
|
||||
</if>
|
||||
<if test="projectState != null and projectState != ''">
|
||||
and t1.project_state = #{projectState}
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
and t1.create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
and t1.update_by = #{updateBy}
|
||||
</if>
|
||||
|
||||
<if test="updateTime != null">
|
||||
and t1.update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and t1.create_time = #{createTime}
|
||||
</if>
|
||||
<if test="queryUserId != null">
|
||||
and (t1.project_id in (select project_id from pms_project_team where user_id=#{queryUserId} ))
|
||||
</if>
|
||||
${params.dataScope}
|
||||
order by start_date desc
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from pms_project
|
||||
<where>
|
||||
<if test="projectId != null">
|
||||
and project_id = #{projectId}
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
and tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="projectName != null and projectName != ''">
|
||||
and project_name = #{projectName}
|
||||
</if>
|
||||
<if test="projectCode != null and projectCode != ''">
|
||||
and project_code = #{projectCode}
|
||||
</if>
|
||||
<if test="projectLeader != null and projectLeader != ''">
|
||||
and project_leader = #{projectLeader}
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
and start_date = #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
and end_date = #{endDate}
|
||||
</if>
|
||||
<if test="budgetDate != null">
|
||||
and budget_date = #{budgetDate}
|
||||
</if>
|
||||
<if test="state != null and state != ''">
|
||||
and state = #{state}
|
||||
</if>
|
||||
<if test="projectState != null and projectState != ''">
|
||||
and project_state = #{projectState}
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="projectId" useGeneratedKeys="true">
|
||||
insert into pms_project(tenant_id, project_name, project_code, project_leader, start_date, end_date,
|
||||
budget_date, state, project_state, create_by, update_by,
|
||||
update_time, create_time)
|
||||
values (#{tenantId}, #{projectName}, #{projectCode}, #{projectLeader}, #{startDate}, #{endDate}, #{budgetDate},
|
||||
#{state}, #{projectState}, #{createBy}, #{updateBy}, #{updateTime},
|
||||
#{createTime})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="projectId" useGeneratedKeys="true">
|
||||
insert into pms_project(tenant_id, project_name, project_code, project_leader, start_date, end_date,
|
||||
budget_date, state, project_state, create_by, update_by, update_time,
|
||||
create_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.tenantId}, #{entity.projectName}, #{entity.projectCode}, #{entity.projectLeader},
|
||||
#{entity.startDate}, #{entity.endDate}, #{entity.budgetDate}, #{entity.state}, #{entity.projectState},
|
||||
#{entity.createBy}, #{entity.updateBy},
|
||||
#{entity.updateTime}, #{entity.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="projectId" useGeneratedKeys="true">
|
||||
insert into pms_project(tenant_id, project_name, project_code, project_leader, start_date, end_date,
|
||||
budget_date, state, project_state, create_by, update_by, update_time,
|
||||
create_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.tenantId}, #{entity.projectName}, #{entity.projectCode}, #{entity.projectLeader},
|
||||
#{entity.startDate}, #{entity.endDate}, #{entity.budgetDate}, #{entity.state}, #{entity.projectState},
|
||||
#{entity.createBy}, #{entity.updateBy},
|
||||
#{entity.updateTime}, #{entity.createTime})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
tenant_id = values(tenant_id),
|
||||
project_name = values(project_name),
|
||||
project_code = values(project_code),
|
||||
project_leader = values(project_leader),
|
||||
start_date = values(start_date),
|
||||
end_date = values(end_date),
|
||||
budget_date = values(budget_date),
|
||||
state = values(state),
|
||||
project_state = values(project_state),
|
||||
create_by = values(create_by),
|
||||
update_by = values(update_by),
|
||||
|
||||
update_time = values(update_time),
|
||||
create_time = values(create_time)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update pms_project
|
||||
<set>
|
||||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId},
|
||||
</if>
|
||||
<if test="projectName != null and projectName != ''">
|
||||
project_name = #{projectName},
|
||||
</if>
|
||||
<if test="projectCode != null and projectCode != ''">
|
||||
project_code = #{projectCode},
|
||||
</if>
|
||||
<if test="projectLeader != null and projectLeader != ''">
|
||||
project_leader = #{projectLeader},
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
start_date = #{startDate},
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
end_date = #{endDate},
|
||||
</if>
|
||||
<if test="budgetDate != null">
|
||||
budget_date = #{budgetDate},
|
||||
</if>
|
||||
<if test="state != null and state != ''">
|
||||
state = #{state},
|
||||
</if>
|
||||
<if test="projectState != null and projectState != ''">
|
||||
project_state = #{projectState},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
</set>
|
||||
where project_id = #{projectId}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from pms_project
|
||||
where project_id = #{projectId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="tech.unissense.pms.business.projectteam.mapper.ProjectTeamMapper">
|
||||
|
||||
<resultMap type="tech.unissense.pms.business.projectteam.domain.ProjectTeam" id="ProjectTeamMap">
|
||||
<result property="projectId" column="project_id" jdbcType="INTEGER"/>
|
||||
<result property="teamId" column="team_id" jdbcType="INTEGER"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="userName" column="user_name" jdbcType="INTEGER"/>
|
||||
<result property="postId" column="post_id" jdbcType="VARCHAR"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
<sql id="base_query">
|
||||
select project_id,
|
||||
team_id,
|
||||
user_id,
|
||||
post_id,
|
||||
create_by,
|
||||
update_by,
|
||||
update_time,
|
||||
create_time
|
||||
from pms_project_team
|
||||
</sql>
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="ProjectTeamMap">
|
||||
select project_id,
|
||||
team_id,
|
||||
user_id,
|
||||
post_id,
|
||||
create_by,
|
||||
update_by,
|
||||
update_time,
|
||||
create_time
|
||||
from pms_project_team
|
||||
where team_id = #{teamId}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="list" resultMap="ProjectTeamMap">
|
||||
select
|
||||
t1.project_id, t1.team_id, t1.user_id, t1.post_id, t1.create_by, t1.update_by, t1.update_time, t1.create_time,
|
||||
t2.nick_name as user_name
|
||||
from pms_project_team t1
|
||||
left join sys_user t2 on t1.user_id=t2.user_id
|
||||
<where>
|
||||
<if test="projectId != null">
|
||||
and project_id = #{projectId}
|
||||
</if>
|
||||
<if test="teamId != null">
|
||||
and team_id = #{teamId}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="postId != null and postId != ''">
|
||||
and post_id = #{postId}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from pms_project_team
|
||||
<where>
|
||||
<if test="projectId != null">
|
||||
and project_id = #{projectId}
|
||||
</if>
|
||||
<if test="teamId != null">
|
||||
and team_id = #{teamId}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="postId != null and postId != ''">
|
||||
and post_id = #{postId}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="teamId" useGeneratedKeys="true">
|
||||
insert into pms_project_team(project_id, user_id, post_id, create_by, update_by, update_time, create_time)
|
||||
values (#{projectId}, #{userId}, #{postId}, #{createBy}, #{updateBy}, #{updateTime}, #{createTime})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="teamId" useGeneratedKeys="true">
|
||||
insert into pms_project_team(project_id, user_id, post_id, create_by, update_by, update_time, create_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.projectId}, #{entity.userId}, #{entity.postId}, #{entity.createBy}, #{entity.updateBy},
|
||||
#{entity.updateTime}, #{entity.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="teamId" useGeneratedKeys="true">
|
||||
insert into pms_project_team(project_id, user_id, post_id, create_by, update_by, update_time, create_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.projectId}, #{entity.userId}, #{entity.postId}, #{entity.createBy}, #{entity.updateBy},
|
||||
#{entity.updateTime}, #{entity.createTime})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
project_id = values(project_id),
|
||||
user_id = values(user_id),
|
||||
post_id = values(post_id),
|
||||
update_by = values(update_by),
|
||||
update_time = values(update_time),
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update pms_project_team
|
||||
<set>
|
||||
<if test="projectId != null">
|
||||
project_id = #{projectId},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="postId != null and postId != ''">
|
||||
post_id = #{postId},
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
</set>
|
||||
where team_id = #{teamId}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from pms_project_team
|
||||
where team_id = #{teamId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="tech.unissense.pms.business.work.logger.mapper.WorkLoggerMapper">
|
||||
|
||||
<resultMap type="tech.unissense.pms.business.work.logger.domain.WorkLogger" id="WorkLoggerMap">
|
||||
<result property="loggerId" column="logger_id" jdbcType="INTEGER"/>
|
||||
<result property="loggerDate" column="logger_date" jdbcType="TIMESTAMP"/>
|
||||
<result property="projectId" column="project_id" jdbcType="INTEGER"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="workTime" column="work_time" jdbcType="INTEGER"/>
|
||||
<result property="workContent" column="work_content" jdbcType="VARCHAR"/>
|
||||
<result property="state" column="state" jdbcType="VARCHAR"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
<sql id="base_query">
|
||||
select logger_id,
|
||||
logger_date,
|
||||
project_id,
|
||||
user_id,
|
||||
work_time,
|
||||
work_content,
|
||||
state,
|
||||
create_by,
|
||||
update_by,
|
||||
update_time,
|
||||
create_time
|
||||
from pms_work_logger
|
||||
</sql>
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="WorkLoggerMap">
|
||||
select logger_id,
|
||||
logger_date,
|
||||
project_id,
|
||||
user_id,
|
||||
work_time,
|
||||
work_content,
|
||||
state,
|
||||
create_by,
|
||||
update_by,
|
||||
update_time,
|
||||
create_time
|
||||
from pms_work_logger
|
||||
where logger_id = #{loggerId}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="list" resultMap="WorkLoggerMap">
|
||||
select
|
||||
logger_id, logger_date, project_id, user_id, work_time, work_content, state, create_by, update_by, update_time,
|
||||
create_time
|
||||
from pms_work_logger
|
||||
<where>
|
||||
<if test="loggerId != null">
|
||||
and logger_id = #{loggerId}
|
||||
</if>
|
||||
<if test="loggerDate != null">
|
||||
and logger_date = #{loggerDate}
|
||||
</if>
|
||||
<if test="startDate != null or endDate!=null">
|
||||
<choose>
|
||||
<when test="startDate != null ">
|
||||
and logger_date <![CDATA[>=]]> #{startDate}
|
||||
</when>
|
||||
<when test="endDate != null">
|
||||
and logger_date <![CDATA[<=]]> #{endDate}
|
||||
</when>
|
||||
<otherwise>
|
||||
and logger_date between #{startDate} and #{endDate}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="projectId != null">
|
||||
and project_id = #{projectId}
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size>0">
|
||||
and project_id in
|
||||
<foreach collection="projectIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="workTime != null">
|
||||
and work_time = #{workTime}
|
||||
</if>
|
||||
<if test="workContent != null and workContent != ''">
|
||||
and work_content = #{workContent}
|
||||
</if>
|
||||
<if test="state != null and state != ''">
|
||||
and state = #{state}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from pms_work_logger
|
||||
<where>
|
||||
<if test="loggerId != null">
|
||||
and logger_id = #{loggerId}
|
||||
</if>
|
||||
<if test="loggerDate != null">
|
||||
and logger_date = #{loggerDate}
|
||||
</if>
|
||||
<if test="projectId != null">
|
||||
and project_id = #{projectId}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="workTime != null">
|
||||
and work_time = #{workTime}
|
||||
</if>
|
||||
<if test="workContent != null and workContent != ''">
|
||||
and work_content = #{workContent}
|
||||
</if>
|
||||
<if test="state != null and state != ''">
|
||||
and state = #{state}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="loggerId" useGeneratedKeys="true">
|
||||
insert into pms_work_logger(logger_date, project_id, user_id, work_time, work_content, state, create_by,
|
||||
update_by, update_time, create_time)
|
||||
values (#{loggerDate}, #{projectId}, #{userId}, #{workTime}, #{workContent}, #{state}, #{createBy}, #{updateBy},
|
||||
#{updateTime}, #{createTime})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="loggerId" useGeneratedKeys="true">
|
||||
insert into pms_work_logger(logger_date, project_id, user_id, work_time, work_content, state, create_by,
|
||||
update_by, update_time, create_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.loggerDate}, #{entity.projectId}, #{entity.userId}, #{entity.workTime}, #{entity.workContent},
|
||||
#{entity.state}, #{entity.createBy}, #{entity.updateBy}, #{entity.updateTime}, #{entity.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="loggerId" useGeneratedKeys="true">
|
||||
insert into pms_work_logger(logger_date, project_id, user_id, work_time, work_content, state, create_by,
|
||||
update_by, update_time, create_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.loggerDate}, #{entity.projectId}, #{entity.userId}, #{entity.workTime}, #{entity.workContent},
|
||||
#{entity.state}, #{entity.createBy}, #{entity.updateBy}, #{entity.updateTime}, #{entity.createTime})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
logger_date = values(logger_date),
|
||||
project_id = values(project_id),
|
||||
user_id = values(user_id),
|
||||
work_time = values(work_time),
|
||||
work_content = values(work_content),
|
||||
state = values(state),
|
||||
create_by = values(create_by),
|
||||
update_by = values(update_by),
|
||||
update_time = values(update_time),
|
||||
create_time = values(create_time)
|
||||
</insert>
|
||||
<select id="calendar" resultMap="WorkLoggerMap">
|
||||
<include refid="base_query" />
|
||||
where project_id = #{projectId}
|
||||
and report_date between #{startDate} and #{endDate}
|
||||
and user_id=#{userId}
|
||||
</select>
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update pms_work_logger
|
||||
<set>
|
||||
<if test="loggerDate != null">
|
||||
logger_date = #{loggerDate},
|
||||
</if>
|
||||
<if test="projectId != null">
|
||||
project_id = #{projectId},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="workTime != null">
|
||||
work_time = #{workTime},
|
||||
</if>
|
||||
<if test="workContent != null and workContent != ''">
|
||||
work_content = #{workContent},
|
||||
</if>
|
||||
<if test="state != null and state != ''">
|
||||
state = #{state},
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
</set>
|
||||
where logger_id = #{loggerId}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from pms_work_logger
|
||||
where logger_id = #{loggerId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -69,6 +69,7 @@ public class SysUser extends BaseEntity
|
|||
/** 最后登录时间 */
|
||||
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||
private Date loginDate;
|
||||
private Integer tenantId;
|
||||
|
||||
/** 部门对象 */
|
||||
@Excels({
|
||||
|
@ -94,6 +95,14 @@ public class SysUser extends BaseEntity
|
|||
|
||||
}
|
||||
|
||||
public Integer getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(Integer tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public SysUser(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
|
|
|
@ -25,6 +25,10 @@ public class LoginUser implements UserDetails
|
|||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 用户唯一标识
|
||||
|
@ -71,6 +75,14 @@ public class LoginUser implements UserDetails
|
|||
*/
|
||||
private SysUser user;
|
||||
|
||||
public Long getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(Long tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public LoginUser()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package tech.unissense.pms.common.core.page;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import tech.unissense.pms.common.core.text.Convert;
|
||||
import tech.unissense.pms.common.utils.ServletUtils;
|
||||
import tech.unissense.pms.common.utils.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 表格数据处理
|
||||
|
@ -40,11 +45,28 @@ public class TableSupport
|
|||
*/
|
||||
public static PageDomain getPageDomain()
|
||||
{
|
||||
String body = null;
|
||||
try {
|
||||
body = new String(IOUtils.toByteArray((ServletUtils.getRequest().getInputStream()))).replaceAll("\t|\n|\r", "");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject paramMap = StringUtils.isNotBlank(body)?JSONObject.parseObject(body):new JSONObject();
|
||||
|
||||
Integer pageSize = ServletUtils.getParameterToInt(PAGE_SIZE);
|
||||
Integer pageNum = ServletUtils.getParameterToInt(PAGE_NUM);
|
||||
if(paramMap.getIntValue(PAGE_NUM) > 0){
|
||||
pageNum = paramMap.getIntValue(PAGE_NUM);
|
||||
}
|
||||
if(paramMap.getIntValue(PAGE_SIZE) > 0){
|
||||
pageSize = paramMap.getIntValue(PAGE_SIZE);
|
||||
}
|
||||
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
|
||||
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
|
||||
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
|
||||
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
|
||||
pageDomain.setPageNum(pageNum);
|
||||
pageDomain.setPageSize(pageSize);
|
||||
pageDomain.setOrderByColumn(StringUtils.isNotBlank(paramMap.getString(ORDER_BY_COLUMN))?paramMap.getString(ORDER_BY_COLUMN):ServletUtils.getParameter(ORDER_BY_COLUMN));
|
||||
pageDomain.setIsAsc(StringUtils.isNotBlank(paramMap.getString(IS_ASC))?paramMap.getString(IS_ASC):ServletUtils.getParameter(IS_ASC));
|
||||
pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
|
||||
return pageDomain;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class CaptchaConfig
|
|||
// KAPTCHA_SESSION_KEY
|
||||
properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath");
|
||||
// 验证码文本生成器
|
||||
properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "tech.unissense.framework.config.KaptchaTextCreator");
|
||||
properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "tech.unissense.pms.framework.config.KaptchaTextCreator");
|
||||
// 验证码文本字符间距 默认为2
|
||||
properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3");
|
||||
// 验证码文本字符长度 默认为5
|
||||
|
|
14
pom.xml
14
pom.xml
|
@ -8,7 +8,7 @@
|
|||
<artifactId>pms</artifactId>
|
||||
<version>3.8.8</version>
|
||||
|
||||
<name>ruoyi</name>
|
||||
<name>pms</name>
|
||||
<url>http://www.ruoyi.vip</url>
|
||||
<description>若依管理系统</description>
|
||||
|
||||
|
@ -54,7 +54,11 @@
|
|||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.27</version>
|
||||
</dependency>
|
||||
<!-- SpringBoot的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -167,6 +171,11 @@
|
|||
<artifactId>pms-framework</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.unissense</groupId>
|
||||
<artifactId>pms-business</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
|
@ -192,6 +201,7 @@
|
|||
<module>pms-quartz</module>
|
||||
<module>pms-generator</module>
|
||||
<module>pms-common</module>
|
||||
<module>pms-business</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
|
Loading…
Reference in New Issue