|
@@ -63,7 +63,7 @@ import static com.szwl.constant.ResponseCodesEnum.*;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 前端控制器
|
|
|
+ * 前端控制器
|
|
|
* </p>
|
|
|
*
|
|
|
* @author wuhs
|
|
@@ -429,15 +429,32 @@ public class TEquipmentController {
|
|
|
}
|
|
|
// query.eq(TEquipment::getAdminId,adminId);
|
|
|
List<TEquipment> list = tEquipmentService.list(query);
|
|
|
- List<EquipmentVO> equipmentVOS = new ArrayList<>();
|
|
|
+ List<EquipmentVO> equipmentVOs = new ArrayList<>();
|
|
|
+// for (TEquipment equipment : list) {
|
|
|
+// EquipmentVO equipmentVO = new EquipmentVO();
|
|
|
+// equipmentVO.setId(equipment.getId());
|
|
|
+// String name = StringUtils.isEmpty(equipment.getName()) ? equipment.getClientId() : equipment.getName();
|
|
|
+// equipmentVO.setName(name);
|
|
|
+// equipmentVO.setClientId(equipment.getClientId());
|
|
|
+// equipmentVOS.add(equipmentVO);
|
|
|
+// }
|
|
|
+ Map<String, String> duplicateNames = new HashMap<>();
|
|
|
+
|
|
|
for (TEquipment equipment : list) {
|
|
|
+ String name = StringUtils.isEmpty(equipment.getName()) ? equipment.getClientId() : equipment.getName();
|
|
|
+ String clientId = equipment.getClientId();
|
|
|
+ if (duplicateNames.containsValue(name)) {
|
|
|
+ name = clientId;
|
|
|
+ }
|
|
|
+ duplicateNames.put(String.valueOf(equipment.getId()), name);
|
|
|
+
|
|
|
EquipmentVO equipmentVO = new EquipmentVO();
|
|
|
equipmentVO.setId(equipment.getId());
|
|
|
- equipmentVO.setName(equipment.getName());
|
|
|
- equipmentVO.setClientId(equipment.getClientId());
|
|
|
- equipmentVOS.add(equipmentVO);
|
|
|
+ equipmentVO.setName(name);
|
|
|
+ equipmentVO.setClientId(clientId);
|
|
|
+ equipmentVOs.add(equipmentVO);
|
|
|
}
|
|
|
- return R.ok(equipmentVOS);
|
|
|
+ return R.ok(equipmentVOs);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查找设备")
|
|
@@ -1682,22 +1699,22 @@ public class TEquipmentController {
|
|
|
public ResponseModel<?> updateDIYProductShow(@RequestBody String productList) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(productList);
|
|
|
List<TDiyFlower> products = JSONObject.parseArray(jsonObject.get("productList").toString(), TDiyFlower.class);
|
|
|
- if(products.size()>0){
|
|
|
+ if (products.size() > 0) {
|
|
|
TDiyFlower diyFlower = products.get(0);
|
|
|
- if(diyFlower==null && diyFlower.getEquipmentId()==null){
|
|
|
- return R.fail(ResponseCodesEnum.A0001,"找不到当前设备");
|
|
|
+ if (diyFlower == null && diyFlower.getEquipmentId() == null) {
|
|
|
+ return R.fail(ResponseCodesEnum.A0001, "找不到当前设备");
|
|
|
}
|
|
|
}
|
|
|
TEquipment equipment = tEquipmentService.getById(products.get(0).getEquipmentId());
|
|
|
- if(equipment==null){
|
|
|
- return R.fail(ResponseCodesEnum.A0001,"请退出重试");
|
|
|
+ if (equipment == null) {
|
|
|
+ return R.fail(ResponseCodesEnum.A0001, "请退出重试");
|
|
|
}
|
|
|
List<TProductBean> list = new ArrayList<>();
|
|
|
- for(TDiyFlower product:products){
|
|
|
+ for (TDiyFlower product : products) {
|
|
|
TProductBean productBean = new TProductBean();
|
|
|
- if(product!=null&&product.getId()!=null){
|
|
|
+ if (product != null && product.getId() != null) {
|
|
|
productBean.setShowType(product.getShowType());
|
|
|
- if(StringUtils.isEmpty(product.getShowType())){
|
|
|
+ if (StringUtils.isEmpty(product.getShowType())) {
|
|
|
productBean.setShowType("1");
|
|
|
}
|
|
|
productBean.setProductName(product.getName());
|
|
@@ -1706,24 +1723,24 @@ public class TEquipmentController {
|
|
|
}
|
|
|
tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("updateDIYProductShow", JSON.toJSONString(list)).toString());
|
|
|
// tDiyFlowerService.updateBatchById(products);
|
|
|
- return R.ok(null,"修改请求发送成功");
|
|
|
+ return R.ok(null, "修改请求发送成功");
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查询DIY花型列表信息")
|
|
|
@GetMapping("/selectDIYFlowers")
|
|
|
- public ResponseModel<?> selectDIYFlowers(String equipmentId){
|
|
|
+ public ResponseModel<?> selectDIYFlowers(String equipmentId) {
|
|
|
if (StringUtils.isEmpty(equipmentId)) {
|
|
|
return R.fail(ResponseCodesEnum.A0001, "参数有空");
|
|
|
}
|
|
|
LambdaQueryWrapper<TDiyFlower> query = Wrappers.lambdaQuery();
|
|
|
- query.eq(TDiyFlower::getEquipmentId,Long.valueOf(equipmentId));
|
|
|
+ query.eq(TDiyFlower::getEquipmentId, Long.valueOf(equipmentId));
|
|
|
List<TDiyFlower> list = tDiyFlowerService.list(query);
|
|
|
return R.ok(list);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "远程修改锁机状态,锁机:1,解锁:0")
|
|
|
@GetMapping("/updateLockStatus")
|
|
|
- public ResponseModel<?> updateLockStatus(String equipmentId, String status){
|
|
|
+ public ResponseModel<?> updateLockStatus(String equipmentId, String status) {
|
|
|
if (StringUtils.isEmpty(equipmentId) || StringUtils.isEmpty(status)) {
|
|
|
return R.fail(ResponseCodesEnum.A0001, "参数有空");
|
|
|
}
|
|
@@ -1774,7 +1791,7 @@ public class TEquipmentController {
|
|
|
return R.fail(A0001, "该设备不存在");
|
|
|
}
|
|
|
String clientId = tEquipment.getClientId();
|
|
|
- String key = "log/"+ day + "-" + clientId + ".txt";
|
|
|
+ String key = "log/" + day + "-" + clientId + ".txt";
|
|
|
//构造一个带指定 Region 对象的配置类
|
|
|
Configuration cfg = new Configuration(Region.region2());
|
|
|
Auth auth = Auth.create(ConfigConsts.QINIU_CLOUD_ACCESS_KEY, ConfigConsts.QINIU_CLOUD_SECRET_KEY);
|