diff --git a/yudao-server/src/main/resources/application-prod.yaml b/yudao-server/src/main/resources/application-prod.yaml index bdd829d8..53af3ba4 100644 --- a/yudao-server/src/main/resources/application-prod.yaml +++ b/yudao-server/src/main/resources/application-prod.yaml @@ -74,6 +74,7 @@ spring: host: 127.0.0.1 # 地址 port: 6379 # 端口 database: 15 # 数据库索引 + password: guozinengliang --- #################### 定时任务相关配置 #################### diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDTO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDTO.java index 65694ea0..96d2b957 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDTO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDTO.java @@ -29,4 +29,6 @@ public class DiscussDTO extends DiscussDO { private List workList; + private List areaNameList; + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaService.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaService.java index fc91ed76..15663f41 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaService.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaService.java @@ -5,6 +5,8 @@ import javax.validation.*; import cn.iocoder.yudao.module.farm.controller.admin.area.vo.*; import cn.iocoder.yudao.module.farm.dal.dataobject.area.AreaDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import com.alibaba.fastjson.JSONArray; +import com.google.gson.JsonArray; /** * Service 接口 @@ -67,4 +69,9 @@ public interface AreaService { */ List getAreaList(AreaExportReqVO exportReqVO); + /** + * 根据区域 返回区域信息List + **/ + public List findAreaName(List areaList, JSONArray areaArray); + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java index df649848..c5003763 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java @@ -1,5 +1,8 @@ package cn.iocoder.yudao.module.farm.service.area; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONArray; +import com.google.gson.JsonArray; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -79,4 +82,29 @@ public class AreaServiceImpl implements AreaService { return areaMapper.selectList(exportReqVO); } + + /** + * 根据区域 返回区域信息List + **/ + public List findAreaName(List areaList, JSONArray areaArray){ + List areaNameList = new ArrayList<>(); + JSONArray array = JSONArray.parseArray(areaArray.toString()); + Long areaParent = Long.valueOf(String.valueOf(array.get(0))); + Long areaSon = Long.valueOf(String.valueOf(array.get(1))); + StringBuilder areaName = new StringBuilder(); + for (AreaDO areaDO : areaList) { + if (areaDO.getId().equals(areaParent)){ + areaName.append(areaDO.getName()); + } + if (areaDO.getId().equals(areaSon)){ + areaName.append(areaDO.getName()); + } + } + if (ObjectUtil.isNotEmpty(areaName)){ + areaNameList.add(areaName.toString()); + } + return areaNameList; + + } + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java index 7661c2ff..eb354be4 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java @@ -10,8 +10,11 @@ import cn.iocoder.yudao.module.farm.controller.admin.discuss.dto.DiscussPageDTO; import cn.iocoder.yudao.module.farm.controller.admin.project.dto.ProjectListDTO; import cn.iocoder.yudao.module.farm.controller.admin.workHour.dto.WorkUserMsgDTO; import cn.iocoder.yudao.module.farm.controller.admin.workHour.vo.WorkHourBaseVO; +import cn.iocoder.yudao.module.farm.dal.dataobject.area.AreaDO; import cn.iocoder.yudao.module.farm.dal.dataobject.workHour.WorkHourDO; +import cn.iocoder.yudao.module.farm.dal.mysql.area.AreaMapper; import cn.iocoder.yudao.module.farm.dal.mysql.workHour.WorkHourMapper; +import cn.iocoder.yudao.module.farm.service.area.AreaService; 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; @@ -52,6 +55,10 @@ public class DiscussServiceImpl implements DiscussService { private AdminUserMapper adminUserMapper; @Resource private WorkHourMapper workHourMapper; + @Resource + private AreaService areaService; + @Resource + private AreaMapper areaMapper; @Override public Long createDiscuss(DiscussCreateReqVO createReqVO) { @@ -124,10 +131,11 @@ public class DiscussServiceImpl implements DiscussService { List userNameList = adminUserList.stream().map(AdminUserDO::getUsername).collect(Collectors.toList()); //企业用户 List cpUserList = cpUserMapper.selectList(Wrappers.lambdaQuery()); - //工时List List workIdList = discussList.stream().map(DiscussDO::getId).collect(Collectors.toList()); List workHourList = workHourMapper.selectList(Wrappers.lambdaQuery().in(WorkHourDO::getProjectId, workIdList)); + //全部区域List + List areaList = areaMapper.selectList(); // key 系统用户id value cpUser Map map = new HashMap<>(); @@ -157,6 +165,9 @@ public class DiscussServiceImpl implements DiscussService { } } discussDTO.setWorkList(workUserMsgList); + + List areaNameList = areaService.findAreaName(areaList, discussDTO.getAreas()); + discussDTO.setAreaNameList(areaNameList); } PageVO returnList = PageUtil.convertPageInfo(discussDTOList); return R.success(returnList);