wangzhinan 3 anni fa
parent
commit
bf35c3e2f2

+ 31 - 29
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/a4endpoint/MedicineDeviceEndpoint.java

@ -218,35 +218,37 @@ public class MedicineDeviceEndpoint extends EnvelopRestEndpoint {
    }
//    @PostMapping(value = BaseRequestMapping.BaseDevice.updateTAndH)
//    @ApiOperation(value = "更新设备温度湿度and控制")
//    public Envelop updateTAndH(
//            @ApiParam(name = "humidity", value = "目标湿度")
//            @RequestParam(value = "humidity") String humidity,
//            @ApiParam(name = "temperature", value = "目标温度")
//            @RequestParam(value = "temperature") String temperature,
//            @ApiParam(name = "humiditycontrol", value = "湿度控制,1开启,0关闭")
//            @RequestParam(value = "humiditycontrol") String humiditycontrol,
//            @ApiParam(name = "temperaturecontrol", value = "温度控制,1开启,0关闭")
//            @RequestParam(value = "temperaturecontrol") String temperaturecontrol,
//            @ApiParam(name = "heat", value = "加热控制,1开启,0关闭")
//            @RequestParam(value = "heat") String heat,
//            @ApiParam(name = "warningTemperatureHeight", value = "预警温度上限")
//            @RequestParam(value = "warningTemperatureHeight") String warningTemperatureHeight,
//            @ApiParam(name = "waringHumidityHeight", value = "预警湿度上限")
//            @RequestParam(value = "waringHumidityHeight") String waringHumidityHeight,
//            @ApiParam(name = "warningTemperatureLow", value = "预警温度下限")
//            @RequestParam(value = "warningTemperatureLow") String warningTemperatureLow,
//            @ApiParam(name = "waringHumidityLow", value = "预警湿度下限", required = true)
//            @RequestParam(value = "waringHumidityLow") String waringHumidityLow) throws Exception {
//        String str = deviceService.updateTAndH(humidity, temperature, humiditycontrol,temperaturecontrol,
//                heat,warningTemperatureHeight, waringHumidityHeight,warningTemperatureLow, waringHumidityLow);
//        JSONObject jsonObject = JSONObject.parseObject(str);
//        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
//            return failed(jsonObject.getString("msg"));
//        }
//        return success(jsonObject.getString("response"));
//    }
    @PostMapping(value = BaseRequestMapping.BaseDevice.updateTAndH)
    @ApiOperation(value = "更新设备温度湿度and控制")
    public Envelop updateTAndH(
            @ApiParam(name = "deviceId", value = "设备id")
            @RequestParam(value = "deviceId") String deviceId,
            @ApiParam(name = "humidity", value = "目标湿度")
            @RequestParam(value = "humidity") String humidity,
            @ApiParam(name = "temperature", value = "目标温度")
            @RequestParam(value = "temperature") String temperature,
            @ApiParam(name = "humiditycontrol", value = "湿度控制,1开启,0关闭")
            @RequestParam(value = "humiditycontrol") String humiditycontrol,
            @ApiParam(name = "temperaturecontrol", value = "温度控制,1开启,0关闭")
            @RequestParam(value = "temperaturecontrol") String temperaturecontrol,
            @ApiParam(name = "heat", value = "加热控制,1开启,0关闭")
            @RequestParam(value = "heat") String heat,
            @ApiParam(name = "warningTemperatureHeight", value = "预警温度上限")
            @RequestParam(value = "warningTemperatureHeight") String warningTemperatureHeight,
            @ApiParam(name = "waringHumidityHeight", value = "预警湿度上限")
            @RequestParam(value = "waringHumidityHeight") String waringHumidityHeight,
            @ApiParam(name = "warningTemperatureLow", value = "预警温度下限")
            @RequestParam(value = "warningTemperatureLow") String warningTemperatureLow,
            @ApiParam(name = "waringHumidityLow", value = "预警湿度下限", required = true)
            @RequestParam(value = "waringHumidityLow") String waringHumidityLow) throws Exception {
        String str = deviceService.updateTAndH(deviceId, humidity, temperature, humiditycontrol,temperaturecontrol,
                heat,warningTemperatureHeight, waringHumidityHeight,warningTemperatureLow, waringHumidityLow);
        JSONObject jsonObject = JSONObject.parseObject(str);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("response"));
    }
    @PostMapping(value = BaseRequestMapping.BaseDevice.UNBINDDEVICE)

+ 21 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicinedeviceService.java

@ -52,6 +52,9 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
    @Autowired
    private MediicinecabinetInventoryDao inventoryDao;
    @Autowired
    MedicineServive medicineServive;
    @Autowired
    private ObjectMapper objectMapper;
@ -513,6 +516,8 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
        mediicinedevice.setWarningTemperatureLow(warningTemperatureLow);
        mediicinedevice.setWaringHumidityLow(waringHumidityLow);
        this.save(mediicinedevice);
        medicineServive.SetTemperatureAndHumidity(mediicinedevice.getEquNum(), temperature,
                humidity, "1".equals(temperaturecontrol) ? true : false, "1".equals(humiditycontrol) ? true : false, "1".equals(heat) ? true : false);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",mediicinedevice);
        return result.toJSONString();
@ -613,10 +618,12 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
                    }
                }
            }
            MediicinecabinetInventory copyInventory = new MediicinecabinetInventory();
            for (String deviceId : cargoIds.split(",")) {
                if(!StringUtils.isEmpty(deviceId)){
                    if (isFirst) {
                        MediicinecabinetInventory inventory = inventoryDao.findOne(deviceId);
                        copyInventory = inventory;
                        inventory.setMerge(wayerNos);
                        inventory.setState("21");
                        inventoryDao.save(inventory);
@ -624,6 +631,10 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
                    } else {
                        MediicinecabinetInventory inventory = inventoryDao.findOne(deviceId);
                        inventory.setMerge(wayerNos);
//                        inventory.setCargoCapacity(copyInventory.getCargoCapacity());
//                        inventory.setState(copyInventory.getState());
//                        inventory.setNum(copyInventory.getNum());
//                        inventory.setShelfStatus(copyInventory.getShelfStatus());
                        inventory.setState("20");
                        inventoryDao.save(inventory);
                    }
@ -2703,7 +2714,17 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
            String id = map.get("layerNo").toString();
            JSONObject object = new JSONObject();
            JSONArray jsonArray = new JSONArray();
            MediicinecabinetInventory tempInventory = new MediicinecabinetInventory();
            for (MediicinecabinetInventory inventory:list){
                if ("21".equals(inventory.getState())) {
                    tempInventory = inventory;
                }
                if ("20".equals(inventory.getState())) {
                    inventory.setCargoCapacity(tempInventory.getCargoCapacity());
                    inventory.setPrice(tempInventory.getPrice());
                    inventory.setDrugName(tempInventory.getDrugName());
                    inventory.setQty(tempInventory.getQty());
                }
                if (id.equalsIgnoreCase(inventory.getLayerNo())){
                    jsonArray.add(inventory);
                }