|
@@ -73,7 +73,8 @@ public class LampConfigServiceImpl extends ServiceImpl<LampConfigMapper, LampCon
|
|
|
@Override
|
|
|
public Result lsitAllLamp(Map<String, String> map, HttpServletRequest request) {
|
|
|
String farmCode = map.get("farmCode");
|
|
|
- List<LampConfig> lampConfigs = lampConfigMapper.selectList(new QueryWrapper<LampConfig>().eq("farm_code", farmCode));
|
|
|
+ List<LampConfig> lampConfigs = lampConfigMapper.selectList(new QueryWrapper<LampConfig>().eq("farm_code", farmCode)
|
|
|
+ .last(" ORDER BY unit_id, CAST( REPLACE(location,\"号产床\",\"\")AS SIGNED)"));
|
|
|
List endList = new ArrayList();
|
|
|
for (LampConfig lampConfig : lampConfigs) {
|
|
|
Map endMap = new HashMap();
|
|
@@ -135,10 +136,11 @@ public class LampConfigServiceImpl extends ServiceImpl<LampConfigMapper, LampCon
|
|
|
public String updateTemp(String ageList, Integer dayAge) {
|
|
|
|
|
|
String[] split = ageList.split(";");
|
|
|
+ // 5,32;10,36;12,39;40,39; 5->32
|
|
|
String temp = split[split.length-1].split(",")[1];
|
|
|
for (int i = 0; i < split.length; i++) {
|
|
|
String lamp1 = split[i];
|
|
|
- if (dayAge>=Integer.parseInt(lamp1.split(",")[0])){
|
|
|
+ if (dayAge<=Integer.parseInt(lamp1.split(",")[0])){
|
|
|
temp = lamp1.split(",")[1];
|
|
|
String tempStr = (Double.parseDouble(temp) * 10) + "";
|
|
|
return tempStr.substring(0,tempStr.lastIndexOf("."));
|
|
@@ -154,14 +156,10 @@ public class LampConfigServiceImpl extends ServiceImpl<LampConfigMapper, LampCon
|
|
|
try {
|
|
|
Integer initDayAge = (Integer) map.get("initDayAge");
|
|
|
List<String> dayAgeList = (List<String> )map.get("dayAgeList");
|
|
|
- //
|
|
|
-// Integer boardGear =(Integer) map.get("boardGear");
|
|
|
String unitId =(String) map.get("unitId");
|
|
|
String id = (String)map.get("id");
|
|
|
-
|
|
|
LampConfig lampConfig = new LampConfig();
|
|
|
lampConfig.setInitAge(initDayAge);
|
|
|
-// lampConfig.setBoardGear(boardGear);
|
|
|
StringBuilder dayAgeListStr = new StringBuilder();
|
|
|
for (String s : dayAgeList) {
|
|
|
dayAgeListStr.append(s).append(";");
|
|
@@ -172,17 +170,17 @@ public class LampConfigServiceImpl extends ServiceImpl<LampConfigMapper, LampCon
|
|
|
lampConfig.setAgeList(dayAgeListStr.toString());
|
|
|
lampConfig.setDayAge(initDayAge);
|
|
|
UpdateWrapper<LampConfig> wrapper = new UpdateWrapper<>();
|
|
|
+ //栋舍配置
|
|
|
if (StringUtils.isBlank(id)){
|
|
|
LampConfigAll lampConfigAll = new LampConfigAll();
|
|
|
-// lampConfigAll.setBoardGear(boardGear);
|
|
|
lampConfigAll.setInitDayage((initDayAge));
|
|
|
lampConfigAll.setListDayage((dayAgeListStr.toString()));
|
|
|
-
|
|
|
lampConfigAllMapper.update(lampConfigAll,new UpdateWrapper<LampConfigAll>().eq("unit_id",unitId));
|
|
|
wrapper.eq("unit_id",unitId);
|
|
|
lampConfigMapper.update(lampConfig,wrapper);
|
|
|
return new Result(10000,"全局配置成功",true);
|
|
|
}else {
|
|
|
+ //单个配置
|
|
|
wrapper.eq("id",id);
|
|
|
lampConfigMapper.update(lampConfig,wrapper);
|
|
|
return new Result(10000,"配置成功",true);
|
|
@@ -228,7 +226,7 @@ public class LampConfigServiceImpl extends ServiceImpl<LampConfigMapper, LampCon
|
|
|
public Result listByUnit(Map<String, String> map, HttpServletRequest request) {
|
|
|
String unitId = map.get("unitId");
|
|
|
QueryWrapper<LampConfig> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("unit_id",unitId);
|
|
|
+ wrapper.eq("unit_id",unitId).last("ORDER BY CAST( REPLACE(location,\"号产床\",\"\")AS SIGNED) ");
|
|
|
List<LampConfig> lampConfigs = lampConfigMapper.selectList(wrapper);
|
|
|
for (LampConfig lampConfig : lampConfigs) {
|
|
|
String deviceId = lampConfig.getDeviceId();
|
|
@@ -320,4 +318,6 @@ public class LampConfigServiceImpl extends ServiceImpl<LampConfigMapper, LampCon
|
|
|
endMap.put("pigpenName",basePigpen.getPigpenName());
|
|
|
return new Result(ResultCode.SUCCESS,endMap);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|