Browse Source

1、优化楼栋、设备资料管理

dev
25604 3 weeks ago
parent
commit
ed96530ded
  1. 17
      user-service/src/main/java/com/mh/user/controller/BuildingController.java
  2. 11
      user-service/src/main/java/com/mh/user/controller/DeviceInstallController.java

17
user-service/src/main/java/com/mh/user/controller/BuildingController.java

@ -5,6 +5,7 @@ import com.mh.user.annotation.SysLogger;
import com.mh.user.entity.BuildingEntity; import com.mh.user.entity.BuildingEntity;
import com.mh.user.model.AreaBuildingTreeModel; import com.mh.user.model.AreaBuildingTreeModel;
import com.mh.user.model.BuildingModel; import com.mh.user.model.BuildingModel;
import com.mh.user.service.AreaService;
import com.mh.user.service.BuildingService; import com.mh.user.service.BuildingService;
import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
@ -29,6 +30,9 @@ public class BuildingController {
@Autowired @Autowired
private BuildingService buildingService; private BuildingService buildingService;
@Autowired
private AreaService areaService;
//保存 //保存
@SysLogger(title="楼栋信息",optDesc = "保存楼栋信息") @SysLogger(title="楼栋信息",optDesc = "保存楼栋信息")
@PostMapping(value="/save") @PostMapping(value="/save")
@ -185,6 +189,9 @@ public class BuildingController {
case 9 : case 9 :
rolName = "热泵个数"; rolName = "热泵个数";
break; break;
case 10:
rolName = "区域名称";
break;
} }
if ((rol >= 1)&&(rol <= 4)&&(sCell.equals(""))){ if ((rol >= 1)&&(rol <= 4)&&(sCell.equals(""))){
msg = rolName + "不能为空" ; msg = rolName + "不能为空" ;
@ -205,7 +212,15 @@ public class BuildingController {
uploadEntity.setTankHeight(Double.parseDouble(deviceList.get(6))); //默认(高区)水箱高度 uploadEntity.setTankHeight(Double.parseDouble(deviceList.get(6))); //默认(高区)水箱高度
uploadEntity.setLowTankHeight(Double.parseDouble(deviceList.get(7))); //低区水箱高度 uploadEntity.setLowTankHeight(Double.parseDouble(deviceList.get(7))); //低区水箱高度
uploadEntity.setPumpCount(Integer.parseInt(deviceList.get(8))); //热泵个数 uploadEntity.setPumpCount(Integer.parseInt(deviceList.get(8))); //热泵个数
uploadEntity.setAreaName(deviceList.get(9)); //区域名称
// 根据区域名称查询区域ID
int areaId = areaService.selectByAreaName(uploadEntity.getAreaName());
if (areaId != 0) {
httpResult.setMsg(uploadEntity.getAreaName() + "区域名称有误!");
httpResult.setCode(500);
return httpResult;
}
uploadEntity.setAreaId(String.valueOf(areaId));
deviceList.clear(); deviceList.clear();
uploadEntityList.add(uploadEntity); uploadEntityList.add(uploadEntity);

11
user-service/src/main/java/com/mh/user/controller/DeviceInstallController.java

@ -279,12 +279,18 @@ public class DeviceInstallController {
uploadEntity.setDeviceType(deviceList.get(2));//设备类型 uploadEntity.setDeviceType(deviceList.get(2));//设备类型
uploadEntity.setDataCom(deviceList.get(3));//通讯端口 uploadEntity.setDataCom(deviceList.get(3));//通讯端口
uploadEntity.setBaudRate(Integer.parseInt(deviceList.get(4)));//波特率 uploadEntity.setBaudRate(Integer.parseInt(deviceList.get(4)));//波特率
uploadEntity.setParity(deviceList.get(5));//波特率 uploadEntity.setParity(deviceList.get(5));//校验位
uploadEntity.setRatio(Double.parseDouble(deviceList.get(6)));//倍率 uploadEntity.setRatio(Double.parseDouble(deviceList.get(6)));//倍率
uploadEntity.setBrand(deviceList.get(7));//品牌 uploadEntity.setBrand(deviceList.get(7));//品牌
uploadEntity.setModel(deviceList.get(8));//型号 uploadEntity.setModel(deviceList.get(8));//型号
uploadEntity.setInstaller(deviceList.get(9));//安装人员 uploadEntity.setInstaller(deviceList.get(9));//安装人员
uploadEntity.setBuildingName(deviceList.get(10));//所属楼栋 uploadEntity.setBuildingName(deviceList.get(10));//所属楼栋
Integer buildingId = buildingService.selectBuildingIdByName(uploadEntity.getBuildingName());
if (buildingId == null) {
httpResult.setMsg(uploadEntity.getBuildingName() + "没有当前楼栋名称!");
httpResult.setCode(500);
return httpResult;
}
if (deviceList.get(11).equals("是")){ if (deviceList.get(11).equals("是")){
uploadEntity.setIsUse(1); uploadEntity.setIsUse(1);
}else{ }else{
@ -311,7 +317,8 @@ public class DeviceInstallController {
} }
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); httpResult.setMsg("批量插入异常,异常信息:" + e.getMessage());
httpResult.setCode(500);
} }
return httpResult; return httpResult;
} }

Loading…
Cancel
Save