| | |
| | | package com.gkhy.safePlatform.emergency.service.impl; |
| | | |
| | | 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.enums.ResultCodes; |
| | | import com.gkhy.safePlatform.commons.query.PageQuery; |
| | | import com.gkhy.safePlatform.commons.utils.BeanCopyUtils; |
| | |
| | | import com.gkhy.safePlatform.emergency.query.db.EmergencySuppliesDBQuery; |
| | | import com.gkhy.safePlatform.emergency.service.EmergencySuppliesService; |
| | | import com.gkhy.safePlatform.emergency.service.baseService.*; |
| | | import org.apache.dubbo.config.annotation.DubboReference; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service("emergencySuppliesService") |
| | | public class EmergencySuppliesServiceImpl implements EmergencySuppliesService { |
| | | |
| | | @Autowired |
| | | private EmergencySuppliesInfoService emergencySuppliesInfoService; |
| | | |
| | | @DubboReference(check = false) |
| | | private AccountDepartmentService accountDepartmentService; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | List<EmergencySuppliesInfoPageDO> emergencySuppliesListDoInfoList = emergencySuppliesInfoService.selectEmergencySuppliesList(page,emergencySuppliesDBQuery); |
| | | List<EmergencySuppliesPageRespDTO> respList = BeanCopyUtils.copyBeanList(emergencySuppliesListDoInfoList, EmergencySuppliesPageRespDTO.class); |
| | | |
| | | Map<Long, String> depPool = new HashMap<>(); |
| | | |
| | | respList.forEach(AccidentExpressPageRespDTO ->{ |
| | | // 设置部门名称 |
| | | if (!depPool.containsKey(AccidentExpressPageRespDTO.getDepartmentId())) { |
| | | ResultVO<DepInfoRPCRespDTO> rpcResult = accountDepartmentService.getDepInfoByDepId(AccidentExpressPageRespDTO.getDepartmentId()); |
| | | if (rpcResult != null && rpcResult.getCode().equals(ResultCodes.OK.getCode())) { |
| | | if (rpcResult.getData() != null) { |
| | | DepInfoRPCRespDTO dep = (DepInfoRPCRespDTO) rpcResult.getData(); |
| | | |
| | | depPool.put(dep.getDepId(), dep.getDepName()); |
| | | } |
| | | }} |
| | | |
| | | String depName = depPool.get(AccidentExpressPageRespDTO.getDepartmentId()); |
| | | AccidentExpressPageRespDTO.setDeptName(depName); |
| | | }); |
| | | |
| | | return new SearchResultVO<>( |
| | | true, |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ResultVO batchDeleteEmergencySupplies(String ids) { |
| | | if (StringUtils.isBlank(ids)) { |
| | | public ResultVO batchDeleteEmergencySupplies( Long[] ids) { |
| | | |
| | | if (ids == null || ids.length==0){ |
| | | throw new EmergencyException(EmergencyResultCodes.SUPPLIES_NULL); |
| | | } else { |
| | | String[] idArr = ids.split(","); |
| | | for (String id : idArr) { |
| | | deleteEmergencySupplies(Long.valueOf(id)); |
| | | }else{ |
| | | for (Long id : ids){ |
| | | deleteEmergencySupplies(id); |
| | | } |
| | | return new ResultVO(ResultCodes.OK); |
| | | } |