青羊经侦大队-数据平台
fix:修改案件的文件导入自动生成案件的number,修改案件名时候自动修改群组名称
2个文件已修改
1个文件已添加
27 ■■■■■ 已修改文件
src/main/java/com/example/jz/controller/CauseController.java 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/jz/service/impl/CauseServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/jz/utils/IdUtils.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/jz/controller/CauseController.java
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);
    }
@@ -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());
    }
}