瀏覽代碼

fix:"修复机器报警状态"

soobin 3 周之前
父節點
當前提交
b6ea7811d2

+ 2 - 6
src/main/java/com/szwl/controller/IndexController.java

@@ -1418,12 +1418,8 @@ public class IndexController {
         if (eqeStatus != null) {
             equipment.setEqeStatus(eqeStatus);
             equipment.setModifyDate(new Date());
-//            if (eqeStatus == 0) {
-//                equipment.setCabinetTm("0");
-//                equipment.setCabinetHd("0");
-//                equipment.setFurnaceTm("0");
-//                equipment.setFurnaceSp("0");
-//            }
+            // 重置设备报警状态
+            equipment.setIsAlarm(false);
             equipmentService.updateById(equipment);
         }
         return "修改成功";

+ 0 - 47
src/main/java/com/szwl/controller/SyncOldAllController.java

@@ -34,53 +34,6 @@ public class SyncOldAllController {
     }
 
 
-//    @ApiOperation(value = "")
-//    @GetMapping("/getAllDataByAdminIdClientId")
-//    public ResponseModel<?> getAllDataByAdminIdClientId(Long adminId, String clientId) {
-//        if (StringUtils.isEmpty(clientId) || adminId == null) {
-//            return R.fail("参数不能为空");
-//        }
-//
-//        // 先设置这个账户的权限
-//        String s = adminService.addSysRole(adminId);
-//        if ("success".equals(s)) {
-////            return R.ok("添加" + adminId + "的权限成功");
-//        } else {
-//            return R.fail("设备权限失败");
-//        }
-//
-//        // 同步该设备信息
-//        Optional<String> result = equipmentService.syncOneEquipmentByClientId(clientId);
-//        if (result.isPresent() && "success".equals(result.get())) {
-//            return R.ok("同步设备编号" + clientId + "的 equipment 信息成功");
-//        } else {
-//            return R.fail("同步设备数据失败");
-//        }
-//
-//
-////        if("success".equals(s1)) {
-////            return R.ok();
-////
-////        }
-////        if ("success".equals(s1)) {
-////            return R.ok("同步设备编号" + clientId + "的 equipment 信息成功");
-////        } else {
-////            return R.fail("设备权限失败");
-////        }
-//
-//
-//        // 同步花型
-//
-//        // 同步分销
-//
-//        // 同步汇聚支付
-//
-//        // 同步订单
-//
-////        return R.ok();
-//    }
-
-
     @ApiOperation(value = "根据设备同步旧系统所有数据")
     @PostMapping("/byClient")
     public ResponseModel<?> byClient(@RequestBody Map<String, String> params) {

+ 0 - 26
src/main/java/com/szwl/controller/SyncOldEquipmentController.java

@@ -199,16 +199,6 @@ public class SyncOldEquipmentController {
         if (adminId != null) {
             List<TEquipment> oldEquipmentList = R.getDataIfSuccess(syncOldFeign.getEquipmentByAdminId(adminId));
 
-            // 先查看新系统该账户名下有无设备信息
-//            LambdaQueryWrapper<TEquipment> lqw = Wrappers.lambdaQuery();
-//            lqw.eq(TEquipment::getAdminId, adminId);
-//            List<TEquipment> newEquipmentList = equipmentService.list(lqw);
-
-//            if (newEquipmentList.isEmpty()) {
-                // 伪批量插入
-//                equipmentService.saveBatch(oldEquipmentList);
-                // 真批量插入
-//                equipmentMapper.insertBatchSomeColumn(oldEquipmentList);
                 for (TEquipment oldEquipment : oldEquipmentList) {
                     Long id = oldEquipment.getId();
                     Date createDate = oldEquipment.getCreateDate();
@@ -339,20 +329,6 @@ public class SyncOldEquipmentController {
 
                 }
 
-//            } else {
-////                for (TEquipment oldEquipment : oldEquipmentList) {
-////                    for (TEquipment newEquipment : newEquipmentList) {
-////                        if (newEquipment.getId().equals(oldEquipment.getId())) {
-////                            return R.fail("新系统已存在相同id的记录");
-////                        }
-////                        else {
-////                            equipmentService.save(oldEquipment);
-////                        }
-////                    }
-////                }
-//                return R.fail("新系统中已存在该账户的设备信息");
-//            }
-
             return R.ok("同步" + adminId + "名下所有机器设备信息成功");
         } else {
             return R.fail("旧系统中不存在该用户");
@@ -497,8 +473,6 @@ public class SyncOldEquipmentController {
                     equipment.setEndDate(endDate);
                     equipment.setFlowers(flowers);
                     equipment.setMachineType(machineType);
-//                equipment.setApkVersion();
-//                equipment.setCouponStatus();
                     equipment.setCompanyType(companyType);
                     equipment.setPaymentType(paymentType);
 

+ 0 - 6
src/main/java/com/szwl/controller/SyncOldProductController.java

@@ -107,13 +107,7 @@ public class SyncOldProductController {
         TEquipment equipment = equipmentService.getOne(lqw);
         String equipmentId = String.valueOf(equipment.getId());
 
-//        LambdaQueryWrapper<TProduct> wrapper = Wrappers.lambdaQuery();
-//        wrapper.eq(TProduct::getEquipmentId, equipmentId);
-//        List<TProduct> productList = productService.list(wrapper);
-//        if (Objects.isNull(productList)) {
             List<TProduct> oldProductList = R.getDataIfSuccess(syncOldFeign.getProductByEquipmentId(equipmentId));
-//            TProduct newProduct = new TProduct();
-//            productService.saveBatch(oldProductList);
             productService.saveOrUpdateBatch(oldProductList);
             return R.ok("同步设备" + equipmentId + "的花型数据成功");
 //        } else {

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

@@ -38,9 +38,6 @@ public class SynchroController {
     @Autowired
     private TAlarmRecordService alarmRecordService;
 
-//    @Autowired
-//    private TMaintainingHistoryService maintainingHistoryService;
-
     /**
      * 同步密码
      *
@@ -89,61 +86,6 @@ public class SynchroController {
 
     }
 
-    /**
-     * 同步商品数据
-     */
-//    @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);
@@ -174,34 +116,6 @@ public class SynchroController {
     }
 
     /**
-     * 同步开关机时间
-     *
-     * @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
@@ -241,8 +155,6 @@ public class SynchroController {
              time = String.valueOf(endDate.getTime());
             jsonObject.put("endDate", time);
         }
-//        return JsonMessage.success(time);
-//        return time;
         return jsonObject.toJSONString();
     }
 }

+ 0 - 21
src/main/java/com/szwl/controller/TAirwallexWalletController.java

@@ -1,21 +0,0 @@
-package com.szwl.controller;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * <p>
- *  前端控制器
- * </p>
- *
- * @author wuhs
- * @since 2023-07-29
- */
-@RestController
-@RequestMapping("/tAirwallexWallet")
-public class TAirwallexWalletController {
-
-}
-

+ 0 - 21
src/main/java/com/szwl/controller/TCoinOrderController.java

@@ -1,21 +0,0 @@
-package com.szwl.controller;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * <p>
- * 线下支付订单 前端控制器
- * </p>
- *
- * @author wuhs
- * @since 2022-04-23
- */
-@RestController
-@RequestMapping("/tCoinOrder")
-public class TCoinOrderController {
-
-}
-

+ 0 - 20
src/main/java/com/szwl/controller/TDepartmentController.java

@@ -1,20 +0,0 @@
-package com.szwl.controller;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * <p>
- * 部门表(用于研发部值日通知) 前端控制器
- * </p>
- *
- * @author wuhs
- * @since 2022-07-14
- */
-@RestController
-@RequestMapping("/tDepartment")
-public class TDepartmentController {
-
-}
-

+ 2 - 1
src/main/java/com/szwl/controller/TEquipmentController.java

@@ -413,7 +413,7 @@ public class TEquipmentController {
                 String[] split = equipmentIds.split(",");
                 query.in(TEquipment::getId, split);
             } else if (ConfigConsts.ABNORMAL.equals(labelId)) {
-                query.eq(TEquipment::getIsAlarm, 1);
+                query.eq(TEquipment::getIsAlarm, true);
             } else if (ConfigConsts.ON.equals(labelId)) {
                 query.eq(TEquipment::getEqeStatus, 1);
             }
@@ -2036,6 +2036,7 @@ public class TEquipmentController {
         }
     }
 
+    // 以下都是MQTT接口
     @ApiOperation("修改税费开关状态")
     @PostMapping("/updateTaxSwitch")
     public ResponseModel<?> updateTaxSwitch(@RequestBody TEquipmentDesc equipmentDesc) {

+ 0 - 114
src/main/java/com/szwl/controller/THotUpdateController.java

@@ -54,17 +54,6 @@ public class THotUpdateController {
     @ApiOperation(value = "设备热更新+1")
     @PostMapping("/upPatchNum")
     public ResponseModel<?> upPatchNum(String patchVersion) {
-//        Long patchId = hotUpdateService.lambdaQuery().eq(THotUpdate::getPatchVersion, patchVersion).one().getId();
-//        TEquipment equipment = equipmentService.lambdaQuery().eq(TEquipment::getClientId, clientId).one();
-//        Long equipmentId = equipment.getId();
-//        TEquipmentDesc equipmentDesc = equipmentDescService.lambdaQuery().eq(TEquipmentDesc::getEquipmentId, equipmentId).one();
-//        equipmentDesc.setPatchId(patchId);
-//        equipmentDescService.saveOrUpdate(equipmentDesc);
-
-//        UpdateWrapper<THotUpdate> uw = new UpdateWrapper<>();
-//        uw.eq("patch_version", patchVersion)
-//                .setSql("have_update_num = have_update_num + 1, modify_time = NOW()");
-//        hotUpdateService.update(uw);
 
         THotUpdate hotUpdate = hotUpdateService.lambdaQuery().eq(THotUpdate::getPatchVersion, patchVersion).one();
         hotUpdate.setModifyTime(new Date());
@@ -148,55 +137,6 @@ public class THotUpdateController {
         return R.ok(lastTen);
     }
 
-//    @ApiOperation(value = "获取补丁下载链接")
-//    @GetMapping("/getPatchUrl")
-//    public ResponseModel<?> getPatchUrl(String clientId, String isForeign) {
-//
-//        if (StringUtils.isEmpty(clientId) || StringUtils.isEmpty(isForeign)) {
-//            return R.fail(ResponseCodesEnum.B0001, "参数不能为空");
-//        }
-//        LambdaQueryWrapper<TEquipment> wrapper = Wrappers.lambdaQuery();
-//        wrapper.eq(TEquipment::getClientId, clientId);
-//        TEquipment equipment = equipmentService.getOne(wrapper);
-//        Long adminId = equipment.getAdminId();
-//        TAdmin admin = adminService.getById(adminId);
-//        String ifForeign = admin.getIfForeign();
-//        if (!isForeign.equals(ifForeign)) {
-//            return R.fail(ResponseCodesEnum.B0001, "海外内不匹配");
-//        }
-//        Long equipmentId = equipment.getId();
-//        LambdaQueryWrapper<TEquipmentDesc> lqw = Wrappers.lambdaQuery();
-//        lqw.eq(TEquipmentDesc::getEquipmentId, equipmentId);
-//        TEquipmentDesc equipmentDesc = equipmentDescService.getOne(lqw);
-//        Long patchId = equipmentDesc.getPatchId();
-//
-//        LambdaQueryWrapper<THotUpdate> qw = Wrappers.lambdaQuery();
-//        qw.eq(THotUpdate::getId, patchId);
-//        THotUpdate hotUpdate = hotUpdateService.getOne(qw);
-//        return R.ok(hotUpdate);
-//    }
-
-//    @ApiOperation(value = "测试")
-//    @PostMapping("/test")
-//    public ResponseModel<?> test() {
-//        // 遍历所有设备的apk_version,看多少台设备的apk_version = patch_veriosn
-//        // 获取热更新表中所有的 patch_version 信息
-//        List<String> patchVersions = hotUpdateService.list().stream().map(THotUpdate::getPatchVersion).collect(Collectors.toList());
-//        for (String patchVersion : patchVersions) {
-//            // 查询所有设备表中的的 apk_version 等于 patch_version的
-//            List<TEquipment> equipmentList = equipmentService.lambdaQuery().eq(TEquipment::getApkVersion, patchVersion).list();
-//            // 计算当前的 patch_version = apk_version 的设备数量
-//            int count = equipmentList.size();
-//            System.out.println("count 》》》" + count);
-//            THotUpdate hotUpdate = hotUpdateService.lambdaQuery().eq(THotUpdate::getPatchVersion, patchVersion).one();
-//            if (hotUpdate != null) {
-//                hotUpdate.setHaveUpdateNum(count);
-//                hotUpdateService.updateById(hotUpdate);
-//            }
-//        }
-//        return R.ok();
-//    }
-
     @ApiOperation(value = "添加热更新信息")
     @PostMapping("/postPatchInfo")
     public ResponseModel<?> postPatchInfo(@RequestBody THotUpdate hotUpdate) {
@@ -457,29 +397,6 @@ public class THotUpdateController {
                     return R.fail(ResponseCodesEnum.B0001, "推送区域为空时,需要填写设备编号");
                 }
                 // 推送指定设备
-//                tHotUpdate.setClientId(clientIdS);
-//                String[] clientIdArray = clientIdS.split(",");
-//                ArrayList<Long> equipmentIdList0 = new ArrayList<>();
-//
-//                for (String s : clientIdArray) {
-//                    String clientId = s.trim();
-//                    if (StringUtils.isNotEmpty(clientId)) {
-//                        LambdaQueryWrapper<TEquipment> wrapper = Wrappers.lambdaQuery();
-//                        wrapper.eq(TEquipment::getClientId, clientId);
-//                        TEquipment equipment = equipmentService.getOne(wrapper);
-//                        if (Objects.isNull(equipment)) {
-//                            return R.fail(ResponseCodesEnum.B0001, "设备信息不存在");
-//                        }
-//                        Long equipmentId = equipment.getId();
-//                        equipmentIdList0.add(equipmentId);
-////                        saveOrUpdateEquipmentDesc(equipmentId, hotUpdateId);
-//                    }
-//                }
-//                if (!equipmentIdList0.isEmpty()) {
-////                    saveOrUpdateEquipmentDescBatch(equipmentIdList0, hotUpdateId);
-//                    hotUpdateService.saveOrUpdateEquipmentDescBatch(equipmentIdList0, hotUpdateId);
-//                }
-
                 List<String> clientIdList = Arrays.asList(clientIdS.split(","));
                 LambdaQueryWrapper<TEquipment> wrapper1 = Wrappers.lambdaQuery();
                 wrapper1.in(TEquipment::getClientId, clientIdList);
@@ -515,47 +432,16 @@ public class THotUpdateController {
                 break;
             case "2":
                 // 推送海外
-//                LambdaQueryWrapper<TAdmin> lambdaQuery = Wrappers.lambdaQuery();
-//                lambdaQuery.eq(TAdmin::getIfForeign, "1");
-//                List<TAdmin> abroadList = adminService.list(lambdaQuery);
-//                ArrayList<Long> equipmentIdList2 = new ArrayList<>();
-//                for (TAdmin admin : abroadList) {
-//                    Long adminId = admin.getId();
-//                    LambdaQueryWrapper<TEquipment> lqw = Wrappers.lambdaQuery();
-//                    lqw.eq(TEquipment::getAdminId, adminId);
-//                    List<TEquipment> equipmentList = equipmentService.list(lqw);
-//                    for (TEquipment equipment : equipmentList) {
-//                        Long equipmentId = equipment.getId();
-//                        equipmentIdList2.add(equipmentId);
-////                        saveOrUpdateEquipmentDesc(equipmentId, hotUpdateId);
-//                    }
-//                }
-//                if (!equipmentIdList2.isEmpty()) {
-////                    saveOrUpdateEquipmentDescBatch(equipmentIdList2, hotUpdateId);
-//                    hotUpdateService.saveOrUpdateEquipmentDescBatch(equipmentIdList2,hotUpdateId);
-//                }
 
                 List<TAdmin> adminList = adminService.lambdaQuery().eq(TAdmin::getIfForeign, "1").list();
                 List<Long> equipmentIdList3 = adminList.stream().flatMap(admin -> equipmentService.lambdaQuery().eq(TEquipment::getAdminId, admin.getId()).list().stream()).map(TEquipment::getId).collect(Collectors.toList());
                 if (!equipmentIdList3.isEmpty()) {
-//                    saveOrUpdateEquipmentDescBatch(equipmentIdList3, hotUpdateId);
                     equipmentDescService.saveOrUpdateEquipmentDescBatch(equipmentIdList3, hotUpdateId);
                 }
 
                 break;
             case "3":
                 // 推送全球
-//                List<TEquipmentDesc> equipmentDescAll = equipmentDescService.list();
-//                ArrayList<TEquipmentDesc> equipmentDescArrayList = new ArrayList<>();
-//
-//                for (TEquipmentDesc equipmentDesc : equipmentDescAll) {
-//                    equipmentDesc.setPatchId(hotUpdateId);
-//                    equipmentDescArrayList.add(equipmentDesc);
-////                    equipmentDescService.saveOrUpdate(equipmentDesc);
-//                }
-//                if (!equipmentDescArrayList.isEmpty()) {
-//                    equipmentDescService.saveOrUpdateBatch(equipmentDescArrayList);
-//                }
 
                 List<TEquipmentDesc> equipmentDescList = equipmentDescService.list();
                 equipmentDescList.forEach(d -> d.setPatchId(hotUpdateId));

+ 0 - 3
src/main/java/com/szwl/controller/THuifuMchController.java

@@ -56,9 +56,6 @@ public class THuifuMchController {
     @Autowired
     private THuifuMchCheckService tHuifuMchCheckService;
 
-//    @Autowired
-//    private TokenManager tokenManager;
-
     @ApiOperation(value = "商户入驻申请")
     @PostMapping("/addApplication")
     public ResponseModel<?> addApplication(@Valid @RequestBody THuifuMchCheck tHuifuMchCheck) {

+ 0 - 35
src/main/java/com/szwl/controller/TShandeMchController.java

@@ -58,41 +58,6 @@ public class TShandeMchController {
         List<TShandeMch> list = tShandeMchService.list(query);
         if(list.size()>0){
             return R.ok(list.get(0));
-            //已经注册,就要查看是否有提交审核的
-//            LambdaQueryWrapper<TShandeMchCheck> query1 = Wrappers.lambdaQuery();
-//            query1.eq(TShandeMchCheck::getAdminId,adminId);
-//            List<TShandeMchCheck> list1 = tShandeMchCheckService.list(query1);
-//            if(list1.size()>0){
-//                int i = 0;
-//                for(TShandeMchCheck tShandeMchCheck:list1){
-//                    if(tShandeMchCheck.getCheckType().equals("0")||tShandeMchCheck.getCheckType().equals("3")){
-//                        i++;
-//                    }
-//                }
-//                if(i==0){
-//                    return R.ok(list.get(0));
-//                }else {
-//                    for(int j=list1.size()-1;j>=0;j--){
-//                        if(!list1.get(j).getCheckType().equals("2")&!list1.get(j).getCheckType().equals("1")){
-//                            if(list1.get(j).getCheckType().equals("3")){
-//                                Date data = new Date();
-//                                long time = data.getTime();
-//                                long updateTime = list1.get(j).getModifyDate().getTime();
-//                                if(3*24*60*60*1000l>time-updateTime){
-//                                    //拒绝的审核,超过3天后不显示
-//                                    return R.ok(list.get(0));
-//                                }else {
-//                                    return R.ok(list.get(j));
-//                                }
-//                            }
-//                            return R.ok(list.get(j));
-//                        }
-//                    }
-//                }
-//            }else {
-//                return R.ok(list.get(0));
-//            }
-//            return R.ok(list.get(0));
         }else {
             return R.fail("尚未注册!");
         }

+ 0 - 24
src/main/java/com/szwl/model/dto/WechatDTO.java

@@ -1,24 +0,0 @@
-//package com.szwl.model.dto;
-//
-//import io.swagger.annotations.ApiModelProperty;
-//import lombok.Getter;
-//import lombok.NoArgsConstructor;
-//import lombok.Setter;
-//import lombok.ToString;
-//import lombok.experimental.Accessors;
-//
-//@Accessors(chain = true)
-//@NoArgsConstructor
-//@Getter
-//@Setter
-//@ToString
-//public class WechatDTO {
-//    @ApiModelProperty(value = "用户名")
-//    private String username;
-//
-//    @ApiModelProperty(value = "密码")
-//    private String password;
-//
-//    @ApiModelProperty(value = "adminId")
-//    private Long adminId;
-//}