李天标 2 years ago
parent
commit
27b4863d99

+ 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/**","/tJoinpayMch/**","/tLogo/**",
-                "/tProportion/**","/tProduct/**","/tPromoCode/**", "/tApkInfo/**", "/tProduct/selectProductList",  "/tApkInfo/**","/tJoinpayMchCheck/**","/indexController/**","/sysRoleMenu/**",
+                "/tProportion/**","/tProduct/**","/tPromoCode/**", "/tApkInfo/**", "/tProduct/selectProductList",  "/tApkInfo/**","/tJoinpayMchCheck/**","/tTimeRule/**","/sysRoleMenu/**",
                 "/tEquipmentApply/**","/tEquipment/**","/api/**","/tOrder/**","/tAlarmClock/**","/tNotice/**","/tParameters/**",
                 "/tLabel/**","/tArea/**","/error"};
         registry.addInterceptor(headTokenInterceptor).addPathPatterns("/**")

+ 18 - 1
src/main/java/com/szwl/controller/IndexController.java

@@ -181,7 +181,24 @@ public class IndexController { ;
 //            return JsonMessage.error("设备不能为空");
             return "设备不能为空";
         }
-
+        LambdaQueryWrapper<TEquipmentApply> query1 = Wrappers.lambdaQuery();
+        query1.eq(TEquipmentApply::getClientId,clientId);
+        query1.eq(TEquipmentApply::getStatusType,"1");
+        query1.eq(TEquipmentApply::getManagerId,managerId);
+        String dateStr = "2022-12-28 00:00:00";
+        //获得SimpleDateFormat类,我们转换为yyyy-MM-dd的时间格式
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            //使用SimpleDateFormat的parse()方法生成Date
+            Date date = sf.parse(dateStr);
+            query1.gt(TEquipmentApply::getCreateDate,date);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        List<TEquipmentApply> list1 = equipmentApplyService.list(query1);
+        if(list1.size()>0){
+            return "重复申请";
+        }
         TEquipmentApply equipmentApply = new TEquipmentApply();
         equipmentApply.setStatusType(1);
         equipmentApply.setClientId(clientId);

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

@@ -344,6 +344,9 @@ public class TEquipmentController {
         if(StringUtils.isNotEmpty(equipment.getChannel())){
             oldEquipment.setChannel(equipment.getChannel());
         }
+        if(equipment.getPayType()!=null){
+            oldEquipment.setPayType(equipment.getPayType());
+        }
         if(equipment.getEndDate()!=null){
             oldEquipment.setEndDate(equipment.getEndDate());
         }
@@ -364,7 +367,9 @@ public class TEquipmentController {
         String channel = oldEquipment.getChannel();
         String equimentType = oldEquipment.getEquimentType();
         String clientId = oldEquipment.getClientId();
-        tEquipmentService.sentMessage(oldEquipment.getClientId(),PushUtils.buildJson("payType", oldEquipment.getPayType().toString() + ":" + oldEquipment.getTimeRuleId()).toString());
+        if(equipment.getPayType()!=null){
+            tEquipmentService.sentMessage(oldEquipment.getClientId(),PushUtils.buildJson("payType", oldEquipment.getPayType().toString() + ":" + oldEquipment.getTimeRuleId()).toString());
+        }
         tEquipmentService.sentMessage(oldEquipment.getClientId(),PushUtils.buildJson("phone", oldEquipment.getContactName() + ":" + oldEquipment.getContactPhone().toString()).toString());
         tEquipmentService.sentMessage(oldEquipment.getClientId(),PushUtils.buildJson("companyPhone", oldEquipment.getCompanyPhone()).toString());
         tEquipmentService.sentMessage(oldEquipment.getClientId(),PushUtils.buildJson("plcVersion",  oldEquipment.getPlcVersion()).toString());
@@ -372,7 +377,7 @@ public class TEquipmentController {
         tEquipmentService.sentMessage(oldEquipment.getClientId(),PushUtils.buildJson("pushTimeRule", oldEquipment.getTimeRuleId() + "").toString());
         tEquipmentService.sentMessage(oldEquipment.getClientId(),PushUtils.buildJson("operational", oldEquipment.getOperationalName() + ":" + oldEquipment.getOperationalPhone()).toString());
 
-        return R.ok();
+        return R.ok("null","更新成功!");
     }
     @ApiOperation(value = "更新机器 整体")
     @PostMapping("/updateByEquipment")

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

@@ -358,7 +358,7 @@ public class TPromoCodeController {
                 promoCode.setType(type);
                 promoCodeService.save(promoCode);
             }
-            return R.ok();
+            return R.ok(null,"生成成功");
         }
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.eq(TEquipment::getAdminId,admin.getId());
@@ -477,7 +477,7 @@ public class TPromoCodeController {
             promoCode.setType(type);
             promoCodeService.save(promoCode);
         }
-        return R.ok();
+        return R.ok(null,"生成成功");
     }
     @ApiOperation(value = "获取优惠码列表")
     @GetMapping("/pagePromoCode")
@@ -507,7 +507,7 @@ public class TPromoCodeController {
             query.gt(TPromoCode::getCreateDate,createStratDate);
             query.lt(TPromoCode::getCreateDate,createEndDate);
         }
-
+        query.orderByDesc(TPromoCode::getCreateDate);
         Page<TPromoCode> page = new Page<>(current, size, true);
         IPage<TPromoCode> iPage = promoCodeService.page(page, query);
         return R.ok(iPage);

+ 34 - 0
src/main/java/com/szwl/controller/TTimeRuleController.java

@@ -1,13 +1,16 @@
 package com.szwl.controller;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gexin.fastjson.JSON;
 import com.szwl.constant.ResponseCodesEnum;
 import com.szwl.model.bo.R;
 import com.szwl.model.bo.ResponseModel;
+import com.szwl.model.dto.TimeRuleVo;
 import com.szwl.model.entity.TAd;
 import com.szwl.model.entity.TAdmin;
 import com.szwl.model.entity.TEquipment;
@@ -23,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -65,6 +69,7 @@ public class TTimeRuleController {
         }
         timeRule.setCreateDate(new Date());
         timeRule.setModifyDate(new Date());
+        timeRule.setType("1");
         timeRuleService.save(timeRule);
         return R.ok(timeRule,"添加成功");
     }
@@ -93,6 +98,35 @@ public class TTimeRuleController {
         List<TTimeRule> list = timeRuleService.list(query);
         return R.ok(list);
     }
+    @GetMapping("/getAdListByTimeRule")
+    public ResponseModel<?> getAdListByTimeRule(String id) {
+        List<TAd> adList = new ArrayList<>();
+        TTimeRule timeRule = timeRuleService.getById(id);
+        if(StringUtils.isEmpty(timeRule.getType())){
+            List<TimeRuleVo> timeRuleVos = JSON.parseArray(timeRule.getRule(), TimeRuleVo.class);
+            for(TimeRuleVo timeRuleVo:timeRuleVos){
+                List<String> ads = timeRuleVo.getAd();
+                for (String aid:ads){
+                    TAd ad = adService.getById(aid);
+                    if(ad!=null&&ad.getId()!=null){
+                        adList.add(ad);
+                    }
+                 }
+                break;
+            }
+        }else if(timeRule.getType().equals("1")){
+            String rule = timeRule.getRule();
+            rule= rule.substring(1, rule.length() - 1);
+            List<String> result = Arrays.asList(rule.split(","));
+            for (String aid:result){
+                TAd ad = adService.getById(aid);
+                if(ad!=null&&ad.getId()!=null){
+                    adList.add(ad);
+                }
+            }
+        }
+        return R.ok(adList);
+    }
     @GetMapping("/updateEquimentpTimeRule")
     public ResponseModel<?> updateEquimentpTimeRule(String equipmentId,String timeRuleId) {
         TEquipment equipment = equipmentService.getById(equipmentId);

+ 2 - 1
src/main/java/com/szwl/model/entity/TTimeRule.java

@@ -40,5 +40,6 @@ public class TTimeRule implements Serializable {
     @ApiModelProperty(value = "时间规则;")
     private String rule;
 
-
+    @ApiModelProperty(value = "1,新系统的规则;")
+    private String type;
 }