|
|
|
@ -7,15 +7,20 @@ import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.ExcelReader; |
|
|
|
import com.alibaba.excel.ExcelReader; |
|
|
|
import com.alibaba.excel.context.AnalysisContext; |
|
|
|
import com.alibaba.excel.context.AnalysisContext; |
|
|
|
import com.alibaba.excel.read.listener.ReadListener; |
|
|
|
import com.alibaba.excel.read.listener.ReadListener; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.biutag.supervision.pojo.Result; |
|
|
|
import com.biutag.supervision.pojo.Result; |
|
|
|
import com.biutag.supervision.pojo.dto.DataCaseVerifImportDto; |
|
|
|
import com.biutag.supervision.pojo.dto.DataCaseVerifImportDto; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.dto.SupRiskDto; |
|
|
|
import com.biutag.supervision.pojo.dto.TaskManagementDto; |
|
|
|
import com.biutag.supervision.pojo.dto.TaskManagementDto; |
|
|
|
import com.biutag.supervision.pojo.dto.TemperancePoliceDto; |
|
|
|
import com.biutag.supervision.pojo.dto.TemperancePoliceDto; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.entity.SupDepart; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.entity.SupRiskPersonal; |
|
|
|
import com.biutag.supervision.pojo.param.TaskInspectionQueryParam; |
|
|
|
import com.biutag.supervision.pojo.param.TaskInspectionQueryParam; |
|
|
|
import com.biutag.supervision.pojo.param.TaskQueryParam; |
|
|
|
import com.biutag.supervision.pojo.param.TaskQueryParam; |
|
|
|
import com.biutag.supervision.pojo.vo.TaskInspectionVo; |
|
|
|
import com.biutag.supervision.pojo.vo.TaskInspectionVo; |
|
|
|
import com.biutag.supervision.pojo.vo.TaskVo; |
|
|
|
import com.biutag.supervision.pojo.vo.TaskVo; |
|
|
|
|
|
|
|
import com.biutag.supervision.service.SupDepartService; |
|
|
|
import com.biutag.supervision.service.SupTaskService; |
|
|
|
import com.biutag.supervision.service.SupTaskService; |
|
|
|
import com.biutag.supervision.service.TaskManagementService; |
|
|
|
import com.biutag.supervision.service.TaskManagementService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
@ -36,6 +41,8 @@ public class TaskManagementController { |
|
|
|
private final TaskManagementService taskManagementService; |
|
|
|
private final TaskManagementService taskManagementService; |
|
|
|
|
|
|
|
|
|
|
|
private final SupTaskService taskService; |
|
|
|
private final SupTaskService taskService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final SupDepartService departService; |
|
|
|
@GetMapping |
|
|
|
@GetMapping |
|
|
|
public Result<Page<TaskVo>> pageResult(TaskQueryParam queryParam) { |
|
|
|
public Result<Page<TaskVo>> pageResult(TaskQueryParam queryParam) { |
|
|
|
return Result.success(taskService.pageTaskData(queryParam)); |
|
|
|
return Result.success(taskService.pageTaskData(queryParam)); |
|
|
|
@ -68,7 +75,7 @@ public class TaskManagementController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("import") |
|
|
|
@PostMapping("/import") |
|
|
|
public Result<List<TemperancePoliceDto>> importExcel(@RequestPart("file") MultipartFile file) throws IOException { |
|
|
|
public Result<List<TemperancePoliceDto>> importExcel(@RequestPart("file") MultipartFile file) throws IOException { |
|
|
|
log.info("文件导入中------------------------------"); |
|
|
|
log.info("文件导入中------------------------------"); |
|
|
|
String fileNameType = FileUtil.extName(file.getOriginalFilename()); |
|
|
|
String fileNameType = FileUtil.extName(file.getOriginalFilename()); |
|
|
|
@ -82,15 +89,50 @@ public class TaskManagementController { |
|
|
|
public void invoke(TemperancePoliceDto data, AnalysisContext analysisContext) { |
|
|
|
public void invoke(TemperancePoliceDto data, AnalysisContext analysisContext) { |
|
|
|
list.add(data); |
|
|
|
list.add(data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|
|
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}).build().read(EasyExcel.readSheet(0).build()); |
|
|
|
}).build().read(EasyExcel.readSheet(0).build()); |
|
|
|
excelReader.close(); |
|
|
|
excelReader.close(); |
|
|
|
log.info("数据导入完成"); |
|
|
|
log.info("数据导入完成"); |
|
|
|
return Result.success(list); |
|
|
|
return Result.success(list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 重点督察人员导入 |
|
|
|
|
|
|
|
* */ |
|
|
|
|
|
|
|
@PostMapping("/importSupRiskPersonal") |
|
|
|
|
|
|
|
public Result<List<SupRiskDto>> importSupRiskPersonal(@RequestPart("file")MultipartFile file) throws IOException{ |
|
|
|
|
|
|
|
log.info("重点督察人员文件导入中------------------------------"); |
|
|
|
|
|
|
|
String fileNameType = FileUtil.extName(file.getOriginalFilename()); |
|
|
|
|
|
|
|
if (!"xls".equals(fileNameType) && !"xlsx".equals(fileNameType)) { |
|
|
|
|
|
|
|
throw new RuntimeException("仅支持 xls/xlsx 格式文件的导入"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<SupRiskDto> list = new ArrayList<>(); |
|
|
|
|
|
|
|
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), SupRiskDto.class, new ReadListener<SupRiskDto>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void invoke(SupRiskDto data, AnalysisContext analysisContext) { |
|
|
|
|
|
|
|
String[] departParts = data.getResponsibleDepartName().replace("长沙市公安局", "").split("-"); |
|
|
|
|
|
|
|
String departName = departParts[departParts.length - 1]; |
|
|
|
|
|
|
|
List<SupDepart> departs = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getShortName, departName)); |
|
|
|
|
|
|
|
if (departs.size() == 1) { |
|
|
|
|
|
|
|
data.setResponsibleDepartId(departs.get(0).getId()); |
|
|
|
|
|
|
|
} else if (departParts.length > 1) { |
|
|
|
|
|
|
|
String departPart = departParts[0].replace("公安", ""); |
|
|
|
|
|
|
|
List<SupDepart> departs2 = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getShortName, departPart)); |
|
|
|
|
|
|
|
if (departs2.size() == 1) { |
|
|
|
|
|
|
|
data.setResponsibleDepartId(departs2.get(0).getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
list.add(data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).headRowNumber(2).build().read(EasyExcel.readSheet(0).build()); |
|
|
|
|
|
|
|
excelReader.close(); |
|
|
|
|
|
|
|
log.info("重点督察人员数据导入完成"); |
|
|
|
|
|
|
|
return Result.success(list); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|