32 changed files with 664 additions and 105 deletions
@ -0,0 +1,167 @@
|
||||
package com.biutag.supervision.controller; |
||||
|
||||
import cn.hutool.core.io.FileUtil; |
||||
import cn.hutool.core.util.IdUtil; |
||||
import cn.hutool.core.util.StrUtil; |
||||
import cn.hutool.http.HttpResponse; |
||||
import cn.hutool.http.HttpUtil; |
||||
import com.alibaba.fastjson2.JSON; |
||||
import com.alibaba.fastjson2.JSONArray; |
||||
import com.alibaba.fastjson2.JSONObject; |
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||
import com.biutag.supervision.constants.enums.BusinessTypeEnum; |
||||
import com.biutag.supervision.constants.enums.InspectCaseEnum; |
||||
import com.biutag.supervision.constants.enums.ProblemSourcesEnum; |
||||
import com.biutag.supervision.constants.enums.ProcessingStatusEnum; |
||||
import com.biutag.supervision.mapper.MailMapper; |
||||
import com.biutag.supervision.pojo.entity.*; |
||||
import com.biutag.supervision.pojo.entity.mailbox.Mail; |
||||
import com.biutag.supervision.service.*; |
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.io.InputStream; |
||||
import java.time.LocalDateTime; |
||||
import java.util.List; |
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* @author wxc |
||||
* @date 2025/1/13 |
||||
*/ |
||||
@RequestMapping("common") |
||||
@Slf4j |
||||
@RequiredArgsConstructor |
||||
@RestController |
||||
public class CommonController { |
||||
|
||||
@Value("${mailbox.url}") |
||||
private String mailboxUrl; |
||||
|
||||
private final FileService fileService; |
||||
|
||||
private final NegativeThingFileService thingFileService; |
||||
|
||||
private final NegativeFileService negativeThingFile; |
||||
|
||||
private final SupPoliceService supPoliceService; |
||||
|
||||
private final NegativeBlameService blameService; |
||||
|
||||
private final MailMapper mailMapper; |
||||
|
||||
private final NegativeService negativeService; |
||||
|
||||
@RequestMapping("mailbox") |
||||
public void mailbox() { |
||||
List<Mail> mailList = mailMapper.selectList(new LambdaUpdateWrapper<Mail>().eq(Mail::getMailState, "completion") |
||||
.in(Mail::getVerifyIsTrue, List.of("属实", "基本属实"))); |
||||
for (Mail item : mailList) { |
||||
// 判断是否存在
|
||||
if (negativeService.exists(new LambdaUpdateWrapper<Negative>().eq(Negative::getOriginId, item.getId()).eq(Negative::getProblemSourcesCode, ProblemSourcesEnum.JZXX.getValue()))) { |
||||
log.info("信件 {} 已存在", item.getId()); |
||||
continue; |
||||
} |
||||
Negative negative = new Negative(); |
||||
negative.setId(IdUtil.getSnowflakeNextIdStr()); |
||||
negative.setOriginId(item.getId()); |
||||
negative.setDiscoveryTime(item.getCreateTime()); |
||||
negative.setResponderName(item.getContactName()); |
||||
negative.setContactPhone(item.getContactPhone()); |
||||
negative.setThingDesc(item.getContent()); |
||||
// 问题涉及单位
|
||||
// negative.setInvolveDepartName();
|
||||
|
||||
negative.setProblemSources(ProblemSourcesEnum.JZXX.getLabel()); |
||||
negative.setProblemSourcesCode(ProblemSourcesEnum.JZXX.getValue()); |
||||
negative.setBusinessTypeCode(BusinessTypeEnum.QT.getValue()); |
||||
negative.setBusinessTypeName(BusinessTypeEnum.QT.getLabel()); |
||||
if ("属实".equals(item.getVerifyIsTrue())) { |
||||
negative.setCheckStatus(InspectCaseEnum.TRUE.getValue()); |
||||
negative.setCheckStatusName(InspectCaseEnum.TRUE.getLabel()); |
||||
} |
||||
if ("基本属实".equals(item.getVerifyIsTrue())) { |
||||
negative.setCheckStatus(InspectCaseEnum.PARTIALLY_TRUE.getValue()); |
||||
negative.setCheckStatusName(InspectCaseEnum.PARTIALLY_TRUE.getLabel()); |
||||
} |
||||
// 核办情况
|
||||
negative.setCheckStatusDesc(item.getVerifyDetails()); |
||||
negative.setProcessingStatus(ProcessingStatusEnum.completed.name()); |
||||
negative.setCrtTime(LocalDateTime.now()); |
||||
negativeService.save(negative); |
||||
|
||||
// 被举报人
|
||||
if (StrUtil.isNotBlank(item.getVerifyReportedPolices())) { |
||||
JSONArray jsonArray = JSON.parseArray(item.getVerifyReportedPolices()); |
||||
if (!jsonArray.isEmpty()) { |
||||
for (int i = 0; i < jsonArray.size(); i++) { |
||||
// [{"deptId":310,"empNo":"A00002","gender":null,"birthday":null,"name":"李四","mobile":null}]
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i); |
||||
String empNo = jsonObject.getString("empNo"); |
||||
String name = jsonObject.getString("name"); |
||||
SupPolice police = supPoliceService.getOne(new LambdaUpdateWrapper<SupPolice>().eq(SupPolice::getEmpNo, empNo).eq(SupPolice::getName, name)); |
||||
if (Objects.isNull(police)) { |
||||
log.error("没有该警员的数据! {}-{}", name, empNo); |
||||
continue; |
||||
} |
||||
NegativeBlame negativeBlame = new NegativeBlame(); |
||||
|
||||
negativeBlame |
||||
.setBlameId(IdUtil.getSnowflakeNextIdStr()) |
||||
.setNegativeId(negative.getId()) |
||||
.setType("personal") |
||||
.setBlameEmpNo(empNo) |
||||
.setBlameIdCode(police.getIdCode()) |
||||
.setBlameName(name) |
||||
.setUpdTime(LocalDateTime.now()) |
||||
.setCrtTime(LocalDateTime.now()); |
||||
blameService.save(negativeBlame); |
||||
} |
||||
} |
||||
} |
||||
|
||||
// [{"filepath":"250102/_B5HQNhI.doc","orgiinFilename":"3、定级报告 .doc","type":"application/msword","size":95744,"docxFilepath":"250102/l-Tl5dux.docx"}]
|
||||
if (StrUtil.isNotBlank(item.getAttachments())) { |
||||
JSONArray jsonArray = JSON.parseArray(item.getAttachments()); |
||||
if (!jsonArray.isEmpty()) { |
||||
for (int i = 0; i < jsonArray.size(); i++) { |
||||
JSONObject jsonObject = jsonArray.getJSONObject(i); |
||||
HttpResponse httpResponse = HttpUtil.createGet(mailboxUrl + "api/file/steam/" + jsonObject.getString("filepath")).execute(); |
||||
InputStream is = httpResponse.bodyStream(); |
||||
String fileName = jsonObject.getString("orgiinFilename"); |
||||
String filePath = fileService.upload(is, 0L, FileUtil.extName(fileName)); |
||||
NegativeThingFile negativeThingFile = new NegativeThingFile(); |
||||
negativeThingFile.setFileName(fileName); |
||||
negativeThingFile.setFilePath(filePath); |
||||
negativeThingFile.setCreateTime(LocalDateTime.now()); |
||||
negativeThingFile.setNegativeId(negative.getId()); |
||||
thingFileService.save(negativeThingFile); |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (StrUtil.isNotBlank(item.getVerifyAttachments())) { |
||||
JSONArray jsonArray = JSON.parseArray(item.getVerifyAttachments()); |
||||
if (!jsonArray.isEmpty()) { |
||||
for (int i = 0; i < jsonArray.size(); i++) { |
||||
JSONObject jsonObject = jsonArray.getJSONObject(i); |
||||
HttpResponse httpResponse = HttpUtil.createGet(mailboxUrl + "api/file/steam/" + jsonObject.getString("filepath")).execute(); |
||||
InputStream is = httpResponse.bodyStream(); |
||||
String fileName = jsonObject.getString("orgiinFilename"); |
||||
String filePath = fileService.upload(is, 0L, FileUtil.extName(fileName)); |
||||
NegativeFile file = new NegativeFile(); |
||||
file.setFileName(fileName); |
||||
file.setFilePath(filePath); |
||||
file.setCrtTime(LocalDateTime.now()); |
||||
file.setNegtiveId(negative.getId()); |
||||
negativeThingFile.save(file); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,83 @@
|
||||
package com.biutag.supervision.pojo.vo; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore; |
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.time.LocalDateTime; |
||||
|
||||
/** |
||||
* @author wxc |
||||
* @date 2025/1/10 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class DataCaseVerifVo { |
||||
|
||||
@ExcelProperty({"基本信息", "序号"}) |
||||
private Integer index; |
||||
|
||||
// 问题来源(投诉渠道)
|
||||
@ExcelProperty({"基本信息", "投诉渠道"}) |
||||
private String problemSources; |
||||
|
||||
// 案件编号
|
||||
@ExcelProperty({"基本信息", "案件编号"}) |
||||
private String originId; |
||||
|
||||
// 问题发现时间
|
||||
@ExcelProperty({"基本信息", "受理时间"}) |
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm") |
||||
private LocalDateTime discoveryTime; |
||||
|
||||
// 投诉人姓名
|
||||
@ExcelProperty({"基本信息", "投诉人"}) |
||||
private String responderName; |
||||
|
||||
// 投诉人电话
|
||||
@ExcelProperty({"基本信息", "投诉人电话"}) |
||||
private String responderPhone; |
||||
|
||||
|
||||
// 涉及单位 二级
|
||||
@ExcelIgnore |
||||
private String secondDepartId; |
||||
|
||||
@ExcelProperty({"基本信息", "被投诉机构"}) |
||||
private String secondDepartName; |
||||
|
||||
// 所队
|
||||
@ExcelIgnore |
||||
private String thirdDepartId; |
||||
|
||||
@ExcelProperty({"基本信息", "被投诉所队"}) |
||||
private String thirdDepartName; |
||||
|
||||
// 事情简述
|
||||
@ExcelProperty({"基本信息", "具体内容"}) |
||||
private String thingDesc; |
||||
|
||||
// 涉及问题
|
||||
@ExcelProperty({"基本信息", "问题类别"}) |
||||
private String involveProblem; |
||||
|
||||
// 业务类型
|
||||
@ExcelProperty({"基本信息", "业务类别"}) |
||||
private String businessTypeName; |
||||
|
||||
@ExcelProperty({"办理情况", "承办单位"}) |
||||
private String handleDepartName; |
||||
|
||||
// 核查情况
|
||||
@ExcelProperty({"办理情况", "审定结果"}) |
||||
private String checkStatusName; |
||||
|
||||
// 问题核查情况
|
||||
@ExcelProperty({"办理情况", "情况反馈"}) |
||||
private String checkStatusDesc; |
||||
|
||||
|
||||
|
||||
} |
||||
@ -1,23 +1,25 @@
|
||||
package com.biutag.supervision; |
||||
|
||||
import cn.hutool.core.io.FileUtil; |
||||
import cn.hutool.core.bean.BeanUtil; |
||||
import cn.hutool.core.bean.copier.CopyOptions; |
||||
import com.biutag.supervision.pojo.entity.DataCaseVerifExt; |
||||
import org.junit.jupiter.api.Test; |
||||
import org.springframework.security.crypto.bcrypt.BCrypt; |
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
||||
|
||||
import java.io.File; |
||||
import java.io.FileNotFoundException; |
||||
import java.time.LocalDateTime; |
||||
import java.time.format.DateTimeFormatter; |
||||
import java.util.List; |
||||
|
||||
public class StrUtil { |
||||
|
||||
@Test |
||||
public void testSubstr() throws FileNotFoundException { |
||||
LocalDateTime parse = LocalDateTime.parse("2025-01-03", DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
||||
|
||||
System.out.println(parse); |
||||
DataCaseVerifExt dataCaseVerifExt = new DataCaseVerifExt(); |
||||
dataCaseVerifExt.setOuterId("1"); |
||||
dataCaseVerifExt.setCheckStatusName("123"); |
||||
DataCaseVerifExt obj = new DataCaseVerifExt(); |
||||
obj.setBlameEmpNo("ABC"); |
||||
obj.setCheckStatusName("3"); |
||||
obj.setOuterId("1"); |
||||
BeanUtil.copyProperties(dataCaseVerifExt, obj, CopyOptions.create().setIgnoreNullValue(true)); |
||||
System.out.println(obj); |
||||
} |
||||
|
||||
} |
||||
|
||||
Loading…
Reference in new issue