| | |
| | | import org.eclipse.paho.client.mqttv3.MqttMessage; |
| | | import org.jeecg.common.api.vo.Result; |
| | | |
| | | import org.jeecg.common.config.TenantContext; |
| | | import org.jeecg.common.constant.MqttConstant; |
| | | import org.jeecg.common.util.IpUtils; |
| | | import org.jeecg.common.util.SpringContextUtils; |
| | | import org.jeecg.modules.dry.Bo.HerbFormulaBo; |
| | | import org.jeecg.modules.dry.entity.*; |
| | | import org.jeecg.modules.dry.mqtt.MqttConfig; |
| | | import org.jeecg.modules.dry.mqtt.MqttUtil; |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * drying formula upload |
| | | * @param formulaBo |
| | | * @return |
| | | */ |
| | | |
| | | @ApiOperation(value = "干燥配方上传", notes = "干燥配方新增或更新") |
| | | @PostMapping(value = "/saveFormula") |
| | | public Result<?> saveFormula(@RequestBody HerbFormulaBo formulaBo) { |
| | | TenantContext.setTenant(formulaBo.getTenantId()+""); |
| | | //获取request |
| | | HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); |
| | | // 获取请求主机的IP地址 |
| | | String ip = IpUtils.getIpAddr(request); |
| | | DryEquipment dryEquipment = dryEquipmentService.selectByTenantIdEquipmentId(formulaBo.getTenantId() + "", formulaBo.getEqpCode()); |
| | | if (dryEquipment != null) { |
| | | if (dryEquipment.getIp().equals(ip)) { |
| | | } else { |
| | | return Result.error("设备IP地址未配置:" + ip); |
| | | } |
| | | } else { |
| | | return Result.error("设备不存在"); |
| | | } |
| | | formulaBo.setEqpType(dryEquipment.getType()); |
| | | dryHerbFormulaService.saveOrUpdateFormula(formulaBo); |
| | | return Result.ok("保存成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "干燥配方上报", notes = "干燥配方记录上报") |
| | | @PostMapping(value = "/sendFormulaHistory") |
| | | public Result<?> sendFormulaHistory(DryHerbFormulaHisVo hisVo) { |