35 changed files with 533 additions and 55 deletions
@ -0,0 +1,9 @@ |
|||||||
|
ALTER TABLE `negative`.`sup_depart` |
||||||
|
ADD COLUMN `first_host` tinyint DEFAULT '0' COMMENT '是否是市局主办'; |
||||||
|
|
||||||
|
ALTER TABLE `negative`.`negative` |
||||||
|
ADD COLUMN `current_processing_object` varchar(255) COMMENT '当前处理对象'; |
||||||
|
|
||||||
|
ALTER TABLE `negative`.`sup_police` |
||||||
|
ADD COLUMN `employment_date` datetime COMMENT '入职时间', |
||||||
|
ADD COLUMN `police_role` varchar(255) COMMENT '角色'; |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
public enum DataUpdateMethodEnum { |
||||||
|
|
||||||
|
// 增量更新
|
||||||
|
incremental, |
||||||
|
// 覆盖更新
|
||||||
|
overwrite |
||||||
|
} |
||||||
@ -0,0 +1,75 @@ |
|||||||
|
package com.biutag.supervision.controller.data; |
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil; |
||||||
|
import com.alibaba.excel.EasyExcel; |
||||||
|
import com.alibaba.excel.ExcelReader; |
||||||
|
import com.alibaba.excel.context.AnalysisContext; |
||||||
|
import com.alibaba.excel.read.listener.ReadListener; |
||||||
|
import com.alibaba.excel.read.metadata.ReadSheet; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.dto.DataCaseVerifImportDto; |
||||||
|
import com.biutag.supervision.pojo.entity.DataCaseVerif; |
||||||
|
import com.biutag.supervision.pojo.param.DataCaseVerifQueryParam; |
||||||
|
import com.biutag.supervision.service.DataCaseVerifService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
import org.springframework.web.multipart.MultipartFile; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@RequestMapping("data/caseVerif") |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
public class DataCaseVerifController { |
||||||
|
|
||||||
|
private final DataCaseVerifService dataCaseVerifService; |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<Page<DataCaseVerif>> list(DataCaseVerifQueryParam queryParam) { |
||||||
|
return Result.success(dataCaseVerifService.page(queryParam)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("import") |
||||||
|
public Result<List<DataCaseVerifImportDto>> 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 格式文件的导入"); |
||||||
|
} |
||||||
|
List<DataCaseVerifImportDto> list = new ArrayList<>(); |
||||||
|
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), DataCaseVerifImportDto.class, new ReadListener<DataCaseVerifImportDto>() { |
||||||
|
@Override |
||||||
|
public void invoke(DataCaseVerifImportDto data, AnalysisContext analysisContext) { |
||||||
|
list.add(data); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
||||||
|
|
||||||
|
} |
||||||
|
}).build(); |
||||||
|
ReadSheet sheet = EasyExcel.readSheet(0).build(); |
||||||
|
excelReader.read(sheet); |
||||||
|
excelReader.close(); |
||||||
|
return Result.success(list); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("{dataUpdateMethod}") |
||||||
|
public Result<Boolean> add(@RequestBody List<DataCaseVerifImportDto> body, @PathVariable String dataUpdateMethod) { |
||||||
|
if (body.isEmpty()) { |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
return Result.success(dataCaseVerifService.save(body, dataUpdateMethod)); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("{id}") |
||||||
|
public Result<Boolean> del(@PathVariable String id) { |
||||||
|
return Result.success(dataCaseVerifService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
package com.biutag.supervision.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.biutag.supervision.pojo.entity.DataCaseVerif; |
||||||
|
|
||||||
|
public interface DataCaseVerifMapper extends BaseMapper<DataCaseVerif> { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,59 @@ |
|||||||
|
package com.biutag.supervision.pojo.dto; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
@Schema(description = "案件核查") |
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public class DataCaseVerifImportDto { |
||||||
|
|
||||||
|
// 信件编号
|
||||||
|
@ExcelProperty({"问题基本信息", "案件编号"}) |
||||||
|
private String originId; |
||||||
|
|
||||||
|
// 登记时间
|
||||||
|
@ExcelProperty({"问题基本信息", "受理时间"}) |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm") |
||||||
|
private LocalDateTime discoveryTime; |
||||||
|
|
||||||
|
// 登记时间
|
||||||
|
@ExcelProperty({"问题基本信息", "问题发生时间"}) |
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm") |
||||||
|
private LocalDateTime happenTime; |
||||||
|
|
||||||
|
@ExcelProperty({"问题基本信息", "问题来源"}) |
||||||
|
private String problemSources; |
||||||
|
|
||||||
|
// 投诉人
|
||||||
|
@ExcelProperty({"问题基本信息", "投诉人"}) |
||||||
|
private String responderName; |
||||||
|
|
||||||
|
// 投诉人电话
|
||||||
|
@ExcelProperty({"问题基本信息", "投诉人电话"}) |
||||||
|
private String contactPhone; |
||||||
|
|
||||||
|
@ExcelProperty({"问题基本信息", "业务类别"}) |
||||||
|
private String businessTypeName; |
||||||
|
|
||||||
|
@ExcelProperty({"问题基本信息", "涉嫌问题"}) |
||||||
|
private String involveProblem; |
||||||
|
|
||||||
|
@ExcelProperty({"问题基本信息", "涉及警种"}) |
||||||
|
private String policeTypeName; |
||||||
|
|
||||||
|
// 被投诉机构
|
||||||
|
@ExcelProperty({"问题基本信息", "涉及单位"}) |
||||||
|
private String complainedDepartName; |
||||||
|
|
||||||
|
// 具体内容
|
||||||
|
@ExcelProperty({"问题基本信息", "具体内容"}) |
||||||
|
private String thingDesc; |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package com.biutag.supervision.pojo.dto; |
||||||
|
|
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public class DataPetitionComplaintAddDto { |
||||||
|
|
||||||
|
// 更新方式
|
||||||
|
private String dataUpdateMethod; |
||||||
|
|
||||||
|
// 来源
|
||||||
|
private String problemSourcesCode; |
||||||
|
|
||||||
|
List<DataPetitionComplaintImportDto> data = new ArrayList<>(); |
||||||
|
} |
||||||
@ -0,0 +1,65 @@ |
|||||||
|
package com.biutag.supervision.pojo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public class DataCaseVerif { |
||||||
|
|
||||||
|
// 样本源头编号
|
||||||
|
@TableId(value = "originId") |
||||||
|
private String originId; |
||||||
|
|
||||||
|
// 问题发现时间
|
||||||
|
@TableField("discovery_time") |
||||||
|
@JsonFormat(pattern = "YYYY-MM-dd HH:mm") |
||||||
|
private LocalDateTime discoveryTime; |
||||||
|
|
||||||
|
// 问题发生时间
|
||||||
|
@TableField("happen_time") |
||||||
|
@JsonFormat(pattern = "YYYY-MM-dd HH:mm") |
||||||
|
private LocalDateTime happenTime; |
||||||
|
|
||||||
|
// 问题来源
|
||||||
|
@TableField("problem_sources") |
||||||
|
private String problemSources; |
||||||
|
|
||||||
|
// 投诉人姓名
|
||||||
|
@TableField("responder_name") |
||||||
|
private String responderName; |
||||||
|
|
||||||
|
// 投诉人电话
|
||||||
|
@TableField("responder_phone") |
||||||
|
private String responderPhone; |
||||||
|
|
||||||
|
// 业务类型
|
||||||
|
@TableField("business_type_name") |
||||||
|
private String businessTypeName; |
||||||
|
|
||||||
|
// 涉及问题
|
||||||
|
@TableField("involve_problem") |
||||||
|
private String involveProblem; |
||||||
|
|
||||||
|
// 涉及警种
|
||||||
|
@TableField("police_type_name") |
||||||
|
private String policeTypeName; |
||||||
|
|
||||||
|
// 涉及单位
|
||||||
|
@TableField("involve_depart_name") |
||||||
|
private String involveDepartName; |
||||||
|
|
||||||
|
// 事情简述
|
||||||
|
@TableField("thing_desc") |
||||||
|
private String thingDesc; |
||||||
|
|
||||||
|
//
|
||||||
|
@TableField("create_time") |
||||||
|
private LocalDateTime createTime; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
package com.biutag.supervision.pojo.param; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/10/15 |
||||||
|
*/ |
||||||
|
public class DataCaseVerifQueryParam extends BasePage { |
||||||
|
} |
||||||
@ -0,0 +1,47 @@ |
|||||||
|
package com.biutag.supervision.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import com.biutag.supervision.constants.enums.DataUpdateMethodEnum; |
||||||
|
import com.biutag.supervision.mapper.DataCaseVerifMapper; |
||||||
|
import com.biutag.supervision.pojo.dto.DataCaseVerifImportDto; |
||||||
|
import com.biutag.supervision.pojo.dto.DataPetitionComplaintAddDto; |
||||||
|
import com.biutag.supervision.pojo.dto.DataPetitionComplaintImportDto; |
||||||
|
import com.biutag.supervision.pojo.entity.DataCaseVerif; |
||||||
|
import com.biutag.supervision.pojo.entity.DataPetitionComplaint; |
||||||
|
import com.biutag.supervision.pojo.param.DataCaseVerifQueryParam; |
||||||
|
import org.springframework.beans.BeanUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Service |
||||||
|
public class DataCaseVerifService extends ServiceImpl<DataCaseVerifMapper, DataCaseVerif> { |
||||||
|
|
||||||
|
public Page<DataCaseVerif> page(DataCaseVerifQueryParam queryParam) { |
||||||
|
LambdaQueryWrapper<DataCaseVerif> queryWrapper = new LambdaQueryWrapper<>(); |
||||||
|
queryWrapper.orderByDesc(DataCaseVerif::getCreateTime); |
||||||
|
return page(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean save(List<DataCaseVerifImportDto> list, String dataUpdateMethod) { |
||||||
|
LocalDateTime now = LocalDateTime.now(); |
||||||
|
int index = 0; |
||||||
|
for (DataCaseVerifImportDto dto : list) { |
||||||
|
index++; |
||||||
|
boolean exists = exists(new LambdaQueryWrapper<DataCaseVerif>().eq(DataCaseVerif::getOriginId, dto.getOriginId())); |
||||||
|
// 增量更新
|
||||||
|
if (DataUpdateMethodEnum.incremental.name().equals(dataUpdateMethod) && exists) { |
||||||
|
throw new RuntimeException(String.format("第%s条数据的案件编号已存在,请核实", index)); |
||||||
|
} |
||||||
|
DataCaseVerif data = new DataCaseVerif(); |
||||||
|
BeanUtils.copyProperties(dto, data); |
||||||
|
data.setCreateTime(now); |
||||||
|
saveOrUpdate(data); |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue