parent
e3be3f41b5
commit
6060c73073
@ -0,0 +1,29 @@
|
||||
package me.zhengjie.modules.constant;
|
||||
|
||||
|
||||
/**
|
||||
* 文件相关 常量类
|
||||
*/
|
||||
public class FileConstant {
|
||||
|
||||
/**
|
||||
* 文件分隔符 .
|
||||
*/
|
||||
public static final String SPLIT_FILE_SYMBOL = ".";
|
||||
|
||||
/**
|
||||
* 以 xlsx 结尾的文件
|
||||
*/
|
||||
public static final String XLSX_FILE_SUB_NAME = "xlsx";
|
||||
|
||||
|
||||
/**
|
||||
* 以 zip 结尾的文件
|
||||
*/
|
||||
public static final String ZIP_FILE_SUB_NAME = "zip";
|
||||
|
||||
/**
|
||||
* 以 rar 结尾的文件
|
||||
*/
|
||||
public static final String RAR_FILE_SUB_NAME = "rar";
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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 me.zhengjie.modules.formdata.domain;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* @website https://el-admin.vip
|
||||
* @description /
|
||||
* @author x
|
||||
* @date 2021-08-05
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="t_formdata")
|
||||
public class Formdata implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
@Column(name = "upload_time")
|
||||
@ApiModelProperty(value = "上传时间")
|
||||
private Timestamp uploadTime;
|
||||
|
||||
@Column(name = "source_id")
|
||||
@ApiModelProperty(value = "渠道方id")
|
||||
private Integer sourceId;
|
||||
|
||||
@Column(name = "name")
|
||||
@ApiModelProperty(value = "称呼")
|
||||
private String name;
|
||||
|
||||
@Column(name = "phone")
|
||||
@ApiModelProperty(value = "联系方式")
|
||||
private String phone;
|
||||
|
||||
@Column(name = "age")
|
||||
@ApiModelProperty(value = "年龄")
|
||||
private Integer age;
|
||||
|
||||
@Column(name = "province")
|
||||
@ApiModelProperty(value = "省份")
|
||||
private String province;
|
||||
|
||||
@Column(name = "city")
|
||||
@ApiModelProperty(value = "城市")
|
||||
private String city;
|
||||
|
||||
public void copy(Formdata source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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 me.zhengjie.modules.formdata.repository;
|
||||
|
||||
import me.zhengjie.modules.formdata.domain.Formdata;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://el-admin.vip
|
||||
* @author x
|
||||
* @date 2021-08-05
|
||||
**/
|
||||
public interface FormdataRepository extends JpaRepository<Formdata, Long>, JpaSpecificationExecutor<Formdata> {
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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 me.zhengjie.modules.formdata.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.formdata.domain.Formdata;
|
||||
import me.zhengjie.modules.formdata.service.FormdataService;
|
||||
import me.zhengjie.modules.formdata.service.dto.FormdataQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @website https://el-admin.vip
|
||||
* @author x
|
||||
* @date 2021-08-05
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "表单文件解析接口管理")
|
||||
@RequestMapping("/api/formdata")
|
||||
public class FormdataController {
|
||||
|
||||
private final FormdataService formdataService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('formdata:list')")
|
||||
public void download(HttpServletResponse response, FormdataQueryCriteria criteria) throws IOException {
|
||||
formdataService.download(formdataService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询表单文件解析接口")
|
||||
@ApiOperation("查询表单文件解析接口")
|
||||
@PreAuthorize("@el.check('formdata:list')")
|
||||
public ResponseEntity<Object> query(FormdataQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(formdataService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增表单文件解析接口")
|
||||
@ApiOperation("新增表单文件解析接口")
|
||||
@PreAuthorize("@el.check('formdata:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Formdata resources){
|
||||
return new ResponseEntity<>(formdataService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改表单文件解析接口")
|
||||
@ApiOperation("修改表单文件解析接口")
|
||||
@PreAuthorize("@el.check('formdata:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody Formdata resources){
|
||||
formdataService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除表单文件解析接口")
|
||||
@ApiOperation("删除表单文件解析接口")
|
||||
@PreAuthorize("@el.check('formdata:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
formdataService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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 me.zhengjie.modules.formdata.service;
|
||||
|
||||
import me.zhengjie.modules.formdata.domain.Formdata;
|
||||
import me.zhengjie.modules.formdata.service.dto.FormdataDto;
|
||||
import me.zhengjie.modules.formdata.service.dto.FormdataQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @website https://el-admin.vip
|
||||
* @description 服务接口
|
||||
* @author x
|
||||
* @date 2021-08-05
|
||||
**/
|
||||
public interface FormdataService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(FormdataQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<FormdataDto>
|
||||
*/
|
||||
List<FormdataDto> queryAll(FormdataQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return FormdataDto
|
||||
*/
|
||||
FormdataDto findById(Long id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return FormdataDto
|
||||
*/
|
||||
FormdataDto create(Formdata resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(Formdata resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<FormdataDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 解析文件并进行存储
|
||||
*
|
||||
* @param file 需要进行处理的文件对象
|
||||
* @return 是否处理成功
|
||||
*/
|
||||
boolean parseFileAndSaveToDB(MultipartFile file);
|
||||
|
||||
/**
|
||||
* 保存音频文件在本地
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
String parseMediaFileToLocal(MultipartFile file);
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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 me.zhengjie.modules.formdata.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://el-admin.vip
|
||||
* @description /
|
||||
* @author x
|
||||
* @date 2021-08-05
|
||||
**/
|
||||
@Data
|
||||
public class FormdataDto implements Serializable {
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 上传时间 */
|
||||
private Timestamp uploadTime;
|
||||
|
||||
/** 渠道方id */
|
||||
private Integer sourceId;
|
||||
|
||||
/** 称呼 */
|
||||
private String name;
|
||||
|
||||
/** 联系方式 */
|
||||
private String phone;
|
||||
|
||||
/** 年龄 */
|
||||
private Integer age;
|
||||
|
||||
/** 省份 */
|
||||
private String province;
|
||||
|
||||
/** 城市 */
|
||||
private String city;
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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 me.zhengjie.modules.formdata.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @website https://el-admin.vip
|
||||
* @author x
|
||||
* @date 2021-08-05
|
||||
**/
|
||||
@Data
|
||||
public class FormdataQueryCriteria{
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Timestamp uploadTime;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String phone;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String province;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String city;
|
||||
/** BETWEEN */
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Integer> age;
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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 me.zhengjie.modules.formdata.service.impl;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.formdata.domain.Formdata;
|
||||
import me.zhengjie.modules.formdata.repository.FormdataRepository;
|
||||
import me.zhengjie.modules.formdata.service.FormdataService;
|
||||
import me.zhengjie.modules.formdata.service.dto.FormdataDto;
|
||||
import me.zhengjie.modules.formdata.service.dto.FormdataQueryCriteria;
|
||||
import me.zhengjie.modules.formdata.service.mapstruct.FormdataMapper;
|
||||
import me.zhengjie.modules.uploadnew.task.TransFormDataTask;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @website https://el-admin.vip
|
||||
* @description 服务实现
|
||||
* @author x
|
||||
* @date 2021-08-05
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class FormdataServiceImpl implements FormdataService {
|
||||
|
||||
private final FormdataRepository formdataRepository;
|
||||
private final FormdataMapper formdataMapper;
|
||||
|
||||
@Autowired
|
||||
private TransFormDataTask transFormDataTask;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(FormdataQueryCriteria criteria, Pageable pageable){
|
||||
Page<Formdata> page = formdataRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(formdataMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FormdataDto> queryAll(FormdataQueryCriteria criteria){
|
||||
return formdataMapper.toDto(formdataRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public FormdataDto findById(Long id) {
|
||||
Formdata formdata = formdataRepository.findById(id).orElseGet(Formdata::new);
|
||||
ValidationUtil.isNull(formdata.getId(),"Formdata","id",id);
|
||||
return formdataMapper.toDto(formdata);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public FormdataDto create(Formdata resources) {
|
||||
return formdataMapper.toDto(formdataRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Formdata resources) {
|
||||
Formdata formdata = formdataRepository.findById(resources.getId()).orElseGet(Formdata::new);
|
||||
ValidationUtil.isNull( formdata.getId(),"Formdata","id",resources.getId());
|
||||
formdata.copy(resources);
|
||||
formdataRepository.save(formdata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
formdataRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<FormdataDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (FormdataDto formdata : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("上传时间", formdata.getUploadTime());
|
||||
map.put("渠道方id", formdata.getSourceId());
|
||||
map.put("称呼", formdata.getName());
|
||||
map.put("联系方式", formdata.getPhone());
|
||||
map.put("年龄", formdata.getAge());
|
||||
map.put("省份", formdata.getProvince());
|
||||
map.put("城市", formdata.getCity());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 相关逻辑
|
||||
*
|
||||
* @param file 需要进行处理的文件对象
|
||||
* @return 是否操作成功
|
||||
*/
|
||||
@Override
|
||||
public boolean parseFileAndSaveToDB(MultipartFile file) {
|
||||
List<FormdataDto> formdataDtos = new ArrayList<>();
|
||||
// 1. todo 先进行解析 excel 文件
|
||||
|
||||
|
||||
// 2. todo 把解析后的结果进行入库
|
||||
|
||||
|
||||
// 3. todo 异步发送给 下游接口
|
||||
transFormDataTask.doRunTask(formdataDtos);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 相关逻辑
|
||||
* @param file 需要进行处理的文件对象
|
||||
* @return 是否操作成功
|
||||
*/
|
||||
@Override
|
||||
public String parseMediaFileToLocal(MultipartFile file) {
|
||||
// todo 存储音频压缩文件到指定目录下 每次上传以 2021-8-5 为 文件名进行记录 每次记录一天的 并保存记录
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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 me.zhengjie.modules.formdata.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.formdata.domain.Formdata;
|
||||
import me.zhengjie.modules.formdata.service.dto.FormdataDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://el-admin.vip
|
||||
* @author x
|
||||
* @date 2021-08-05
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface FormdataMapper extends BaseMapper<FormdataDto, Formdata> {
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package me.zhengjie.modules.uploadnew.task;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhengjie.modules.formdata.service.dto.FormdataDto;
|
||||
import me.zhengjie.utils.ConvertUtil;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Scope("prototype")
|
||||
@Slf4j
|
||||
public class TransFormDataTask {
|
||||
|
||||
|
||||
@Async(value = "SendBigDataTaskExecutor")
|
||||
public void doRunTask(List<FormdataDto> formdataDtos) {
|
||||
Long satrtMilliSecond = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
||||
log.info("====== [ task start running, task name is {} ] ======", "TransFormDataTask");
|
||||
runTask(formdataDtos);
|
||||
Long endMilliSecond = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
||||
log.info("====== [ task start end, task name is {},cost milliSecond is {} ] ======", "TransFormDataTask", ConvertUtil.secondToTime(endMilliSecond - satrtMilliSecond));
|
||||
}
|
||||
|
||||
private void runTask(List<FormdataDto> formdataDtos) {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue