|
|
|
|
@ -9,6 +9,7 @@ import com.alibaba.excel.context.AnalysisContext;
|
|
|
|
|
import com.alibaba.excel.read.listener.ReadListener; |
|
|
|
|
import com.alibaba.excel.read.metadata.ReadSheet; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.biutag.supervision.common.UserContextHolder; |
|
|
|
|
import com.biutag.supervision.constants.enums.*; |
|
|
|
|
@ -16,6 +17,7 @@ import com.biutag.supervision.pojo.Result;
|
|
|
|
|
import com.biutag.supervision.pojo.dto.DataDataPetitionComplainDistribute; |
|
|
|
|
import com.biutag.supervision.pojo.dto.DataPetitionComplaintGjImportDto; |
|
|
|
|
import com.biutag.supervision.pojo.dto.DataPetitionComplaintImportDto; |
|
|
|
|
import com.biutag.supervision.pojo.dto.DataPetitionComplaintReplenishDto; |
|
|
|
|
import com.biutag.supervision.pojo.entity.DataPetitionComplaint; |
|
|
|
|
import com.biutag.supervision.pojo.entity.NegativeTask; |
|
|
|
|
import com.biutag.supervision.pojo.entity.SupDepart; |
|
|
|
|
@ -25,7 +27,7 @@ import com.biutag.supervision.pojo.vo.DataPetitionComplaintVo;
|
|
|
|
|
import com.biutag.supervision.service.DataPetitionComplaintService; |
|
|
|
|
import com.biutag.supervision.service.NegativeTaskService; |
|
|
|
|
import com.biutag.supervision.service.SupDepartService; |
|
|
|
|
import jakarta.validation.Validator; |
|
|
|
|
import dm.jdbc.util.StringUtil; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
@ -41,7 +43,6 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @author wxc |
|
|
|
|
* @date |
|
|
|
|
*/ |
|
|
|
|
@ -99,8 +100,10 @@ public class DataPetitionComplaintController {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
list.add(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|
|
|
|
} |
|
|
|
|
@ -111,6 +114,37 @@ public class DataPetitionComplaintController {
|
|
|
|
|
return Result.success(list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("gab/replenish") |
|
|
|
|
public Result replenishExcel(@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 格式文件的导入"); |
|
|
|
|
} |
|
|
|
|
EasyExcel.read(file.getInputStream(), DataPetitionComplaintReplenishDto.class, new ReadListener<DataPetitionComplaintReplenishDto>() { |
|
|
|
|
@Override |
|
|
|
|
public void invoke(DataPetitionComplaintReplenishDto data, AnalysisContext analysisContext) { |
|
|
|
|
|
|
|
|
|
LambdaUpdateWrapper<DataPetitionComplaint> updateWrapper = new LambdaUpdateWrapper<DataPetitionComplaint>() |
|
|
|
|
.eq(DataPetitionComplaint::getOriginId, data.getOriginId()); |
|
|
|
|
if (StringUtil.isNotEmpty(data.getInitialPetition())) { |
|
|
|
|
updateWrapper.set(DataPetitionComplaint::getInitialPetition, data.getInitialPetition().contains("初") ? "1" : "2"); |
|
|
|
|
} |
|
|
|
|
if (StringUtil.isNotEmpty(data.getMassVisits())) { |
|
|
|
|
updateWrapper.set(DataPetitionComplaint::getMassVisits, data.getMassVisits().contains("是")); |
|
|
|
|
} |
|
|
|
|
dataPetitionComplaintService.update(updateWrapper); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}).sheet(0).headRowNumber(2).doRead(); |
|
|
|
|
return Result.success(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("gab") |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public Result<Boolean> add(@RequestBody List<DataPetitionComplaintImportDto> list) { |
|
|
|
|
@ -127,6 +161,11 @@ public class DataPetitionComplaintController {
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
dataPetitionComplaint.setDiscoveryTime(LocalDate.parse(item.getDiscoveryTime(), DateTimeFormatter.ofPattern("yyyy-M-d H:m")).atStartOfDay()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotBlank(item.getDepartId())) { |
|
|
|
|
SupDepart depart = departService.getById(item.getDepartId()); |
|
|
|
|
@ -184,6 +223,7 @@ public class DataPetitionComplaintController {
|
|
|
|
|
} |
|
|
|
|
list.add(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|
|
|
|
} |
|
|
|
|
|