|
@ -1,9 +1,12 @@
|
|
package com.yihu.iot.controller.product;
|
|
package com.yihu.iot.controller.product;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.yihu.iot.service.device.IotDeviceInventoryWarningService;
|
|
import com.yihu.iot.service.dict.IotSystemDictService;
|
|
import com.yihu.iot.service.dict.IotSystemDictService;
|
|
import com.yihu.iot.service.product.IotProductBaseInfoService;
|
|
import com.yihu.iot.service.product.IotProductBaseInfoService;
|
|
|
|
import com.yihu.jw.entity.iot.device.IotDeviceInventoryWarningDO;
|
|
import com.yihu.jw.entity.iot.product.IotProductBaseInfoDO;
|
|
import com.yihu.jw.entity.iot.product.IotProductBaseInfoDO;
|
|
|
|
import com.yihu.jw.restmodel.iot.device.IotDeviceInventoryWarningVO;
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
|
|
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
|
|
@ -35,6 +38,8 @@ public class IotProductController extends EnvelopRestEndpoint {
|
|
private IotSystemDictService iotSystemDictService;
|
|
private IotSystemDictService iotSystemDictService;
|
|
@Autowired
|
|
@Autowired
|
|
private HttpServletRequest request;
|
|
private HttpServletRequest request;
|
|
|
|
@Autowired
|
|
|
|
private IotDeviceInventoryWarningService deviceInventoryWarningService;
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = IotRequestMapping.Product.findProductPage)
|
|
@GetMapping(value = IotRequestMapping.Product.findProductPage)
|
|
@ -203,14 +208,13 @@ public class IotProductController extends EnvelopRestEndpoint {
|
|
|
|
|
|
@GetMapping(value = IotRequestMapping.Product.setInventoryById)
|
|
@GetMapping(value = IotRequestMapping.Product.setInventoryById)
|
|
@ApiOperation(value = "根据产品id设置库存上下限预警值")
|
|
@ApiOperation(value = "根据产品id设置库存上下限预警值")
|
|
public MixEnvelop<IotProductVO, IotProductVO> setInventoryById(@ApiParam(name = "jsonData", value = "设置库存预警提醒json数组", defaultValue = "[]")
|
|
|
|
|
|
public MixEnvelop<IotDeviceInventoryWarningVO, IotDeviceInventoryWarningVO> setInventoryById(@ApiParam(name = "jsonData", value = "设置库存预警提醒json数组", defaultValue = "[]")
|
|
@RequestParam(value = "jsonData", required = true)String jsonData) {
|
|
@RequestParam(value = "jsonData", required = true)String jsonData) {
|
|
try {
|
|
try {
|
|
List<IotProductBaseInfoDO> productBaseInfoDOList = iotProductBaseInfoService.setInventoryById(jsonData);
|
|
|
|
|
|
List<IotDeviceInventoryWarningDO> doList = deviceInventoryWarningService.setInventoryById(jsonData);
|
|
//DO转VO
|
|
//DO转VO
|
|
List<IotProductBaseInfoVO> productVOList = convertToModels(productBaseInfoDOList,new ArrayList<>(productBaseInfoDOList.size()),IotProductBaseInfoVO.class);
|
|
|
|
iotProductBaseInfoService.translateDictForList(productVOList);
|
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_update, productVOList);
|
|
|
|
|
|
List<IotDeviceInventoryWarningVO> voList = convertToModels(doList,new ArrayList<>(doList.size()),IotDeviceInventoryWarningVO.class);
|
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_update, voList);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
return MixEnvelop.getError(e.getMessage());
|
|
return MixEnvelop.getError(e.getMessage());
|