feat:优化问题
parent
e4e718d4e8
commit
e5c3868c27
|
@ -95,7 +95,7 @@ public class ProjectController extends BaseController
|
||||||
@PostMapping("/team")
|
@PostMapping("/team")
|
||||||
public AjaxResult personnelChanges(@RequestBody ProjectTeam team)
|
public AjaxResult personnelChanges(@RequestBody ProjectTeam team)
|
||||||
{
|
{
|
||||||
return toAjax(teamService.personnelChanges(team));
|
return success(teamService.personnelChanges(team));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 删除项目
|
* 删除项目
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Date;
|
||||||
* @author : ch
|
* @author : ch
|
||||||
* @version : 1.0
|
* @version : 1.0
|
||||||
* @ClassName : ProjectQueryDto
|
* @ClassName : ProjectQueryDto
|
||||||
* @Description : TODO(用一句话描述该类做什么)
|
* @Description : 请求参数
|
||||||
* @DATE : Created in 14:51 2024/10/10
|
* @DATE : Created in 14:51 2024/10/10
|
||||||
* <pre> Copyright: Copyright(c)2024 </pre>
|
* <pre> Copyright: Copyright(c)2024 </pre>
|
||||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class ProjectServiceImpl implements IProjectService {
|
||||||
}
|
}
|
||||||
if (user.getRoles().stream().anyMatch(item-> "企业管理员".equals(item.getRoleName())|| "公司领导".equals(item.getRoleName()))){
|
if (user.getRoles().stream().anyMatch(item-> "企业管理员".equals(item.getRoleName())|| "公司领导".equals(item.getRoleName()))){
|
||||||
|
|
||||||
}else if (user.getRoles().stream().anyMatch(item -> "项目管理员".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={})");
|
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()));
|
project.getParams().put("dataScope", StringUtils.format(sql.toString(), user.getUserId(), user.getUserId()));
|
||||||
}else{
|
}else{
|
||||||
|
@ -160,6 +160,7 @@ public class ProjectServiceImpl implements IProjectService {
|
||||||
TeamStaticsVo teamStaticsVo = new TeamStaticsVo();
|
TeamStaticsVo teamStaticsVo = new TeamStaticsVo();
|
||||||
teamStaticsVo.setTeamId(item.getTeamId());
|
teamStaticsVo.setTeamId(item.getTeamId());
|
||||||
teamStaticsVo.setUserName(item.getUserName());
|
teamStaticsVo.setUserName(item.getUserName());
|
||||||
|
teamStaticsVo.setUserId(item.getUserId());
|
||||||
teamStaticsVo.setPostId(item.getPostId());
|
teamStaticsVo.setPostId(item.getPostId());
|
||||||
teamStaticsVo.setWorkDay(workDay);
|
teamStaticsVo.setWorkDay(workDay);
|
||||||
return teamStaticsVo;
|
return teamStaticsVo;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||||
* @author : ch
|
* @author : ch
|
||||||
* @version : 1.0
|
* @version : 1.0
|
||||||
* @ClassName : ProjectExecutionVo
|
* @ClassName : ProjectExecutionVo
|
||||||
* @Description : TODO(用一句话描述该类做什么)
|
* @Description : 项目执行情况
|
||||||
* @DATE : Created in 11:20 2024/10/10
|
* @DATE : Created in 11:20 2024/10/10
|
||||||
* <pre> Copyright: Copyright(c)2024 </pre>
|
* <pre> Copyright: Copyright(c)2024 </pre>
|
||||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||||
|
|
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||||
* @author : ch
|
* @author : ch
|
||||||
* @version : 1.0
|
* @version : 1.0
|
||||||
* @ClassName : ProjectExecutionVo
|
* @ClassName : ProjectExecutionVo
|
||||||
* @Description : TODO(用一句话描述该类做什么)
|
* @Description : 项目执行vo
|
||||||
* @DATE : Created in 11:20 2024/10/10
|
* @DATE : Created in 11:20 2024/10/10
|
||||||
* <pre> Copyright: Copyright(c)2024 </pre>
|
* <pre> Copyright: Copyright(c)2024 </pre>
|
||||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||||
|
|
|
@ -55,5 +55,5 @@ public interface IProjectTeamService {
|
||||||
|
|
||||||
void insertBatch(List<ProjectTeam> projectTeamList);
|
void insertBatch(List<ProjectTeam> projectTeamList);
|
||||||
|
|
||||||
int personnelChanges(ProjectTeam teamList);
|
ProjectTeam personnelChanges(ProjectTeam teamList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,11 +86,12 @@ public class ProjectTeamServiceImpl implements IProjectTeamService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int personnelChanges(ProjectTeam team) {
|
public ProjectTeam personnelChanges(ProjectTeam team) {
|
||||||
if (team.getTeamId()!=null){
|
if (team.getTeamId()!=null){
|
||||||
return projectTeamMapper.update(team);
|
projectTeamMapper.update(team);
|
||||||
}else {
|
}else {
|
||||||
return projectTeamMapper.insert(team);
|
projectTeamMapper.insert(team);
|
||||||
}
|
}
|
||||||
|
return team;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.math.BigDecimal;
|
||||||
* @author : ch
|
* @author : ch
|
||||||
* @version : 1.0
|
* @version : 1.0
|
||||||
* @ClassName : TeamStaticsVo
|
* @ClassName : TeamStaticsVo
|
||||||
* @Description : TODO(用一句话描述该类做什么)
|
* @Description : 项目人员工时
|
||||||
* @DATE : Created in 15:25 2024/10/9
|
* @DATE : Created in 15:25 2024/10/9
|
||||||
* <pre> Copyright: Copyright(c)2024 </pre>
|
* <pre> Copyright: Copyright(c)2024 </pre>
|
||||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||||
|
@ -21,6 +21,7 @@ import java.math.BigDecimal;
|
||||||
public class TeamStaticsVo {
|
public class TeamStaticsVo {
|
||||||
private Integer teamId;
|
private Integer teamId;
|
||||||
private String userName;
|
private String userName;
|
||||||
|
private Integer userId;
|
||||||
private String postId;
|
private String postId;
|
||||||
private BigDecimal workDay;
|
private BigDecimal workDay;
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
||||||
BigDecimal::add
|
BigDecimal::add
|
||||||
));
|
));
|
||||||
|
|
||||||
// 生成StaticsHourVo列表
|
|
||||||
return generateStaticsHourVoList(projects, workHourMap, Project::getProjectId, Project::getProjectName);
|
return generateStaticsHourVoList(projects, workHourMap, Project::getProjectId, Project::getProjectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,8 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
||||||
Function<T, Integer> idExtractor, Function<T, String> nameExtractor) {
|
Function<T, Integer> idExtractor, Function<T, String> nameExtractor) {
|
||||||
return items.stream()
|
return items.stream()
|
||||||
// 对每个项目项创建一个StaticsHourVo对象
|
// 对每个项目项创建一个StaticsHourVo对象
|
||||||
.map(item -> createStaticsHourVo(nameExtractor.apply(item), workDayMap.getOrDefault(idExtractor.apply(item), BigDecimal.ZERO)))
|
.map(item -> createStaticsHourVo(nameExtractor.apply(item), workDayMap.getOrDefault(idExtractor.apply(item), BigDecimal.ZERO)
|
||||||
|
,idExtractor.apply(item)))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,13 +187,14 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
||||||
private List<StaticsHourVo> generateStaticsHourVoList(Map<String, BigDecimal> workDayMap) {
|
private List<StaticsHourVo> generateStaticsHourVoList(Map<String, BigDecimal> workDayMap) {
|
||||||
return workDayMap.entrySet().stream()
|
return workDayMap.entrySet().stream()
|
||||||
// 对每个用户创建一个StaticsHourVo对象
|
// 对每个用户创建一个StaticsHourVo对象
|
||||||
.map(entry -> createStaticsHourVo(entry.getKey(), entry.getValue()))
|
.map(entry -> createStaticsHourVo(entry.getKey(), entry.getValue(),null))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建StaticsHourVo对象,计算工时并格式化为字符串
|
// 创建StaticsHourVo对象,计算工时并格式化为字符串
|
||||||
private StaticsHourVo createStaticsHourVo(String name, BigDecimal workDay) {
|
private StaticsHourVo createStaticsHourVo(String name, BigDecimal workDay,Integer projectId) {
|
||||||
StaticsHourVo vo = new StaticsHourVo();
|
StaticsHourVo vo = new StaticsHourVo();
|
||||||
|
vo.setProjectId(projectId);
|
||||||
vo.setName(name);
|
vo.setName(name);
|
||||||
// 将总工时除以8,表示为工作日,并保留两位小数
|
// 将总工时除以8,表示为工作日,并保留两位小数
|
||||||
vo.setWorkDay(workDay);
|
vo.setWorkDay(workDay);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Date;
|
||||||
* @author : ch
|
* @author : ch
|
||||||
* @version : 1.0
|
* @version : 1.0
|
||||||
* @ClassName : CalendarVo
|
* @ClassName : CalendarVo
|
||||||
* @Description : TODO(用一句话描述该类做什么)
|
* @Description : 工作日历显示
|
||||||
* @DATE : Created in 11:40 2024/10/9
|
* @DATE : Created in 11:40 2024/10/9
|
||||||
* <pre> Copyright: Copyright(c)2024 </pre>
|
* <pre> Copyright: Copyright(c)2024 </pre>
|
||||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.math.BigDecimal;
|
||||||
* @author : ch
|
* @author : ch
|
||||||
* @version : 1.0
|
* @version : 1.0
|
||||||
* @ClassName : CalendarVo
|
* @ClassName : CalendarVo
|
||||||
* @Description : TODO(用一句话描述该类做什么)
|
* @Description : 工时统计
|
||||||
* @DATE : Created in 11:40 2024/10/9
|
* @DATE : Created in 11:40 2024/10/9
|
||||||
* <pre> Copyright: Copyright(c)2024 </pre>
|
* <pre> Copyright: Copyright(c)2024 </pre>
|
||||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||||
|
@ -19,6 +19,7 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class StaticsHourVo {
|
public class StaticsHourVo {
|
||||||
|
private Integer projectId;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private BigDecimal workDay;
|
private BigDecimal workDay;
|
||||||
|
|
|
@ -191,7 +191,7 @@
|
||||||
<select id="calendar" resultMap="WorkLoggerMap">
|
<select id="calendar" resultMap="WorkLoggerMap">
|
||||||
<include refid="base_query" />
|
<include refid="base_query" />
|
||||||
where project_id = #{projectId}
|
where project_id = #{projectId}
|
||||||
and report_date between #{startDate} and #{endDate}
|
and logger_date between #{startDate} and #{endDate}
|
||||||
and user_id=#{userId}
|
and user_id=#{userId}
|
||||||
</select>
|
</select>
|
||||||
<select id="listUser" resultMap="WorkLoggerMap">
|
<select id="listUser" resultMap="WorkLoggerMap">
|
||||||
|
|
|
@ -170,4 +170,7 @@ public class Constants
|
||||||
*/
|
*/
|
||||||
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
||||||
"org.springframework", "org.apache", "tech.unissense.common.utils.file", "tech.unissense.common.config", "tech.unissense.generator" };
|
"org.springframework", "org.apache", "tech.unissense.common.utils.file", "tech.unissense.common.config", "tech.unissense.generator" };
|
||||||
|
|
||||||
|
|
||||||
|
public static final String TENANT_ID="tenant_id";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue