|  | @ -34,6 +34,7 @@ import java.text.DecimalFormat;
 | 
												
													
														
															|  | import java.text.ParseException;
 |  | import java.text.ParseException;
 | 
												
													
														
															|  | import java.util.*;
 |  | import java.util.*;
 | 
												
													
														
															|  | import java.util.logging.Logger;
 |  | import java.util.logging.Logger;
 | 
												
													
														
															|  | 
 |  | import java.util.stream.Collectors;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | /**
 |  | /**
 | 
												
													
														
															|  |  * Created by Bing on 2021/9/23.
 |  |  * Created by Bing on 2021/9/23.
 | 
												
											
												
													
														
															|  | @ -532,15 +533,33 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
												
													
														
															|  |             result.put("response", ConstantUtils.FAIL);
 |  |             result.put("response", ConstantUtils.FAIL);
 | 
												
													
														
															|  |             return result.toJSONString();
 |  |             return result.toJSONString();
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         mediicinedevice.setHumidity(humidity);
 |  | 
 | 
												
													
														
															|  |         mediicinedevice.setTemperature(temperature);
 |  | 
 | 
												
													
														
															|  |         mediicinedevice.setHumiditycontrol(humiditycontrol);
 |  | 
 | 
												
													
														
															|  |         mediicinedevice.setTemperaturecontrol(temperaturecontrol);
 |  | 
 | 
												
													
														
															|  |         mediicinedevice.setHeat(heat);
 |  | 
 | 
												
													
														
															|  |         mediicinedevice.setWaringHumidityHeight(waringHumidityHeight);
 |  | 
 | 
												
													
														
															|  |         mediicinedevice.setWarningTemperatureHeight(warningTemperatureHeight);
 |  | 
 | 
												
													
														
															|  |         mediicinedevice.setWarningTemperatureLow(warningTemperatureLow);
 |  | 
 | 
												
													
														
															|  |         mediicinedevice.setWaringHumidityLow(waringHumidityLow);
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (humidity != null && !StringUtils.isEmpty(humidity)) {
 | 
												
													
														
															|  | 
 |  |             mediicinedevice.setHumidity(humidity);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (humidity != null && !StringUtils.isEmpty(temperature)) {
 | 
												
													
														
															|  | 
 |  |             mediicinedevice.setTemperature(temperature);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (humidity != null && !StringUtils.isEmpty(humiditycontrol)) {
 | 
												
													
														
															|  | 
 |  |             mediicinedevice.setHumiditycontrol(humiditycontrol);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (humidity != null && !StringUtils.isEmpty(temperaturecontrol)) {
 | 
												
													
														
															|  | 
 |  |             mediicinedevice.setTemperaturecontrol(temperaturecontrol);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (humidity != null && !StringUtils.isEmpty(heat)) {
 | 
												
													
														
															|  | 
 |  |             mediicinedevice.setHeat(heat);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (humidity != null && !StringUtils.isEmpty(waringHumidityHeight)) {
 | 
												
													
														
															|  | 
 |  |             mediicinedevice.setWaringHumidityHeight(waringHumidityHeight);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (humidity != null && !StringUtils.isEmpty(warningTemperatureHeight)) {
 | 
												
													
														
															|  | 
 |  |             mediicinedevice.setWarningTemperatureHeight(warningTemperatureHeight);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (humidity != null && !StringUtils.isEmpty(warningTemperatureLow)) {
 | 
												
													
														
															|  | 
 |  |             mediicinedevice.setWarningTemperatureLow(warningTemperatureLow);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (humidity != null && !StringUtils.isEmpty(waringHumidityLow)) {
 | 
												
													
														
															|  | 
 |  |             mediicinedevice.setWaringHumidityLow(waringHumidityLow);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         this.save(mediicinedevice);
 |  |         this.save(mediicinedevice);
 | 
												
													
														
															|  |         medicineServive.SetTemperatureAndHumidity(mediicinedevice.getEquNum(), temperature,
 |  |         medicineServive.SetTemperatureAndHumidity(mediicinedevice.getEquNum(), temperature,
 | 
												
													
														
															|  |                 humidity, "1".equals(temperaturecontrol) ? true : false, "1".equals(humiditycontrol) ? true : false, "1".equals(heat) ? true : false);
 |  |                 humidity, "1".equals(temperaturecontrol) ? true : false, "1".equals(humiditycontrol) ? true : false, "1".equals(heat) ? true : false);
 | 
												
											
												
													
														
															|  | @ -1069,6 +1088,105 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 查询补货员所在社区的设备列表
 | 
												
													
														
															|  | 
 |  |      * @param userIds
 | 
												
													
														
															|  | 
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      * @throws Exception
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public JSONObject getDevicesByReplenishEr(String userIds) throws Exception {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  | 
 |  |         if(StringUtils.isEmpty(userIds)){
 | 
												
													
														
															|  | 
 |  |             result.put("msg","parameter userIds is null ");
 | 
												
													
														
															|  | 
 |  |             result.put("response",ConstantUtils.FAIL);
 | 
												
													
														
															|  | 
 |  |             return result;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         String[] userIdArray = userIds.split(",");
 | 
												
													
														
															|  | 
 |  |         List<String> userIdList = Arrays.stream(userIdArray).filter(string -> !StringUtils.isEmpty(string)).collect(Collectors.toList());
 | 
												
													
														
															|  | 
 |  |         List<String> communitys = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  |         boolean isFirst = true;
 | 
												
													
														
															|  | 
 |  |         for (String s : userIdList) {
 | 
												
													
														
															|  | 
 |  |             if (!StringUtils.isEmpty(s)) {
 | 
												
													
														
															|  | 
 |  |                 String sql = "SELECT\n" +
 | 
												
													
														
															|  | 
 |  |                         "\tt.hospital AS community\n" +
 | 
												
													
														
															|  | 
 |  |                         "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                         "\twlyy_user_area AS t\n" +
 | 
												
													
														
															|  | 
 |  |                         "WHERE\n" +
 | 
												
													
														
															|  | 
 |  |                         "\t',"+ s +",' like CONCAT('%,',t.user_id,',%')\n" +
 | 
												
													
														
															|  | 
 |  |                         "AND t.del = 1;";
 | 
												
													
														
															|  | 
 |  |                 if (isFirst) {
 | 
												
													
														
															|  | 
 |  |                     communitys.addAll(jdbcTemplate.queryForList(sql, String.class));
 | 
												
													
														
															|  | 
 |  |                     isFirst = false;
 | 
												
													
														
															|  | 
 |  |                 }else {
 | 
												
													
														
															|  | 
 |  |                     communitys.retainAll(jdbcTemplate.queryForList(sql, String.class));
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         String sql = "";
 | 
												
													
														
															|  | 
 |  |         {
 | 
												
													
														
															|  | 
 |  |             sql += "SELECT\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.id,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.belong_community,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.community,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.del,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.delivery_address,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.detail_address,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.equ_area,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.equ_class,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.equ_info,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.equ_name,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.equ_num,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.equ_type,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.fbelong_community,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.machine_code,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.network_status,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.poweron_test,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.reg_date,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.sale_status,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.signalintensity,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.upgr_adesit,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.`status`,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.card_status,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.operator,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.pack_age,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.usage_flow,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.flow,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.create_time,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.create_user,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.create_user_name,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.update_time,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.update_user,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.update_user_name,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.aisles,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.capacity,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.ratio,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.cargo_capacity,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.layer,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.wayer,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.humidity,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.temperature,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.humiditycontrol,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.temperaturecontrol,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.heat,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.warning_temperature_height,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.waring_humidity_height,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.warning_temperature_low,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.waring_humidity_low,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.lng,\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.lat\n" +
 | 
												
													
														
															|  | 
 |  |                     "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt_mediicine_device AS t\n" +
 | 
												
													
														
															|  | 
 |  |                     "WHERE\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tt.del = 1\n" +
 | 
												
													
														
															|  | 
 |  |                     "AND ',"+ String.join(",", communitys) +",' LIKE CONCAT('%,',t.belong_community,',%')";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
 | 
												
													
														
															|  | 
 |  |         result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 根据人员id,查询与之绑定的设备
 |  |      * 根据人员id,查询与之绑定的设备
 | 
												
													
														
															|  |      * @param userId
 |  |      * @param userId
 | 
												
											
												
													
														
															|  | @ -3380,6 +3498,9 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
												
													
														
															|  |             inventory.setQty(qty);
 |  |             inventory.setQty(qty);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         if (org.apache.commons.lang3.StringUtils.isNoneBlank(cargoCapacity)){
 |  |         if (org.apache.commons.lang3.StringUtils.isNoneBlank(cargoCapacity)){
 | 
												
													
														
															|  | 
 |  |             if (Integer.parseInt(cargoCapacity) > 99) {
 | 
												
													
														
															|  | 
 |  |                 throw new RuntimeException("货道容量最多99个,如超过请放置另一格");
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  |             inventory.setCargoCapacity(cargoCapacity);
 |  |             inventory.setCargoCapacity(cargoCapacity);
 | 
												
													
														
															|  |             cargoCapacityChanged = true;
 |  |             cargoCapacityChanged = true;
 | 
												
													
														
															|  |         }
 |  |         }
 |