任务进度bug修复
This commit is contained in:
parent
29058b3094
commit
68822a580c
@ -90,6 +90,8 @@ public class AmmeterRecordDetailServiceImpl extends ServiceImpl<AmmeterRecordDet
|
||||
|
||||
@Override
|
||||
public CountAmmeterRecordDetailVo countAmmeterRecordDetail(Map<String, Object> map) {
|
||||
String projectSn = MapUtils.getString(map, "projectSn");
|
||||
String ammeterNo = MapUtils.getString(map, "ammeterNo");
|
||||
CountAmmeterRecordDetailVo vo = new CountAmmeterRecordDetailVo();
|
||||
String today1 = DateUtil.today();
|
||||
map.put("startTime", today1);
|
||||
@ -108,6 +110,8 @@ public class AmmeterRecordDetailServiceImpl extends ServiceImpl<AmmeterRecordDet
|
||||
vo.setThisMonthElectricityConsumption(thisMonth);
|
||||
vo.setMonthOnMonthElectricityConsumptionThisMonth(NumberUtils.div(thisMonth - lastMonth, lastMonth, 2));
|
||||
vo.setTodayMonthOnMonthElectricityConsumption(NumberUtils.div(today - yesterday, yesterday, 2));
|
||||
AmmeterRecordDetail ard = baseMapper.selectOne(new LambdaQueryWrapper<AmmeterRecordDetail>().eq(AmmeterRecordDetail::getAmmeterNo, ammeterNo).orderByDesc(AmmeterRecordDetail::getId).last("limit 1"));
|
||||
vo.setDegree(ard != null ? ard.getDegree().doubleValue() : 0.0);
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
@ -1,39 +1,35 @@
|
||||
package com.zhgd.xmgl.modules.taskprogress.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.jeecg.common.util.oConvertUtils;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressContent;
|
||||
import com.zhgd.xmgl.modules.taskprogress.service.ITaskProgressContentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.jeecg.common.util.oConvertUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressContent;
|
||||
import com.zhgd.xmgl.modules.taskprogress.service.ITaskProgressContentService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
@ -83,7 +79,6 @@ public class TaskProgressContentController {
|
||||
*/
|
||||
@ApiOperation(value = "列表查询任务进度甘特图-内容信息", notes = "列表查询任务进度甘特图-内容信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "taskProgressId", value = "任务进度甘特图id", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@GetMapping(value = "/list")
|
||||
@ -92,6 +87,16 @@ public class TaskProgressContentController {
|
||||
return Result.success(taskProgressContentService.queryList(taskProgressContent, req));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询最新任务进度甘特图-内容信息", notes = "查询最新任务进度甘特图-内容信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "taskProgressId", value = "任务进度甘特图id", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@GetMapping(value = "/queryNewestOne")
|
||||
public Result<TaskProgressContent> queryNewestOne(TaskProgressContent taskProgressContent,
|
||||
HttpServletRequest req) {
|
||||
return Result.success(taskProgressContentService.queryNewestOne(taskProgressContent, req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
|
||||
@ -140,6 +140,19 @@ public class TaskProgress implements Serializable {
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 开始预警:1提前2正常3逾期
|
||||
*/
|
||||
@Excel(name = "开始预警", width = 15, replace = {"提前_1", "正常_2", "逾期_3"})
|
||||
@ApiModelProperty(value = "开始预警:1提前2正常3逾期")
|
||||
private java.lang.Integer beginWarning;
|
||||
/**
|
||||
* 结束预警:1提前2正常3逾期
|
||||
*/
|
||||
@Excel(name = "结束预警", width = 15, replace = {"提前_1", "正常_2", "逾期_3"})
|
||||
@ApiModelProperty(value = "结束预警:1提前2正常3逾期")
|
||||
private java.lang.Integer endWarning;
|
||||
|
||||
/**
|
||||
* 负责人名称
|
||||
*/
|
||||
@ -155,19 +168,4 @@ public class TaskProgress implements Serializable {
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "任务进度甘特图-材料类型数量")
|
||||
private List<TaskProgressMaterialRel> relList;
|
||||
|
||||
/**
|
||||
* 开始预警:1提前2正常3逾期
|
||||
*/
|
||||
@Excel(name = "开始预警", width = 15, replace = {"提前_1", "正常_2", "逾期_3"})
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "开始预警:1提前2正常3逾期")
|
||||
private java.lang.Integer beginWarning;
|
||||
/**
|
||||
* 结束预警:1提前2正常3逾期
|
||||
*/
|
||||
@Excel(name = "结束预警", width = 15, replace = {"提前_1", "正常_2", "逾期_3"})
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "结束预警:1提前2正常3逾期")
|
||||
private java.lang.Integer endWarning;
|
||||
}
|
||||
|
||||
@ -88,6 +88,13 @@ public class TaskProgressContent implements Serializable {
|
||||
@ApiModelProperty(value = "所属项目SN")
|
||||
private java.lang.String projectSn;
|
||||
|
||||
@ApiModelProperty(value = "上报人id")
|
||||
private java.lang.Long uploadUserId;
|
||||
|
||||
@ApiModelProperty(value = "上报人名称")
|
||||
private java.lang.String uploadUserName;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("上报进度的材料信息列表,如:{\"taskProgressMaterialTypeId\":100,\"actualUsage\":20.01},其中id是任务进度甘特图-材料类型的id")
|
||||
private List<TaskProgressMaterialRel> typeDataList;
|
||||
|
||||
@ -88,4 +88,7 @@ public class TaskProgressMaterialRel implements Serializable {
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "类型:1工种2材料3设备")
|
||||
private java.lang.Integer type;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "单位")
|
||||
private java.lang.String unit;
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<mapper namespace="com.zhgd.xmgl.modules.taskprogress.mapper.TaskProgressMaterialRelMapper">
|
||||
<select id="queryDetailListByContentIds"
|
||||
resultType="com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressMaterialRel">
|
||||
select tpmr.*, tpmt.type, tpmt.name
|
||||
select tpmr.*, tpmt.type, tpmt.name,tpmt.unit
|
||||
from task_progress_material_rel tpmr
|
||||
join task_progress_material_type tpmt on tpmt.id = tpmr.task_progress_material_type_id
|
||||
WHERE tpmr.task_progress_content_id in
|
||||
|
||||
@ -17,4 +17,6 @@ public interface ITaskProgressContentService extends IService<TaskProgressConten
|
||||
void add(TaskProgressContent taskProgressContent);
|
||||
|
||||
List<TaskProgressContent> queryList(TaskProgressContent taskProgressContent, HttpServletRequest req);
|
||||
|
||||
TaskProgressContent queryNewestOne(TaskProgressContent taskProgressContent, HttpServletRequest req);
|
||||
}
|
||||
|
||||
@ -4,18 +4,23 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgress;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressContent;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressMaterialRel;
|
||||
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressMaterialType;
|
||||
import com.zhgd.xmgl.modules.taskprogress.mapper.TaskProgressContentMapper;
|
||||
import com.zhgd.xmgl.modules.taskprogress.mapper.TaskProgressMapper;
|
||||
import com.zhgd.xmgl.modules.taskprogress.mapper.TaskProgressMaterialRelMapper;
|
||||
import com.zhgd.xmgl.modules.taskprogress.service.ITaskProgressContentService;
|
||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -28,9 +33,21 @@ import java.util.stream.Collectors;
|
||||
public class TaskProgressContentServiceImpl extends ServiceImpl<TaskProgressContentMapper, TaskProgressContent> implements ITaskProgressContentService {
|
||||
@Autowired
|
||||
TaskProgressMaterialRelMapper taskProgressMaterialRelMapper;
|
||||
@Autowired
|
||||
TaskProgressMapper taskProgressMapper;
|
||||
|
||||
@Override
|
||||
public void add(TaskProgressContent taskProgressContent) {
|
||||
TaskProgress taskProgress = taskProgressMapper.selectById(taskProgressContent.getTaskProgressId());
|
||||
if (Objects.equals(taskProgress.getStatus(), 0)) {
|
||||
taskProgress.setStatus(1);
|
||||
taskProgressMapper.updateById(taskProgress);
|
||||
}
|
||||
String projectSn = taskProgress.getProjectSn();
|
||||
taskProgressContent.setProjectSn(projectSn);
|
||||
UserInfo user = SecurityUtils.getUser();
|
||||
taskProgressContent.setUploadUserId(user.getUserId());
|
||||
taskProgressContent.setUploadUserName(user.getRealName());
|
||||
save(taskProgressContent);
|
||||
List<TaskProgressMaterialRel> list = taskProgressContent.getTypeDataList();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
@ -40,6 +57,7 @@ public class TaskProgressContentServiceImpl extends ServiceImpl<TaskProgressCont
|
||||
rel.setTaskProgressMaterialTypeId(type.getId());
|
||||
rel.setActualUsage(type.getActualUsage());
|
||||
rel.setTaskProgressContentId(taskProgressContent.getId());
|
||||
rel.setProjectSn(projectSn);
|
||||
taskProgressMaterialRelMapper.insert(rel);
|
||||
}
|
||||
}
|
||||
@ -49,6 +67,7 @@ public class TaskProgressContentServiceImpl extends ServiceImpl<TaskProgressCont
|
||||
@Override
|
||||
public List<TaskProgressContent> queryList(TaskProgressContent taskProgressContent, HttpServletRequest req) {
|
||||
QueryWrapper<TaskProgressContent> queryWrapper = QueryGenerator.initQueryWrapper(taskProgressContent, req.getParameterMap());
|
||||
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(TaskProgressContent::getUploadDate));
|
||||
List<TaskProgressContent> taskProgressContents = baseMapper.queryList(taskProgressContent, queryWrapper);
|
||||
List<Long> ids = taskProgressContents.stream().map(TaskProgressContent::getId).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
@ -60,4 +79,10 @@ public class TaskProgressContentServiceImpl extends ServiceImpl<TaskProgressCont
|
||||
}
|
||||
return taskProgressContents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskProgressContent queryNewestOne(TaskProgressContent taskProgressContent, HttpServletRequest req) {
|
||||
List<TaskProgressContent> taskProgressContents = queryList(taskProgressContent, req);
|
||||
return CollUtil.isNotEmpty(taskProgressContents) ? taskProgressContents.get(0) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,17 +85,20 @@ public class TaskProgressServiceImpl extends ServiceImpl<TaskProgressMapper, Tas
|
||||
public List<TaskProgress> getParentChildList(HashMap<String, Object> paramMap) {
|
||||
// 查询项目下的节点集合,通过父节点分组
|
||||
List<TaskProgress> progressTaskList = baseMapper.queryList(paramMap);
|
||||
for (TaskProgress taskProgress : progressTaskList) {
|
||||
taskProgress.setBeginWarning(getBeginWarning(taskProgress));
|
||||
taskProgress.setEndWarning(getEndWarning(taskProgress));
|
||||
}
|
||||
Map<Long, List<TaskProgress>> parentIdTaskListMap = progressTaskList.stream().collect(Collectors.groupingBy(TaskProgress::getParentId));
|
||||
return getChild(parentIdTaskListMap, 0L);
|
||||
}
|
||||
|
||||
private Integer getEndWarning(TaskProgress taskProgress) {
|
||||
if (taskProgress.getActualFinishDate() != null) {
|
||||
int i = taskProgress.getFinishDate().compareTo(taskProgress.getActualFinishDate());
|
||||
/**
|
||||
* 获取预警状态
|
||||
*
|
||||
* @param plan
|
||||
* @param actual
|
||||
* @return
|
||||
*/
|
||||
private Integer getWarningStatus(Date plan, Date actual) {
|
||||
if (actual != null) {
|
||||
int i = plan.compareTo(actual);
|
||||
if (i > 0) {
|
||||
return 1;
|
||||
} else if (i < 0) {
|
||||
@ -103,35 +106,10 @@ public class TaskProgressServiceImpl extends ServiceImpl<TaskProgressMapper, Tas
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
} else {
|
||||
int i = new Date().compareTo(taskProgress.getActualFinishDate());
|
||||
if (i < 0) {
|
||||
return 3;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Integer getBeginWarning(TaskProgress taskProgress) {
|
||||
if (taskProgress.getActualStartDate() != null) {
|
||||
int i = taskProgress.getStartDate().compareTo(taskProgress.getActualStartDate());
|
||||
if (i > 0) {
|
||||
return 1;
|
||||
} else if (i < 0) {
|
||||
return 3;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
} else {
|
||||
int i = new Date().compareTo(taskProgress.getActualStartDate());
|
||||
if (i < 0) {
|
||||
return 3;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(TaskProgress taskProgress) {
|
||||
@ -140,6 +118,13 @@ public class TaskProgressServiceImpl extends ServiceImpl<TaskProgressMapper, Tas
|
||||
.eq(TaskProgress::getId, taskProgress.getParentId()));
|
||||
taskProgress.setPredecessorIds(tp.getPredecessorIds() + "," + taskProgress.getParentId());
|
||||
}
|
||||
if (taskProgress.getProgressRatio().equals(100D)) {
|
||||
taskProgress.setActualFinishDate(taskProgress.getFinishDate());
|
||||
taskProgress.setActualStartDate(taskProgress.getStartDate());
|
||||
taskProgress.setStatus(2);
|
||||
}
|
||||
taskProgress.setBeginWarning(getWarningStatus(taskProgress.getStartDate(), taskProgress.getActualStartDate()));
|
||||
taskProgress.setEndWarning(getWarningStatus(taskProgress.getFinishDate(), taskProgress.getActualFinishDate()));
|
||||
save(taskProgress);
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ public class MyUserDetailsImpl implements UserDetailsService {
|
||||
return "admin";
|
||||
}
|
||||
});
|
||||
return new UserInfo(username, user.getPassword(), true, true, true, true, grantedAuthorityList, user.getUserId(), user.getAccountType());
|
||||
return new UserInfo(username, user.getPassword(), true, true, true, true, grantedAuthorityList, user.getUserId(), user.getAccountType(), user.getRealName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,20 +7,23 @@ import java.util.Collection;
|
||||
|
||||
public class UserInfo extends User {
|
||||
private Long userId;
|
||||
private String realName;
|
||||
/**
|
||||
* 账号类型,1系统管理员:jxjadmin,2企业管理员账号:17512009894,3企业区账号,4企业市账号,5项目账号(thhy,只能看一个项目),6项目子账号(aq,比一个项目更小),7企业子账号:qyyszh(只能看到很多项目的账号):,8参建单位,9政务
|
||||
*/
|
||||
private java.lang.Integer accountType;
|
||||
|
||||
public UserInfo(String username, String password, Collection<? extends GrantedAuthority> authorities, Long userId) {
|
||||
public UserInfo(String username, String password, Collection<? extends GrantedAuthority> authorities, Long userId, String realName) {
|
||||
super(username, password, authorities);
|
||||
this.userId = userId;
|
||||
this.realName = realName;
|
||||
}
|
||||
|
||||
public UserInfo(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities, Long userId, Integer accountType) {
|
||||
public UserInfo(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities, Long userId, Integer accountType, String realName) {
|
||||
super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
|
||||
this.userId = userId;
|
||||
this.accountType = accountType;
|
||||
this.realName = realName;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
@ -38,4 +41,12 @@ public class UserInfo extends User {
|
||||
public void setAccountType(Integer accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
|
||||
public String getRealName() {
|
||||
return realName;
|
||||
}
|
||||
|
||||
public void setRealName(String realName) {
|
||||
this.realName = realName;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user