diff --git a/zlpt-modules/zlpt-equip/src/main/java/com/bonus/zlpt/equip/mapper/DevInfoMapper.java b/zlpt-modules/zlpt-equip/src/main/java/com/bonus/zlpt/equip/mapper/DevInfoMapper.java index ef109b7..3d68c71 100644 --- a/zlpt-modules/zlpt-equip/src/main/java/com/bonus/zlpt/equip/mapper/DevInfoMapper.java +++ b/zlpt-modules/zlpt-equip/src/main/java/com/bonus/zlpt/equip/mapper/DevInfoMapper.java @@ -84,4 +84,5 @@ public interface DevInfoMapper int insertLon(InforMationDto inforMationDto); public List getSysDic(); + public SysDic getSysDicById(Integer id); } diff --git a/zlpt-modules/zlpt-equip/src/main/java/com/bonus/zlpt/equip/service/impl/DevInfoServiceImpl.java b/zlpt-modules/zlpt-equip/src/main/java/com/bonus/zlpt/equip/service/impl/DevInfoServiceImpl.java index daa7e35..c42fa52 100644 --- a/zlpt-modules/zlpt-equip/src/main/java/com/bonus/zlpt/equip/service/impl/DevInfoServiceImpl.java +++ b/zlpt-modules/zlpt-equip/src/main/java/com/bonus/zlpt/equip/service/impl/DevInfoServiceImpl.java @@ -17,6 +17,8 @@ import com.bonus.zlpt.equip.service.IDevInfoService; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; +import static com.bonus.zlpt.common.core.web.domain.AjaxResult.error; + /** * 设备信息Service业务层处理 * @@ -47,28 +49,34 @@ public class DevInfoServiceImpl implements IDevInfoService public DevInfoVo selectDevInfoByMaId(Long maId) { DevInfoVo devInfoVo = devInfoMapper.selectDevInfoByMaId(maId); - List files = devInfoMapper.getFilesByMaId(maId); - if (!CollectionUtils.isEmpty(files) && files.get(0) != null) { - List picList = new ArrayList(); - for (SysFile file : files) { - if (file.getDicId() == ASPECT_PICTURE) { - picList.add(file.getUrl()); + try { + List files = devInfoMapper.getFilesByMaId(maId); + if (!CollectionUtils.isEmpty(files) && files.get(0) != null) { + List picList = new ArrayList(); + for (SysFile file : files) { + if (file.getDicId() == ASPECT_PICTURE) { + picList.add(file.getUrl()); + } + if (file.getDicId() == EXAMINATION_PDF) { + devInfoVo.setExaminationPdf(file.getUrl()); + } + if (file.getDicId() == INSURANCE_PDF) { + devInfoVo.setInsurancePdf(file.getUrl()); + } } - if (file.getDicId() == EXAMINATION_PDF) { - devInfoVo.setExaminationPdf(file.getUrl()); - } - if (file.getDicId() == INSURANCE_PDF) { - devInfoVo.setInsurancePdf(file.getUrl()); + String[] pictureArray = null; + if (!CollectionUtils.isEmpty(picList)) { + pictureArray = picList.toArray(new String[picList.size()]); } + devInfoVo.setPictures(pictureArray); } - String[] pictureArray = null; - if (!CollectionUtils.isEmpty(picList)) { - pictureArray = picList.toArray(new String[picList.size()]); - } - devInfoVo.setPictures(pictureArray); + Long companyUpNum = devInfoMapper.getCompanyUpNum(devInfoVo.getOwnCo()); + devInfoVo.setCompanyUpNum(companyUpNum); + SysDic sysDic = devInfoMapper.getSysDicById(Integer.parseInt(devInfoVo.getMaStatus())); + devInfoVo.setMaStatusStr(sysDic.getName()); + } catch (Exception e) { + error("fail to get devInfo for files or companyUpNum or maStatusStr" + maId); } - Long companyUpNum = devInfoMapper.getCompanyUpNum(devInfoVo.getOwnCo()); - devInfoVo.setCompanyUpNum(companyUpNum); return devInfoVo; } diff --git a/zlpt-modules/zlpt-equip/src/main/resources/mapper/DevInfoMapper.xml b/zlpt-modules/zlpt-equip/src/main/resources/mapper/DevInfoMapper.xml index 93d0301..95519af 100644 --- a/zlpt-modules/zlpt-equip/src/main/resources/mapper/DevInfoMapper.xml +++ b/zlpt-modules/zlpt-equip/src/main/resources/mapper/DevInfoMapper.xml @@ -347,4 +347,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" id,p_id,code,`name`,description,`value`,sort,`level`,status,create_time,creator from sys_dic + + \ No newline at end of file