14 changed files with 201 additions and 65 deletions
@ -0,0 +1,19 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/24 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum SpecialSupervisionEnum { |
||||||
|
|
||||||
|
// 黄赌警情
|
||||||
|
HDJQ("1"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,52 @@ |
|||||||
|
package com.biutag.supervision.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||||
|
import com.biutag.supervision.mapper.SupPoliceMapper; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.SupPolice; |
||||||
|
import com.biutag.supervision.service.FileService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.io.FileInputStream; |
||||||
|
import java.io.FileNotFoundException; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/24 |
||||||
|
*/ |
||||||
|
@RequestMapping("policeUpdateAvatar") |
||||||
|
@Slf4j |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
public class PoliceAvatarController { |
||||||
|
|
||||||
|
private final FileService fileService; |
||||||
|
|
||||||
|
private final SupPoliceMapper policeMapper; |
||||||
|
|
||||||
|
@RequestMapping |
||||||
|
public Result<String> update() throws FileNotFoundException { |
||||||
|
List<File> files = FileUtil.loopFiles("/work/POLICE"); |
||||||
|
int i = 0; |
||||||
|
for (File file : files) { |
||||||
|
try { |
||||||
|
String img = file.getPath().replace("/work/POLICE", ""); |
||||||
|
|
||||||
|
String filePath = fileService.upload(new FileInputStream(file), FileUtil.size(file), FileUtil.extName(file.getName())); |
||||||
|
|
||||||
|
String idCode = ""; |
||||||
|
policeMapper.update(new LambdaUpdateWrapper<SupPolice>().eq(SupPolice::getIdCode, "idCode").set(SupPolice::getAvatarUrl, filePath)); |
||||||
|
log.info("{} 更新头像 {}", idCode, file.getName()); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(), e); |
||||||
|
} |
||||||
|
} |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
} |
||||||
@ -1,49 +0,0 @@ |
|||||||
package com.biutag.supervision.controller; |
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil; |
|
||||||
import com.alibaba.fastjson.JSON; |
|
||||||
import com.alibaba.fastjson.JSONArray; |
|
||||||
import com.alibaba.fastjson.JSONObject; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
||||||
import com.biutag.supervision.pojo.entity.Negative; |
|
||||||
import com.biutag.supervision.service.NegativeService; |
|
||||||
import lombok.RequiredArgsConstructor; |
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
import java.util.stream.Collectors; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author wxc |
|
||||||
* @date 2024/12/4 |
|
||||||
*/ |
|
||||||
@Slf4j |
|
||||||
@RequiredArgsConstructor |
|
||||||
@RestController |
|
||||||
public class UpdateController { |
|
||||||
|
|
||||||
private final NegativeService negativeService; |
|
||||||
|
|
||||||
@RequestMapping("updateInvolveProblem") |
|
||||||
public String update() { |
|
||||||
List<Negative> list = negativeService.list(new LambdaUpdateWrapper<Negative>().isNotNull(Negative::getInvolveProblem)); |
|
||||||
int i = 0; |
|
||||||
for (Negative negative : list) { |
|
||||||
if (StrUtil.isBlank(negative.getInvolveProblem())) { |
|
||||||
continue; |
|
||||||
} |
|
||||||
log.info("第{}条数据--------", i++); |
|
||||||
try { |
|
||||||
JSONArray jsonArray = JSON.parseArray(negative.getInvolveProblem()); |
|
||||||
String val = jsonArray.stream().map(item -> ((JSONObject) item).getString("dictValue")).collect(Collectors.joining(",")); |
|
||||||
System.out.println(val); |
|
||||||
negativeService.update(new LambdaUpdateWrapper<Negative>().eq(Negative::getId, negative.getId()).set(Negative::getInvolveProblem, val)); |
|
||||||
} catch (Exception e) { |
|
||||||
log.error("更新涉嫌问题异常:{}", e.getMessage(), e); |
|
||||||
} |
|
||||||
} |
|
||||||
return "success"; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -0,0 +1,49 @@ |
|||||||
|
package com.biutag.supervision.controller.books; |
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.constants.enums.ProblemSourcesEnum; |
||||||
|
import com.biutag.supervision.constants.enums.SpecialSupervisionEnum; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.Negative; |
||||||
|
import com.biutag.supervision.pojo.param.NegativeQueryParam; |
||||||
|
import com.biutag.supervision.pojo.vo.NegativeHdjq; |
||||||
|
import com.biutag.supervision.service.NegativeService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/24 |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("negative/books") |
||||||
|
@RestController |
||||||
|
public class NegativeBookController { |
||||||
|
|
||||||
|
private final NegativeService negativeService; |
||||||
|
|
||||||
|
@GetMapping("hdjq") |
||||||
|
public Result<Page<NegativeHdjq>> page(NegativeQueryParam queryParam) { |
||||||
|
LambdaQueryWrapper<Negative> queryWrapper = new LambdaQueryWrapper<>(); |
||||||
|
queryWrapper.eq(Negative::getProblemSourcesCode, ProblemSourcesEnum.ZXDC.getValue()) |
||||||
|
.eq(Negative::getSpecialSupervision, SpecialSupervisionEnum.HDJQ.getValue()) |
||||||
|
.orderByAsc(Negative::getReportNumber) |
||||||
|
.orderByAsc(Negative::getCrtTime); |
||||||
|
Page<Negative> page = negativeService.page(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper); |
||||||
|
List<NegativeHdjq> list = page.getRecords().stream().map(item -> { |
||||||
|
NegativeHdjq negativeHdjq = new NegativeHdjq(); |
||||||
|
BeanUtil.copyProperties(item, negativeHdjq); |
||||||
|
return negativeHdjq; |
||||||
|
}).toList(); |
||||||
|
return Result.success(new Page<NegativeHdjq>().setTotal(page.getTotal()).setRecords(list)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,51 @@ |
|||||||
|
package com.biutag.supervision.pojo.vo; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/24 |
||||||
|
*/ |
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public class NegativeHdjq { |
||||||
|
|
||||||
|
private String id; |
||||||
|
|
||||||
|
private String involveDepartName; |
||||||
|
|
||||||
|
// 涉及单位
|
||||||
|
private String involveDepartId; |
||||||
|
|
||||||
|
// 办理单位
|
||||||
|
private String handleSecondDepartId; |
||||||
|
|
||||||
|
private String handleSecondDepartName; |
||||||
|
|
||||||
|
private String handleThreeDepartId; |
||||||
|
|
||||||
|
private String handleThreeDepartName; |
||||||
|
|
||||||
|
// 发现时间
|
||||||
|
@JsonFormat(pattern = "YYYY-MM-dd HH:mm") |
||||||
|
private LocalDateTime discoveryTime; |
||||||
|
|
||||||
|
// 涉及案件/警情编号
|
||||||
|
private String caseNumber; |
||||||
|
|
||||||
|
|
||||||
|
// 通报期数
|
||||||
|
private String reportNumber; |
||||||
|
|
||||||
|
// 创建单位层级 (默认为市局)
|
||||||
|
private Integer crtDepartLevel; |
||||||
|
|
||||||
|
private String thingDesc; |
||||||
|
|
||||||
|
// 办理状态
|
||||||
|
private String processingStatus; |
||||||
|
} |
||||||
@ -1,18 +1,22 @@ |
|||||||
package com.biutag.supervision; |
package com.biutag.supervision; |
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil; |
||||||
import org.junit.jupiter.api.Test; |
import org.junit.jupiter.api.Test; |
||||||
import org.springframework.security.crypto.bcrypt.BCrypt; |
import org.springframework.security.crypto.bcrypt.BCrypt; |
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
import java.io.FileNotFoundException; |
import java.io.FileNotFoundException; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
public class StrUtil { |
public class StrUtil { |
||||||
|
|
||||||
@Test |
@Test |
||||||
public void testSubstr() throws FileNotFoundException { |
public void testSubstr() throws FileNotFoundException { |
||||||
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); |
List<File> files = FileUtil.loopFiles("D:\\deploy\\test2"); |
||||||
String encode = encoder.encode("123456"); |
for (File file : files) { |
||||||
System.out.println(BCrypt.checkpw("123456", encode)); |
System.out.println(file.getPath()); |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
|||||||
Loading…
Reference in new issue