|
|
|
|
@ -21,6 +21,7 @@ import com.biutag.supervision.pojo.entity.SupPolice;
|
|
|
|
|
import com.biutag.supervision.pojo.entity.SupRiskPersonal; |
|
|
|
|
import com.biutag.supervision.pojo.param.TaskInspectionQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.param.TaskQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.param.TaskRiskPersonalQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.vo.TaskInspectionVo; |
|
|
|
|
import com.biutag.supervision.pojo.vo.TaskVo; |
|
|
|
|
import com.biutag.supervision.service.*; |
|
|
|
|
@ -39,133 +40,138 @@ import java.util.List;
|
|
|
|
|
@RestController |
|
|
|
|
public class TaskManagementController { |
|
|
|
|
|
|
|
|
|
private final TaskManagementService taskManagementService; |
|
|
|
|
private final TaskManagementService taskManagementService; |
|
|
|
|
|
|
|
|
|
private final SupTaskService taskService; |
|
|
|
|
private final SupTaskService taskService; |
|
|
|
|
|
|
|
|
|
private final SupDepartService departService; |
|
|
|
|
private final SupDepartService departService; |
|
|
|
|
|
|
|
|
|
private final SupPoliceService policeService; |
|
|
|
|
private final SupPoliceService policeService; |
|
|
|
|
|
|
|
|
|
private final SupRiskPersonalService supRiskPersonalService; |
|
|
|
|
private final SupRiskPersonalService supRiskPersonalService; |
|
|
|
|
|
|
|
|
|
private final RiskPersonInfoService riskPersonInfoService; |
|
|
|
|
private final RiskPersonInfoService riskPersonInfoService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping |
|
|
|
|
public Result<Page<TaskVo>> pageResult(TaskQueryParam queryParam) { |
|
|
|
|
return Result.success(taskService.pageTaskData(queryParam)); |
|
|
|
|
} |
|
|
|
|
@PostMapping("/addTaskManagement") |
|
|
|
|
public Result addTaskManagement(@RequestBody TaskManagementDto dto){ |
|
|
|
|
if(taskManagementService.save(dto)){ |
|
|
|
|
return Result.success(); |
|
|
|
|
}else{ |
|
|
|
|
return Result.failed("操作失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/{id}") |
|
|
|
|
public Result<TaskManagementDto> getDetil(@PathVariable Integer id){ |
|
|
|
|
TaskManagementDto taskManagementDto = taskManagementService.getDetail(id); |
|
|
|
|
if(ObjectUtil.isNotEmpty(taskManagementDto)){ |
|
|
|
|
return Result.success(taskManagementDto); |
|
|
|
|
}else{ |
|
|
|
|
return Result.failed("查询失败"); |
|
|
|
|
@GetMapping |
|
|
|
|
public Result<Page<TaskVo>> pageResult(TaskQueryParam queryParam) { |
|
|
|
|
return Result.success(taskService.pageTaskData(queryParam)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@DeleteMapping("/{id}") |
|
|
|
|
public Result delTaskById(@PathVariable Integer id){ |
|
|
|
|
if(taskManagementService.delTaskById(id)){ |
|
|
|
|
return Result.success(); |
|
|
|
|
}else{ |
|
|
|
|
return Result.failed("操作失败"); |
|
|
|
|
@PostMapping("/addTaskManagement") |
|
|
|
|
public Result addTaskManagement(@RequestBody TaskManagementDto dto){ |
|
|
|
|
if(taskManagementService.save(dto)){ |
|
|
|
|
return Result.success(); |
|
|
|
|
}else{ |
|
|
|
|
return Result.failed("操作失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/import") |
|
|
|
|
public Result<List<TemperancePoliceDto>> importExcel(@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 格式文件的导入"); |
|
|
|
|
|
|
|
|
|
@GetMapping("/{id}") |
|
|
|
|
public Result<TaskManagementDto> getDetil(@PathVariable Integer id){ |
|
|
|
|
TaskManagementDto taskManagementDto = taskManagementService.getDetail(id); |
|
|
|
|
if(ObjectUtil.isNotEmpty(taskManagementDto)){ |
|
|
|
|
return Result.success(taskManagementDto); |
|
|
|
|
}else{ |
|
|
|
|
return Result.failed("查询失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
List<TemperancePoliceDto> list = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), TemperancePoliceDto.class, new ReadListener<TemperancePoliceDto>() { |
|
|
|
|
@Override |
|
|
|
|
public void invoke(TemperancePoliceDto data, AnalysisContext analysisContext) { |
|
|
|
|
list.add(data); |
|
|
|
|
@GetMapping("/getRiskPersonalPage") |
|
|
|
|
public Result<Page<SupRiskDto>> getRiskPersonalPage(TaskRiskPersonalQueryParam queryParam){ |
|
|
|
|
return Result.success(taskManagementService.getSupRiskDtoPage(queryParam)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@DeleteMapping("/{id}") |
|
|
|
|
public Result delTaskById(@PathVariable Integer id){ |
|
|
|
|
if(taskManagementService.delTaskById(id)){ |
|
|
|
|
return Result.success(); |
|
|
|
|
}else{ |
|
|
|
|
return Result.failed("操作失败"); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/import") |
|
|
|
|
public Result<List<TemperancePoliceDto>> importExcel(@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 格式文件的导入"); |
|
|
|
|
} |
|
|
|
|
}).build().read(EasyExcel.readSheet(0).build()); |
|
|
|
|
excelReader.close(); |
|
|
|
|
log.info("数据导入完成"); |
|
|
|
|
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<TemperancePoliceDto> list = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), TemperancePoliceDto.class, new ReadListener<TemperancePoliceDto>() { |
|
|
|
|
@Override |
|
|
|
|
public void invoke(TemperancePoliceDto data, AnalysisContext analysisContext) { |
|
|
|
|
list.add(data); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|
|
|
|
} |
|
|
|
|
}).build().read(EasyExcel.readSheet(0).build()); |
|
|
|
|
excelReader.close(); |
|
|
|
|
log.info("数据导入完成"); |
|
|
|
|
return Result.success(list); |
|
|
|
|
} |
|
|
|
|
List<SupRiskDto> list = new ArrayList<>(); |
|
|
|
|
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), SupRiskDto.class, new ReadListener<SupRiskDto>() { |
|
|
|
|
@Override |
|
|
|
|
public void invoke(SupRiskDto data, AnalysisContext analysisContext) { |
|
|
|
|
if(StrUtil.isNotBlank(data.getResponsibleDepartName())){ |
|
|
|
|
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()); |
|
|
|
|
/** |
|
|
|
|
* 重点督察人员导入 |
|
|
|
|
* */ |
|
|
|
|
@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) { |
|
|
|
|
if(StrUtil.isNotBlank(data.getResponsibleDepartName())){ |
|
|
|
|
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<SupPolice> polices = policeService.list(new LambdaQueryWrapper<SupPolice>().eq(SupPolice::getOrgId,data.getResponsibleDepartId()).eq(SupPolice::getName,data.getResponsibleName())); |
|
|
|
|
if(CollectionUtil.isNotEmpty(polices)){ |
|
|
|
|
data.setResponsibleEmpNo(polices.get(0).getEmpNo()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
List<SupPolice> polices = policeService.list(new LambdaQueryWrapper<SupPolice>().eq(SupPolice::getOrgId,data.getResponsibleDepartId()).eq(SupPolice::getName,data.getResponsibleName())); |
|
|
|
|
if(CollectionUtil.isNotEmpty(polices)){ |
|
|
|
|
data.setResponsibleEmpNo(polices.get(0).getEmpNo()); |
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(data.getIdCode())){ |
|
|
|
|
|
|
|
|
|
RiskPersonInfo riskPersonInfo= riskPersonInfoService.getOne(new LambdaQueryWrapper<RiskPersonInfo>().eq(RiskPersonInfo::getIdCode,data.getIdCode())); |
|
|
|
|
if(ObjectUtil.isNotEmpty(riskPersonInfo)){ |
|
|
|
|
data.setImgBase64(riskPersonInfo.getImageBase64()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(data.getIdCode())){ |
|
|
|
|
|
|
|
|
|
RiskPersonInfo riskPersonInfo= riskPersonInfoService.getOne(new LambdaQueryWrapper<RiskPersonInfo>().eq(RiskPersonInfo::getIdCode,data.getIdCode())); |
|
|
|
|
if(ObjectUtil.isNotEmpty(riskPersonInfo)){ |
|
|
|
|
data.setImgBase64(riskPersonInfo.getImageBase64()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(StrUtil.isNotBlank(data.getControlEmpNo())){ |
|
|
|
|
SupPolice supPolice= policeService.getByEmpNo(data.getControlEmpNo()); |
|
|
|
|
data.setControlIdcode(supPolice.getIdCode()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(data)){ |
|
|
|
|
list.add(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(StrUtil.isNotBlank(data.getControlEmpNo())){ |
|
|
|
|
SupPolice supPolice= policeService.getByEmpNo(data.getControlEmpNo()); |
|
|
|
|
data.setControlIdcode(supPolice.getIdCode()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(data)){ |
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|
|
|
|
} |
|
|
|
|
}).headRowNumber(2).build().read(EasyExcel.readSheet(0).build()); |
|
|
|
|
excelReader.close(); |
|
|
|
|
log.info("重点督察人员数据导入完成"); |
|
|
|
|
return Result.success(list); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|