浏览代码

远程开关机响应

李天标 5 年之前
父节点
当前提交
c0a22d1fa9

+ 85 - 2
app-api/src/main/java/com/hboxs/control/api/equipment/IndexController.java

@@ -166,7 +166,90 @@ public class IndexController extends BaseController {
         return JsonMessage.success("设备申请中,请耐心等待");
 
     }
+    /**
+     * 设备申请
+     *
+     * @param clientId  个推
+     * @param managerId 管理系统id
+     * @return
+     */
+    @RequestMapping(value = "/initNew", method = RequestMethod.POST)
+    @ResponseBody
+    public JsonMessage initNew(String clientId, String managerId, String gtClientId,String equimentType) {
+
+        long size = equipmentService.count(Filter.eq("clientId", clientId));
+
+        if (size > 0) {
+            return JsonMessage.error("该设备已经初始化");
+        }
+
+        if (StringUtils.isEmpty(gtClientId)) {
+            return JsonMessage.error("设备不能为空");
+        }
+
+        EquipmentApply equipmentApply = new EquipmentApply();
+        equipmentApply.setStatusType(EquipmentApply.StatusType.applying);
+        equipmentApply.setClientId(clientId);
+        equipmentApply.setManagerId(managerId);
+        equipmentApply.setGtClientId(gtClientId);
+        Long adminId = AdminUtils.decrypt(false, managerId);
+
+        Admin admin = adminService.find(adminId);
+        if (admin == null) {
+            return JsonMessage.error("找不到商家");
+        }
+        //所属商家
+        String username = admin.getUsername();
+
+        Long agencyId = admin.getAgencyId();
+
+        Long merchantId = admin.getMerchantId();
+        Long personageId = admin.getPersonageId();
+        Admin.Type type = admin.getType();
+        EquipmentApply.Type eApplyType = null;
+        switch (type) {
+            case personage:
+                if (admin.getType() != Admin.Type.personage) {
+                    return JsonMessage.error("设备商家类型错误");
+                }
+                eApplyType = EquipmentApply.Type.personage;
+                break;
+            case merchant:
+                if (admin.getType() != Admin.Type.merchant) {
+                    return JsonMessage.error("设备商家类型错误");
+                }
+                eApplyType = EquipmentApply.Type.merchant;
+                break;
+            case agency:
+                if (admin.getType() != Admin.Type.agency) {
+                    return JsonMessage.error("设备商家类型错误");
+                }
+                eApplyType = EquipmentApply.Type.agency;
+                break;
+            case admin:
+                if (admin.getType() != Admin.Type.admin) {
+                    return JsonMessage.error("设备商家类型错误");
+                }
+                eApplyType = EquipmentApply.Type.admin;
+                break;
+        }
+
+
+        //获取商家级别
+        String adminLevel = type.toValue();
+        equipmentApply.setAdminId(adminId);
+        equipmentApply.setAdminUserName(username);
+        equipmentApply.setAdminLevel(adminLevel);
+        equipmentApply.setAgencyId(agencyId);
+        equipmentApply.setMerchantId(merchantId);
+        equipmentApply.setPersonageId(personageId);
+        equipmentApply.setType(eApplyType);
+        equipmentApply.setEquimentType(equimentType);
 
+        equipmentApplyService.save(equipmentApply);
+        return JsonMessage.success("设备申请中,请耐心等待");
+
+    }
 
     /**
      * 商品调价
@@ -556,13 +639,13 @@ public class IndexController extends BaseController {
      */
     @RequestMapping(value = "/updateEqeStatusNew", method = RequestMethod.POST)
     @ResponseBody
-    public JsonMessage updateEqeStatusNew(String clientId, Integer eqeStatus,String network) {
+    public JsonMessage updateEqeStatusNew(String clientId, Integer eqeStatus,String netTime) {
         Equipment equipment = equipmentService.findByClientId(clientId);
         if (equipment == null) {
 
             return JsonMessage.error("该设备不存在");
         }
-        equipment.setNetwork(network);
+        equipment.setNetwork(netTime);
         equipment.setEqeStatus(eqeStatus);
         equipmentService.update(equipment);
         return JsonMessage.success("修改成功");

+ 1 - 1
app-api/src/main/java/com/hboxs/control/api/order/OrderController.java

@@ -492,7 +492,7 @@ public class OrderController extends BaseController {
 //        }catch (Exception e){
 //            e.printStackTrace();
 //        }
-//        productName = "玫瑰精灵";
+//        productName = "烈焰红唇";
         Equipment equipment = equipmentService.findByClientId(clientId);
         if (!frpCode.equals("ALIPAY_NATIVE") && !frpCode.equals("WEIXIN_NATIVE")) {
             return JsonMessage.error("参数错误");

+ 19 - 1
app-backend-web/src/main/java/com/hboxs/control/admin/EquipmentApplyController.java

@@ -197,7 +197,12 @@ public class EquipmentApplyController extends BaseController {
                         //获取设备的id
                         Long equipmentId = equipmentService.findByClientId(clientId).getId();
                         if (!productService.exists(Filter.eq("equipmentId", equipmentId))) {
-                            saveProduct(equipmentId);
+                            if(equipmentApply.getEquimentType().equals("MG280")){
+                                saveProductMG280(equipmentId);
+                            }else{
+                                saveProduct(equipmentId);
+                            }
+
                         }
 
                     } else if (status.equals("rejected")) {
@@ -233,5 +238,18 @@ public class EquipmentApplyController extends BaseController {
         }
 
     }
+    private void saveProductMG280(Long id) {
+        String[] str = { "水中芙蓉mini", "水中芙蓉", "烈焰红唇", "烈焰红唇mini", "夏日爱恋", "夏日爱恋mini", "冰美人", "冰美人mini", "彩色精灵", "彩色精灵mini"};
+
+        for (int i = 0; i < str.length; i++) {
+            Product product = new Product();
+            product.setEquipmentId(id);
+            product.setProductName(str[i]);
+            product.setRmbPrice(BigDecimal.ZERO);
+            product.setCodePrice(BigDecimal.ZERO);
+            productService.save(product);
+        }
+
+    }
 
 }

+ 1 - 1
app-backend-web/src/main/webapp/accessCode.html

@@ -83,7 +83,7 @@
         <p class="remind"><i class="iconfont icon-tixing"></i> 提示:请咨询管理员获得访问码</p>
     </div>
 <div class="footer">
-    <p>地址:广州市番禺区市桥市南路92号301 电话:020-31062206 或 13631335699(朱生)</p>
+    <p>地址:广州市番禺区桥南街蚬涌村联兴路11号华深科技园五层 电话:020-31062206 或 13631335699(朱生)</p>
     <p>Copyright © 2019 广州申泽智能科技有限公司 版权所有 | 粤ICP备16009221号-1 </p>
 </div>
 <script type="text/javascript">

+ 1 - 1
app-backend-web/src/main/webapp/asl-admin/login.jsp

@@ -271,7 +271,7 @@
     </div>
 </div>
 <div class="footer">
-    <p>地址:广州市番禺区市桥市南路92号301 电话:020-31062206 或 13631335699(朱生)</p>
+    <p>地址:广州市番禺区桥南街蚬涌村联兴路11号华深科技园五层 电话:020-31062206 或 13631335699(朱生)</p>
     <p>Copyright © 2019 广州申泽智能科技有限公司 版权所有 | 粤ICP备16009221号-1 | <a href="/asl-admin/login.jsp?type=admin">总后台管理系统</a></p>
 </div>
 <script type="text/javascript">

+ 13 - 0
app-entity/src/main/java/com/hboxs/entity/EquipmentApply.java

@@ -47,6 +47,19 @@ public class EquipmentApply extends BaseEntity {
     private String managerId;
 
     /**
+     * 机器类型
+     */
+    private String equimentType;
+
+    public String getEquimentType() {
+        return equimentType;
+    }
+
+    public void setEquimentType(String equimentType) {
+        this.equimentType = equimentType;
+    }
+
+    /**
      * 类型
      */
     public enum Type {