| | |
| | | import com.zt.common.utils.TreeUtils; |
| | | import com.zt.common.utils.UUIDUtil; |
| | | import com.zt.core.shiro.ImportUtil; |
| | | import com.zt.life.core.model.ZtProduct; |
| | | import com.zt.life.modules.mainPart.basicInfo.dao.XhProductModelDao; |
| | | import com.zt.life.modules.mainPart.basicInfo.model.ParamData; |
| | | import com.zt.life.modules.mainPart.basicInfo.model.ProductImg; |
| | | import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel; |
| | | import com.zt.life.modules.mainPart.sysPictureBase.service.SysPictureBaseService; |
| | | import com.zt.modules.sys.dto.DictTypeDto; |
| | | import com.zt.modules.sys.model.SysDictData; |
| | | import com.zt.modules.sys.model.SysDictType; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | |
| | | import com.zt.common.db.query.QueryFilter; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | |
| | | repairType.put("指数分布", 1); |
| | | repairType.put("威布尔分布", 2); |
| | | Map<String, Integer> isOrNot = new HashMap<>(); |
| | | isOrNot.put("是", 0); |
| | | isOrNot.put("否", 1); |
| | | isOrNot.put("是", 1); |
| | | isOrNot.put("否", 0); |
| | | |
| | | //获取是否有数据,如果有则删除数据 |
| | | List<XhProductModel> productList = this.getByShipId(shipId); |
| | | List<ParamData> dataList = paramDataService.getByShipId(shipId); |
| | | if (productList.size() > 0) { |
| | | this.deleteByShipId(shipId); |
| | | } |
| | | if (dataList.size()>0){ |
| | | paramDataService.deleteByShipId(shipId); |
| | | } |
| | | |
| | | try { |
| | | // 获取导入文件的后缀名 |
| | | String fileName = mutFile.getOriginalFilename(); |
| | |
| | | Long xtId = null; |
| | | Long fxtId = null; |
| | | |
| | | |
| | | //导入预计参数 |
| | | ParamData itemEntity1 = new ParamData(); |
| | | itemEntity1.setShipId(shipId); |
| | | itemEntity1.setProductId(shipId); |
| | | itemEntity1.setPageCode("expect"); |
| | | paramDataService.insert(itemEntity1); |
| | |
| | | |
| | | //导入预计参数 |
| | | ParamData itemEntity = new ParamData(); |
| | | itemEntity.setShipId(shipId); |
| | | itemEntity.setProductId(xtId); |
| | | itemEntity.setPageCode("expect"); |
| | | paramDataService.insert(itemEntity); |
| | |
| | | |
| | | //导入预计参数 |
| | | ParamData itemEntity = new ParamData(); |
| | | itemEntity.setShipId(shipId); |
| | | itemEntity.setProductId(fxtId); |
| | | itemEntity.setPageCode("expect"); |
| | | paramDataService.insert(itemEntity); |
| | |
| | | //导入预计参数 |
| | | ParamData itemEntity = new ParamData(); |
| | | //绑定设备ID |
| | | itemEntity.setShipId(shipId); |
| | | itemEntity.setProductId(sbId); |
| | | itemEntity.setPageCode("expect"); |
| | | itemEntity.setReliabDistribType(reliabType.get(reliabDistribType)); |
| | | itemEntity.setBasicJoinCompute(isOrNot.get(basicJoinCompute)); |
| | | itemEntity.setBasicMtbfRegulate(basicMtbfRegulate); |
| | | itemEntity.setBasicMtbfRegulSuccRate(basicMtbfRegulSuccRate); |
| | | itemEntity.setBasicMtbfOperatingRatio(basicMtbfOperatingRatio); |
| | | itemEntity.setTaskMtbcfRegulate(taskMtbcfRegulate); |
| | | itemEntity.setTaskMtbcfOtherParams(taskMtbcfOtherParams2 + "," + taskMtbcfOtherParams3); |
| | | itemEntity.setTaskMtbcfRegulSuccRate(taskMtbcfRegulSuccRate); |
| | | itemEntity.setTaskMtbcfOperatingRatio(taskMtbcfOperatingRatio); |
| | | if (StringUtils.isNotBlank(basicMtbfRegulate)){ |
| | | itemEntity.setBasicMtbfRegulate(Double.valueOf(basicMtbfRegulate)); |
| | | } |
| | | if (StringUtils.isNotBlank(basicMtbfRegulSuccRate)){ |
| | | itemEntity.setBasicMtbfRegulSuccRate(Double.valueOf(basicMtbfRegulSuccRate)); |
| | | } |
| | | if (StringUtils.isNotBlank(basicMtbfOperatingRatio)){ |
| | | itemEntity.setBasicMtbfOperatingRatio(Double.valueOf(basicMtbfOperatingRatio)); |
| | | } |
| | | if (StringUtils.isNotBlank(taskMtbcfRegulate)){ |
| | | itemEntity.setTaskMtbcfRegulate(Double.valueOf(taskMtbcfRegulate)); |
| | | } |
| | | if (StringUtils.isNotBlank(taskMtbcfOtherParams2)){ |
| | | itemEntity.setTaskMtbcfOtherParams2(Double.valueOf(taskMtbcfOtherParams2)); |
| | | } |
| | | if (StringUtils.isNotBlank(taskMtbcfOtherParams3)){ |
| | | itemEntity.setTaskMtbcfOtherParams3(Double.valueOf(taskMtbcfOtherParams3)); |
| | | } |
| | | if (StringUtils.isNotBlank(taskMtbcfRegulSuccRate)){ |
| | | itemEntity.setTaskMtbcfRegulSuccRate(Double.valueOf(taskMtbcfRegulSuccRate)); |
| | | } |
| | | if (StringUtils.isNotBlank(taskMtbcfOperatingRatio)){ |
| | | itemEntity.setTaskMtbcfOperatingRatio(Double.valueOf(taskMtbcfOperatingRatio)); |
| | | } |
| | | itemEntity.setRepairable(isOrNot.get(repairable)); |
| | | itemEntity.setRepairDistribType(repairType.get(repairDistribType)); |
| | | itemEntity.setRepairMttcr(repairMttcr); |
| | | itemEntity.setRepairMttcrOtherParams(repairMttcrOtherParams2 + "," + repairMttcrOtherParams3); |
| | | if (StringUtils.isNotBlank(repairMttcr)){ |
| | | itemEntity.setRepairMttcr(Double.valueOf(repairMttcr)); |
| | | } |
| | | if (StringUtils.isNotBlank(repairMttcrOtherParams2)){ |
| | | itemEntity.setRepairMttcrOtherParams2(Double.valueOf(repairMttcrOtherParams2)); |
| | | } |
| | | if (StringUtils.isNotBlank(repairMttcrOtherParams3)){ |
| | | itemEntity.setRepairMttcrOtherParams3(Double.valueOf(repairMttcrOtherParams3)); |
| | | } |
| | | paramDataService.insert(itemEntity); |
| | | } |
| | | } |
| | |
| | | list.add(errMap); |
| | | return list; |
| | | } |
| | | |
| | | private void deleteByShipId(Long shipId) { |
| | | baseDao.deleteByShipId(shipId); |
| | | } |
| | | |
| | | private List<XhProductModel> getByShipId(Long shipId) { |
| | | return baseDao.getByShipId(shipId); |
| | | } |
| | | } |