青羊经侦大队-数据平台
fix:修改案件的文件导入自动生成案件的number,修改案件名时候自动修改群组名称
2个文件已修改
1个文件已添加
35 ■■■■ 已修改文件
src/main/java/com/example/jz/controller/CauseController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/jz/service/impl/CauseServiceImpl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/jz/utils/IdUtils.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/jz/controller/CauseController.java
@@ -130,7 +130,7 @@
    @ApiResponse(message = "执行成功", code = 200)
    @SneakyThrows
    public R uploadReporter(@RequestParam(value = "multipartFile") MultipartFile multipartFile,Integer causeId) {
        causeService.loadFileReport(multipartFile,causeId);
            causeService.loadFileReport(multipartFile,causeId);
        return R.ok();
    }
src/main/java/com/example/jz/service/impl/CauseServiceImpl.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.jz.dao.*;
import com.example.jz.enums.CauseEnums;
@@ -23,6 +24,7 @@
import com.example.jz.service.CauseService;
import com.example.jz.service.ReportService;
import com.example.jz.service.UserService;
import com.example.jz.utils.IdUtils;
import lombok.SneakyThrows;
import org.springframework.beans.BeanUtils;
import org.springframework.security.core.context.SecurityContextHolder;
@@ -167,6 +169,9 @@
        Cause cause = new Cause();
        BeanUtils.copyProperties(causeDto, cause);
        cause.setId(id);
        groupDao.update(null, Wrappers.lambdaUpdate(Group.class)
                .set(Group::getGroupName, causeDto.getName())
                .eq(Group::getCauseId, id));
        return causeDao.updateById(cause);
    }
@@ -206,9 +211,9 @@
    public void deleteCause(Integer id) {
        causeDao.deleteById(id);
        Group group = groupDao.selectOne(new LambdaQueryWrapper<Group>().eq(Group::getCauseId, id));
        if (group!=null){
            messageDao.delete(new LambdaQueryWrapper<Message>().eq(Message::getGroupId,group.getId()));
            groupUserDao.delete(new LambdaQueryWrapper<GroupUser>().eq(GroupUser::getGroupId,group.getId()));
        if (group != null) {
            messageDao.delete(new LambdaQueryWrapper<Message>().eq(Message::getGroupId, group.getId()));
            groupUserDao.delete(new LambdaQueryWrapper<GroupUser>().eq(GroupUser::getGroupId, group.getId()));
        }
        groupDao.delete(new QueryWrapper<Group>().eq("cause_id", id));
    }
@@ -237,6 +242,7 @@
                a -> {
                    Cause cause = new Cause();
                    BeanUtils.copyProperties(a, cause);
                    cause.setNumber(IdUtils.getAduitId());
                    if (StringUtils.isBlank(a.getStatus())) {
                        throw new BusinessException("状态不能为空");
                    }
src/main/java/com/example/jz/utils/IdUtils.java
New file
@@ -0,0 +1,21 @@
package com.example.jz.utils;
import java.util.Date;
public class IdUtils {
    public static String getAduitId() {
        String time = String.valueOf(new Date().getTime());
        String txt = "1234567890";
        int len = 13;
        String pwd = "";
        for (int i = 0; i < len; i++) {
            pwd += txt.charAt((int) Math.floor(Math.random() * txt.length()));
        }
        String s = time + pwd;
        return s;
    }
    public static void main(String[] args) {
        System.out.println(getAduitId());
    }
}