Commit 81a8fe8cae629b9a4e349dd9cb731c9101eb4a34
1 parent
8969241f
抢险任务提交
Showing
2 changed files
with
48 additions
and
0 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyTaskRespVO.java
| @@ -132,4 +132,13 @@ public class EmergencyTaskRespVO { | @@ -132,4 +132,13 @@ public class EmergencyTaskRespVO { | ||
| 132 | 132 | ||
| 133 | private List<EmergencyMachineryDO> emergencyMachineryList; | 133 | private List<EmergencyMachineryDO> emergencyMachineryList; |
| 134 | 134 | ||
| 135 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "20800") | ||
| 136 | + @ExcelProperty("归属(一级部门id)") | ||
| 137 | + private String companyName; | ||
| 138 | + | ||
| 139 | + | ||
| 140 | + @Schema(description = "部门(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "12055") | ||
| 141 | + @ExcelProperty("部门") | ||
| 142 | + private String deptName; | ||
| 143 | + | ||
| 135 | } | 144 | } |
| 136 | \ No newline at end of file | 145 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/emergencytask/EmergencyTaskServiceImpl.java
| @@ -8,16 +8,22 @@ import com.alibaba.fastjson.JSONObject; | @@ -8,16 +8,22 @@ import com.alibaba.fastjson.JSONObject; | ||
| 8 | import com.baomidou.mybatisplus.core.conditions.Wrapper; | 8 | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| 9 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 9 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| 10 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | 10 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 11 | +import com.zteits.urbanops.module.garden.controller.admin.road.vo.RoadRespVO; | ||
| 11 | import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyMachineryDO; | 12 | import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyMachineryDO; |
| 12 | import com.zteits.urbanops.module.garden.dal.mysql.emergencytask.EmergencyMachineryMapper; | 13 | import com.zteits.urbanops.module.garden.dal.mysql.emergencytask.EmergencyMachineryMapper; |
| 14 | +import com.zteits.urbanops.module.system.api.dept.DeptApi; | ||
| 15 | +import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; | ||
| 13 | import jodd.util.StringUtil; | 16 | import jodd.util.StringUtil; |
| 14 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| 15 | import jakarta.annotation.Resource; | 18 | import jakarta.annotation.Resource; |
| 19 | +import org.springframework.util.CollectionUtils; | ||
| 16 | import org.springframework.util.StringUtils; | 20 | import org.springframework.util.StringUtils; |
| 17 | import org.springframework.validation.annotation.Validated; | 21 | import org.springframework.validation.annotation.Validated; |
| 18 | import org.springframework.transaction.annotation.Transactional; | 22 | import org.springframework.transaction.annotation.Transactional; |
| 19 | 23 | ||
| 20 | import java.util.*; | 24 | import java.util.*; |
| 25 | +import java.util.stream.Collectors; | ||
| 26 | + | ||
| 21 | import com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo.*; | 27 | import com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo.*; |
| 22 | import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyTaskDO; | 28 | import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyTaskDO; |
| 23 | import com.zteits.urbanops.framework.common.pojo.PageResult; | 29 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| @@ -46,6 +52,9 @@ public class EmergencyTaskServiceImpl implements EmergencyTaskService { | @@ -46,6 +52,9 @@ public class EmergencyTaskServiceImpl implements EmergencyTaskService { | ||
| 46 | @Resource | 52 | @Resource |
| 47 | private EmergencyMachineryMapper emergencyMachineryMapper; | 53 | private EmergencyMachineryMapper emergencyMachineryMapper; |
| 48 | 54 | ||
| 55 | + @Resource | ||
| 56 | + protected DeptApi deptApi; | ||
| 57 | + | ||
| 49 | @Transactional(rollbackFor = Exception.class) | 58 | @Transactional(rollbackFor = Exception.class) |
| 50 | @Override | 59 | @Override |
| 51 | public Long createEmergencyTask(EmergencyTaskSaveReqVO createReqVO) { | 60 | public Long createEmergencyTask(EmergencyTaskSaveReqVO createReqVO) { |
| @@ -193,11 +202,41 @@ public class EmergencyTaskServiceImpl implements EmergencyTaskService { | @@ -193,11 +202,41 @@ public class EmergencyTaskServiceImpl implements EmergencyTaskService { | ||
| 193 | emergencyTaskRespVO.setEmergencyMachineryList(detailList); | 202 | emergencyTaskRespVO.setEmergencyMachineryList(detailList); |
| 194 | } | 203 | } |
| 195 | }); | 204 | }); |
| 205 | + addDataInspectionPlan(listTwo); | ||
| 196 | 206 | ||
| 197 | // 转换返回 | 207 | // 转换返回 |
| 198 | return new PageResult<>(listTwo, page.getTotal()); | 208 | return new PageResult<>(listTwo, page.getTotal()); |
| 199 | 209 | ||
| 200 | } | 210 | } |
| 201 | 211 | ||
| 212 | + /** | ||
| 213 | + * 回填部门/公司/角色 | ||
| 214 | + * @param list 分页对象 | ||
| 215 | + */ | ||
| 216 | + private void addDataInspectionPlan(List<EmergencyTaskRespVO> list ){ | ||
| 217 | + if(CollectionUtils.isEmpty(list)){ | ||
| 218 | + return ; | ||
| 219 | + } | ||
| 220 | + //公司 | ||
| 221 | + Set<Long> companyIds = list.stream().map(EmergencyTaskRespVO::getCompanyId).collect(Collectors.toSet()); | ||
| 222 | + //部门 | ||
| 223 | + Set<Long> deptIds = list.stream().map(EmergencyTaskRespVO::getDeptId).collect(Collectors.toSet()); | ||
| 224 | + deptIds.addAll(companyIds); | ||
| 225 | + /*1.获取部门*/ | ||
| 226 | + Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(deptIds); | ||
| 227 | + | ||
| 228 | + list.forEach(plan -> { | ||
| 229 | + DeptRespDTO dept = deptMap.get(plan.getDeptId()); | ||
| 230 | + if (dept != null) { | ||
| 231 | + plan.setDeptName(dept.getName()); | ||
| 232 | + | ||
| 233 | + } | ||
| 234 | + DeptRespDTO company = deptMap.get(plan.getCompanyId()); | ||
| 235 | + if(company != null){ | ||
| 236 | + plan.setCompanyName(company.getName()); | ||
| 237 | + } | ||
| 238 | + }); | ||
| 239 | + } | ||
| 240 | + | ||
| 202 | 241 | ||
| 203 | } | 242 | } |
| 204 | \ No newline at end of file | 243 | \ No newline at end of file |