|
@@ -6,10 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.szwl.constant.ResponseCodesEnum;
|
|
|
-import com.szwl.model.bean.CommonParamVo;
|
|
|
-import com.szwl.model.bean.EquipmentDTO;
|
|
|
-import com.szwl.model.bean.EquipmentVo;
|
|
|
-import com.szwl.model.bean.ProductVo;
|
|
|
+import com.szwl.model.bean.*;
|
|
|
import com.szwl.model.bo.JsonMessage;
|
|
|
import com.szwl.model.bo.JsonUtils;
|
|
|
import com.szwl.model.bo.R;
|
|
@@ -1068,14 +1065,6 @@ public class IndexController { ;
|
|
|
if (equipment == null) {
|
|
|
return "404";
|
|
|
}
|
|
|
- //TODO
|
|
|
-// TAdmin admin = adminService.find(equipment.getAdminId());
|
|
|
-// String qrCodeImgUrl = admin.getQrCodeImgUrl();
|
|
|
-// if(!StringUtils.isEmpty(qrCodeImgUrl)){
|
|
|
-// return qrCodeImgUrl;
|
|
|
-// }else {
|
|
|
-// return "400";
|
|
|
-// }
|
|
|
return "400";
|
|
|
}
|
|
|
/**
|
|
@@ -1786,15 +1775,17 @@ public class IndexController { ;
|
|
|
LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
|
|
|
query.eq(TEquipment::getClientId,clientId);
|
|
|
List<TEquipment> list = equipmentService.list(query);
|
|
|
- TEquipment equipment = list.get(0);
|
|
|
- Long adminId = equipment.getAdminId();
|
|
|
- if(adminId!=null){
|
|
|
- String managerId = AdminUtils.encrypt(false, adminId);
|
|
|
- if(StringUtils.isEmpty(equipment.getManagerId())||!equipment.getManagerId().equals(managerId)){
|
|
|
- equipment.setManagerId(managerId);
|
|
|
- equipmentService.save(equipment);
|
|
|
+ if (list.size()>0) {
|
|
|
+ TEquipment equipment = list.get(0);
|
|
|
+ Long adminId = equipment.getAdminId();
|
|
|
+ if(adminId!=null){
|
|
|
+ String managerId = AdminUtils.encrypt(false, adminId);
|
|
|
+ if(StringUtils.isEmpty(equipment.getManagerId())||!equipment.getManagerId().equals(managerId)){
|
|
|
+ equipment.setManagerId(managerId);
|
|
|
+ equipmentService.save(equipment);
|
|
|
+ }
|
|
|
+ return managerId;
|
|
|
}
|
|
|
- return managerId;
|
|
|
}
|
|
|
return "error";
|
|
|
}
|
|
@@ -1930,5 +1921,42 @@ public class IndexController { ;
|
|
|
return R.fail(ResponseCodesEnum.A0002);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 上传花型显示状态
|
|
|
+ * @param clientId 设备编号
|
|
|
+ * @param tProductBean 包含花型编号和状态
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/updateShowGoods", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public String updateShowGoods(@RequestParam String clientId, @RequestBody List<TProductBean> tProductBean) {
|
|
|
+ if(StringUtils.isEmpty(clientId)||tProductBean == null) {
|
|
|
+ return "参数为空";
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
|
|
|
+ query.eq(TEquipment::getClientId,clientId);
|
|
|
+ TEquipment equipment = equipmentService.getOnly(query);
|
|
|
+ if (equipment==null) {
|
|
|
+ return "找不到设备信息";
|
|
|
+ }
|
|
|
+ Long equipmentId = equipment.getId();
|
|
|
+ ArrayList<TProduct> tProducts = new ArrayList<>();
|
|
|
+ for (TProductBean productBean : tProductBean) {
|
|
|
+ String no = productBean.getNo();
|
|
|
+ String showType = productBean.getShowType();
|
|
|
+ LambdaQueryWrapper<TProduct> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(TProduct::getEquipmentId,equipmentId);
|
|
|
+ wrapper.eq(TProduct::getNo,no);
|
|
|
+ TProduct product = productService.getOnly(wrapper);
|
|
|
+ product.setShowType(showType);
|
|
|
+ tProducts.add(product);
|
|
|
+ }
|
|
|
+ boolean res = productService.updateBatchById(tProducts);
|
|
|
+ if (!res) {
|
|
|
+ return "error";
|
|
|
+ }
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|