Prechádzať zdrojové kódy

添加批量修改家长预约配置接口

liu 2 rokov pred
rodič
commit
b8b1d4836a

+ 7 - 1
src/main/java/com/template/api/SmartVisitorParentsConfigControllerAPI.java

@@ -1,5 +1,6 @@
 package com.template.api;
 
+import com.template.model.dto.SvpcDto;
 import com.template.model.pojo.SmartAskForLeaveConfig;
 import com.template.model.pojo.SmartVisitorParentsConfig;
 import com.template.model.result.CommonResult;
@@ -17,10 +18,15 @@ public interface SmartVisitorParentsConfigControllerAPI {
 
     @PostMapping(value = "/update")
     @ApiOperation(value = "家长访客配置修改", notes = "家长访客配置修改", httpMethod = "POST")
-    CommonResult update(@RequestBody List<SmartVisitorParentsConfig> smartVisitorParentsConfigs);
+    CommonResult update(@RequestBody SmartVisitorParentsConfig smartVisitorParentsConfig);
 
     @GetMapping(value = "/getUserId")
     @ApiOperation(value = "根据用户id获取所管理的班级配置", notes = "根据用户id获取所管理的班级配置", httpMethod = "GET")
     CommonResult getUserId(@RequestParam Integer userId);
 
+    @PostMapping(value = "/updates")
+    @ApiOperation(value = "家长访客配置批量修改", notes = "家长访客配置批量修改", httpMethod = "POST")
+    CommonResult updates(@RequestBody SvpcDto svpcDto);
+
+
 }

+ 37 - 22
src/main/java/com/template/controller/SmartVisitorParentsConfigController.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.template.annotation.DESRespondSecret;
 import com.template.api.SmartVisitorParentsConfigControllerAPI;
 import com.template.mapper.SmartVisitorParentsConfigMapper;
+import com.template.model.dto.SvpcDto;
 import com.template.model.pojo.SmartAskForLeaveConfig;
 import com.template.model.pojo.SmartDuties;
 import com.template.model.pojo.SmartUser;
@@ -31,7 +32,7 @@ import java.util.List;
 
 /**
  * <p>
- *  前端控制器
+ * 前端控制器
  * </p>
  *
  * @author ceshi
@@ -52,32 +53,16 @@ public class SmartVisitorParentsConfigController implements SmartVisitorParentsC
 
     @Override
     @DESRespondSecret(validated = true)
-    public CommonResult getClassId(Integer page,Integer size, Integer classId,Integer gradeId) {
-        PageUtils<SmartVisitorParentsConfigVo> smartVisitorParentsConfig=smartVisitorParentsConfigService.getClassIdPage(page,size,classId,gradeId);
+    public CommonResult getClassId(Integer page, Integer size, Integer classId, Integer gradeId) {
+        PageUtils<SmartVisitorParentsConfigVo> smartVisitorParentsConfig = smartVisitorParentsConfigService.getClassIdPage(page, size, classId, gradeId);
         return CommonResult.ok(smartVisitorParentsConfig);
     }
 
     @Override
     @DESRespondSecret(validated = true)
-    public CommonResult update(List<SmartVisitorParentsConfig> smartVisitorParentsConfigs) {
+    public CommonResult update(SmartVisitorParentsConfig smartVisitorParentsConfig) {
 
-        ArrayList<SmartVisitorParentsConfig> svpcs = new ArrayList<>();
-        for (SmartVisitorParentsConfig smartVisitorParentsConfig : smartVisitorParentsConfigs) {
-            Integer classId = smartVisitorParentsConfig.getClassId();
-            SmartVisitorParentsConfig svpc=smartVisitorParentsConfigService.getByClassId(classId);
-            svpc.setAppAuditConfig(smartVisitorParentsConfig.getAppAuditConfig());
-            svpc.setAppPushConfig(smartVisitorParentsConfig.getAppPushConfig());
-            svpc.setAppCancelConfig(smartVisitorParentsConfig.getAppCancelConfig());
-            svpc.setScreenAuditConfig(smartVisitorParentsConfig.getScreenAuditConfig());
-            svpc.setScreenPushConfig(smartVisitorParentsConfig.getScreenPushConfig());
-            svpc.setScreenCancelConfig(smartVisitorParentsConfig.getScreenCancelConfig());
-            svpc.setAccessConfig(smartVisitorParentsConfig.getAccessConfig());
-            svpc.setCarConfig(smartVisitorParentsConfig.getCarConfig());
-            svpcs.add(svpc);
-
-        }
-
-        boolean update = smartVisitorParentsConfigService.updateBatchById(svpcs);
+        boolean update = smartVisitorParentsConfigService.updateById(smartVisitorParentsConfig);
 
         if (update) {
             return CommonResult.ok();
@@ -107,10 +92,40 @@ public class SmartVisitorParentsConfigController implements SmartVisitorParentsC
 
         Integer schoolClass = smartById.getSchoolClass();
 
-        SmartVisitorParentsConfigVo smartVisitorParentsConfigVo=smartVisitorParentsConfigService.getClassId(schoolClass);
+        SmartVisitorParentsConfigVo smartVisitorParentsConfigVo = smartVisitorParentsConfigService.getClassId(schoolClass);
 
         return CommonResult.ok(smartVisitorParentsConfigVo);
     }
 
+    @Override
+    public CommonResult updates(SvpcDto svpcDto) {
+        List<Integer> classIds = svpcDto.getClassIds();
+        if (ObjectUtils.isEmpty(classIds) || classIds.size() == 0) {
+            return CommonResult.fail("参数异常");
+        }
+        ArrayList<SmartVisitorParentsConfig> svpcs = new ArrayList<>();
+        for (Integer classId : classIds) {
+            SmartVisitorParentsConfig svpc = smartVisitorParentsConfigService.getByClassId(classId);
+            if (ObjectUtils.isNotEmpty(svpc)) {
+                svpc.setAppAuditConfig(svpcDto.getAppAuditConfig());
+                svpc.setAppPushConfig(svpcDto.getAppPushConfig());
+                svpc.setAppCancelConfig(svpcDto.getAppCancelConfig());
+                svpc.setScreenAuditConfig(svpcDto.getScreenAuditConfig());
+                svpc.setScreenPushConfig(svpcDto.getScreenPushConfig());
+                svpc.setScreenCancelConfig(svpcDto.getScreenCancelConfig());
+                svpc.setAccessConfig(svpcDto.getAccessConfig());
+                svpc.setCarConfig(svpcDto.getCarConfig());
+                svpcs.add(svpc);
+            }
+
+        }
+        boolean update = smartVisitorParentsConfigService.updateBatchById(svpcs);
+
+        if (update) {
+            return CommonResult.ok();
+        }
+        return CommonResult.fail();
+    }
+
 }
 

+ 39 - 0
src/main/java/com/template/model/dto/SvpcDto.java

@@ -0,0 +1,39 @@
+package com.template.model.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class SvpcDto {
+
+
+    @ApiModelProperty(value = "年级ID")
+    private List<Integer> classIds;
+
+    @ApiModelProperty(value = "小程序审核配置 1:需要审核, 4:不需要审核")
+    private Integer appAuditConfig;
+
+    @ApiModelProperty(value = "小程序推送配置 5:需要推送,3:不需要推送")
+    private Integer appPushConfig;
+
+    @ApiModelProperty(value = "小程序核销配置 6:需要核销,7:不需要核销")
+    private Integer appCancelConfig;
+
+    @ApiModelProperty(value = "大屏序审核配置 1:需要审核, 4:不需要审核")
+    private Integer screenAuditConfig;
+
+    @ApiModelProperty(value = "大屏序推送配置 5:需要推送,3:不需要推送")
+    private Integer screenPushConfig;
+
+    @ApiModelProperty(value = "大屏核销配置 6:需要核销,7:不需要核销")
+    private Integer screenCancelConfig;
+
+    @ApiModelProperty(value = "门禁配置 0:推送到门禁,1:不推送到门禁")
+    private Integer accessConfig;
+
+    @ApiModelProperty(value = "车闸配置 0:推送到车闸,1:不推送到车闸")
+    private Integer carConfig;
+
+}