| | |
| | | import com.fzzy.igds.camera.ApiCameraManager; |
| | | import com.fzzy.igds.camera.data.ApiCameraData; |
| | | import com.fzzy.igds.camera.data.ApiCameraResp; |
| | | import com.fzzy.igds.constant.DepotType; |
| | | import com.fzzy.igds.constant.OrderRespEnum; |
| | | import com.fzzy.igds.constant.RespCodeEnum; |
| | | import com.fzzy.igds.data.*; |
| | | import com.fzzy.igds.domain.*; |
| | | import com.fzzy.igds.io.manager.QuantityRemoteManager; |
| | | import com.fzzy.igds.io.service.RemoteQuantityService; |
| | | import com.fzzy.igds.request.QuantityRequest; |
| | | import com.fzzy.igds.response.BaseResponse; |
| | | import com.fzzy.igds.service.*; |
| | | import com.fzzy.igds.utils.ContextUtil; |
| | | import com.fzzy.igds.utils.DateUtil; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description |
| | |
| | | |
| | | @Resource |
| | | private CommonManager commonManager; |
| | | @Resource |
| | | private QuantityRemoteManager remoteManager; |
| | | @Resource |
| | | private SecCameraService secCameraService; |
| | | @Resource |
| | |
| | | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功!!", fileList); |
| | | } |
| | | |
| | | /** |
| | | * 单仓检测 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public BaseResponse checkSingle(IgdsBaseParam param) { |
| | | if (null == param || StringUtils.isBlank(param.getDepotId())) { |
| | | return new BaseResponse(RespCodeEnum.CODE_1007.getCode(), RespCodeEnum.CODE_1007.getMsg()); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(param.getCompanyId())) { |
| | | param.setCompanyId(ContextUtil.getCompanyId()); |
| | | } |
| | | |
| | | QuantityConf conf = quantityService.getCacheQuantityConf(param.getCompanyId(), param.getDepotId()); |
| | | if (conf == null) { |
| | | return new BaseResponse(RespCodeEnum.CODE_1007.getCode(), RespCodeEnum.CODE_1007.getMsg()); |
| | | } |
| | | |
| | | RemoteQuantityService remoteQuantityService = remoteManager.getRemoteQuantityService(conf.getProtocol()); |
| | | |
| | | if (null == remoteQuantityService) { |
| | | return new BaseResponse(OrderRespEnum.ORDER_ERROR.getCode(), |
| | | "系统没有" + conf.getProtocol() + "的协议实现,执行被拒绝!"); |
| | | } |
| | | |
| | | QuantityRequest request = new QuantityRequest(); |
| | | BeanUtils.copyProperties(conf, request); |
| | | request.setDepotId(conf.getDepotId()); |
| | | request.setYtIp(conf.getYtIp()); |
| | | request.setCompanyId(conf.getCompanyId()); |
| | | request.setDeptId(conf.getDeptId()); |
| | | request.setSn(conf.getSn()); |
| | | request.setLength(conf.getLength()); |
| | | |
| | | request.setBatchId(conf.getDepotId() + "_" + DateFormatUtils.format(new Date(), "yyyyMMddHHmm")); |
| | | |
| | | return remoteQuantityService.checkStart(request); |
| | | } |
| | | |
| | | /** |
| | | * 停止检测 |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public BaseResponse checkStop(IgdsBaseParam param) { |
| | | if (param == null || StringUtils.isEmpty(param.getDepotId())) { |
| | | return new BaseResponse(RespCodeEnum.CODE_1007.getCode(), RespCodeEnum.CODE_1007.getMsg()); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(param.getCompanyId())) { |
| | | param.setCompanyId(ContextUtil.getCompanyId()); |
| | | } |
| | | |
| | | QuantityConf conf = quantityService.getCacheQuantityConf(param.getCompanyId(), param.getDepotId()); |
| | | if (conf == null) { |
| | | return new BaseResponse(RespCodeEnum.CODE_1007.getCode(), RespCodeEnum.CODE_1007.getMsg()); |
| | | } |
| | | |
| | | RemoteQuantityService remoteQuantityService = remoteManager.getRemoteQuantityService(conf.getProtocol()); |
| | | |
| | | if (null == remoteQuantityService) { |
| | | return new BaseResponse(OrderRespEnum.ORDER_ERROR.getCode(), |
| | | "系统没有" + conf.getProtocol() + "的协议实现,执行被拒绝!"); |
| | | } |
| | | |
| | | QuantityRequest request = new QuantityRequest(); |
| | | BeanUtils.copyProperties(conf, request); |
| | | request.setCompanyId(conf.getCompanyId()); |
| | | request.setYtIp(conf.getYtIp()); |
| | | request.setSn(conf.getSn()); |
| | | request.setDeptId(conf.getDeptId()); |
| | | request.setDepotId(conf.getDepotId()); |
| | | |
| | | return remoteQuantityService.checkStop(request); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取油罐油情及液位信息 |
| | | * |
| | | * @param deptId |
| | | * @return |
| | | */ |
| | | public List<Quantity> getHeightList(String deptId) { |
| | | |
| | | if (StringUtils.isEmpty(deptId)) { |
| | | deptId = ContextUtil.subDeptId(null); |
| | | } |
| | | //获取所有筒仓及浅圆仓 |
| | | List<Depot> depotList = commonManager.listAllDepot(deptId, DepotType.TYPE_02.getCode() + "," + DepotType.TYPE_04.getCode()); |
| | | if (null == depotList || depotList.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | List<Quantity> list = new ArrayList<>(); |
| | | List<Quantity> quantityList; |
| | | Quantity quantity; |
| | | for (Depot depot : depotList) { |
| | | |
| | | quantityList = quantityService.getQuantityList(depot.getId(), 1); |
| | | if (null == quantityList || quantityList.isEmpty()) { |
| | | quantity = new Quantity(); |
| | | quantity.setDepotId(depot.getId()); |
| | | }else { |
| | | quantity = quantityList.get(0); |
| | | } |
| | | quantity.setDepotData(depot); |
| | | |
| | | list.add(quantity); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | } |