From 1ebfa27940f6ec7ef7bf47450a102a01470fc68a Mon Sep 17 00:00:00 2001 From: qyx <565485304@qq.com> Date: Wed, 9 Sep 2020 14:31:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E4=BB=BB=E5=8A=A1=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E7=B1=BB=E5=92=8C=E5=88=A0=E9=99=A4=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E6=B2=A1=E7=94=A8=E7=9A=84=E7=94=9F=E6=88=90=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/me/zhengjie/utils/HttpUtil.java | 33 +++++ .../modules/taskrecord/domain/TaskRecord.java | 2 +- .../taskrecord/rest/TaskRecordController.java | 27 +++- .../java/me/zhengjie/task/SendRecordTask.java | 52 +++++++- .../main/resources/config/application-dev.yml | 4 + .../eladmin-system/domain/FormMessage.java | 112 ----------------- .../repository/FormMessageRepository.java | 28 ----- .../rest/FormMessageController.java | 87 ------------- .../service/FormMessageService.java | 83 ------------ .../service/dto/FormMessageDto.java | 75 ----------- .../service/dto/FormMessageQueryCriteria.java | 54 -------- .../service/impl/FormMessageServiceImpl.java | 118 ------------------ .../service/mapstruct/FormMessageMapper.java | 32 ----- src/views/student/index.vue | 108 ---------------- student/index.vue | 108 ---------------- student/student.js | 27 ---- 16 files changed, 112 insertions(+), 838 deletions(-) create mode 100644 eladmin-common/src/main/java/me/zhengjie/utils/HttpUtil.java delete mode 100644 form/src/main/java/eladmin-system/domain/FormMessage.java delete mode 100644 form/src/main/java/eladmin-system/repository/FormMessageRepository.java delete mode 100644 form/src/main/java/eladmin-system/rest/FormMessageController.java delete mode 100644 form/src/main/java/eladmin-system/service/FormMessageService.java delete mode 100644 form/src/main/java/eladmin-system/service/dto/FormMessageDto.java delete mode 100644 form/src/main/java/eladmin-system/service/dto/FormMessageQueryCriteria.java delete mode 100644 form/src/main/java/eladmin-system/service/impl/FormMessageServiceImpl.java delete mode 100644 form/src/main/java/eladmin-system/service/mapstruct/FormMessageMapper.java delete mode 100644 src/views/student/index.vue delete mode 100644 student/index.vue delete mode 100644 student/student.js diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/HttpUtil.java b/eladmin-common/src/main/java/me/zhengjie/utils/HttpUtil.java new file mode 100644 index 0000000..a189232 --- /dev/null +++ b/eladmin-common/src/main/java/me/zhengjie/utils/HttpUtil.java @@ -0,0 +1,33 @@ +package me.zhengjie.utils; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import org.springframework.beans.factory.annotation.Value; + +/** + * 继承于 + * @see cn.hutool.http.HttpUtil + * Http请求发送类,实现具体的Http发送逻辑 + */ +public class HttpUtil extends cn.hutool.http.HttpUtil { + + @Value(value = "req.db.url") + private String reqDBUrl; + + private HttpUtil(){} + + /** + * 调用HTTP请求发送Post请求 + * + * @param json 请求的body内容 + * @return 返回请求结果 + */ + private HttpResponse sendPostReq(String url, String json){ + HttpResponse httpResponse = HttpRequest + .post(url) + .body(json) + .execute(); + return httpResponse; + } + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/taskrecord/domain/TaskRecord.java b/eladmin-system/src/main/java/me/zhengjie/modules/taskrecord/domain/TaskRecord.java index 159e351..a3c5394 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/taskrecord/domain/TaskRecord.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/taskrecord/domain/TaskRecord.java @@ -56,6 +56,7 @@ public class TaskRecord implements Serializable { @Column(name = "task_name") @ApiModelProperty(value = "任务名称") + @NotBlank private String taskName; @Column(name = "time_period",nullable = false) @@ -78,7 +79,6 @@ public class TaskRecord implements Serializable { private String oprationName; @Column(name = "desc",nullable = false) - @NotBlank @ApiModelProperty(value = "自定义内容补充") private String desc; diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/taskrecord/rest/TaskRecordController.java b/eladmin-system/src/main/java/me/zhengjie/modules/taskrecord/rest/TaskRecordController.java index b8f8a18..acf925c 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/taskrecord/rest/TaskRecordController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/taskrecord/rest/TaskRecordController.java @@ -16,19 +16,25 @@ package me.zhengjie.modules.taskrecord.rest; import me.zhengjie.annotation.Log; +import me.zhengjie.common.CommonResponse; +import me.zhengjie.common.ResponseCode; import me.zhengjie.modules.abmessage.rest.vo.AbMessageVO; import me.zhengjie.modules.taskrecord.domain.TaskRecord; import me.zhengjie.modules.taskrecord.service.TaskRecordService; import me.zhengjie.modules.taskrecord.service.dto.TaskRecordQueryCriteria; +import me.zhengjie.task.SendRecordTask; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import io.swagger.annotations.*; import java.io.IOException; +import java.util.List; import javax.servlet.http.HttpServletResponse; /** @@ -44,6 +50,10 @@ public class TaskRecordController { private final TaskRecordService taskRecordService; + @Autowired + private SendRecordTask sendRecordTask; + + @Log("导出数据") @ApiOperation("导出数据") @GetMapping(value = "/download") @@ -87,12 +97,21 @@ public class TaskRecordController { } // ================ 自定义功能实现 start ================ + + /** + * 发送课包任务,支持同事发送多个课包任务,然后进行发送 + * @param idList + * @return + */ @Log("发送课包任务") - @ApiOperation("ABMessage发送任务") + @ApiOperation("发送课包任务") @PreAuthorize("@el.check('taskRecord:list')") @PostMapping(value = "/sendTask") - public ResponseEntity sendTask(@Validated @RequestBody TaskRecord resources){ - // TODO: 2020/9/8 0008 发送任务在相关逻辑类中实现 + public ResponseEntity sendTask(@RequestParam(value = "ids") List idList){ + if (CollectionUtils.isEmpty(idList)){ + return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.EMPTY_ARGUMENT), HttpStatus.OK); + } + sendRecordTask.doRunTask(idList); return new ResponseEntity<>(HttpStatus.OK); } @@ -100,7 +119,7 @@ public class TaskRecordController { @ApiOperation("任务课包任务合并") @PreAuthorize("@el.check('taskRecord:list')") @PostMapping(value = "/mergeRecord") - public ResponseEntity mergeRecord(@RequestBody Integer[] ids){ + public ResponseEntity mergeRecord(@RequestBody Integer[] ids, @RequestBody TaskRecord taskRecord){ // TODO: 2020/9/8 0008 发送任务在相关逻辑类中实现 return new ResponseEntity<>(HttpStatus.OK); } diff --git a/eladmin-system/src/main/java/me/zhengjie/task/SendRecordTask.java b/eladmin-system/src/main/java/me/zhengjie/task/SendRecordTask.java index d652ab3..3f3ad3a 100644 --- a/eladmin-system/src/main/java/me/zhengjie/task/SendRecordTask.java +++ b/eladmin-system/src/main/java/me/zhengjie/task/SendRecordTask.java @@ -1,12 +1,20 @@ package me.zhengjie.task; import lombok.extern.slf4j.Slf4j; +import me.zhengjie.modules.taskrecord.service.TaskRecordService; +import me.zhengjie.modules.taskrecord.service.dto.TaskRecordDto; +import me.zhengjie.utils.StringUtils; import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.time.LocalDateTime; import java.time.ZoneOffset; +import java.util.ArrayList; import java.util.List; /** @@ -14,7 +22,15 @@ import java.util.List; */ @Component @Slf4j -public class SendRecordTask { +public class SendRecordTask { + + /** + * 成功构建标识 + */ + private static final int BUILD_STATUS = 1; + + @Autowired + private TaskRecordService taskRecordService; /** @@ -32,6 +48,40 @@ public class SendRecordTask { } private void runTask(List list) { + // 准备所有需要发送任务 + List readySendTasks = new ArrayList<>(); + list.forEach( + id->{ + TaskRecordDto taskRecordDto = taskRecordService.findById((Integer) id); + if (BUILD_STATUS == taskRecordDto.getIsBuild() && StringUtils.isNotBlank(taskRecordDto.getLocalFilePath())){ + readySendTasks.add(taskRecordDto); + } + } + ); + // 遍历所有的待发送路径进行发送 + readySendTasks.forEach( + task->{ + try { + // 先查数据库从上次该课包的指定行数开始继续读取指定的行,默认每次发送指定发送条数的数据 + checkReadySendTotal(); + + + + List lines = Files.readAllLines(Paths.get(task)); + + } catch (IOException e) { + log.error("read ready send file fail, send class is {}, ready send file path is {}", this.getClass().getName(), path, e); + } + } + ); + + // + } + + /** + * 对发送前的 + */ + private void checkReadySendTotal(){ } } diff --git a/eladmin-system/src/main/resources/config/application-dev.yml b/eladmin-system/src/main/resources/config/application-dev.yml index c297716..b5a32ff 100644 --- a/eladmin-system/src/main/resources/config/application-dev.yml +++ b/eladmin-system/src/main/resources/config/application-dev.yml @@ -111,3 +111,7 @@ file: # 文件大小 /M maxSize: 100 avatarMaxSize: 5 +# 配置请求发送路径 +req: + db: + url: # 设置给大坝回传号码的地址 diff --git a/form/src/main/java/eladmin-system/domain/FormMessage.java b/form/src/main/java/eladmin-system/domain/FormMessage.java deleted file mode 100644 index 9fcb429..0000000 --- a/form/src/main/java/eladmin-system/domain/FormMessage.java +++ /dev/null @@ -1,112 +0,0 @@ -/* -* Copyright 2019-2020 Zheng Jie -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package eladmin-system.domain; - -import lombok.Data; -import cn.hutool.core.bean.BeanUtil; -import io.swagger.annotations.ApiModelProperty; -import cn.hutool.core.bean.copier.CopyOptions; -import javax.persistence.*; -import javax.validation.constraints.*; -import javax.persistence.Entity; -import javax.persistence.Table; -import org.hibernate.annotations.*; -import java.sql.Timestamp; -import java.io.Serializable; - -/** -* @website https://el-admin.vip -* @description / -* @author x -* @date 2020-09-07 -**/ -@Entity -@Data -@Table(name="t_form_message") -public class FormMessage implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - @ApiModelProperty(value = "id") - private Long id; - - @Column(name = "gmt_create") - @CreationTimestamp - @ApiModelProperty(value = "gmtCreate") - private Timestamp gmtCreate; - - @Column(name = "gmt_modified") - @UpdateTimestamp - @ApiModelProperty(value = "gmtModified") - private Timestamp gmtModified; - - @Column(name = "rec_id") - @ApiModelProperty(value = "记录id") - private Long recId; - - @Column(name = "uid") - @ApiModelProperty(value = "uid") - private String uid; - - @Column(name = "act_name") - @ApiModelProperty(value = "业务名") - private String actName; - - @Column(name = "stu_name") - @ApiModelProperty(value = "报课学生名") - private String stuName; - - @Column(name = "stu_grade") - @ApiModelProperty(value = "报课年级") - private Integer stuGrade; - - @Column(name = "stu_sub") - @ApiModelProperty(value = "报课学科") - private Integer stuSub; - - @Column(name = "province_code") - @ApiModelProperty(value = "所在省份编码") - private Integer provinceCode; - - @Column(name = "city") - @ApiModelProperty(value = "所在城市") - private String city; - - @Column(name = "city_code") - @ApiModelProperty(value = "所在城市编码") - private Integer cityCode; - - @Column(name = "device") - @ApiModelProperty(value = "听课设备(0.没有以上设备 1.平板电脑 2.笔记本电脑 3.台式设备+耳麦)") - private Integer device; - - @Column(name = "appointment_time") - @ApiModelProperty(value = "预约听课时间(0.近期没有学习安排 1.三天内 2.一周内 3.一周以后)") - private Integer appointmentTime; - - @Column(name = "start_time") - @ApiModelProperty(value = "业务开始时间") - private Timestamp startTime; - - @Column(name = "push_time") - @ApiModelProperty(value = "最新推送时间") - private Timestamp pushTime; - - public void copy(FormMessage source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} \ No newline at end of file diff --git a/form/src/main/java/eladmin-system/repository/FormMessageRepository.java b/form/src/main/java/eladmin-system/repository/FormMessageRepository.java deleted file mode 100644 index ced7ff6..0000000 --- a/form/src/main/java/eladmin-system/repository/FormMessageRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -* Copyright 2019-2020 Zheng Jie -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package eladmin-system.repository; - -import eladmin-system.domain.FormMessage; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -/** -* @website https://el-admin.vip -* @author x -* @date 2020-09-07 -**/ -public interface FormMessageRepository extends JpaRepository, JpaSpecificationExecutor { -} \ No newline at end of file diff --git a/form/src/main/java/eladmin-system/rest/FormMessageController.java b/form/src/main/java/eladmin-system/rest/FormMessageController.java deleted file mode 100644 index ec7d64f..0000000 --- a/form/src/main/java/eladmin-system/rest/FormMessageController.java +++ /dev/null @@ -1,87 +0,0 @@ -/* -* Copyright 2019-2020 Zheng Jie -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package eladmin-system.rest; - -import me.zhengjie.annotation.Log; -import eladmin-system.domain.FormMessage; -import eladmin-system.service.FormMessageService; -import eladmin-system.service.dto.FormMessageQueryCriteria; -import org.springframework.data.domain.Pageable; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import io.swagger.annotations.*; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://el-admin.vip -* @author x -* @date 2020-09-07 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "form管理") -@RequestMapping("/api/formMessage") -public class FormMessageController { - - private final FormMessageService formMessageService; - - @Log("导出数据") - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('formMessage:list')") - public void download(HttpServletResponse response, FormMessageQueryCriteria criteria) throws IOException { - formMessageService.download(formMessageService.queryAll(criteria), response); - } - - @GetMapping - @Log("查询form") - @ApiOperation("查询form") - @PreAuthorize("@el.check('formMessage:list')") - public ResponseEntity query(FormMessageQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(formMessageService.queryAll(criteria,pageable),HttpStatus.OK); - } - - @PostMapping - @Log("新增form") - @ApiOperation("新增form") - @PreAuthorize("@el.check('formMessage:add')") - public ResponseEntity create(@Validated @RequestBody FormMessage resources){ - return new ResponseEntity<>(formMessageService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @Log("修改form") - @ApiOperation("修改form") - @PreAuthorize("@el.check('formMessage:edit')") - public ResponseEntity update(@Validated @RequestBody FormMessage resources){ - formMessageService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @Log("删除form") - @ApiOperation("删除form") - @PreAuthorize("@el.check('formMessage:del')") - @DeleteMapping - public ResponseEntity delete(@RequestBody Long[] ids) { - formMessageService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} \ No newline at end of file diff --git a/form/src/main/java/eladmin-system/service/FormMessageService.java b/form/src/main/java/eladmin-system/service/FormMessageService.java deleted file mode 100644 index 41102c8..0000000 --- a/form/src/main/java/eladmin-system/service/FormMessageService.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -* Copyright 2019-2020 Zheng Jie -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package eladmin-system.service; - -import eladmin-system.domain.FormMessage; -import eladmin-system.service.dto.FormMessageDto; -import eladmin-system.service.dto.FormMessageQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://el-admin.vip -* @description 服务接口 -* @author x -* @date 2020-09-07 -**/ -public interface FormMessageService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(FormMessageQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(FormMessageQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return FormMessageDto - */ - FormMessageDto findById(Long id); - - /** - * 创建 - * @param resources / - * @return FormMessageDto - */ - FormMessageDto create(FormMessage resources); - - /** - * 编辑 - * @param resources / - */ - void update(FormMessage resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Long[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/form/src/main/java/eladmin-system/service/dto/FormMessageDto.java b/form/src/main/java/eladmin-system/service/dto/FormMessageDto.java deleted file mode 100644 index a721c0c..0000000 --- a/form/src/main/java/eladmin-system/service/dto/FormMessageDto.java +++ /dev/null @@ -1,75 +0,0 @@ -/* -* Copyright 2019-2020 Zheng Jie -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package eladmin-system.service.dto; - -import lombok.Data; -import java.sql.Timestamp; -import java.io.Serializable; - -/** -* @website https://el-admin.vip -* @description / -* @author x -* @date 2020-09-07 -**/ -@Data -public class FormMessageDto implements Serializable { - - private Long id; - - private Timestamp gmtCreate; - - private Timestamp gmtModified; - - /** 记录id */ - private Long recId; - - /** uid */ - private String uid; - - /** 业务名 */ - private String actName; - - /** 报课学生名 */ - private String stuName; - - /** 报课年级 */ - private Integer stuGrade; - - /** 报课学科 */ - private Integer stuSub; - - /** 所在省份编码 */ - private Integer provinceCode; - - /** 所在城市 */ - private String city; - - /** 所在城市编码 */ - private Integer cityCode; - - /** 听课设备(0.没有以上设备 1.平板电脑 2.笔记本电脑 3.台式设备+耳麦) */ - private Integer device; - - /** 预约听课时间(0.近期没有学习安排 1.三天内 2.一周内 3.一周以后) */ - private Integer appointmentTime; - - /** 业务开始时间 */ - private Timestamp startTime; - - /** 最新推送时间 */ - private Timestamp pushTime; -} \ No newline at end of file diff --git a/form/src/main/java/eladmin-system/service/dto/FormMessageQueryCriteria.java b/form/src/main/java/eladmin-system/service/dto/FormMessageQueryCriteria.java deleted file mode 100644 index a1d91b0..0000000 --- a/form/src/main/java/eladmin-system/service/dto/FormMessageQueryCriteria.java +++ /dev/null @@ -1,54 +0,0 @@ -/* -* Copyright 2019-2020 Zheng Jie -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package eladmin-system.service.dto; - -import lombok.Data; -import java.sql.Timestamp; -import java.util.List; -import me.zhengjie.annotation.Query; - -/** -* @website https://el-admin.vip -* @author x -* @date 2020-09-07 -**/ -@Data -public class FormMessageQueryCriteria{ - - /** 精确 */ - @Query - private String uid; - - /** 模糊 */ - @Query(type = Query.Type.INNER_LIKE) - private String actName; - - /** 精确 */ - @Query - private Integer device; - /** BETWEEN */ - @Query(type = Query.Type.BETWEEN) - private List createTime; - /** BETWEEN */ - @Query(type = Query.Type.BETWEEN) - private List createTime; - /** BETWEEN */ - @Query(type = Query.Type.BETWEEN) - private List createTime; - /** BETWEEN */ - @Query(type = Query.Type.BETWEEN) - private List createTime; -} \ No newline at end of file diff --git a/form/src/main/java/eladmin-system/service/impl/FormMessageServiceImpl.java b/form/src/main/java/eladmin-system/service/impl/FormMessageServiceImpl.java deleted file mode 100644 index 6a1dd72..0000000 --- a/form/src/main/java/eladmin-system/service/impl/FormMessageServiceImpl.java +++ /dev/null @@ -1,118 +0,0 @@ -/* -* Copyright 2019-2020 Zheng Jie -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package eladmin-system.service.impl; - -import eladmin-system.domain.FormMessage; -import me.zhengjie.utils.ValidationUtil; -import me.zhengjie.utils.FileUtil; -import lombok.RequiredArgsConstructor; -import eladmin-system.repository.FormMessageRepository; -import eladmin-system.service.FormMessageService; -import eladmin-system.service.dto.FormMessageDto; -import eladmin-system.service.dto.FormMessageQueryCriteria; -import eladmin-system.service.mapstruct.FormMessageMapper; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import me.zhengjie.utils.PageUtil; -import me.zhengjie.utils.QueryHelp; -import java.util.List; -import java.util.Map; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.LinkedHashMap; - -/** -* @website https://el-admin.vip -* @description 服务实现 -* @author x -* @date 2020-09-07 -**/ -@Service -@RequiredArgsConstructor -public class FormMessageServiceImpl implements FormMessageService { - - private final FormMessageRepository formMessageRepository; - private final FormMessageMapper formMessageMapper; - - @Override - public Map queryAll(FormMessageQueryCriteria criteria, Pageable pageable){ - Page page = formMessageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(formMessageMapper::toDto)); - } - - @Override - public List queryAll(FormMessageQueryCriteria criteria){ - return formMessageMapper.toDto(formMessageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public FormMessageDto findById(Long id) { - FormMessage formMessage = formMessageRepository.findById(id).orElseGet(FormMessage::new); - ValidationUtil.isNull(formMessage.getId(),"FormMessage","id",id); - return formMessageMapper.toDto(formMessage); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public FormMessageDto create(FormMessage resources) { - return formMessageMapper.toDto(formMessageRepository.save(resources)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(FormMessage resources) { - FormMessage formMessage = formMessageRepository.findById(resources.getId()).orElseGet(FormMessage::new); - ValidationUtil.isNull( formMessage.getId(),"FormMessage","id",resources.getId()); - formMessage.copy(resources); - formMessageRepository.save(formMessage); - } - - @Override - public void deleteAll(Long[] ids) { - for (Long id : ids) { - formMessageRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (FormMessageDto formMessage : all) { - Map map = new LinkedHashMap<>(); - map.put(" gmtCreate", formMessage.getGmtCreate()); - map.put(" gmtModified", formMessage.getGmtModified()); - map.put("记录id", formMessage.getRecId()); - map.put("uid", formMessage.getUid()); - map.put("业务名", formMessage.getActName()); - map.put("报课学生名", formMessage.getStuName()); - map.put("报课年级", formMessage.getStuGrade()); - map.put("报课学科", formMessage.getStuSub()); - map.put("所在省份编码", formMessage.getProvinceCode()); - map.put("所在城市", formMessage.getCity()); - map.put("所在城市编码", formMessage.getCityCode()); - map.put("听课设备(0.没有以上设备 1.平板电脑 2.笔记本电脑 3.台式设备+耳麦)", formMessage.getDevice()); - map.put("预约听课时间(0.近期没有学习安排 1.三天内 2.一周内 3.一周以后)", formMessage.getAppointmentTime()); - map.put("业务开始时间", formMessage.getStartTime()); - map.put("最新推送时间", formMessage.getPushTime()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} \ No newline at end of file diff --git a/form/src/main/java/eladmin-system/service/mapstruct/FormMessageMapper.java b/form/src/main/java/eladmin-system/service/mapstruct/FormMessageMapper.java deleted file mode 100644 index b96c9cd..0000000 --- a/form/src/main/java/eladmin-system/service/mapstruct/FormMessageMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* -* Copyright 2019-2020 Zheng Jie -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package eladmin-system.service.mapstruct; - -import me.zhengjie.base.BaseMapper; -import eladmin-system.domain.FormMessage; -import eladmin-system.service.dto.FormMessageDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @website https://el-admin.vip -* @author x -* @date 2020-09-07 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface FormMessageMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/src/views/student/index.vue b/src/views/student/index.vue deleted file mode 100644 index 432fce0..0000000 --- a/src/views/student/index.vue +++ /dev/null @@ -1,108 +0,0 @@ - - - - - diff --git a/student/index.vue b/student/index.vue deleted file mode 100644 index 432fce0..0000000 --- a/student/index.vue +++ /dev/null @@ -1,108 +0,0 @@ - - - - - diff --git a/student/student.js b/student/student.js deleted file mode 100644 index 467263a..0000000 --- a/student/student.js +++ /dev/null @@ -1,27 +0,0 @@ -import request from '@/utils/request' - -export function add(data) { - return request({ - url: 'api/student', - method: 'post', - data - }) -} - -export function del(ids) { - return request({ - url: 'api/student/', - method: 'delete', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/student', - method: 'put', - data - }) -} - -export default { add, edit, del }