|
@@ -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";
|
|
|
}
|
|
|
}
|
|
|
|