|
@ -2,12 +2,14 @@ package com.yihu.iot.controller.product;
|
|
|
|
|
|
import com.yihu.iot.service.device.IotDeviceInventoryWarningService;
|
|
|
import com.yihu.iot.service.dict.IotSystemDictService;
|
|
|
import com.yihu.iot.service.product.IotProductBaseInfoPropertyService;
|
|
|
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.util.AesEncryptUtils;
|
|
|
import com.yihu.jw.restmodel.iot.device.IotDeviceInventoryWarningVO;
|
|
|
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
|
|
|
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoPropertyVO;
|
|
|
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
|
|
|
import com.yihu.jw.restmodel.iot.product.IotProductVO;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
@ -31,7 +33,8 @@ import java.util.List;
|
|
|
@RequestMapping(IotRequestMapping.Common.product)
|
|
|
@Api(tags = "产品管理相关操作", description = "产品管理相关操作")
|
|
|
public class IotProductController extends EnvelopRestEndpoint {
|
|
|
|
|
|
@Autowired
|
|
|
private IotProductBaseInfoPropertyService iotProductBaseInfoPropertyService;
|
|
|
@Autowired
|
|
|
private IotProductBaseInfoService iotProductBaseInfoService;
|
|
|
@Autowired
|
|
@ -47,6 +50,8 @@ public class IotProductController extends EnvelopRestEndpoint {
|
|
|
public MixEnvelop<IotProductBaseInfoVO, IotProductBaseInfoVO> findCompanyPage(
|
|
|
@ApiParam(name = "name", value = "注册证号或产品名称", defaultValue = "")
|
|
|
@RequestParam(value = "name", required = false) String name,
|
|
|
@ApiParam(name = "property", value = "属性", defaultValue = "")
|
|
|
@RequestParam(value = "property", required = false) String property,
|
|
|
@ApiParam(name = "classify", value = "产品分类", defaultValue = "")
|
|
|
@RequestParam(value = "classify", required = false) String classify,
|
|
|
@ApiParam(name = "companyId", value = "企业id", defaultValue = "")
|
|
@ -76,6 +81,10 @@ public class IotProductController extends EnvelopRestEndpoint {
|
|
|
filters += semicolon +"productClassify="+classify;
|
|
|
semicolon = ";";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(property)){
|
|
|
filters += semicolon +"property="+property;
|
|
|
semicolon = ";";
|
|
|
}
|
|
|
String sorts = "-updateTime";
|
|
|
//得到list数据
|
|
|
List<IotProductBaseInfoDO> list = iotProductBaseInfoService.search(null, filters, sorts, page, size);
|
|
@ -227,5 +236,44 @@ public class IotProductController extends EnvelopRestEndpoint {
|
|
|
return iotProductBaseInfoService.findAll();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "增加产品属性")
|
|
|
@PostMapping(value = IotRequestMapping.Product.addProductProperty)
|
|
|
public MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> addProductProperty(@ApiParam(name = "jsonData", value = "添加产品属性json", defaultValue = "[]")
|
|
|
@RequestParam(value = "jsonData", required = true)String jsonData){
|
|
|
try {
|
|
|
IotProductBaseInfoPropertyVO iotProductBaseInfoPropertyVO = toEntity(jsonData, IotProductBaseInfoPropertyVO.class);
|
|
|
MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> res = iotProductBaseInfoPropertyService.create(iotProductBaseInfoPropertyVO);
|
|
|
//创建熟悉 修改熟悉状态为 1
|
|
|
iotProductBaseInfoService.updateProperty(iotProductBaseInfoPropertyVO.getProductId(), "1");
|
|
|
return res;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError("操作失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "修改产品熟悉 通过id")
|
|
|
@PostMapping(value = IotRequestMapping.Product.updateProductProperty)
|
|
|
public MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> updateProductProperty(@ApiParam(name = "jsonData", value = "添加产品属性json", defaultValue = "[]") @RequestParam(value = "jsonData", required = true)String jsonData){
|
|
|
try {
|
|
|
IotProductBaseInfoPropertyVO iotProductBaseInfoPropertyVO = toEntity(jsonData, IotProductBaseInfoPropertyVO.class);
|
|
|
return iotProductBaseInfoPropertyService.update(iotProductBaseInfoPropertyVO);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError("操作失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "修改产品熟悉 通过id")
|
|
|
@PostMapping(value = IotRequestMapping.Product.findProductProperty)
|
|
|
public MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> findProductProperty(@ApiParam(name = "productId", value = "产品id") @RequestParam(value = "productId", required = true) String productId){
|
|
|
try {
|
|
|
IotProductBaseInfoPropertyVO vo = iotProductBaseInfoPropertyService.findProductPropertyByProductId(productId);
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, vo);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError("操作失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|