李天标 3 years ago
parent
commit
d39725c774

+ 1 - 1
src/main/java/com/szwl/aspect/MyWebMvcConfigurer.java

@@ -20,7 +20,7 @@ public class MyWebMvcConfigurer extends WebMvcConfigurationSupport {
     public void addInterceptors(InterceptorRegistry registry) {
         // 自定义去除的路径
         String[] myExcludes= {"/tAdmin/login","/tAdmin/save","/tAdmin/updatePassword","/tMessageCode/**",
-                "/rabbitMqController/**","/indexController/initNew.htm","/indexController/**","/tAdmin/**","/tPromoCode/**","/api/**"};
+                "/rabbitMqController/**","/indexController/initNew.htm","/indexController/**","/tAdmin/**","/tPromoCode/**","/api/**","/error"};
         registry.addInterceptor(headTokenInterceptor).addPathPatterns("/**")
                 // swagger
                 .excludePathPatterns(swaggerExcludes)

+ 25 - 19
src/main/java/com/szwl/controller/ADIndexController.java

@@ -44,11 +44,12 @@ public class ADIndexController {
     /**
      * 根据广告id获取广告
      */
-    @GetMapping(value = "/getAdById.htm", produces = "application/json;charset=UTF-8")
+    @GetMapping(value = "/getAdById.htm", produces = "text/html;charset=utf-8")
     @ResponseBody
-    public Object getAdById(String id) {
+    public String getAdById(String id) {
         if(StringUtils.isEmpty(id)){
-            return JsonMessage.error("id为null");
+//            return JsonMessage.error("id为null");
+            return "id为null";
         }
         TAd ad = aDService.getById(id);
         ArrayList<AdVo> list = new ArrayList<>();
@@ -69,15 +70,15 @@ public class ADIndexController {
         jsonObject.put("code", 0);
         jsonObject.put("data", JSONObject.toJSON(list).toString());
         jsonObject.put("errmsg", "");
-        return jsonObject;
+        return jsonObject.toJSONString();
     }
 
     /**
      * 设备获取默认广告
      */
-    @GetMapping(value = "/getAd.htm", produces = "application/json;charset=UTF-8")
+    @GetMapping(value = "/getAd.htm", produces = "text/html;charset=utf-8")
     @ResponseBody
-    public Object getAdNew(String clientId,String equimentType) {
+    public String getAdNew(String clientId,String equimentType) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> equipmentList = equipmentService.list(query);
@@ -110,14 +111,14 @@ public class ADIndexController {
         jsonObject.put("code", 0);
         jsonObject.put("data", JSONObject.toJSON(list).toString());
         jsonObject.put("errmsg", "");
-        return jsonObject;
+        return jsonObject.toJSONString();
     }
     /**
      * 设备获取广告
      */
-    @GetMapping(value = "/getAdByEquipment.htm", produces = "application/json;charset=UTF-8")
+    @GetMapping(value = "/getAdByEquipment.htm", produces = "text/html;charset=utf-8")
     @ResponseBody
-    public Object getAdByEquipment(String clientId,String equimentType) {
+    public String getAdByEquipment(String clientId,String equimentType) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> equipmentList = equipmentService.list(query);
@@ -151,7 +152,7 @@ public class ADIndexController {
         jsonObject.put("code", 0);
         jsonObject.put("data", JSONObject.toJSON(list).toString());
         jsonObject.put("errmsg", "");
-        return jsonObject;
+        return jsonObject.toJSONString();
     }
     /**
      * 获取时间规则
@@ -159,15 +160,17 @@ public class ADIndexController {
      * @param id
      * @return
      */
-    @GetMapping(value = "/getTimeRule.htm", produces = "application/json;charset=UTF-8")
+    @GetMapping(value = "/getTimeRule.htm", produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage getTimeRule(Long id) {
+    public String getTimeRule(Long id) {
         TTimeRule timeRule = timeRuleService.getById(id);
         if (timeRule == null) {
-            return JsonMessage.error("该规则不存在");
+//            return JsonMessage.error("该规则不存在");
+            return "该规则不存在";
         }
         String rule = timeRule.getRule();
-        return JsonMessage.success(rule);
+//        return JsonMessage.success(rule);
+        return rule;
     }
 
     /**
@@ -175,15 +178,16 @@ public class ADIndexController {
      *
      * @return
      */
-    @PostMapping(value = "/pushTimeUpdate.htm", produces = "application/json;charset=UTF-8")
+    @PostMapping(value = "/pushTimeUpdate.htm", produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updatePushTimeUpdate(String clientId, String pushUpdateTime) {
+    public String updatePushTimeUpdate(String clientId, String pushUpdateTime) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> equipmentList = equipmentService.list(query);
         TEquipment equipment = equipmentList.get(0);
         if (equipment == null) {
-            return JsonMessage.error("该设备不存在");
+//            return JsonMessage.error("该设备不存在");
+            return "该设备不存在";
         }
         Date date = null;
         try {
@@ -192,10 +196,12 @@ public class ADIndexController {
             equipment.setPushUpdateTime(date);
         } catch (ParseException e) {
             e.printStackTrace();
-            return JsonMessage.error("修改失败");
+//            return JsonMessage.error("修改失败");
+            return "修改失败";
         }
         equipmentService.updateById(equipment);
-        return JsonMessage.success("修改成功");
+//        return JsonMessage.success("修改成功");
+        return "修改成功";
     }
     /**
      * 获取时间规则

+ 69 - 0
src/main/java/com/szwl/controller/AlarmClockIndexController.java

@@ -0,0 +1,69 @@
+package com.szwl.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.szwl.model.entity.TAlarmClockItem;
+import com.szwl.model.entity.TEquipment;
+import com.szwl.model.utils.JsonUtils;
+import com.szwl.service.TAlarmClockItemService;
+import com.szwl.service.TEquipmentService;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Controller("appAlarmClockController")
+@RequestMapping("/api/app_alarmClock/alarmClockIndex")
+public class AlarmClockIndexController  {
+    @Autowired
+    private TEquipmentService equipmentService;
+    @Autowired
+    private TAlarmClockItemService alarmClockItemService;
+
+    /**
+     *
+     *获取机器的闹钟
+     * @param clientId
+     * @return
+     */
+    @GetMapping(value = "/getClock", produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String endDate(String clientId,String type){
+        if(!StringUtils.isEmpty(clientId)&&!StringUtils.isEmpty(type)){
+            LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+            query.eq(TEquipment::getClientId,clientId);
+            List<TEquipment> list = equipmentService.list(query);
+            TEquipment equipment = list.get(0);
+            LambdaQueryWrapper<TAlarmClockItem> query1 = Wrappers.lambdaQuery();
+            query1.eq(TAlarmClockItem::getType,type);
+            query1.eq(TAlarmClockItem::getEquipmentId,equipment.getId());
+            query1.eq(TAlarmClockItem::getStatus,"1");
+            query1.eq(TAlarmClockItem::getAdminId,equipment.getAdminId());
+            List<TAlarmClockItem> list2 = alarmClockItemService.list(query1);
+            if(list2.size()>0){
+                JSONObject jsonObject = new JSONObject();
+                List<String> li = new ArrayList<>();
+                for (TAlarmClockItem alarmClockItem:list2){
+                    li.add(alarmClockItem.getWeek()+":"+alarmClockItem.getHour());
+                }
+                jsonObject.put("data", JsonUtils.toJson(li));
+//                return JsonMessage.success(jsonObject);
+                return jsonObject.toJSONString();
+            }else{
+//                return JsonMessage.error("无闹钟数据");
+                return "无闹钟数据";
+            }
+        }else{
+//            return JsonMessage.error("数据为空");
+            return "数据为空";
+        }
+
+    }
+}

+ 209 - 0
src/main/java/com/szwl/controller/AlarmRecordIndexController.java

@@ -0,0 +1,209 @@
+package com.szwl.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.szwl.model.dto.AlarmRecordVo;
+import com.szwl.model.entity.TAdmin;
+import com.szwl.model.entity.TAlarmRecord;
+import com.szwl.model.entity.TEquipment;
+import com.szwl.model.utils.MailUtil;
+import com.szwl.model.utils.YunPianSms;
+import com.szwl.service.TAdminService;
+import com.szwl.service.TAlarmRecordService;
+import com.szwl.service.TEquipmentService;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@Controller("appAlarmRecordController")
+@RequestMapping("/api/app_alarmRecord/alarmRecodeIndex")
+public class AlarmRecordIndexController {
+
+    @Autowired
+    private TAlarmRecordService alarmRecordService;
+
+    @Autowired
+    private TEquipmentService equipmentService;
+
+    @Autowired
+    private TAdminService adminService;
+
+    private static final String appid = "07784f5fedb508046c841b391005b7de";
+    /**
+     * 添加报警记录
+     */
+    @RequestMapping(value = "/addAlarmRecord", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String addAlarmRecord(@RequestBody AlarmRecordVo alarmRecordVo) {
+
+
+        TAlarmRecord alarmRecord = new TAlarmRecord();
+
+        String clientId = alarmRecordVo.getClientId();
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        query.eq(TEquipment::getClientId,clientId);
+        List<TEquipment> list = equipmentService.list(query);
+        TEquipment equipment = list.get(0);
+        if (equipment == null) {
+//            return JsonMessage.error("添加报警记录失败");
+            return "添加报警记录失败";
+        }
+        if (equipment.getType() == null) {
+//            return JsonMessage.error("商家类型不存在");
+            return "商家类型不存在";
+        }
+        Integer type = equipment.getType();
+        Long adminId = equipment.getAdminId();
+        Long equipmentId = equipment.getId();
+        String name = equipment.getName();
+        String adminUserName = equipment.getAdminUserName();
+        alarmRecord.setEquipmentId(equipmentId);
+        alarmRecord.setName(name);
+        alarmRecord.setAdminLevel(equipment.getAdminLevel());
+        alarmRecord.setClientId(clientId);
+        alarmRecord.setType(type);
+        alarmRecord.setAdminId(adminId);
+        alarmRecord.setCreateDate(new Date());
+        alarmRecord.setModifyDate(new Date());
+        alarmRecord.setAdminUserName(adminUserName);
+        String alarmContent = alarmRecordVo.getAlarmContent();
+        alarmRecord.setAlarmContent(alarmContent);
+        alarmRecord.setRemark(alarmRecordVo.getRemark());
+        alarmRecord.setOccurrenceTime(alarmRecordVo.getOccurrenceTime());
+        alarmRecordService.save(alarmRecord);
+        TAdmin admin = adminService.getById(adminId);
+        String email = admin.getEmail();
+        String ifForeign = admin.getIfForeign();
+        if(ifForeign.equals("1")){
+            if(email!=null){
+                String subject = "Error message from Magic Candy Machine";
+                StringBuffer contnet = new StringBuffer();
+                String str1="Dear customer<br>" +
+                        "<br>" +
+                        "This is an automatic-sent mail to inform you that there is an error occurred on one of your Magic Candy machines, please kindly check the detail as below.<br>" +
+                        "<br>" +
+                        " Machine name:";
+                String str2="<br>" +" Time&Date:";
+                String str3="<br>"+" Error Message:";
+                String str4= "<br>" +" <br>You don't have to reply this mail . What you need to do is to follow the instructions on the touch screen to clear the error and recover the machine. If there is any question or more information you need . Please do not be hesitated to contact your distributor.<br>" +
+                        "<br>" +
+                        " Thank you for choosing our machine!<br>" +
+                        "<br>" +
+                        "<br>" +
+                        "Best Regards.<br>" +
+                        "Magic Candy Service Team";
+                contnet.append(str1).append(name).append(str2).append(alarmRecordVo.getOccurrenceTime()).append(str3).append(alarmContent).append(str4);
+                new MailUtil().send(email,subject,contnet.toString());
+//                return JsonMessage.success("报警记录添加成功");
+                return "报警记录添加成功";
+            }else {
+//                return JsonMessage.error("email is null");
+                return "email is null";
+            }
+        }
+        String result = null;
+        try {
+            String messageReceiver = equipment.getMessageReceiver();
+            if (!"二次曲棍".equals(alarmContent)) {
+                if (StringUtils.isNotEmpty(messageReceiver)) {
+                    String[] split = messageReceiver.split(",");
+                    for (int i = 0; i < split.length; i++) {
+                        if (StringUtils.isNotEmpty(split[i])) {
+                            Long id = alarmRecord.getId();
+                            String mess = ";序号:"+String.valueOf(id);
+                            result = YunPianSms.sendSms(appid, getMessage(alarmContent+mess, name, clientId), split[i]);
+                        }
+                    }
+                }
+            }
+
+        } catch (Exception e) {
+//            logger.info("短信发送结果:" + result);
+        }
+//        return JsonMessage.success("报警记录添加成功");
+        return "报警记录添加成功";
+    }
+
+    private String getMessage(String content, String name, String clientId) {
+
+        String message = "您好,机器" + content + ",机器名:" + name + ",设备号:" + clientId;
+        return message;
+    }
+
+    /**
+     * 获取系统时间
+     */
+    @RequestMapping(value = "/getTime", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String getTime() {
+        Date date = new Date();
+        SimpleDateFormat sformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//日期格式
+//        return JsonMessage.success(sformat.format(date));
+        return sformat.format(date);
+    }
+
+    /**
+     * 机器将要到期
+     *
+     * @param clientId
+     * @return
+     */
+    @GetMapping(value = "/alarmDate", produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String endDate(String clientId){
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        query.eq(TEquipment::getClientId,clientId);
+        List<TEquipment> list = equipmentService.list(query);
+        TEquipment equipment = list.get(0);
+        Date endDate = equipment.getEndDate();
+        long endDateTime = endDate.getTime();
+        long time = new Date().getTime();
+        if(endDateTime>time){
+            if(endDateTime-time<=3*24*3600*1000l){
+                //发短信
+                String result = null;
+                try {
+                    String messageReceiver = equipment.getMessageReceiver();
+                    if (StringUtils.isNotEmpty(messageReceiver)) {
+                        String[] split = messageReceiver.split(",");
+                        for (int i = 0; i < split.length; i++) {
+                            if (StringUtils.isNotEmpty(split[i])) {
+                                result = YunPianSms.sendSms(appid, getMessage("使用时间即将到期", equipment.getName(), clientId), split[i]);
+                            }
+                        }
+                    }
+                } catch (Exception e) {
+//                    logger.info("短信发送结果:" + result);
+                }
+            }
+        }else{
+//            return JsonMessage.success("已过期");
+            return "已过期";
+        }
+
+//        return JsonMessage.success("success");
+        return "success";
+    }
+
+    /**
+     * 更改报警状态  消除
+     *
+     * @param
+     * @return
+     */
+    @GetMapping(value = "/eliminate", produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String eliminate(String id){
+        TAlarmRecord alarmRecord = alarmRecordService.getById(Long.valueOf(id));
+        alarmRecord.setIsEliminate(1);
+        alarmRecordService.updateById(alarmRecord);
+//        return JsonMessage.success("success");
+        return "success";
+    }
+}

+ 8 - 5
src/main/java/com/szwl/controller/ApkInfoController.java

@@ -37,19 +37,22 @@ public class ApkInfoController {
      * @return
      */
     @ResponseBody
-    @RequestMapping(value = "/apkinfo.htm")
-    public Object getApkInfo(String model) {
+    @RequestMapping(value = "/apkinfo.htm", produces = "text/html;charset=utf-8")
+    public String getApkInfo(String model) {
         if (StringUtils.isEmpty(model)) {
-            return JsonMessage.error("没有版本数据");
+//            return JsonMessage.error("没有版本数据");
+            return "没有版本数据";
         }
         LambdaQueryWrapper<TApkInfo> query = Wrappers.lambdaQuery();
         query.eq(TApkInfo::getModel,model);
         List<TApkInfo> list = tApkInfoService.list(query);
         TApkInfo info = list.get(0);
             if (info != null) {
-                return JsonMessage.success(JSONObject.toJSONString(info));
+//                return JsonMessage.success(JSONObject.toJSONString(info));
+                return JSONObject.toJSONString(info);
             }
-            return JsonMessage.error("没有版本数据");
+//            return JsonMessage.error("没有版本数据");
+            return "没有版本数据";
     }
 
 }

+ 183 - 126
src/main/java/com/szwl/controller/IndexController.java

@@ -1,7 +1,6 @@
 package com.szwl.controller;
 
 
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -11,8 +10,6 @@ import com.szwl.model.bean.EquipmentVo;
 import com.szwl.model.bean.ProductVo;
 import com.szwl.model.bo.JsonMessage;
 import com.szwl.model.bo.JsonUtils;
-import com.szwl.model.bo.R;
-import com.szwl.model.bo.ResponseModel;
 import com.szwl.model.entity.*;
 import com.szwl.model.utils.AdminUtils;
 import com.szwl.model.utils.PushUtils;
@@ -23,7 +20,6 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -57,8 +53,10 @@ public class IndexController { ;
     @Autowired
     TPromoCodeService promoCodeService;
     @ApiOperation(value = "心跳")
-    @PostMapping("/heart.htm")
-    public JsonMessage heart(@RequestBody EquipmentVo equipmentVo) {
+//    @PostMapping("/heart.htm")
+    @RequestMapping(value = "/heart.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String heart(@RequestBody EquipmentVo equipmentVo) {
 
         String clientId = equipmentVo.getClientId();
         Date lastUpdateTime = equipmentVo.getLastUpdateTime();
@@ -140,11 +138,11 @@ public class IndexController { ;
                 equipmentDesc.setStick(equipmentVo.getStick());
             }
             equipmentDescService.updateById(equipmentDesc);
-            return JsonMessage.success("心跳成功");
-//            return "心跳成功";
+//            return JsonMessage.success("心跳成功");
+            return "心跳成功";
         }
-        return JsonMessage.error("心跳失败");
-//        return "心跳失败";
+//        return JsonMessage.error("心跳失败");
+        return "心跳失败";
     }
     /**
      * 设备申请
@@ -154,8 +152,11 @@ public class IndexController { ;
      * @return
      */
     @ApiOperation(value = "设备申请")
-    @PostMapping("/initNew.htm")
-    public JsonMessage initNew(String clientId, String managerId, String gtClientId, String equimentType) {
+//    @PostMapping("/initNew.htm")
+    @RequestMapping(value = "/initNew.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
+//    @RequestMapping(value = "/initNew.htm", method = RequestMethod.POST)
+    @ResponseBody
+    public String initNew(String clientId, String managerId, String gtClientId, String equimentType) {
         String machineType = "0";
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
@@ -164,17 +165,17 @@ public class IndexController { ;
             TEquipment equipment = list.get(0);
             String managerId1 = equipment.getManagerId();
             if(!managerId.equals(managerId1)){
-//                return "该设备未脱离";
-                return JsonMessage.error("该设备已经初始化");
+                return "该设备未脱离";
+//                return JsonMessage.error("该设备已经初始化");
             }else {
-                return JsonMessage.error("该设备已经初始化");
-//                return "该设备已经初始化";
+//                return JsonMessage.error("该设备已经初始化");
+                return "该设备已经初始化";
             }
         }
 
         if (StringUtils.isEmpty(gtClientId)) {
-            return JsonMessage.error("设备不能为空");
-//            return "设备不能为空";
+//            return JsonMessage.error("设备不能为空");
+            return "设备不能为空";
         }
 
         TEquipmentApply equipmentApply = new TEquipmentApply();
@@ -186,8 +187,8 @@ public class IndexController { ;
 
         TAdmin admin = adminService.getById(adminId);
         if (admin == null) {
-            return JsonMessage.error("找不到商家");
-//            return "找不到商家";
+//            return JsonMessage.error("找不到商家");
+            return "找不到商家";
         }
         //所属商家
         String username = admin.getUsername();
@@ -201,8 +202,8 @@ public class IndexController { ;
         if(String.valueOf(adminId).equals("3")||String.valueOf(adminId).equals("31")||String.valueOf(adminId).equals("506")||String.valueOf(adminId).equals("1090")){
             Long id = equipmentApply.getId();
             agree(id);
-            return JsonMessage.success("设备申请成功");
-//            return "设备申请成功";
+//            return JsonMessage.success("设备申请成功");
+            return "设备申请成功";
         }
         Date applyStartTime = admin.getApplyStartTime();
         Date applyEndTime = admin.getApplyEndTime();
@@ -210,11 +211,11 @@ public class IndexController { ;
         if(now.getTime()>applyStartTime.getTime()&&now.getTime()<applyEndTime.getTime()){
             Long id = equipmentApply.getId();
             agree(id);
-            return JsonMessage.success("设备申请成功");
-//            return "设备申请成功";
+//            return JsonMessage.success("设备申请成功");
+            return "设备申请成功";
         }
-        return JsonMessage.success("设备申请中,请耐心等待");
-//        return "设备申请中,请耐心等待";
+//        return JsonMessage.success("设备申请中,请耐心等待");
+        return "设备申请中,请耐心等待";
 
     }
 
@@ -560,9 +561,9 @@ public class IndexController { ;
      * @param
      * @return
      */
-    @RequestMapping(value = "/updateFlowers.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/updateFlowers.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updateFlowers(String clientId,String number){
+    public String updateFlowers(String clientId,String number){
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
@@ -603,9 +604,11 @@ public class IndexController { ;
             if(number.equals("30")){
                 saveProductMG1(id);
             }
-            return JsonMessage.success("success");
+//            return JsonMessage.success("success");
+            return "success";
         }else {
-            return JsonMessage.success("error");
+//            return JsonMessage.success("error");
+            return "error";
         }
     }
     /**
@@ -615,9 +618,9 @@ public class IndexController { ;
 
      * @return
      */
-    @RequestMapping(value = "/equimentType.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/equimentType.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage equimentType(String clientId, String equimentType){
+    public String equimentType(String clientId, String equimentType){
         if(!StringUtils.isEmpty(equimentType)){
             LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
             query.eq(TEquipment::getClientId,clientId);
@@ -627,16 +630,17 @@ public class IndexController { ;
             equipmentService.updateById(equipment);
         }
 
-        return JsonMessage.success("success");
+//        return JsonMessage.success("success");
+        return "success";
     }
     /**
      * 设备地址  开机时上传
      * @param clientId  个推
      * @return
      */
-    @RequestMapping(value = "/equimentArea.htm", method = RequestMethod.GET)
+    @RequestMapping(value = "/equimentArea.htm", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage equimentArea(String clientId, String longitude, String latitude, String fullName){
+    public String equimentArea(String clientId, String longitude, String latitude, String fullName){
         if(!StringUtils.isEmpty(longitude)&&!StringUtils.isEmpty(latitude)&&!StringUtils.isEmpty(fullName)){
             LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
             query.eq(TEquipment::getClientId,clientId);
@@ -646,16 +650,18 @@ public class IndexController { ;
             equipment.setLongitude(Double.valueOf(longitude));
             equipment.setFullName(fullName+"-");
             equipmentService.updateById(equipment);
-            return JsonMessage.success("success");
+//            return JsonMessage.success("success");
+            return "success";
         }
-        return JsonMessage.success("error");
+//        return JsonMessage.success("error");
+        return "error";
     }
     /**
      * 商品调价
      */
-    @RequestMapping(value = "/updateProduct.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/updateProduct.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updateProduct(@RequestBody List<ProductVo> productVos) {
+    public String updateProduct(@RequestBody List<ProductVo> productVos) {
         Double f=0.00;
         int num=0;
         int n=0;
@@ -695,7 +701,8 @@ public class IndexController { ;
             }
         }
 
-        return JsonMessage.success("调价成功");
+//        return JsonMessage.success("调价成功");
+        return "调价成功";
     }
     public Double tran(Double d){
         return new BigDecimal(d).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
@@ -711,9 +718,9 @@ public class IndexController { ;
      * @return
      * @Param pwd 密码内容
      */
-    @RequestMapping(value = "/updatePwd.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/updatePwd.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updatePwd(String clientId, String pwdType, String pwd) {
+    public String updatePwd(String clientId, String pwdType, String pwd) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
@@ -729,13 +736,34 @@ public class IndexController { ;
                         break;
                 }
                 equipmentService.updateById(equipment);
-                return JsonMessage.success("更新密码成功");
+//                return JsonMessage.success("更新密码成功");
+                return "更新密码成功";
             }
 
         }
-        return JsonMessage.error("更新密码失败");
+//        return JsonMessage.error("更新密码失败");
+        return "更新密码失败";
+    }
+    /**
+     * 设备获取密码
+     */
+    @GetMapping(value = "/getPwd",  produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String getPwd(String clientId) {
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        query.eq(TEquipment::getClientId,clientId);
+        List<TEquipment> list = equipmentService.list(query);
+        TEquipment equipment = list.get(0);
+        Map<String,String> map = new HashMap<>();
+//        map.put("adminUserName",equipment.getAdminUserName());
+        map.put("adminPwd",equipment.getAdminPwd());
+        map.put("guestPwd",equipment.getGuestPwd());
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("code", 0);
+        jsonObject.put("data", JSONObject.toJSON(map).toString());
+        jsonObject.put("errmsg", "");
+        return jsonObject.toJSONString();
     }
-
     /**
      * 修改支付方式
      *
@@ -746,25 +774,27 @@ public class IndexController { ;
      *                 线上/线下
      * @return
      */
-    @RequestMapping(value = "/updatePayType.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/updatePayType.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updatePayType(String clientId, String payType) {
+    public String updatePayType(String clientId, String payType) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("修改支付方式失败");
+//            return JsonMessage.error("修改支付方式失败");
+            return "修改支付方式失败";
         }
         equipment.setPayType(0);
         equipmentService.updateById(equipment);
-        return JsonMessage.success("修改成功");
+        return "修改成功";
+//        return JsonMessage.success("修改成功");
     }
 
     /**
      * 日志上传
      */
-    @RequestMapping(value = "/sendLog.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/sendLog.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
     public String uploadFile(HttpServletRequest request, HttpServletResponse response, String fileName) throws Exception{
 //        String fileName = request.getParameter("fileName");
@@ -840,24 +870,27 @@ public class IndexController { ;
      * @param clientId
      * @return
      */
-    @RequestMapping(value = "/separate.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/separate.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage separate(String clientId) {
+    public String separate(String clientId) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("该设备不存在");
+//            return "该设备不存在";
+            return "该设备不存在";
         }
         equipmentService.sentMessage(clientId,PushUtils.buildJson("tuoji", "0").toString());
 //        PushUtils.push(equipment.getGtClientId(), "", "", PushUtils.buildJson("tuoji", "0").toString());
         if("xxx".equals(equipment.getClientId().substring(equipment.getClientId().length()-3,equipment.getClientId().length()))){
-            return JsonMessage.success("脱离成功");
+//            return JsonMessage.success("脱离成功");
+            return "脱离成功";
         }
         equipment.setClientId(equipment.getClientId() + "xxx");
         equipmentService.updateById(equipment);
-        return JsonMessage.success("脱离成功");
+//        return JsonMessage.success("脱离成功");
+        return "脱离成功";
     }
 
 
@@ -865,43 +898,47 @@ public class IndexController { ;
     /**
      * 修改设备联系人名称以及电话
      */
-    @RequestMapping(value = "/updateContractPN.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/updateContractPN.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updateContractPN(String clientId, String contactName, String contactPhone) {
+    public String updateContractPN(String clientId, String contactName, String contactPhone) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("该设备不存在");
+//            return JsonMessage.error("该设备不存在");
+            return "该设备不存在";
         }
         equipment.setContactName(contactName);
         equipment.setContactPhone(contactPhone);
         equipmentService.updateById(equipment);
-        return JsonMessage.success("修改成功");
+//        return JsonMessage.success("修改成功");
+        return "修改成功";
     }
 
     /**
      * 设备上传公司电话
      */
-    @RequestMapping(value = "/sentCompanyPhone.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/sentCompanyPhone.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage sentCompanyPhone(String clientId, String companyPhone) {
+    public String sentCompanyPhone(String clientId, String companyPhone) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("该设备不存在");
+//            return JsonMessage.error("该设备不存在");
+            return "该设备不存在";
         }
         equipment.setCompanyPhone(companyPhone);
         equipmentService.updateById(equipment);
-        return JsonMessage.success("修改成功");
+//        return JsonMessage.success("修改成功");
+        return "修改成功";
     }
     /**
      * 获取二维码图片
      */
-    @RequestMapping(value = "/getQrCodeImgUrl.htm", method = RequestMethod.GET)
+    @RequestMapping(value = "/getQrCodeImgUrl.htm", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
     @ResponseBody
     public String getQrCodeImgUrl(String clientId) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
@@ -924,19 +961,21 @@ public class IndexController { ;
     /**
      * 上传4G卡号
      */
-    @RequestMapping(value = "/sentSimNo.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/sentSimNo.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage sentSimNo(String clientId, String simNo) {
+    public String sentSimNo(String clientId, String simNo) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("该设备不存在");
+//            return JsonMessage.error("该设备不存在");
+            return "该设备不存在";
         }
         equipment.setSimNo(simNo);
         equipmentService.updateById(equipment);
-        return JsonMessage.success("修改成功");
+//        return JsonMessage.success("修改成功");
+        return "修改成功";
     }
 
     /**
@@ -946,22 +985,22 @@ public class IndexController { ;
      * @param eqeStatus 设备状态1开 0关
      * @return
      */
-    @RequestMapping(value = "/updateEqeStatus.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/updateEqeStatus.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updateEqeStatus(String clientId, Integer eqeStatus) {
+    public String updateEqeStatus(String clientId, Integer eqeStatus) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("该设备不存在");
+            return "该设备不存在";
         }
         if(eqeStatus!=null){
             equipment.setEqeStatus(eqeStatus);
             equipment.setModifyDate(new Date());
             equipmentService.updateById(equipment);
         }
-        return JsonMessage.success("修改成功");
+        return "修改成功";
     }
     /**
      * 新修改设备状态
@@ -970,22 +1009,24 @@ public class IndexController { ;
      * @param eqeStatus 设备状态1开 0关
      * @return
      */
-    @RequestMapping(value = "/updateEqeStatusNew.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/updateEqeStatusNew.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updateEqeStatusNew(String clientId, Integer eqeStatus,String netTime) {
+    public String updateEqeStatusNew(String clientId, Integer eqeStatus,String netTime) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("该设备不存在");
+//            return JsonMessage.error("该设备不存在");
+            return "该设备不存在";
         }
         if(eqeStatus!=null){
             equipment.setNetwork(netTime);
             equipment.setEqeStatus(eqeStatus);
             equipmentService.updateById(equipment);
         }
-        return JsonMessage.success("修改成功");
+//        return JsonMessage.success("修改成功");
+        return "修改成功";
     }
     /**
      * 修改设备锁定状态
@@ -994,19 +1035,20 @@ public class IndexController { ;
      * @param block
      * @return
      */
-    @RequestMapping(value = "/updateBlock.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/updateBlock.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updateBlock(String clientId, Boolean block) {
+    public String updateBlock(String clientId, Boolean block) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("该设备不存在");
+//            return JsonMessage.error("该设备不存在");
+            return "该设备不存在";
         }
         equipment.setIsBlocked(block);
         equipmentService.updateById(equipment);
-        return JsonMessage.success("修改成功");
+        return "修改成功";
     }
 
     /**
@@ -1016,21 +1058,21 @@ public class IndexController { ;
      * @param is_sleep
      * @return
      */
-    @RequestMapping(value = "/updateSleep.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/updateSleep.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updateSleep(String clientId, Boolean is_sleep) {
+    public String updateSleep(String clientId, Boolean is_sleep) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("该设备不存在");
+            return "该设备不存在";
         }
         if(is_sleep!=null){
             equipment.setIsSleep(is_sleep);
             equipmentService.updateById(equipment);
         }
-        return JsonMessage.success("修改成功");
+        return "修改成功";
     }
 
     /**
@@ -1040,15 +1082,15 @@ public class IndexController { ;
      * @param productTotal
      * @return
      */
-    @RequestMapping(value = "/updateProductTotal.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/updateProductTotal.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updateProductTotal(String clientId, Integer productTotal) {
+    public String updateProductTotal(String clientId, Integer productTotal) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("该设备不存在");
+            return "该设备不存在";
         }
         Integer total = equipment.getProductTotal();
         if (total == null) {
@@ -1056,7 +1098,7 @@ public class IndexController { ;
         }
         equipment.setProductTotal(total + productTotal);
         equipmentService.updateById(equipment);
-        return JsonMessage.success("修改成功");
+        return "修改成功";
     }
 
     /**
@@ -1088,18 +1130,20 @@ public class IndexController { ;
      * @param
      * @return
      */
-    @PostMapping(value = "/updateParamNew.htm/{code}/{clientId}", produces = "application/json;charset=UTF-8")
+    @PostMapping(value = "/updateParamNew.htm/{code}/{clientId}", produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updateParamNew(@PathVariable Integer code, @PathVariable String clientId, @RequestBody List<CommonParamVo> commonParamVos) {
+    public String updateParamNew(@PathVariable Integer code, @PathVariable String clientId, @RequestBody List<CommonParamVo> commonParamVos) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("设备不存在");
+//            return JsonMessage.error("设备不存在");
+            return "设备不存在";
         }
         if(commonParamVos.size()<=0){
-            return JsonMessage.error("参数为空");
+//            return JsonMessage.error("参数为空");
+            return "参数为空";
         }
 //        ArrayList<Filter> filters = new ArrayList<>();
 //        filters.add(Filter.eq("status", code));
@@ -1129,7 +1173,7 @@ public class IndexController { ;
             parameters.setModifyDate(date);
             parametersService.save(parameters);
         }
-        return JsonMessage.success("修改成功");
+        return "修改成功";
     }
 
     /**
@@ -1138,15 +1182,16 @@ public class IndexController { ;
      * @param
      * @return
      */
-    @PostMapping(value = "/updateAloneParam.htm", produces = "application/json;charset=UTF-8")
+    @PostMapping(value = "/updateAloneParam.htm", produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updateAloneParam(String code, String clientId,String name,String val) {
+    public String updateAloneParam(String code, String clientId,String name,String val) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
         TEquipment equipment = list.get(0);
         if (equipment == null) {
-            return JsonMessage.error("设备不存在");
+//            return JsonMessage.error("设备不存在");
+            return "设备不存在";
         }
 //        ArrayList<Filter> filters = new ArrayList<>();
 //        filters.add(Filter.eq("status", code));
@@ -1167,31 +1212,31 @@ public class IndexController { ;
             parametersService.updateById(parameters);
         }
 
-        return JsonMessage.success("修改成功");
+        return "修改成功";
     }
     /**
      * 获取机器列表
      */
     @RequestMapping(value = "/getEquipmentList.htm", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
     @ResponseBody
-    public Object getByAdminAndProduct(String adminId,String name) {
+    public String getByAdminAndProduct(String adminId,String name) {
         JSONObject jsonObject = new JSONObject();
         if(StringUtils.isEmpty(adminId)){
             jsonObject.put("code", 1);
             jsonObject.put("errmsg", "adminId为空");
-            return jsonObject;
+            return jsonObject.toJSONString();
         }
         if(StringUtils.isEmpty(name)){
             jsonObject.put("code", 1);
             jsonObject.put("errmsg", "name为空");
-            return jsonObject;
+            return jsonObject.toJSONString();
         }
 //        Admin admin = adminService.find(Long.valueOf(adminId));
         TAdmin admin = adminService.getById(adminId);
         if(!admin.getUsername().equals(name)){
             jsonObject.put("code", 1);
             jsonObject.put("errmsg", "name与adminId不匹配");
-            return jsonObject;
+            return jsonObject.toJSONString();
         }
         List<EquipmentDTO> list = new ArrayList<>();
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
@@ -1214,25 +1259,25 @@ public class IndexController { ;
         jsonObject.put("errmsg", "");
         jsonObject.put("total", list.size());
 
-        return jsonObject;
+        return jsonObject.toJSONString();
     }
 
     /**
      * 获取商品信息
      */
-    @RequestMapping(value = "/getProductions.htm", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
+    @RequestMapping(value = "/getProductions.htm", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public Object getProductions(String adminId,String clientId) {
+    public String getProductions(String adminId,String clientId) {
         JSONObject jsonObject = new JSONObject();
         if(StringUtils.isEmpty(adminId)){
             jsonObject.put("code", 1);
             jsonObject.put("errmsg", "adminId为空");
-            return jsonObject;
+            return jsonObject.toJSONString();
         }
         if(StringUtils.isEmpty(clientId)){
             jsonObject.put("code", 1);
             jsonObject.put("errmsg", "clientId为空");
-            return jsonObject;
+            return jsonObject.toJSONString();
         }
 //        KafkaProperties.Admin admin = adminService.find(Long.valueOf(adminId));
         TAdmin admin = adminService.getById(Long.valueOf(adminId));
@@ -1246,7 +1291,7 @@ public class IndexController { ;
         if(!equipment.getAdminId().toString().equals(admin.getId().toString())){
             jsonObject.put("code", 1);
             jsonObject.put("errmsg", "clientId与adminId不匹配");
-            return jsonObject;
+            return jsonObject.toJSONString();
         }
 //        ArrayList<Filter> filters = new ArrayList<>();
 //        filters.add(Filter.eq("equipmentId", equipment.getId()));
@@ -1264,7 +1309,7 @@ public class IndexController { ;
         jsonObject.put("errmsg", "");
         jsonObject.put("total", list.size());
 
-        return jsonObject;
+        return jsonObject.toJSONString();
     }
 //    @ApiOperation(value = "分页查询")
 //    @GetMapping("/testPage")
@@ -1309,9 +1354,9 @@ public class IndexController { ;
 
      * @return
      */
-    @RequestMapping(value = "/updateMaterialStatus.htm", method = RequestMethod.POST)
+    @RequestMapping(value = "/updateMaterialStatus.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public JsonMessage updateMaterialUse(String clientId, String isMaterialUse){
+    public String updateMaterialUse(String clientId, String isMaterialUse){
         if(!StringUtils.isEmpty(clientId)&&!StringUtils.isEmpty(isMaterialUse)){
             LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
             query.eq(TEquipment::getClientId,clientId);
@@ -1320,15 +1365,17 @@ public class IndexController { ;
             TEquipmentDesc equipmentDesc = equipmentDescService.getById(equipment.getId());
             equipmentDesc.setIsMaterialUse(isMaterialUse);
             equipmentDescService.updateById(equipmentDesc);
-            return JsonMessage.success("success");
+//            return JsonMessage.success("success");
+            return "success";
         }
-        return JsonMessage.error("error");
+//        return JsonMessage.error("error");
+        return "error";
     }
 
     //修改优惠码状态
-    @RequestMapping(value = "/updateCode.htm", method = RequestMethod.GET)
+    @RequestMapping(value = "/updateCode.htm", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public Object CardPay(String code, String clientId) {
+    public String CardPay(String code, String clientId) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
@@ -1351,12 +1398,13 @@ public class IndexController { ;
         String time = sdf.format(new Date());
         promoCode.setUseDate(time);
         promoCodeService.updateById(promoCode);
-        return JsonMessage.success("success");
+//        return JsonMessage.success("success");
+        return "success";
     }
     //验证优惠码
-    @RequestMapping(value = "/selectCode.htm", method = RequestMethod.GET)
+    @RequestMapping(value = "/selectCode.htm", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
     @ResponseBody
-    public Object selectCode(String code, String clientId) {
+    public String selectCode(String code, String clientId) {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = equipmentService.list(query);
@@ -1369,7 +1417,8 @@ public class IndexController { ;
         TPromoCode promoCode = new TPromoCode();
         if (codeList.size() == 0) {
             //不存在
-            return JsonMessage.success("1");
+//            return JsonMessage.success("1");
+            return "1";
         }
         for (TPromoCode cod : codeList) {
             if(!cod.getAdminId().equals("1")){
@@ -1384,7 +1433,8 @@ public class IndexController { ;
         }
         if(promoCode.getAdminId()==null){
             //不是本机
-            return JsonMessage.success("3");
+//            return JsonMessage.success("3");
+            return "3";
         }
         Date lastUseDate = null;
         if (promoCode != null) {
@@ -1395,33 +1445,40 @@ public class IndexController { ;
             promoCode.setIsUse("2");
             promoCodeService.updateById(promoCode);
             //过期
-            return JsonMessage.success("4");
+//            return JsonMessage.success("4");
+            return "4";
         }
         if (promoCode.getId() == null) {
             //不存在
-            return JsonMessage.success("1");
+//            return JsonMessage.success("1");
+            return "1";
         }
         if (promoCode.getIsUse().equals("1")) {
             //被使用
-            return JsonMessage.success("2");
+//            return JsonMessage.success("2");
+            return "2";
         }
         if(!promoCode.getAdminId().equals("1")){
             if (String.valueOf(equipment.getAdminId()).equals(promoCode.getAdminId())) {
 
             } else {
                 //不是本机
-                return JsonMessage.success("3");
+//                return JsonMessage.success("3");
+                return "3";
             }
         }
         if (promoCode.getDiscount() == null) {
             //旧优惠码
-            return JsonMessage.success("0");
+//            return JsonMessage.success("0");
+            return "0";
         }
         if (promoCode.getDiscount() != null && promoCode.getDiscount() == 0) {
             //0折
-            return JsonMessage.success("0");
+//            return JsonMessage.success("0");
+            return "0";
         }
-        return JsonMessage.success("success");
+//        return JsonMessage.success("success");
+        return "success";
     }
 }
 

+ 11 - 11
src/main/java/com/szwl/controller/RabbitMqController.java

@@ -44,10 +44,10 @@ public class RabbitMqController {
      */
     @GetMapping(value = "/addExchange.htm")
     @ResponseBody
-    public Object addExchange(String exchange,String type,Boolean durable){
+    public String addExchange(String exchange,String type,Boolean durable){
         if(StringUtils.isEmpty(type)){
-            return JsonMessage.success("type is null");
-//            return "type is null";
+//            return JsonMessage.success("type is null");
+            return "type is null";
         }
         if(type.equals("Direct")){
 //            amqpAdmin.declareExchange(new DirectExchange(exchange, durable, false));
@@ -60,8 +60,8 @@ public class RabbitMqController {
         if(type.equals("Fanout")){
             amqpAdmin.declareExchange(new FanoutExchange(exchange, durable, false));
         }
-//        return "成功";
-        return JsonMessage.success("成功");
+        return "成功";
+//        return JsonMessage.success("成功");
     }
     /**
      *添加队列并绑定
@@ -70,7 +70,7 @@ public class RabbitMqController {
      */
     @GetMapping(value = "/addQueue.htm")
     @ResponseBody
-    public Object addQueue(String exchange,String queue,String routingKey,Boolean durable){
+    public String addQueue(String exchange,String queue,String routingKey,Boolean durable){
         Map<String,Object> arg = new HashMap<>();
         arg.put("x-message-ttl",1800000);
         String queue1 = amqpAdmin.declareQueue(new Queue(queue, durable, false, false, arg));
@@ -84,8 +84,8 @@ public class RabbitMqController {
         TEquipment equipment = list.get(0);
         equipment.setEquimentType(exchange);
         tEquipmentService.updateById(equipment);
-        return JsonMessage.success("成功");
-//        return "成功";
+//        return JsonMessage.success("成功");
+        return "成功";
     }
     /**
      *修改信道
@@ -94,14 +94,14 @@ public class RabbitMqController {
      */
     @GetMapping(value = "/updateChannel.htm")
     @ResponseBody
-    public Object updateChannel(String clientId,String type){
+    public String updateChannel(String clientId,String type){
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getClientId,clientId);
         List<TEquipment> list = tEquipmentService.list(query);
         TEquipment equipment = list.get(0);
         equipment.setChannel(type);
         tEquipmentService.updateById(equipment);
-        return JsonMessage.success("成功");
-//        return "成功";
+//        return JsonMessage.success("成功");
+        return "成功";
     }
 }

+ 126 - 0
src/main/java/com/szwl/controller/SugarDoOrderController.java

@@ -0,0 +1,126 @@
+package com.szwl.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.szwl.model.entity.TEquipment;
+import com.szwl.model.entity.TSugarDo;
+import com.szwl.service.TAdminService;
+import com.szwl.service.TEquipmentService;
+import com.szwl.service.TProductService;
+import com.szwl.service.TSugarDoService;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+
+@Controller("apiSugarDoController")
+@RequestMapping("/api/SugarDo")
+public class SugarDoOrderController {
+
+    @Autowired
+    private TSugarDoService sugarDoService;
+
+    @Autowired
+    TEquipmentService equipmentService;
+
+//    @Autowired
+//    private TAdminService adminService;
+//
+//    @Autowired
+//    private TProductService productService;
+
+
+
+    //远程做糖状态回返
+    @RequestMapping(value = "/updateSugarDoStatus", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String updateSugarDoStatus(String clientId,  String status, String no,String note) {
+        if(!StringUtils.isEmpty(no)&&!StringUtils.isEmpty(status)){
+            LambdaQueryWrapper<TSugarDo> query = Wrappers.lambdaQuery();
+            query.eq(TSugarDo::getNo,no);
+            query.eq(TSugarDo::getClientId,clientId);
+            List<TSugarDo> list = sugarDoService.list(query);
+            TSugarDo sugarDo = list.get(0);
+            if(sugarDo.getClientId().equals(clientId)){
+                sugarDo.setStatus(status);
+                if(status.equals("2")){
+                    sugarDo.setNote(note);
+                }
+                sugarDoService.updateById(sugarDo);
+            }else {
+//                return JsonMessage.error("error");
+                return "error";
+            }
+        }else {
+//            return JsonMessage.error("error");
+            return "error";
+        }
+
+//        return JsonMessage.success("success");
+        return "success";
+    }
+
+    /**
+     * 远程做糖
+     */
+//    @RequestMapping(value = "/doSugar", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
+//    @ResponseBody
+//    public Object getProductions(String adminId,String clientId,String productName) {
+////        productName = "夏日倾城";
+//        JSONObject jsonObject = new JSONObject();
+//        if(StringUtils.isEmpty(adminId)){
+//            jsonObject.put("code", 1);
+//            jsonObject.put("errmsg", "adminId为空");
+//            return jsonObject;
+//        }
+//        if(StringUtils.isEmpty(clientId)){
+//            jsonObject.put("code", 1);
+//            jsonObject.put("errmsg", "clientId为空");
+//            return jsonObject;
+//        }
+//        Admin admin = adminService.find(Long.valueOf(adminId));
+//        Equipment equipment = equipmentService.findByClientId(clientId);
+//        if(!equipment.getAdminId().toString().equals(admin.getId().toString())){
+//            jsonObject.put("code", 1);
+//            jsonObject.put("errmsg", "clientId与adminId不匹配");
+//            return jsonObject;
+//        }
+//        int j =0;
+//        ArrayList<Filter> filters = new ArrayList<>();
+//        filters.add(Filter.eq("equipmentId", equipment.getId()));
+//        List<Product> products = productService.findList(null, filters, null);
+//        for (Product product:products){
+//            if(product.getProductName().equals(productName)){
+//                j++;
+//            }
+//        }
+//        if(j==0){
+//            jsonObject.put("code", 1);
+//            jsonObject.put("errmsg", "商品未找到");
+//            return jsonObject;
+//        }
+//        StringBuilder number = new StringBuilder();
+//        Random random = new Random();
+//        number.append(String.valueOf(adminId)).append("-");
+//        for (int i = 0; i < 6; i++) {
+//            number.append(String.valueOf(random.nextInt(10)));
+//        }
+//        JSONObject kindData = new JSONObject();
+//        kindData.put("productName" , productName);
+//        kindData.put("no" , number.toString());
+//        equipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("dosugar", kindData.toString()).toString());
+//
+//        jsonObject.put("code", 0);
+//        jsonObject.put("errmsg", "发送成功!");
+//        return jsonObject;
+//    }
+}

+ 248 - 0
src/main/java/com/szwl/controller/SynchroController.java

@@ -0,0 +1,248 @@
+package com.szwl.controller;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+
+import com.szwl.model.entity.TEquipment;
+import com.szwl.service.TAlarmRecordService;
+import com.szwl.service.TEquipmentService;
+import com.szwl.service.TProductService;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * 用来同步数据
+ */
+@Controller("appsynchroIndexController")
+@RequestMapping("/api/app_synchro/synchroIndex")
+public class SynchroController {
+
+    @Autowired
+    private TProductService productService;
+
+    @Autowired
+    private TEquipmentService equipmentService;
+
+    @Autowired
+    private TAlarmRecordService alarmRecordService;
+
+//    @Autowired
+//    private TMaintainingHistoryService maintainingHistoryService;
+
+    /**
+     * 同步密码
+     *
+     * @param clientId
+     * @return
+     */
+    @RequestMapping(value = "/synPwd", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String synPwd(String clientId) {
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        query.eq(TEquipment::getClientId,clientId);
+        List<TEquipment> list = equipmentService.list(query);
+        TEquipment equipment = list.get(0);
+        if (equipment == null) {
+//            return JsonMessage.error("设备不存在");
+            return "设备不存在";
+        }
+        String adminPwd = equipment.getAdminPwd();
+        String guestPwd = equipment.getGuestPwd();
+        HashMap<String, String> map = new HashMap<>();
+        map.put("adminPwd", adminPwd);
+        map.put("guestPwd", guestPwd);
+        JSONObject jsonObject = getJsonObject(map);
+        return jsonObject.toJSONString();
+    }
+
+    /**
+     * 同步支付方式
+     */
+    @RequestMapping(value = "/synPay", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String synPay(String clientId) {
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        query.eq(TEquipment::getClientId,clientId);
+        List<TEquipment> list = equipmentService.list(query);
+        TEquipment equipment = list.get(0);
+        if (equipment == null) {
+//            return JsonMessage.error("设备不存在");
+            return "设备不存在";
+        }
+        Integer value = equipment.getPayType();
+        HashMap<String, String> map = new HashMap<>();
+        map.put("payType", value.toString());
+        JSONObject jsonObject = getJsonObject(map);
+        return jsonObject.toJSONString();
+
+    }
+
+    /**
+     * 同步商品数据
+     */
+//    @RequestMapping(value = "/synProduct", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
+//    @ResponseBody
+//    public String  synProduct(String clientId) {
+//
+//        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+//        query.eq(TEquipment::getClientId,clientId);
+//        List<TEquipment> list = equipmentService.list(query);
+//        TEquipment equipment = list.get(0);
+//        if (equipment == null) {
+//            //            return JsonMessage.error("设备不存在");
+//            return "设备不存在";
+//        }
+//        Long id = equipment.getId();
+////        Pageable pageable = new Pageable();
+////        List<Filter> filters = pageable.getFilters();
+////        filters.add(Filter.eq("equipmentId", id));
+////        Page<Product> page = productService.findPage(pageable);
+////        List<Product> content = page.getContent();
+//        JSONObject jsonObject = getJsonObject(content);
+//        return jsonObject.toJSONString();
+//    }
+
+    /**
+     * 同步报警记录
+     */
+//    @RequestMapping(value = "/synAlarmRecord", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
+//    @ResponseBody
+//    public Object synAlarmRecord(String clientId) {
+//        Pageable pageable = new Pageable();
+//        List<Filter> filters = pageable.getFilters();
+//        filters.add(Filter.like("clientId", clientId));
+//        List<AlarmRecord> alarmRecords = alarmRecordService.findPage(pageable).getContent();
+//        JSONObject jsonObject = getJsonObject(alarmRecords);
+//        return jsonObject.toJSONString();
+//
+//    }
+
+
+    /**
+     * 维护记录
+     */
+//    @RequestMapping(value = "/synMainTain", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
+//    @ResponseBody
+//    public Object synMainTain(String clientId) {
+//        Pageable pageable = new Pageable();
+//        List<Filter> filters = pageable.getFilters();
+//        filters.add(Filter.like("clientId", clientId));
+//        List<MaintainingHistory> list = maintainingHistoryService.findPage(pageable).getContent();
+//        JSONObject jsonObject = getJsonObject(list);
+//        return jsonObject.toJSONString();
+//    }
+
+    private JSONObject getJsonObject(Object o) {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("code", 0);
+        jsonObject.put("data", jsonObject.toJSONString(o));
+        jsonObject.put("errmsg", "");
+        return jsonObject;
+    }
+
+    /**
+     * 同步广告规则
+     *
+     * @param clientId
+     * @return
+     */
+    @GetMapping(value = "/synTimeRule", produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String synTimeRule(String clientId) {
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        query.eq(TEquipment::getClientId,clientId);
+        List<TEquipment> list = equipmentService.list(query);
+        TEquipment equipment = list.get(0);
+        if (equipment == null) {
+//            return JsonMessage.error("该设备不存在");
+            return "该设备不存在";
+        }
+//        return JsonMessage.success(equipment.getTimeRuleId());
+        return equipment.getTimeRuleId().toString();
+    }
+
+    /**
+     * 同步开关机时间
+     *
+     * @param clientId
+     * @return
+     */
+//    @GetMapping(value = "/timeRule")
+//    @ResponseBody
+//    public Object cleanRule(String clientId){
+//        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+//        query.eq(TEquipment::getClientId,clientId);
+//        List<TEquipment> list = equipmentService.list(query);
+//        TEquipment equipment = list.get(0);
+////        String bootTime = equipment.getBootTime();
+////        String offTime = equipment.getOffTime();
+//        JSONObject jsonObject = new JSONObject();
+//        if(StringUtils.isEmpty(bootTime)){
+//            jsonObject.put("bootTime", "尚未设定清洗规则");
+//        }else {
+//            jsonObject.put("bootTime", bootTime);
+//        }
+//        if(StringUtils.isEmpty(offTime)){
+//            jsonObject.put("offTime", "尚未设定清洗规则");
+//        }else {
+//            jsonObject.put("offTime", offTime);
+//        }
+//        return jsonObject;
+//    }
+    /**
+     * 同步plc版本
+     *
+     * @param clientId
+     * @return
+     */
+    @GetMapping(value = "/plcVersion", produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String plcVersion(String clientId,String plcVersion){
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        query.eq(TEquipment::getClientId,clientId);
+        List<TEquipment> list = equipmentService.list(query);
+        TEquipment equipment = list.get(0);
+        equipment.setPlcVersion(plcVersion);
+        equipmentService.updateById(equipment);
+        return "success";
+    }
+
+    /**
+     * 同步机器到期时间
+     *
+     * @param clientId
+     * @return
+     */
+    @GetMapping(value = "/endDate", produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public Object endDate(String clientId){
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        query.eq(TEquipment::getClientId,clientId);
+        List<TEquipment> list = equipmentService.list(query);
+        TEquipment equipment = list.get(0);
+        Date endDate = equipment.getEndDate();
+        JSONObject jsonObject = new JSONObject();
+        String  time = null;
+        if(endDate!=null){
+            jsonObject.put("endDate", "");
+        }else {
+             time = String.valueOf(endDate.getTime());
+            jsonObject.put("endDate", time);
+        }
+//        return JsonMessage.success(time);
+//        return time;
+        return jsonObject.toJSONString();
+    }
+}

+ 1 - 1
src/main/java/com/szwl/controller/TPromoCodeController.java

@@ -70,7 +70,7 @@ public class TPromoCodeController {
     public ResponseModel<IPage<TPromoCode>> getTPromoCode(@RequestParam String  code) {
         LambdaQueryWrapper<TPromoCode> query = Wrappers.lambdaQuery();
         query.eq(TPromoCode::getCode,code);
-        Page<TPromoCode> page = new Page<>(0, 10, true);
+        Page<TPromoCode> page = new Page<>(1, 10, true);
         IPage<TPromoCode> iPage = promoCodeService.page(page, query);
         return R.ok(iPage);
     }

+ 48 - 0
src/main/java/com/szwl/model/bo/JsonMessage.java

@@ -318,4 +318,52 @@ public final class JsonMessage {
         }
     }
 
+    public static JsonMessage getUserNotLogin() {
+        return USER_NOT_LOGIN;
+    }
+
+    public static JsonMessage getUnknownError() {
+        return UNKNOWN_ERROR;
+    }
+
+    public static int getCodeSuccess() {
+        return CODE_SUCCESS;
+    }
+
+    public static int getCodeError() {
+        return CODE_ERROR;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public Object getErrmsg() {
+        return errmsg;
+    }
+
+    public void setErrmsg(Object errmsg) {
+        this.errmsg = errmsg;
+    }
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(Object data) {
+        this.data = data;
+    }
+
+    @Override
+    public String toString() {
+        return "JsonMessage{" +
+                "code=" + code +
+                ", errmsg=" + errmsg +
+                ", data=" + data +
+                '}';
+    }
 }

+ 59 - 0
src/main/java/com/szwl/model/dto/AlarmRecordVo.java

@@ -0,0 +1,59 @@
+package com.szwl.model.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+public class AlarmRecordVo {
+
+
+    /**
+     * 设备唯一码
+     */
+    private String clientId;
+
+    /**
+     * 报警内容
+     */
+    private String alarmContent;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date occurrenceTime;
+
+    public String getClientId() {
+        return clientId;
+    }
+
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
+    }
+
+    public String getAlarmContent() {
+        return alarmContent;
+    }
+
+    public void setAlarmContent(String alarmContent) {
+        this.alarmContent = alarmContent;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public Date getOccurrenceTime() {
+        return occurrenceTime;
+    }
+
+    public void setOccurrenceTime(Date occurrenceTime) {
+        this.occurrenceTime = occurrenceTime;
+    }
+}

+ 136 - 0
src/main/java/com/szwl/model/utils/JsonUtils.java

@@ -0,0 +1,136 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.szwl.model.utils;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.gexin.fastjson.JSONObject;
+import com.gexin.fastjson.serializer.SimplePropertyPreFilter;
+import org.springframework.util.Assert;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * Utils - JSON
+ */
+public final class JsonUtils {
+
+    /**
+     * ObjectMapper
+     */
+    private static ObjectMapper mapper = new ObjectMapper();
+
+    /**
+     * 不可实例化
+     */
+    private JsonUtils() {
+    }
+
+    /**
+     * 将对象转换为JSON字符串
+     *
+     * @param value 对象
+     * @return JSOn字符串
+     */
+    public static String toJson(Object value) {
+        try {
+            return mapper.writeValueAsString(value);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 将JSON字符串转换为对象
+     *
+     * @param json      JSON字符串
+     * @param valueType 对象类型
+     * @return 对象
+     */
+    public static <T> T toObject(String json, Class<T> valueType) {
+        Assert.hasText(json);
+        Assert.notNull(valueType);
+        try {
+            return mapper.readValue(json, valueType);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 将对象转成JSON
+     *
+     * @param object 对象
+     * @param attrs  包含的属性值
+     * @return 对象
+     */
+    public static String toString(Object object, String... attrs) {
+        SimplePropertyPreFilter filter = new SimplePropertyPreFilter(object.getClass(), attrs);
+        return JSONObject.toJSONString(object, filter);
+    }
+
+    /**
+     * 将JSON字符串转换为对象
+     *
+     * @param json          JSON字符串
+     * @param typeReference 对象类型
+     * @return 对象
+     */
+//    public static <T> T toObject(String json, TypeReference<?> typeReference) {
+//        Assert.hasText(json);
+//        Assert.notNull(typeReference);
+//        try {
+//            return mapper.readValue(json, typeReference);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//        return null;
+//    }
+
+    /**
+     * 将JSON字符串转换为对象
+     *
+     * @param json     JSON字符串
+     * @param javaType 对象类型
+     * @return 对象
+     */
+    public static <T> T toObject(String json, JavaType javaType) {
+        Assert.hasText(json);
+        Assert.notNull(javaType);
+        try {
+            return mapper.readValue(json, javaType);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 将对象转换为JSON流
+     *
+     * @param writer writer
+     * @param value  对象
+     */
+    public static void writeValue(Writer writer, Object value) {
+        try {
+            mapper.writeValue(writer, value);
+        } catch (JsonGenerationException e) {
+            e.printStackTrace();
+        } catch (JsonMappingException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+
+}