大屏定位信息代码提交
This commit is contained in:
parent
d6434ff805
commit
90210e0ac4
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.bonus.sgzb.config;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回异常枚举类
|
||||||
|
* @Author ma_sh
|
||||||
|
* @create 2024/3/29 14:43
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum ExceptionEnum {
|
||||||
|
|
||||||
|
PARAM_NULL(1001, "参数为空"),
|
||||||
|
IOT_CODE_DUPLICATE(1002, "设备编号重复"),
|
||||||
|
IOT_TO_DELETE(1003, "该iot设备绑定相关类型设备,无法删除"),
|
||||||
|
SUCCESS(200, "操作成功"),
|
||||||
|
SAVE_TO_DATABASE(500, "新增保存失败,请联系管理员!!!"),
|
||||||
|
DELETE_TO_DATABASE(500, "删除失败,请联系管理员!!!"),
|
||||||
|
BIND_TO_DATABASE(500, "绑定失败,请联系管理员!!!"),
|
||||||
|
UN_BIND_TO_DATABASE(500, "解绑失败,请联系管理员!!!"),
|
||||||
|
UPDATE_TO_DATABASE(500, "修改失败,请联系管理员!!!"),
|
||||||
|
|
||||||
|
RETURN_DATA_IS_EMPTY(501, "返回数据为空!!"),
|
||||||
|
IOT_ENCODING_ERROR(502, "输入的IOT编码有误,请输入正确的编码!!!");
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,12 +7,10 @@ import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||||
import com.bonus.sgzb.largeScreen.domain.*;
|
import com.bonus.sgzb.largeScreen.domain.*;
|
||||||
import com.bonus.sgzb.largeScreen.service.ILargeScreenService;
|
import com.bonus.sgzb.largeScreen.service.ILargeScreenService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 10488
|
* @author 10488
|
||||||
|
|
@ -231,4 +229,12 @@ public class LargeScreenController extends BaseController {
|
||||||
public AjaxResult getMaintenanceWarning() {
|
public AjaxResult getMaintenanceWarning() {
|
||||||
return service.getMaintenanceWarning();
|
return service.getMaintenanceWarning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Log(title = "获取iot编码绑定设备", businessType = BusinessType.QUERY)
|
||||||
|
@GetMapping("getIotMaCodeMachine")
|
||||||
|
public AjaxResult getIotMaCodeMachine() {
|
||||||
|
List<IotMaCodeMachine> iotMaCodeMachine = service.getIotMaCodeMachine();
|
||||||
|
return AjaxResult.success(iotMaCodeMachine);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.bonus.sgzb.largeScreen.domain;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class IotLocationVo {
|
||||||
|
|
||||||
|
/** iot设备ID */
|
||||||
|
@ApiModelProperty(value = "iot设备ID")
|
||||||
|
private String iotId;
|
||||||
|
|
||||||
|
/** 经度 */
|
||||||
|
@ApiModelProperty(value = "经度")
|
||||||
|
private BigDecimal callon;
|
||||||
|
|
||||||
|
/** 经度 */
|
||||||
|
@ApiModelProperty(value = "纬度")
|
||||||
|
private BigDecimal callat;
|
||||||
|
|
||||||
|
/** 开始时间 */
|
||||||
|
@ApiModelProperty(value = "开始时间")
|
||||||
|
private String beginTime;
|
||||||
|
|
||||||
|
/** 结束时间 */
|
||||||
|
@ApiModelProperty(value = "结束时间")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
/** 详细地址 */
|
||||||
|
@ApiModelProperty(value = "详细地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
|
||||||
|
/** 报警时间 */
|
||||||
|
@ApiModelProperty(value = "报警时间")
|
||||||
|
private String startAlarmTime;
|
||||||
|
|
||||||
|
/** 报警内容 */
|
||||||
|
@ApiModelProperty(value = "报警内容")
|
||||||
|
private String startAlarm;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.bonus.sgzb.largeScreen.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liang.chao
|
||||||
|
* @Date:2024/8/19 - 10:00
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class IotMaCodeMachine {
|
||||||
|
/**
|
||||||
|
* 机具编码
|
||||||
|
*/
|
||||||
|
private String maCode;
|
||||||
|
/**
|
||||||
|
* 机具状态
|
||||||
|
*/
|
||||||
|
private String maStatus;
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private String projectId;
|
||||||
|
/**
|
||||||
|
* 项目名称
|
||||||
|
*/
|
||||||
|
private String projectName;
|
||||||
|
/**
|
||||||
|
* 定位设备名称
|
||||||
|
*/
|
||||||
|
private String iotMachinetName;
|
||||||
|
/**
|
||||||
|
* iot设备编码
|
||||||
|
*/
|
||||||
|
private String iotCode;
|
||||||
|
/**
|
||||||
|
* 绑定状态
|
||||||
|
*/
|
||||||
|
private String bindStatus;
|
||||||
|
/**
|
||||||
|
* 当前位置
|
||||||
|
*/
|
||||||
|
private IotLocationVo iotLocationVo;
|
||||||
|
}
|
||||||
|
|
@ -171,4 +171,6 @@ public interface LargeScreenMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<AccessVo> getRepairList(ParamsDto dto);
|
List<AccessVo> getRepairList(ParamsDto dto);
|
||||||
|
|
||||||
|
List<IotMaCodeMachine> getIotMaCodeMachine();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.bonus.sgzb.largeScreen.service;
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.largeScreen.domain.*;
|
import com.bonus.sgzb.largeScreen.domain.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 10488
|
* @author 10488
|
||||||
* 大屏
|
* 大屏
|
||||||
|
|
@ -166,4 +168,6 @@ public interface ILargeScreenService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult getMaintenanceChartByMonth(ParamsDto dto);
|
AjaxResult getMaintenanceChartByMonth(ParamsDto dto);
|
||||||
|
|
||||||
|
List<IotMaCodeMachine> getIotMaCodeMachine();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,16 @@
|
||||||
package com.bonus.sgzb.largeScreen.service.impl;
|
package com.bonus.sgzb.largeScreen.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.bonus.sgzb.common.core.constant.HttpStatus;
|
||||||
|
import com.bonus.sgzb.common.core.constant.TokenConstants;
|
||||||
import com.bonus.sgzb.common.core.utils.DateTimeHelper;
|
import com.bonus.sgzb.common.core.utils.DateTimeHelper;
|
||||||
|
import com.bonus.sgzb.common.core.utils.HttpHelper;
|
||||||
|
import com.bonus.sgzb.common.core.utils.StringHelper;
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.sgzb.common.redis.service.RedisService;
|
||||||
|
import com.bonus.sgzb.config.ExceptionEnum;
|
||||||
import com.bonus.sgzb.largeScreen.domain.*;
|
import com.bonus.sgzb.largeScreen.domain.*;
|
||||||
import com.bonus.sgzb.largeScreen.mapper.LargeScreenMapper;
|
import com.bonus.sgzb.largeScreen.mapper.LargeScreenMapper;
|
||||||
import com.bonus.sgzb.largeScreen.service.ILargeScreenService;
|
import com.bonus.sgzb.largeScreen.service.ILargeScreenService;
|
||||||
|
|
@ -14,6 +23,7 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -30,6 +40,9 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CommonUtil commonUtil;
|
private CommonUtil commonUtil;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getMaterialReqData() {
|
public AjaxResult getMaterialReqData() {
|
||||||
HashMap<Object, Object> map = new HashMap<>(2);
|
HashMap<Object, Object> map = new HashMap<>(2);
|
||||||
|
|
@ -82,10 +95,10 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
List<TotalOwnershipVo> list = new ArrayList<>();
|
List<TotalOwnershipVo> list = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
//查询所有公司
|
//查询所有公司
|
||||||
list=mapper.getCompany();
|
list = mapper.getCompany();
|
||||||
if (list.size()>0){
|
if (list.size() > 0) {
|
||||||
for (TotalOwnershipVo vo:list){
|
for (TotalOwnershipVo vo : list) {
|
||||||
TotalOwnershipVo vos= countNum(null,null,vo.getCompanyId(), "2");
|
TotalOwnershipVo vos = countNum(null, null, vo.getCompanyId(), "2");
|
||||||
vo.setTotalOwnershipNum(vos.getTotalOwnershipNum());
|
vo.setTotalOwnershipNum(vos.getTotalOwnershipNum());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -97,6 +110,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领料数据详情
|
* 领料数据详情
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -112,13 +126,14 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
pageResult.setTotal(pageInfo.getTotal());
|
pageResult.setTotal(pageInfo.getTotal());
|
||||||
pageResult.setTotalPageCount(pageInfo.getPages());
|
pageResult.setTotalPageCount(pageInfo.getPages());
|
||||||
pageResult.setRows(result);
|
pageResult.setRows(result);
|
||||||
pageResult.setPageNum (dto.getPageNum());
|
pageResult.setPageNum(dto.getPageNum());
|
||||||
pageResult.setPageSize(dto.getPageSize());
|
pageResult.setPageSize(dto.getPageSize());
|
||||||
return pageResult;
|
return pageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退料数据详情
|
* 退料数据详情
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -134,13 +149,14 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
pageResult.setTotal(pageInfo.getTotal());
|
pageResult.setTotal(pageInfo.getTotal());
|
||||||
pageResult.setTotalPageCount(pageInfo.getPages());
|
pageResult.setTotalPageCount(pageInfo.getPages());
|
||||||
pageResult.setRows(materialReturnDetailData);
|
pageResult.setRows(materialReturnDetailData);
|
||||||
pageResult.setPageNum (dto.getPageNum());
|
pageResult.setPageNum(dto.getPageNum());
|
||||||
pageResult.setPageSize(dto.getPageSize());
|
pageResult.setPageSize(dto.getPageSize());
|
||||||
return pageResult;
|
return pageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 施工机具/安全工器具总保有量详情
|
* 施工机具/安全工器具总保有量详情
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -156,13 +172,14 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
pageResult.setTotal(pageInfo.getTotal());
|
pageResult.setTotal(pageInfo.getTotal());
|
||||||
pageResult.setTotalPageCount(pageInfo.getPages());
|
pageResult.setTotalPageCount(pageInfo.getPages());
|
||||||
pageResult.setRows(list);
|
pageResult.setRows(list);
|
||||||
pageResult.setPageNum (dto.getPageNum());
|
pageResult.setPageNum(dto.getPageNum());
|
||||||
pageResult.setPageSize(dto.getPageSize());
|
pageResult.setPageSize(dto.getPageSize());
|
||||||
return pageResult;
|
return pageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新购验收入库分析详情
|
* 新购验收入库分析详情
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -196,6 +213,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 方法抽取,统一赋值
|
* 方法抽取,统一赋值
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
private void extracted(ParamsDto dto) {
|
private void extracted(ParamsDto dto) {
|
||||||
|
|
@ -209,6 +227,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当月报废分析详情
|
* 当月报废分析详情
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -228,7 +247,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
pageResult.setTotal(pageInfo.getTotal());
|
pageResult.setTotal(pageInfo.getTotal());
|
||||||
pageResult.setTotalPageCount(pageInfo.getPages());
|
pageResult.setTotalPageCount(pageInfo.getPages());
|
||||||
pageResult.setRows(result);
|
pageResult.setRows(result);
|
||||||
pageResult.setPageNum (dto.getPageNum());
|
pageResult.setPageNum(dto.getPageNum());
|
||||||
pageResult.setPageSize(dto.getPageSize());
|
pageResult.setPageSize(dto.getPageSize());
|
||||||
return pageResult;
|
return pageResult;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -240,6 +259,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当月领料分析详情
|
* 当月领料分析详情
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -259,7 +279,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
pageResult.setTotal(pageInfo.getTotal());
|
pageResult.setTotal(pageInfo.getTotal());
|
||||||
pageResult.setTotalPageCount(pageInfo.getPages());
|
pageResult.setTotalPageCount(pageInfo.getPages());
|
||||||
pageResult.setRows(result);
|
pageResult.setRows(result);
|
||||||
pageResult.setPageNum (dto.getPageNum());
|
pageResult.setPageNum(dto.getPageNum());
|
||||||
pageResult.setPageSize(dto.getPageSize());
|
pageResult.setPageSize(dto.getPageSize());
|
||||||
return pageResult;
|
return pageResult;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -270,6 +290,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当月退料分析详情
|
* 当月退料分析详情
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -289,7 +310,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
pageResult.setTotal(pageInfo.getTotal());
|
pageResult.setTotal(pageInfo.getTotal());
|
||||||
pageResult.setTotalPageCount(pageInfo.getPages());
|
pageResult.setTotalPageCount(pageInfo.getPages());
|
||||||
pageResult.setRows(result);
|
pageResult.setRows(result);
|
||||||
pageResult.setPageNum (dto.getPageNum());
|
pageResult.setPageNum(dto.getPageNum());
|
||||||
pageResult.setPageSize(dto.getPageSize());
|
pageResult.setPageSize(dto.getPageSize());
|
||||||
return pageResult;
|
return pageResult;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -300,6 +321,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当月维修分析详情
|
* 当月维修分析详情
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -319,10 +341,10 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
pageResult.setTotal(pageInfo.getTotal());
|
pageResult.setTotal(pageInfo.getTotal());
|
||||||
pageResult.setTotalPageCount(pageInfo.getPages());
|
pageResult.setTotalPageCount(pageInfo.getPages());
|
||||||
pageResult.setRows(repairDetailVoList);
|
pageResult.setRows(repairDetailVoList);
|
||||||
pageResult.setPageNum (dto.getPageNum());
|
pageResult.setPageNum(dto.getPageNum());
|
||||||
pageResult.setPageSize(dto.getPageSize());
|
pageResult.setPageSize(dto.getPageSize());
|
||||||
return pageResult;
|
return pageResult;
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("当月维修分析详情error:{}", e.getMessage());
|
log.error("当月维修分析详情error:{}", e.getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -330,6 +352,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当月维修分析详情列表
|
* 当月维修分析详情列表
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -341,15 +364,72 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
return AjaxResult.success(objectHashMap);
|
return AjaxResult.success(objectHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IotMaCodeMachine> getIotMaCodeMachine() {
|
||||||
|
List<IotMaCodeMachine> iotMaCodeMachine = mapper.getIotMaCodeMachine();
|
||||||
|
for (IotMaCodeMachine maCodeMachine : iotMaCodeMachine) {
|
||||||
|
getLocation(maCodeMachine);
|
||||||
|
}
|
||||||
|
return iotMaCodeMachine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getLocation(IotMaCodeMachine iotMaCodeMachine) {
|
||||||
|
log.info("getLocation:{}", iotMaCodeMachine);
|
||||||
|
if (iotMaCodeMachine == null || iotMaCodeMachine.getIotCode() == null) {
|
||||||
|
throw new RuntimeException(ExceptionEnum.PARAM_NULL.getMsg());
|
||||||
|
}
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
//从redis中获取token
|
||||||
|
String redisCode = redisService.getCacheObject(TokenConstants.TOKEN_LOCATION);
|
||||||
|
//如果token为空,先去调登录接口,获取token
|
||||||
|
if (redisCode == null) {
|
||||||
|
redisCode = HttpHelper.getIotToken();
|
||||||
|
redisService.setCacheObject(TokenConstants.TOKEN_LOCATION, redisCode, 23L, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
map.clear();
|
||||||
|
list.add(iotMaCodeMachine.getIotCode());
|
||||||
|
map.put("deviceids", list);
|
||||||
|
String param = JSON.toJSONString(map);
|
||||||
|
String res = HttpHelper.doPost(HttpStatus.LAST_POSITION_URL + redisCode, param);
|
||||||
|
//对返回的结果进行解析
|
||||||
|
IotLocationVo iotLocationVo = resultDataHandler(res);
|
||||||
|
iotMaCodeMachine.setIotLocationVo(iotLocationVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IotLocationVo resultDataHandler(String res) {
|
||||||
|
if (res == null) {
|
||||||
|
throw new RuntimeException(ExceptionEnum.RETURN_DATA_IS_EMPTY.getMsg());
|
||||||
|
}
|
||||||
|
IotLocationVo iotLocationVo = new IotLocationVo();
|
||||||
|
JSONObject object = JSONObject.parseObject(res);
|
||||||
|
String status = object.getString("status");
|
||||||
|
String cause = object.getString("cause");
|
||||||
|
if ("0".equals(status) && "OK".equals(cause)) {
|
||||||
|
String records = object.getString("records");
|
||||||
|
//判断返回结果是否为空
|
||||||
|
if (records != null){
|
||||||
|
JSONArray jsonArray = JSON.parseArray(records);
|
||||||
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
|
JSONObject jsonObject = JSONObject.from(jsonArray.getJSONObject(i));
|
||||||
|
iotLocationVo.setIotId(jsonObject.getString("deviceid"));
|
||||||
|
iotLocationVo.setCallat(StringHelper.conversionBigDecimal(jsonObject.getString("callat")));
|
||||||
|
iotLocationVo.setCallon(StringHelper.conversionBigDecimal(jsonObject.getString("callon")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return iotLocationVo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getTotalOwnership() {
|
public AjaxResult getTotalOwnership() {
|
||||||
List<TotalOwnershipVo> list = new ArrayList<>();
|
List<TotalOwnershipVo> list = new ArrayList<>();
|
||||||
ParamsDto dto = new ParamsDto();
|
ParamsDto dto = new ParamsDto();
|
||||||
try {
|
try {
|
||||||
// 施工机具
|
// 施工机具
|
||||||
TotalOwnershipVo vo = countNum("1", CommonConstants.JJ,"","1");
|
TotalOwnershipVo vo = countNum("1", CommonConstants.JJ, "", "1");
|
||||||
// 安全工器具
|
// 安全工器具
|
||||||
TotalOwnershipVo vo2 = countNum("2", CommonConstants.TS,"","1");
|
TotalOwnershipVo vo2 = countNum("2", CommonConstants.TS, "", "1");
|
||||||
list.add(vo);
|
list.add(vo);
|
||||||
list.add(vo2);
|
list.add(vo2);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -370,14 +450,14 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
* @author cwchen
|
* @author cwchen
|
||||||
* @date 2023/12/15 19:33
|
* @date 2023/12/15 19:33
|
||||||
*/
|
*/
|
||||||
public TotalOwnershipVo countNum(String maType, String maTypeName,String companyId,String type) {
|
public TotalOwnershipVo countNum(String maType, String maTypeName, String companyId, String type) {
|
||||||
TotalOwnershipVo vo = new TotalOwnershipVo();
|
TotalOwnershipVo vo = new TotalOwnershipVo();
|
||||||
ParamsDto dto = new ParamsDto();
|
ParamsDto dto = new ParamsDto();
|
||||||
dto.setMaType(maType);
|
dto.setMaType(maType);
|
||||||
dto.setMaTypeName(maTypeName);
|
dto.setMaTypeName(maTypeName);
|
||||||
if ("2".equals(type)){
|
if ("2".equals(type)) {
|
||||||
dto.setCompanyId(companyId);
|
dto.setCompanyId(companyId);
|
||||||
}else {
|
} else {
|
||||||
dto.setCompanyId("");
|
dto.setCompanyId("");
|
||||||
}
|
}
|
||||||
// 在库数量
|
// 在库数量
|
||||||
|
|
@ -536,6 +616,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 方法抽取
|
* 方法抽取
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -614,7 +695,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
|
||||||
dto.setEndDate(DateTimeHelper.getTimeAfterThirtyDay());
|
dto.setEndDate(DateTimeHelper.getTimeAfterThirtyDay());
|
||||||
list = mapper.getMaintenanceWarning(dto);
|
list = mapper.getMaintenanceWarning(dto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("检修预警-查询失败",e);
|
log.error("检修预警-查询失败", e);
|
||||||
}
|
}
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -885,5 +885,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ORDER BY
|
ORDER BY
|
||||||
tt.create_time DESC
|
tt.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getIotMaCodeMachine" resultType="com.bonus.sgzb.largeScreen.domain.IotMaCodeMachine">
|
||||||
|
SELECT
|
||||||
|
im.iot_code as iotCode,
|
||||||
|
bpl.lot_id as projectId,
|
||||||
|
bpl.lot_name as projectName,
|
||||||
|
sd.name as maStatus,
|
||||||
|
mm.type_id,
|
||||||
|
mm.ma_code,
|
||||||
|
mm.ma_id
|
||||||
|
FROM
|
||||||
|
iot_machine im
|
||||||
|
LEFT JOIN iot_machine_bind imb ON imb.iot_id = im.id
|
||||||
|
LEFT JOIN ma_machine mm ON imb.ma_code = mm.ma_code
|
||||||
|
LEFT JOIN sys_dic sd on mm.ma_status = sd.id
|
||||||
|
LEFT JOIN slt_agreement_info sai ON mm.type_id = sai.type_id
|
||||||
|
AND mm.ma_id = sai.ma_id
|
||||||
|
AND mm.ma_id is not null
|
||||||
|
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id
|
||||||
|
WHERE
|
||||||
|
im.bind_status = 0
|
||||||
|
AND imb.unbind_time IS NULL and sai.`status` = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -10,7 +10,7 @@ public class IotLocationVo {
|
||||||
|
|
||||||
/** iot设备ID */
|
/** iot设备ID */
|
||||||
@ApiModelProperty(value = "iot设备ID")
|
@ApiModelProperty(value = "iot设备ID")
|
||||||
private Long iotId;
|
private String iotId;
|
||||||
|
|
||||||
/** 经度 */
|
/** 经度 */
|
||||||
@ApiModelProperty(value = "经度")
|
@ApiModelProperty(value = "经度")
|
||||||
|
|
|
||||||
|
|
@ -529,7 +529,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
JSONArray jsonArray = JSON.parseArray(records);
|
JSONArray jsonArray = JSON.parseArray(records);
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
JSONObject jsonObject = JSONObject.from(jsonArray.getJSONObject(i));
|
JSONObject jsonObject = JSONObject.from(jsonArray.getJSONObject(i));
|
||||||
iotLocationVo.setIotId(StringHelper.conversionLong(jsonObject.getString("deviceid")));
|
iotLocationVo.setIotId(jsonObject.getString("deviceid"));
|
||||||
iotLocationVo.setCallat(StringHelper.conversionBigDecimal(jsonObject.getString("callat")));
|
iotLocationVo.setCallat(StringHelper.conversionBigDecimal(jsonObject.getString("callat")));
|
||||||
iotLocationVo.setCallon(StringHelper.conversionBigDecimal(jsonObject.getString("callon")));
|
iotLocationVo.setCallon(StringHelper.conversionBigDecimal(jsonObject.getString("callon")));
|
||||||
}
|
}
|
||||||
|
|
@ -537,8 +537,4 @@ public class IotMachineServiceImpl implements IotMachineService {
|
||||||
}
|
}
|
||||||
return iotLocationVo;
|
return iotLocationVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue