青羊经侦大队-数据平台
whj
2022-07-19 caaa6ec6ee809b1c9e56600ba1468e8f4da0103b
src/main/java/com/example/jz/service/impl/ReportServiceImpl.java
@@ -13,10 +13,13 @@
import com.example.jz.dao.GroupDao;
import com.example.jz.dao.GroupUserDao;
import com.example.jz.dao.ReportDao;
import com.example.jz.dao.UserDao;
import com.example.jz.modle.dto.AddReportDto;
import com.example.jz.modle.dto.ReportParamDto;
import com.example.jz.modle.entity.Group;
import com.example.jz.modle.entity.GroupUser;
import com.example.jz.modle.entity.Report;
import com.example.jz.modle.entity.User;
import com.example.jz.modle.vo.ReportListVo;
import com.example.jz.dao.*;
import com.example.jz.modle.entity.*;
@@ -24,6 +27,7 @@
import com.example.jz.service.MinIOService;
import com.example.jz.service.ReportService;
import lombok.SneakyThrows;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -152,5 +156,27 @@
        aaa.getRecords().stream().forEach(x -> x.setIdcard(x.getIdcard().replaceAll("(?<=[\\d]{3})\\d(?=[\\d]{4})", "*")));
        return aaa;
    }
    @Override
    @Transactional
    public Boolean addReport(AddReportDto addReportDto) {
        User user = userDao.selectOne(new LambdaQueryWrapper<User>(User.class).eq(User::getUserIdcard, addReportDto.getIdcard()));
        if (user == null) {
            // 如果用户不存在 则添加用户
            user = new User().setUserIdcard(addReportDto.getIdcard()).setUserMobile(addReportDto.getMobile()).setRealName(addReportDto.getReporterName())
                    .setModifyTime(new Date()).setUserRegtime(new Date()).setPic(addReportDto.getPic());
            userDao.insert(user);
        }
        // 添加报案信息
        Report report = new Report();
        BeanUtils.copyProperties(addReportDto, report);
        report
                .setUserId(user.getId())
                .setCtime(new Date())
                .setStatus(0)
                .setReportMethod("现场录入")
                .setIsCommission("0").setReportTime(new Date());
        return reportDao.insert(report) > 0;
    }
}