Browse Source

1、警员中心新增警员照片上传,新增详情页面展示。在个人问题库展示警员照片;

2、修复用户管理/编辑用户异常的问题,以及去掉角色必填项校验;

3、黄赌情警台账功能;
main
wxc 11 months ago
parent
commit
c7a0e91f6f
  1. 9
      src/main/java/com/biutag/supervision/controller/PoliceAvatarController.java
  2. 16
      src/main/java/com/biutag/supervision/controller/work/AlarmNotificationController.java
  3. 2
      src/main/java/com/biutag/supervision/mapper/SupPoliceMapper.java
  4. 2
      src/main/java/com/biutag/supervision/pojo/entity/AlarmFile.java
  5. 6
      src/main/java/com/biutag/supervision/pojo/entity/AlarmNotification.java
  6. 6
      src/main/java/com/biutag/supervision/service/AlarmNotificationService.java
  7. 3
      src/test/java/com/biutag/supervision/SupervisionApplicationTests.java

9
src/main/java/com/biutag/supervision/controller/PoliceAvatarController.java

@ -1,6 +1,7 @@
package com.biutag.supervision.controller;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.biutag.supervision.mapper.SupPoliceMapper;
import com.biutag.supervision.pojo.Result;
@ -37,10 +38,12 @@ public class PoliceAvatarController {
for (File file : files) {
try {
String img = file.getPath().replace("/work/POLICE", "");
log.info(img);
String idCode = policeMapper.getIdCodeByPoliceAvatar(img);
if (StrUtil.isBlank(idCode) || !policeMapper.exists(new LambdaUpdateWrapper<SupPolice>().eq(SupPolice::getIdCode, idCode))) {
continue;
}
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) {

16
src/main/java/com/biutag/supervision/controller/work/AlarmNotificationController.java

@ -1,5 +1,6 @@
package com.biutag.supervision.controller.work;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -9,8 +10,10 @@ import com.biutag.supervision.pojo.entity.AlarmNotification;
import com.biutag.supervision.pojo.entity.SupDepart;
import com.biutag.supervision.pojo.enums.NotificationType;
import com.biutag.supervision.pojo.param.AlarmParam;
import com.biutag.supervision.service.AlarmFileService;
import com.biutag.supervision.service.AlarmNotificationService;
import com.biutag.supervision.service.SupDepartService;
import com.biutag.supervision.util.JSON;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -35,6 +38,8 @@ public class AlarmNotificationController {
private final AlarmNotificationService notificationService;
private final AlarmFileService alarmFileService;
private final SupDepartService departService;
/**
@ -72,6 +77,17 @@ public class AlarmNotificationController {
if(!res) {
return Result.failed(5000, "回复失败");
}
if (CollectionUtil.isNotEmpty(data.getReplyFiles())) {
List<AlarmFile> files = data.getReplyFiles().stream().map(item -> {
AlarmFile alarmFile = new AlarmFile();
alarmFile.setAlarmId(data.getId());
alarmFile.setFileName(item.getFileName());
alarmFile.setPath(item.getFilePath());
alarmFile.setCrtTime(LocalDateTime.now());
return alarmFile;
}).toList();
alarmFileService.saveBatch(files);
}
return Result.success();
}

2
src/main/java/com/biutag/supervision/mapper/SupPoliceMapper.java

@ -17,6 +17,6 @@ public interface SupPoliceMapper extends BaseMapper<SupPolice> {
Page<PoliceModel> queryPage(@Param("page") Page<PoliceModel> page, @Param(Constants.WRAPPER) QueryWrapper<PoliceModel> queryWrapper);
@Select("select id_code from sup_police_avatar where img = #{img}")
String getPoliceAvatar(String img);
String getIdCodeByPoliceAvatar(String img);
}

2
src/main/java/com/biutag/supervision/pojo/entity/AlarmFile.java

@ -31,7 +31,7 @@ public class AlarmFile {
String path;
String alarmId;
Integer alarmId;
/**
* 创建时间

6
src/main/java/com/biutag/supervision/pojo/entity/AlarmNotification.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.biutag.supervision.pojo.vo.FileVo;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@ -153,10 +154,15 @@ public class AlarmNotification implements Serializable {
// 是否要求回复
private Boolean requestReply;
@TableField(exist = false)
List<AlarmFile> files;
@TableField(exist = false)
List<FileVo> replyFiles;
// 通知回复时限
private Integer replyLimit;
}

6
src/main/java/com/biutag/supervision/service/AlarmNotificationService.java

@ -10,9 +10,7 @@ import com.biutag.supervision.constants.enums.RoleCodeEnum;
import com.biutag.supervision.mapper.AlarmNotificationMapper;
import com.biutag.supervision.pojo.entity.AlarmFile;
import com.biutag.supervision.pojo.entity.AlarmNotification;
import com.biutag.supervision.pojo.entity.BaseUser;
import com.biutag.supervision.pojo.model.UserAuth;
import com.biutag.supervision.pojo.model.UserModel;
import com.biutag.supervision.pojo.param.AlarmParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -39,7 +37,7 @@ public class AlarmNotificationService extends ServiceImpl<AlarmNotificationMappe
* @return 提醒列表
*/
public Page<AlarmNotification> pages(AlarmParam param) {
LambdaQueryWrapper<AlarmNotification> query = new LambdaQueryWrapper<AlarmNotification>();
LambdaQueryWrapper<AlarmNotification> query = new LambdaQueryWrapper<>();
if(param.getAlarmTypeId() != null && param.getAlarmTypeId() != -1) {
query.eq(AlarmNotification::getAlarmTypeId, param.getAlarmTypeId());
}
@ -54,7 +52,7 @@ public class AlarmNotificationService extends ServiceImpl<AlarmNotificationMappe
}
UserAuth user = UserContextHolder.getCurrentUser();
if (!user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode()) && !AppConstants.USER_TYPE_SUPER.equals(user.getUserType())) {
query.in(AlarmNotification::getNotificationDepartName, user.getAuthDepartIds());
query.in(AlarmNotification::getNotificationDepartId, user.getAuthDepartIds());
}
return page(Page.of(param.getCurrent(), param.getSize()), query.orderByDesc(AlarmNotification::getAlarmTime));
}

3
src/test/java/com/biutag/supervision/SupervisionApplicationTests.java

@ -35,8 +35,7 @@ class SupervisionApplicationTests {
@Test
void contextLoads() {
String policeAvatar = policeMapper.getPoliceAvatar("1830552573753421824");
System.out.println(policeAvatar);
}
public String getPathTrace(SupDepart depart) {

Loading…
Cancel
Save