|
@@ -10,10 +10,7 @@ import com.hboxs.common.JsonMessage;
|
|
import com.hboxs.common.utils.AdminUtils;
|
|
import com.hboxs.common.utils.AdminUtils;
|
|
import com.hboxs.common.utils.PushUtils;
|
|
import com.hboxs.common.utils.PushUtils;
|
|
import com.hboxs.control.api.BaseController;
|
|
import com.hboxs.control.api.BaseController;
|
|
-import com.hboxs.entity.Admin;
|
|
|
|
-import com.hboxs.entity.Equipment;
|
|
|
|
-import com.hboxs.entity.EquipmentApply;
|
|
|
|
-import com.hboxs.entity.Proportion;
|
|
|
|
|
|
+import com.hboxs.entity.*;
|
|
import com.hboxs.service.*;
|
|
import com.hboxs.service.*;
|
|
import org.apache.commons.io.IOUtils;
|
|
import org.apache.commons.io.IOUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
@@ -45,6 +42,9 @@ public class IndexController extends BaseController {
|
|
@Resource(name = "proportionServiceImpl")
|
|
@Resource(name = "proportionServiceImpl")
|
|
private ProportionService proportionService;
|
|
private ProportionService proportionService;
|
|
|
|
|
|
|
|
+ @Resource(name = "boxServiceImpl")
|
|
|
|
+ private BoxService boxService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 心跳
|
|
* 心跳
|
|
*
|
|
*
|
|
@@ -260,6 +260,61 @@ public class IndexController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 添加厕所格子(有多少个坑)
|
|
|
|
+ *
|
|
|
|
+ * @param clientId 个推
|
|
|
|
+ * @param
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping(value = "/createBox", method = RequestMethod.POST)
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public JsonMessage createBox(String clientId,String number){
|
|
|
|
+ Equipment equipment = equipmentService.findByClientId(clientId);
|
|
|
|
+ List<Filter> fs = new ArrayList<>();
|
|
|
|
+ fs.add(Filter.eq("equipmentId", equipment.getId()));
|
|
|
|
+ List<Box> boxList = boxService.findList(100, fs, null);
|
|
|
|
+ if(boxList.size()>0){
|
|
|
|
+ for(Box box:boxList){
|
|
|
|
+ boxService.delete(box.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ int j = Integer.parseInt(number);
|
|
|
|
+ for(int i = 1;i <= j;i++){
|
|
|
|
+ Box newBox = new Box();
|
|
|
|
+ newBox.setAdminId(String.valueOf(equipment.getAdminId()));
|
|
|
|
+ newBox.setEquipmentId(String.valueOf(equipment.getId()));
|
|
|
|
+ newBox.setStatus("0");
|
|
|
|
+ newBox.setSn(i+"号");
|
|
|
|
+ boxService.save(newBox);
|
|
|
|
+ }
|
|
|
|
+ return JsonMessage.success("添加成功");
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 添加厕所格子(有多少个坑)
|
|
|
|
+ *
|
|
|
|
+ * @param clientId 个推
|
|
|
|
+ * @param
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping(value = "/updateBox", method = RequestMethod.POST)
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public JsonMessage updateBox(String clientId,String sn,String status){
|
|
|
|
+ Equipment equipment = equipmentService.findByClientId(clientId);
|
|
|
|
+ List<Filter> fs = new ArrayList<>();
|
|
|
|
+ fs.add(Filter.eq("equipmentId", equipment.getId()));
|
|
|
|
+ fs.add(Filter.eq("sn", sn));
|
|
|
|
+ List<Box> boxList = boxService.findList(10, fs, null);
|
|
|
|
+ if(boxList.size()>0){
|
|
|
|
+ Box box = boxList.get(0);
|
|
|
|
+ box.setStatus(status);
|
|
|
|
+ boxService.update(box);
|
|
|
|
+ }else{
|
|
|
|
+ return JsonMessage.success("没找到该编号");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return JsonMessage.success("修改成功");
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
* 商品调价
|
|
* 商品调价
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "/updateProduct", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/updateProduct", method = RequestMethod.POST)
|