|
@ -1,5 +1,7 @@
|
|
|
package com.yihu.iot.service.product;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.iot.dao.device.IotOrderPurchaseDao;
|
|
|
import com.yihu.iot.dao.product.*;
|
|
|
import com.yihu.iot.service.dict.IotSystemDictService;
|
|
@ -330,4 +332,28 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置库存上下限提醒值
|
|
|
* @param jsonData
|
|
|
* @return
|
|
|
*/
|
|
|
public List<IotProductBaseInfoDO> setInventoryById(String jsonData) {
|
|
|
List<IotProductBaseInfoDO> list = new ArrayList();
|
|
|
JSONArray jsonArray = JSONArray.parseArray(jsonData);
|
|
|
for (Object object : jsonArray){
|
|
|
JSONObject jsonObject = (JSONObject) object;
|
|
|
String id = jsonObject.getString("id");
|
|
|
Integer inventoryUpper = jsonObject.getInteger("inventoryUpper");
|
|
|
Integer inventoryFloor = jsonObject.getInteger("inventoryFloor");
|
|
|
//根据id查找对应产品
|
|
|
IotProductBaseInfoDO productBaseInfoDO = iotProductBaseInfoDao.findById(id);
|
|
|
if (productBaseInfoDO != null){
|
|
|
productBaseInfoDO.setInventoryUpper(inventoryUpper);
|
|
|
productBaseInfoDO.setInventoryFloor(inventoryFloor);
|
|
|
list.add(productBaseInfoDO);
|
|
|
}
|
|
|
}
|
|
|
iotProductBaseInfoDao.save(list);
|
|
|
return list;
|
|
|
}
|
|
|
}
|