Browse Source

问题修复

zyh
WIN-IDGBLFHC1K6\Administrator 3 years ago
parent
commit
4d011a2a51
  1. 7
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectServiceImpl.java
  2. 31
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java

7
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectServiceImpl.java

@ -26,6 +26,7 @@ import cn.iocoder.yudao.module.farm.service.task.TaskService;
import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.CpUser.CpUserMapper;
import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper;
import cn.iocoder.yudao.module.system.service.CpUser.CpUserService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.alibaba.fastjson.JSONArray;
@ -54,6 +55,7 @@ import cn.iocoder.yudao.module.farm.convert.project.ProjectConvert;
import cn.iocoder.yudao.module.farm.dal.mysql.project.ProjectMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.*;
@ -75,8 +77,6 @@ public class ProjectServiceImpl implements ProjectService {
private CpUserMapper cpUserMapper;
@Resource
private TaskService taskService;
@Resource
private AdminUserService adminUserService;
@Override
public Long createProject(ProjectCreateReqVO createReqVO) {
@ -158,8 +158,7 @@ public class ProjectServiceImpl implements ProjectService {
}
if (ObjectUtil.isNotEmpty(pageDTO.getMyProject()) && pageDTO.getMyProject()){
AdminUserDO adminUser = adminUserService.getUser(getLoginUserId());
CpUserDO user = cpUserMapper.selectOne(Wrappers.<CpUserDO>lambdaQuery().eq(CpUserDO::getUserId, adminUser.getUsername()));
CpUserDO user = cpUserMapper.selectOne(CpUserDO::getUserId, getLoginUser().getUsername());
if (ObjectUtil.isNotEmpty(user)){
//查看我参与或创建的项目
queryWrapperX.apply(" ((JSON_CONTAINS(members, '"+ user.getId()+"') or creator = " + getLoginUserId() +"))");

31
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java

@ -178,16 +178,7 @@ public class TaskServiceImpl implements TaskService {
PageResult<TaskDO> pageResult = taskMapper.selectPage(pageReqVO, queryWrapperX);
Map<Long, TaskAssemblyDTO> map = this.taskAssemble(pageResult.getList());
List<TaskAssemblyDTO> list = new ArrayList<>();
pageResult.getList().forEach(item ->{
if (map.containsKey(item.getId())){
TaskAssemblyDTO taskAssemblyDTO = map.get(item.getId());
TaskAssemblyDTO dto = BeanUtil.copyProperties(item, TaskAssemblyDTO.class);
dto.setProjectName(taskAssemblyDTO.getProjectName());
dto.setTaskMsg(taskAssemblyDTO.getTaskMsg());
list.add(dto);
}
});
List<TaskAssemblyDTO> list = new ArrayList<>(map.values());
PageResult<TaskAssemblyDTO> assemble = new PageResult<>();
assemble.setTotal(pageResult.getTotal());
@ -199,23 +190,7 @@ public class TaskServiceImpl implements TaskService {
public PageResult<TaskAssemblyDTO> getAdminTaskPage(TaskPageReqVO pageReqVO){
PageResult<TaskDO> taskPage = taskMapper.selectPage(pageReqVO);
Map<Long, TaskAssemblyDTO> map = this.taskAssemble(taskPage.getList());
List<TaskAssemblyDTO> list = new ArrayList<>();
taskPage.getList().forEach(item ->{
if (map.containsKey(item.getId())){
TaskAssemblyDTO dto = map.get(item.getId());
TaskAssemblyDTO newDTO = BeanUtil.copyProperties(item, TaskAssemblyDTO.class);
newDTO.setProjectName(dto.getProjectName());
newDTO.setTaskName(dto.getTaskName());
newDTO.setTaskResourceList(dto.getTaskResourceList());
newDTO.setAreaNameList(dto.getAreaNameList());
newDTO.setExecutorNameList(dto.getExecutorNameList());
newDTO.setTaskMsg(dto.getTaskMsg());
newDTO.setMainPersonName(dto.getMainPersonName());
newDTO.setCropName(dto.getCropName());
newDTO.setCreateTime(dto.getCreateTime());
list.add(newDTO);
}
});
List<TaskAssemblyDTO> list = new ArrayList<>(map.values());
PageResult<TaskAssemblyDTO> page = new PageResult<>();
page.setList(list);
page.setTotal(taskPage.getTotal());
@ -388,7 +363,7 @@ public class TaskServiceImpl implements TaskService {
Map<Long, TaskAssemblyDTO> map = new HashMap<>();
for (TaskDO taskDO : taskDOList) {
TaskAssemblyDTO dto = new TaskAssemblyDTO();
TaskAssemblyDTO dto = BeanUtil.copyProperties(taskDO, TaskAssemblyDTO.class);
//项目名
preAssemblyDTO.getProjectDOList().stream().filter(project -> project.getId().equals(taskDO.getProjectId())).findFirst()
.ifPresent(item ->{

Loading…
Cancel
Save