青羊经侦大队-数据平台
wl
2022-12-27 8b26fa15912e355e57990946ac52f699130788c2
src/main/java/com/example/jz/service/impl/CauseServiceImpl.java
@@ -58,7 +58,8 @@
    UserService userService;
    @Resource
    ReportService reportService;
    @Resource
    MessageDao messageDao;
    @Resource
    AnnouncementDao announcementDao;
@@ -115,7 +116,7 @@
    }
    @Override
    public PageParam<CauseVo> getCauserListByCondition(String cause, Integer status, Integer size, Integer current,Integer id) {
    public PageParam<CauseVo> getCauserListByCondition(String cause, Integer status, Integer size, Integer current, Integer id) {
        QueryWrapper<Cause> causeQueryWrapper = new QueryWrapper<>();
        if (StringUtils.isNotBlank(cause)) {
            causeQueryWrapper.and(a -> a.like(StringUtils.isNotBlank(cause), "number", cause)
@@ -125,7 +126,7 @@
        if (status != null) {
            causeQueryWrapper.eq("status", status);
        }
        causeQueryWrapper.eq("user_id",id);
        causeQueryWrapper.eq("user_id", id);
        causeQueryWrapper.orderByDesc("ctime");
        PageParam<Cause> causePageParam = new PageParam<>();
        if (size != null) {
@@ -174,7 +175,7 @@
        PageParam<Report> reportPageParam = reportDao.selectPage(PageParam, new QueryWrapper<Report>().eq("cause_id", causeId).orderByDesc("ctime"));
        PageParam<CauseReportVo> causeReportVoPageParam = new PageParam<>();
        BeanUtils.copyProperties(reportPageParam, causeReportVoPageParam);
        if (!reportPageParam.getRecords().isEmpty()){
        if (!reportPageParam.getRecords().isEmpty()) {
            List<CauseReportVo> causeReportVos = reportPageParam.getRecords().stream()
                    .map(
                            a -> {
@@ -184,8 +185,8 @@
                                causeReportVo.setMobile(user.getUserMobile());
                                causeReportVo.setIdcard(user.getUserIdcard().replaceAll("(?<=[\\d]{3})\\d(?=[\\d]{4})", "*"));
                                causeReportVo.setReporterName(user.getRealName());
                                if (causeReportVo.getIsInGroup()==1) {
                                    causeReportVo.setGroupId(groupDao.selectOne(new QueryWrapper<Group>().eq("cause_id",causeId)).getId());
                                if (causeReportVo.getIsInGroup() == 1) {
                                    causeReportVo.setGroupId(groupDao.selectOne(new QueryWrapper<Group>().eq("cause_id", causeId)).getId());
                                }
                                return causeReportVo;
                            }
@@ -203,6 +204,11 @@
    @Override
    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()));
        }
        groupDao.delete(new QueryWrapper<Group>().eq("cause_id", id));
    }
@@ -279,21 +285,21 @@
        }
        Group group = groupDao.selectOne(new QueryWrapper<Group>().eq("cause_id", addReportDto.getCauseId()));
        // 添加人员进群组
       // groupUserDao.insert(new GroupUser().setGroupId(group.getId()).setUserId(user.getId()).setCtime(new Date()).setBanSpeech(0));
        // groupUserDao.insert(new GroupUser().setGroupId(group.getId()).setUserId(user.getId()).setCtime(new Date()).setBanSpeech(0));
        // 添加报案信息
        Report report = new Report();
        BeanUtils.copyProperties(addReportDto, report);
        report
                .setIsInGroup(1)
                .setCreator(userDao.selectOne(new QueryWrapper<User>().eq("login_username",  SecurityContextHolder.getContext().getAuthentication().getPrincipal())).getId())
                .setCreator(userDao.selectOne(new QueryWrapper<User>().eq("login_username", SecurityContextHolder.getContext().getAuthentication().getPrincipal())).getId())
                .setUserId(user.getId())
                .setCtime(new Date())
                .setStatus(0)
                .setStatus(1)
                .setReportMethod("后台录入")
                .setIsCommission("0").setReportTime(new Date())
                .setCauseId(addReportDto.getCauseId());
        reportService.save(report);
        return  groupUserDao.insert(new GroupUser().setGroupId(group.getId()).setUserId(report.getId()).setCtime(new Date()).setBanSpeech(0))> 0;
        return groupUserDao.insert(new GroupUser().setGroupId(group.getId()).setUserId(report.getId()).setCtime(new Date()).setBanSpeech(0)) > 0;
    }
    @Override
@@ -310,13 +316,13 @@
    @Override
    @SneakyThrows
    public void loadFileReport(MultipartFile multipartFile,Integer causeId) {
    public void loadFileReport(MultipartFile multipartFile, Integer causeId) {
        EasyExcel.read(multipartFile.getInputStream(), AddReportLoadDto.class, new AnalysisEventListener<AddReportLoadDto>() {
                    @Override
                    public void invoke(AddReportLoadDto data, AnalysisContext context) {
                        if (StringUtils.isNotBlank(data.getReporterName())&&StringUtils.isNotBlank(data.getIdcard())){
                        if (StringUtils.isNotBlank(data.getReporterName()) && StringUtils.isNotBlank(data.getIdcard())) {
                            AddReportDto addReportDto = new AddReportDto();
                            BeanUtils.copyProperties(data,addReportDto);
                            BeanUtils.copyProperties(data, addReportDto);
                            addReportDto.setCauseId(causeId);
                            addReportPeople(addReportDto);
                        }