| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepInfoRPCRespDTO; |
| | | import com.gkhy.safePlatform.commons.co.ContextCacheUser; |
| | | import com.gkhy.safePlatform.commons.enums.E; |
| | | import com.gkhy.safePlatform.commons.enums.ResultCodes; |
| | | import com.gkhy.safePlatform.commons.query.PageQuery; |
| | | import com.gkhy.safePlatform.commons.utils.BeanCopyUtils; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("emergencySuppliesService") |
| | | public class EmergencySuppliesServiceImpl implements EmergencySuppliesService { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 按照物资类型分类获取列表 |
| | | * @param currentUser |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultVO<List<EmergencySuppliesTypeRespDTO>> emergencySuppliesList(ContextCacheUser currentUser) { |
| | | |
| | | List<EmergencySuppliesInfo> emergencySuppliesInfoList = emergencySuppliesInfoService.listByNoConditions(); |
| | | List<EmergencySuppliesTypeRespDTO> typeRespDTOList = new ArrayList<>(); |
| | | for (EmergencySuppliesClassificationEnum teamLevelEnum : EmergencySuppliesClassificationEnum.values()) { |
| | | EmergencySuppliesTypeRespDTO typeRespDTO = new EmergencySuppliesTypeRespDTO(); |
| | | typeRespDTO.setMaterialType(teamLevelEnum.getCode()); |
| | | typeRespDTO.setMaterialTypeName(teamLevelEnum.getValue()); |
| | | List<EmergencySuppliesRespDTO> respDTOList = new ArrayList<>(); |
| | | List<EmergencySuppliesInfo> collect = emergencySuppliesInfoList.stream().filter(item -> item.getClassification().equals(teamLevelEnum.getCode())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(collect)){ |
| | | for (EmergencySuppliesInfo info : collect) { |
| | | EmergencySuppliesRespDTO respDTO = new EmergencySuppliesRespDTO(); |
| | | BeanUtils.copyProperties(info,respDTO); |
| | | respDTO.setMaterialType(info.getClassification()); |
| | | respDTO.setMaterialTypeName(teamLevelEnum.getValue()); |
| | | respDTOList.add(respDTO); |
| | | } |
| | | } |
| | | typeRespDTO.setList(respDTOList); |
| | | typeRespDTOList.add(typeRespDTO); |
| | | } |
| | | return new ResultVO<>(ResultCodes.OK,typeRespDTOList); |
| | | } |
| | | |
| | | private void deleteEmergencySupplies(Long id) { |
| | | //查询是否存在 |
| | | EmergencySuppliesInfoDetailDO emergencySuppliesInfoDetailDO = emergencySuppliesInfoService.selectEmergencySuppliesById(id); |