| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(httpMethod = "POST", value = "案件台-案件录入-报案人员-报案人元导入") |
| | | @PostMapping("/reporterUpload") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | @SneakyThrows |
| | | public R uploadReporter(@RequestParam(value = "multipartFile") MultipartFile multipartFile,Integer causeId) { |
| | | causeService.loadFileReport(multipartFile,causeId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(httpMethod = "GET", value = "根据群组id查询案件分页") |
| | | @GetMapping("/getAllReportList") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | public R<IPage<ReportListVo>> get(Page<ReportListVo> page, ReportParamDto reportParamDto, Integer groupId) { |
| | | return R.ok(reportService.getPageByGroupId(page, reportParamDto, groupId)); |
| | | public R<IPage<ReportListVo>> get(Page<ReportListVo> page, ReportParamDto reportParamDto, Integer causeId) { |
| | | return R.ok(reportService.getPageByGroupId(page, reportParamDto, causeId)); |
| | | } |
| | | |
| | | @ApiOperation(httpMethod = "POST", value = "添加人员") |
| | | @PostMapping("/addReporter") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | public R<Boolean> get(AddReportDto addReportDto) { |
| | | if (addReportDto.getReporterName() == null || addReportDto.getReporterName().equals("")) { |
| | | return R.failed("报案人员不能为空"); |
| | | } |
| | | if (addReportDto.getMobile() == null || addReportDto.getMobile().equals("")) { |
| | | return R.failed("报案人员电话不能为空"); |
| | | } |
| | | if (addReportDto.getIdcard() == null || addReportDto.getIdcard().equals("")) { |
| | | return R.failed("报案人员身份证不能为空"); |
| | | } |
| | | public R<Boolean> get(@RequestBody AddReportDto addReportDto) { |
| | | return R.ok(causeService.addReportPeople(addReportDto)); |
| | | } |
| | | |
| | |
| | | package com.example.jz.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.api.ApiController; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.example.jz.modle.R; |
| | | import com.example.jz.modle.entity.Announcement; |
| | | import com.example.jz.modle.entity.Group; |
| | | import com.example.jz.modle.entity.GroupUser; |
| | | import com.example.jz.modle.entity.Message; |
| | | import com.example.jz.modle.vo.GroupMessageVo; |
| | | import com.example.jz.modle.vo.GroupUserVo; |
| | | import com.example.jz.service.GroupService; |
| | | import com.example.jz.service.GroupUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public void setGroupService(GroupService groupService) { |
| | | this.groupService = groupService; |
| | | } |
| | | |
| | | @Autowired |
| | | GroupUserService groupUserService; |
| | | |
| | | /** |
| | | * 根据群组id获取当前群组所有的消息 |
| | | * 根据群组id获取当前群组所有的消息 修改 |
| | | * |
| | | * @param id 群组id |
| | | * @return 当前群组所有的消息 |
| | |
| | | @ApiImplicitParam(name = "id", value = "群组id", required = true, dataType = "Integer") |
| | | public R<List<GroupMessageVo>> getAllMessage(@RequestParam("id") Integer id) { |
| | | return R.ok(groupService.getAllMessage(id)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getGroupMessage") |
| | | @ApiOperation(value = "获取当前群组消息通过成员或者内容") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "report", value = "群组id", required = true, dataType = "Integer"), |
| | | @ApiImplicitParam(name = "context", value = "群组id", required = true, dataType = "String") |
| | | }) |
| | | public R<List<GroupMessageVo>> get(@RequestParam(value = "report" ,required = false) String reporter, @RequestParam(value = "context",required = false) String context,Integer groupId) { |
| | | return R.ok(groupService.getByCondition(reporter, context,groupId)); |
| | | } |
| | | |
| | | @PutMapping("banSpeech") |
| | | @ApiOperation(value = "禁言") |
| | | @ApiImplicitParam(name = "id", value = "群组id", required = true, dataType = "Integer") |
| | | public R setBanSpeech(@RequestParam("id") Integer id) { |
| | | return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech",1).eq("user_id",id))); |
| | | } |
| | | |
| | | @PutMapping("allowSpeech") |
| | | @ApiOperation(value = "允许发言") |
| | | @ApiImplicitParam(name = "id", value = "群组id", required = true, dataType = "Integer") |
| | | public R setAllowSpeech(@RequestParam("id") Integer id) { |
| | | return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech",0).eq("user_id",id))); |
| | | } |
| | | |
| | | @PutMapping("banSpeechAll") |
| | | @ApiOperation(value = "全部禁言") |
| | | public R setBanSpeechAll(@RequestParam("id") Integer id) { |
| | | return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech",1).eq("group_id",id))); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取群组所有人员列表 |
| | | * 获取群组所有人员列表 修改 |
| | | * |
| | | * @param id 群组id |
| | | * @return 群组所有人员列表 |
| | |
| | | public R<List<GroupUserVo>> getAllUser(@RequestParam("id") Integer id) { |
| | | return R.ok(groupService.getAllUser(id)); |
| | | } |
| | | } |
| | | |
| | | @GetMapping("getAllGroupName") |
| | | @ApiOperation(value = "获取群组名称") |
| | | public R<List<Group>> getAllGroupName() { |
| | | return R.ok(groupService.list()); |
| | | } |
| | | } |
| | |
| | | @PutMapping("/updateReport") |
| | | @ApiResponse(message = "执行成功", code = 200) |
| | | public R updateReport(@RequestBody Report report) { |
| | | report.setPic(null); |
| | | reportService.updateById(report); |
| | | return R.ok(); |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 报案表(Report)表数据库访问层 |
| | |
| | | |
| | | ReportListVo getReportListVoById(Serializable id); |
| | | |
| | | Page<ReportListVo> getPageByGroupId(Page<ReportListVo> page, ReportParamDto reportParamDto, Integer groupId); |
| | | List<ReportListVo> getPageByGroupId( ReportParamDto reportParamDto, Integer causeId,Long size,Long current); |
| | | |
| | | Integer getPageByGroupIdCount(ReportParamDto reportParamDto, Integer causeId); |
| | | } |
| | | |
| | |
| | | package com.example.jz.modle.dto; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.example.jz.modle.entity.Report; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
New file |
| | |
| | | package com.example.jz.modle.dto; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.example.jz.modle.entity.Report; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author 安瑾然 |
| | | * @data 2022/7/18 - 2:12 PM |
| | | * @description |
| | | */ |
| | | @Data |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class AddReportLoadDto { |
| | | @ApiModelProperty(value = "报案人",dataType = "String") |
| | | @ExcelProperty(value = "报案人",index = 0) |
| | | private String reporterName; |
| | | |
| | | @ApiModelProperty(value = "报案人手机号",dataType = "String") |
| | | @ExcelProperty(value = "手机号",index = 1) |
| | | //报案人手机号 |
| | | private String mobile; |
| | | |
| | | @ApiModelProperty(value = "报案人身份证号",dataType = "String") |
| | | @ExcelProperty(value = "身份证号",index = 2) |
| | | //报案人身份证号 |
| | | private String idcard; |
| | | |
| | | @ExcelProperty(value = "被骗时间",index = 3) |
| | | private Date cheatTime; |
| | | |
| | | @ExcelProperty(value = "涉案金额",index = 4) |
| | | private Double amountInvolved; |
| | | |
| | | @ExcelProperty(value = "案件描述",index = 5) |
| | | private String reportDescription; |
| | | |
| | | @ExcelProperty(value = "补充信息",index = 6) |
| | | private String information; |
| | | |
| | | @ApiModelProperty(value = "群组id",dataType = "Integer") |
| | | private Integer groupId; |
| | | |
| | | //案件Id |
| | | private Integer causeId; |
| | | } |
| | |
| | | |
| | | private Date ctime; |
| | | |
| | | private Integer copId; |
| | | |
| | | private String reportName; |
| | | |
| | | /** |
| | | * 获取主键值 |
| | | * |
| | |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | private Integer causeId; |
| | | //案件描述 |
| | | private String reportDescription; |
| | | //是否进群 |
| | | private Integer isInGroup; |
| | | |
| | | /** |
| | | * 获取主键值 |
| | |
| | | //头像地址 |
| | | private String pic; |
| | | //报案人id |
| | | private String userName; |
| | | private String reporterName; |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | private String userMobile; |
| | | private String mobile; |
| | | /** |
| | | * 用户身份证号码 |
| | | */ |
| | | private String userIdcard; |
| | | private String idcard; |
| | | //是否代办 1(代办) 0(不是代办) |
| | | private String isCommission; |
| | | |
| | | //是否代办 1(代办) 0(不是代办) |
| | | private String isIntoGroup; |
| | | private Integer isInGroup; |
| | | //涉案金额 |
| | | private Double amountInvolved; |
| | | //报案材料图片地址 多个用,分隔 |
| | |
| | | private Integer causeId; |
| | | //群组id |
| | | private Integer groupId; |
| | | //案件描述 |
| | | private String reportDescription; |
| | | } |
| | |
| | | * 用户名 |
| | | */ |
| | | private String userName; |
| | | |
| | | private String pic; |
| | | /** |
| | | * 文本内容 |
| | | */ |
| | |
| | | * 用户名 |
| | | */ |
| | | private String userId; |
| | | /** |
| | | * 文本内容 |
| | | */ |
| | | |
| | | private Integer groupId; |
| | | |
| | | private String pic; |
| | | |
| | | private String userName; |
| | | /** |
| | | * 是否禁言(0为否1为是) |
| | |
| | | @ApiModelProperty(dataType = "Integer",value = "群组id") |
| | | private Integer groupId; |
| | | |
| | | @ApiModelProperty(dataType = "Date",value = "创建师讲") |
| | | @ApiModelProperty(dataType = "Date",value = "创建时间") |
| | | private Date ctime; |
| | | } |
| | |
| | | //最早次案发时间 |
| | | @ApiModelProperty(dataType = "Date", value = "发布时间") |
| | | private Date releaseTime; |
| | | |
| | | //问题解答 |
| | | @ApiModelProperty(value = "问题解答") |
| | | private String answer; |
| | | } |
| | |
| | | @Data |
| | | @ApiModel(description = "报案人员首页",value = "ReportListVo") |
| | | public class ReportListVo extends Report { |
| | | //是否进群 |
| | | private Integer isIntoGroup; |
| | | |
| | | //群id |
| | | private Integer groupId; |
| | |
| | | Boolean addReportPeople(AddReportDto addReportDto); |
| | | |
| | | List<Map<String,String>> getCauseIdAndName(); |
| | | |
| | | void loadFileReport(MultipartFile multipartFile,Integer causeId); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.example.jz.modle.entity.Announcement; |
| | | import com.example.jz.modle.entity.Group; |
| | | import com.example.jz.modle.entity.Message; |
| | | import com.example.jz.modle.vo.GroupMessageVo; |
| | | import com.example.jz.modle.vo.GroupUserVo; |
| | | |
| | |
| | | Boolean sendMessage(Integer id, String text); |
| | | |
| | | List<GroupUserVo> getAllUser(Integer id); |
| | | |
| | | List<GroupMessageVo> getByCondition(String name, String text,Integer groupId); |
| | | } |
| | |
| | | |
| | | ReportListVo getReportListVoById(Serializable id); |
| | | |
| | | Page<ReportListVo> getPageByGroupId(Page<ReportListVo> page, ReportParamDto reportParamDto, Integer groupId); |
| | | Page<ReportListVo> getPageByGroupId(Page<ReportListVo> page, ReportParamDto reportParamDto, Integer causeId); |
| | | |
| | | /** |
| | | * 添加案件 |
| | |
| | | import com.example.jz.exception.BusinessException; |
| | | import com.example.jz.modle.PageParam; |
| | | import com.example.jz.modle.dto.AddReportDto; |
| | | import com.example.jz.modle.dto.AddReportLoadDto; |
| | | import com.example.jz.modle.dto.CauseDto; |
| | | import com.example.jz.modle.dto.CauseLoadDto; |
| | | import com.example.jz.modle.entity.*; |
| | |
| | | import com.example.jz.modle.vo.CauseVo; |
| | | import com.example.jz.modle.vo.UserVo; |
| | | import com.example.jz.service.CauseService; |
| | | import com.example.jz.service.ReportService; |
| | | import com.example.jz.service.UserService; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | GroupDao groupDao; |
| | | @Resource |
| | | GroupUserDao groupUserDao; |
| | | @Resource |
| | | UserService userService; |
| | | @Resource |
| | | ReportService reportService; |
| | | |
| | | @Resource |
| | | AnnouncementDao announcementDao; |
| | |
| | | @Override |
| | | public PageParam<CauseReportVo> getReporterList(Integer causeId) { |
| | | PageParam<Report> PageParam = new PageParam<>(); |
| | | PageParam<Report> reportPageParam = reportDao.selectPage(PageParam, new QueryWrapper<Report>().eq("cause_id", causeId)); |
| | | PageParam<Report> reportPageParam = reportDao.selectPage(PageParam, new QueryWrapper<Report>().eq("cause_id", causeId).orderByDesc("ctime")); |
| | | List<CauseReportVo> causeReportVos = reportPageParam.getRecords().stream() |
| | | .map( |
| | | a -> { |
| | | CauseReportVo causeReportVo = new CauseReportVo(); |
| | | User user = userDao.selectOne(new QueryWrapper<User>().eq("id", a.getUserId())); |
| | | BeanUtils.copyProperties(a, causeReportVo); |
| | | causeReportVo.setUserIdcard(user.getUserIdcard()); |
| | | causeReportVo.setUserMobile(user.getUserMobile()); |
| | | causeReportVo.setUserIdcard(causeReportVo.getUserIdcard().replaceAll("(?<=[\\d]{3})\\d(?=[\\d]{4})", "*")); |
| | | causeReportVo.setUserName(user.getRealName()); |
| | | if (groupUserDao.selectOne(new QueryWrapper<GroupUser>().eq("user_id", a.getId())) == null) { |
| | | causeReportVo.setIsIntoGroup("0"); |
| | | } else { |
| | | causeReportVo.setIsIntoGroup("1"); |
| | | 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()); |
| | | } |
| | | return causeReportVo; |
| | |
| | | // 如果用户不存在 则添加用户 |
| | | user = new User().setUserIdcard(addReportDto.getIdcard()).setUserMobile(addReportDto.getMobile()).setRealName(addReportDto.getReporterName()) |
| | | .setModifyTime(new Date()).setUserRegtime(new Date()).setPic(addReportDto.getPic()); |
| | | userDao.insert(user); |
| | | userService.save(user); |
| | | } |
| | | Group group = groupDao.selectOne(new QueryWrapper<Group>().eq("cause_id", addReportDto.getCauseId())); |
| | | // 添加人员进群组 |
| | | groupUserDao.insert(new GroupUser().setGroupId(addReportDto.getGroupId()).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()) |
| | | .setUserId(user.getId()) |
| | | .setCtime(new Date()) |
| | | .setStatus(0) |
| | | .setReportMethod("现场录入") |
| | | .setIsCommission("0").setReportTime(new Date()) |
| | | .setCauseId(groupDao.selectOne(new QueryWrapper<Group>().eq("id", addReportDto.getGroupId())).getCauseId()); |
| | | return reportDao.insert(report) > 0; |
| | | .setCauseId(addReportDto.getCauseId()); |
| | | reportService.save(report); |
| | | return groupUserDao.insert(new GroupUser().setGroupId(group.getId()).setUserId(report.getId()).setCtime(new Date()).setBanSpeech(0))> 0; |
| | | } |
| | | |
| | | @Override |
| | |
| | | }); |
| | | return maps; |
| | | } |
| | | |
| | | @Override |
| | | @SneakyThrows |
| | | 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())){ |
| | | AddReportDto addReportDto = new AddReportDto(); |
| | | BeanUtils.copyProperties(data,addReportDto); |
| | | addReportDto.setCauseId(causeId); |
| | | addReportPeople(addReportDto); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext context) { |
| | | |
| | | } |
| | | }) |
| | | .autoCloseStream(true) |
| | | .doReadAll(); |
| | | } |
| | | } |
| | |
| | | package com.example.jz.service.impl; |
| | | |
| | | 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.extension.service.impl.ServiceImpl; |
| | | import com.example.jz.dao.AnnouncementDao; |
| | | import com.example.jz.dao.GroupDao; |
| | | import com.example.jz.dao.MessageDao; |
| | | import com.example.jz.modle.entity.Announcement; |
| | | import com.example.jz.modle.entity.Group; |
| | | import com.example.jz.modle.entity.Message; |
| | | import com.example.jz.dao.*; |
| | | import com.example.jz.modle.entity.*; |
| | | import com.example.jz.modle.vo.GroupMessageVo; |
| | | import com.example.jz.modle.vo.GroupUserVo; |
| | | import com.example.jz.service.GroupService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 群表 |
| | |
| | | */ |
| | | @Service("groupService") |
| | | public class GroupServiceImpl extends ServiceImpl<GroupDao, Group> implements GroupService { |
| | | @Resource |
| | | private MessageDao messageDao; |
| | | @Resource |
| | | private AnnouncementDao announcementDao; |
| | | @Resource |
| | | private GroupDao groupDao; |
| | | @Resource |
| | | private UserDao userDao; |
| | | @Resource |
| | | private ReportDao reportDao; |
| | | |
| | | @Autowired |
| | | public void setMessageDao(MessageDao messageDao) { |
| | |
| | | |
| | | @Override |
| | | public List<GroupMessageVo> getAllMessage(Integer id) { |
| | | return messageDao.getAllMessageByGroup(id); |
| | | List<GroupMessageVo> list = messageDao.selectList(new QueryWrapper<Message>().eq("group_id", id).orderByAsc("ctime")).stream().map(item -> { |
| | | String username; |
| | | String pic = null; |
| | | if (item.getUserId() == null) { |
| | | username = userDao.selectOne(new QueryWrapper<User>().eq("id", item.getCopId())).getRealName(); |
| | | } else { |
| | | Report report = reportDao.selectOne(new QueryWrapper<Report>().eq("id", item.getUserId())); |
| | | username = userDao.selectOne(new QueryWrapper<User>().eq("id", report.getUserId())).getRealName(); |
| | | pic = report.getPic(); |
| | | Message message = new Message(); |
| | | message.setReportName(username); |
| | | messageDao.update(message,new QueryWrapper<Message>().eq("user_id",item.getUserId())); |
| | | } |
| | | GroupMessageVo groupMessageVo = new GroupMessageVo(); |
| | | groupMessageVo.setUserName(username); |
| | | groupMessageVo.setText(item.getText()); |
| | | groupMessageVo.setCtime(item.getCtime()); |
| | | groupMessageVo.setPic(pic); |
| | | return groupMessageVo; |
| | | }).collect(Collectors.toList()); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public Boolean sendMessage(Integer id, String text) { |
| | | // todo 动态获取当前登录用户的id |
| | | Message message = new Message().setUserId(1).setText(text).setGroupId(id).setCtime(new Date()); |
| | | Message message = new Message().setCopId(userDao.selectOne(new QueryWrapper<User>().eq("login_username", SecurityContextHolder.getContext().getAuthentication().getPrincipal())).getId()) |
| | | .setText(text).setGroupId(id).setCtime(new Date()); |
| | | return messageDao.insert(message) > 0; |
| | | } |
| | | |
| | |
| | | public List<GroupUserVo> getAllUser(Integer id) { |
| | | return groupDao.getAllUser(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<GroupMessageVo> getByCondition(String name, String text,Integer groupId) { |
| | | List<GroupMessageVo> groupUserVoList; |
| | | if (StringUtils.isBlank(name)) { |
| | | groupUserVoList = messageDao.selectList(new QueryWrapper<Message>().like(StringUtils.isNotBlank(text), "text", text).eq("group_id",groupId).orderByAsc("ctime")).stream().map(item -> { |
| | | String username; |
| | | String pic = null; |
| | | if (item.getUserId() == null) { |
| | | username = userDao.selectOne(new QueryWrapper<User>().eq("cop_id", item.getCopId())).getRealName(); |
| | | } else { |
| | | Report report = reportDao.selectOne(new QueryWrapper<Report>().eq("id", item.getUserId())); |
| | | username = userDao.selectOne(new QueryWrapper<User>().eq("id", report.getUserId())).getRealName(); |
| | | pic = report.getPic(); |
| | | } |
| | | GroupMessageVo groupMessageVo = new GroupMessageVo(); |
| | | groupMessageVo.setUserName(username); |
| | | groupMessageVo.setText(item.getText()); |
| | | groupMessageVo.setCtime(item.getCtime()); |
| | | groupMessageVo.setPic(pic); |
| | | return groupMessageVo; |
| | | }).collect(Collectors.toList()); |
| | | } else { |
| | | groupUserVoList = messageDao.selectList(new QueryWrapper<Message>().eq("report_Name", name).eq("group_id",groupId).orderByAsc("ctime")).stream().map(item -> { |
| | | Report report = reportDao.selectOne(new QueryWrapper<Report>().eq("id", item.getUserId())); |
| | | GroupMessageVo groupMessageVo = new GroupMessageVo(); |
| | | groupMessageVo.setUserName(item.getReportName()); |
| | | groupMessageVo.setText(item.getText()); |
| | | groupMessageVo.setCtime(item.getCtime()); |
| | | groupMessageVo.setPic(report.getPic()); |
| | | return groupMessageVo; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | return groupUserVoList; |
| | | } |
| | | } |
| | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.metadata.data.ImageData; |
| | | import com.alibaba.excel.metadata.data.WriteCellData; |
| | | import com.alibaba.excel.support.ExcelTypeEnum; |
| | | import com.alibaba.excel.util.IoUtils; |
| | | import com.alibaba.excel.util.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.example.jz.dao.*; |
| | | import com.example.jz.modle.PageParam; |
| | | 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.*; |
| | | import com.example.jz.modle.vo.ExportExcelReportVo; |
| | | import com.example.jz.modle.vo.ReportListVo; |
| | | import com.example.jz.service.MinIOService; |
| | | import com.example.jz.service.ReportService; |
| | | import com.example.jz.service.UserService; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | import java.io.Serializable; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.io.Serializable; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Resource |
| | | UserDao userDao; |
| | | @Resource |
| | | UserService userService; |
| | | @Resource |
| | | ReportService reportService; |
| | | |
| | | @Resource |
| | | MinIOService minIOService; |
| | |
| | | // 2. 更新群用户表 |
| | | Group group = groupDao.selectOne(new LambdaQueryWrapper<>(Group.class) |
| | | .eq(Group::getCauseId, report.getCauseId())); |
| | | GroupUser groupUser = new GroupUser().setGroupId(group.getId()).setUserId(report.getUserId()).setCtime(new Date()).setBanSpeech(0); |
| | | GroupUser groupUser = new GroupUser().setGroupId(group.getId()).setUserId(report.getId()).setCtime(new Date()).setBanSpeech(0); |
| | | groupUserDao.insert(groupUser); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public void leaveGroup(Integer id, Integer groupId) { |
| | | Report report = new Report(); |
| | | report.setIsInGroup(0); |
| | | report.setId(id); |
| | | reportDao.updateById(report); |
| | | groupUserDao.delete(new QueryWrapper<GroupUser>().eq("user_id", id).eq("group_id", groupId)); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public Page<ReportListVo> getPage(Page<ReportListVo> page, ReportParamDto reportParamDto) { |
| | | Page<ReportListVo> aaa = reportDao.getPage(page, reportParamDto); |
| | | aaa.getRecords().stream().forEach(x -> x.setIdcard(x.getIdcard().replaceAll("(?<=[\\d]{3})\\d(?=[\\d]{4})", "*"))); |
| | | aaa.getRecords().stream() |
| | | .forEach(x -> x.setIdcard(x.getIdcard().replaceAll("(?<=[\\d]{3})\\d(?=[\\d]{4})", "*"))); |
| | | return aaa; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Page<ReportListVo> getPageByGroupId(Page<ReportListVo> page, ReportParamDto reportParamDto, Integer groupId) { |
| | | Page<ReportListVo> aaa = reportDao.getPageByGroupId(page, reportParamDto, groupId); |
| | | public Page<ReportListVo> getPageByGroupId(Page<ReportListVo> page, ReportParamDto reportParamDto, Integer causeId) { |
| | | Long size = (page.getCurrent() - 1) * page.getSize(); |
| | | Long current = page.getSize(); |
| | | Page<ReportListVo> aaa = new PageParam<>(); |
| | | List<ReportListVo> list = reportDao.getPageByGroupId(reportParamDto, causeId, size, current); |
| | | list.forEach(item -> { |
| | | if (item.getIsInGroup() == 1) { |
| | | item.setGroupId(groupDao.selectOne(new QueryWrapper<Group>().eq("cause_id", causeId)).getId()); |
| | | } |
| | | }); |
| | | aaa.setRecords(list); |
| | | Integer pageByGroupIdCount = reportDao.getPageByGroupIdCount(reportParamDto, causeId); |
| | | aaa.setTotal(pageByGroupIdCount); |
| | | aaa.getRecords().stream().forEach(x -> x.setIdcard(x.getIdcard().replaceAll("(?<=[\\d]{3})\\d(?=[\\d]{4})", "*"))); |
| | | return aaa; |
| | | } |
| | |
| | | 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); |
| | | .setModifyTime(new Date()).setUserRegtime(new Date()).setPic(addReportDto.getPic()).setCtime(new Date()); |
| | | userService.save(user); |
| | | } |
| | | // 添加人员进群组 |
| | | groupUserDao.insert(new GroupUser() |
| | | .setGroupId(groupDao.selectOne(new QueryWrapper<Group>().eq("cause_id", addReportDto.getCauseId())).getId()) |
| | | .setUserId(user.getId()).setCtime(new Date()) |
| | | .setBanSpeech(0)); |
| | | // groupUserDao.insert(new GroupUser() |
| | | // .setGroupId(groupDao.selectOne(new QueryWrapper<Group>().eq("cause_id", addReportDto.getCauseId())).getId()) |
| | | // .setUserId(user.getId()).setCtime(new Date()) |
| | | // .setBanSpeech(0)); |
| | | // 添加报案信息 |
| | | Report report = new Report(); |
| | | BeanUtils.copyProperties(addReportDto, report); |
| | | report |
| | | .setCreator(userDao.selectOne(new QueryWrapper<User>().eq("login_username", SecurityContextHolder.getContext().getAuthentication().getPrincipal())).getId()) |
| | | .setUserId(user.getId()) |
| | | .setCtime(new Date()) |
| | | .setStatus(1) |
| | | .setStatus(0) |
| | | .setIsInGroup(0) |
| | | .setReportMethod("现场录入") |
| | | .setIsCommission("0").setReportTime(new Date()) |
| | | .setCauseId(addReportDto.getCauseId()); |
| | | return reportDao.insert(report) > 0; |
| | | return reportService.save(report); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | @Override |
| | | public List<MessageVo> getGroupMessage() { |
| | | ArrayList<MessageVo> messageVos = new ArrayList<>(); |
| | | messageDao.selectList(new QueryWrapper<Message>().orderByDesc("ctime").last("limit 5")) |
| | | .forEach(a -> { |
| | | messageDao.selectList(new QueryWrapper<Message>().orderByDesc("ctime")).stream() |
| | | .filter(item->item.getUserId()!=null).limit(5).forEach(a -> { |
| | | MessageVo messageVo = new MessageVo(); |
| | | messageVo.setGroupName(groupDao.selectOne(new QueryWrapper<Group>().eq("id", a.getGroupId())).getGroupName()); |
| | | BeanUtils.copyProperties(a, messageVo); |
| | | messageVo.setUserName(userDao.selectOne(new QueryWrapper<User>().eq("id", a.getUserId())).getRealName()); |
| | | messageVo.setUserName(a.getReportName()); |
| | | messageVos.add(messageVo); |
| | | }); |
| | | return messageVos; |
| | |
| | | <mapper namespace="com.example.jz.dao.GroupDao"> |
| | | |
| | | <resultMap id="GroupUserVoMap" type="com.example.jz.modle.vo.GroupUserVo"> |
| | | <result property="userId" column="user_id" /> |
| | | <result property="userName" column="real_name" /> |
| | | <result property="banSpeech" column="ban_speech" /> |
| | | <result property="userId" column="user_id"/> |
| | | <result property="groupId" column="group_id"/> |
| | | <result property="userName" column="real_name"/> |
| | | <result property="banSpeech" column="ban_speech"/> |
| | | </resultMap> |
| | | |
| | | <select id="getAllUser" resultType="com.example.jz.modle.vo.GroupUserVo"> |
| | | select group_user.user_id,group_user.ban_speech,user.real_name |
| | | from group_user |
| | | join user on group_user.user_id = user.id |
| | | <select id="getAllUser" resultMap="GroupUserVoMap"> |
| | | select group_user.user_id,group_user.group_id, group_user.ban_speech, user.real_name |
| | | FROM group_user |
| | | JOIN report ON report.id = group_user.user_id |
| | | JOIN `user` ON `user`.id = report.user_id |
| | | where group_id = #{groupId} |
| | | </select> |
| | | |
| | |
| | | </resultMap> |
| | | |
| | | <select id="getAllMessageByGroup" resultMap="GroupMessageVoMap"> |
| | | select u.real_name, m.text, m.ctime |
| | | select `user`.real_name, m.text, m.ctime |
| | | from message m |
| | | join user u on m.user_id = u.id |
| | | JOIN report ON report.id = m.user_id |
| | | JOIN `user` ON `user`.id = report.user_id |
| | | where m.group_id = #{groupId} |
| | | order by m.ctime desc |
| | | order by m.ctime asc |
| | | </select> |
| | | |
| | | |
| | |
| | | and (u.real_name like '%${reportParamDto.people}%' or u.user_idcard like '%${reportParamDto.people}%') |
| | | </if> |
| | | <if test="reportParamDto.phoneNumber != ''"> |
| | | and u.user_mobile = ${reportParamDto.phoneNumber} |
| | | and u.user_mobile like '%${reportParamDto.phoneNumber}%' |
| | | </if> |
| | | <if test="reportParamDto.havaMaterial != ''"> |
| | | <if test="reportParamDto.havaMaterial == 1"> |
| | |
| | | and r.report_materials is null |
| | | </if> |
| | | </if> |
| | | <if test="reportParamDto.isInGroup != ''"> |
| | | and r.status = ${reportParamDto.isInGroup} |
| | | <if test="reportParamDto.isInGroup != null"> |
| | | and r.is_in_group = ${reportParamDto.isInGroup} |
| | | </if> |
| | | </where> |
| | | order by r.ctime DESC |
| | | </select> |
| | | <select id="getReportListVoById" resultType="com.example.jz.modle.vo.ReportListVo"> |
| | | select u.user_mobile mobile, u.user_idcard idcard, u.real_name reporterName, r.* |
| | |
| | | select u.user_mobile mobile,u.user_idcard idcard,u.real_name reporterName,r.* |
| | | from report r |
| | | join user u on r.user_id = u.id |
| | | join group_user gu on gu.user_id = u.id |
| | | <where> |
| | | 1=1 |
| | | <if test="reportParamDto.people != ''"> |
| | | and (u.real_name like '%${reportParamDto.people}%' or u.user_idcard like '%${reportParamDto.people}%') |
| | | </if> |
| | | <if test="reportParamDto.phoneNumber != ''"> |
| | | and u.user_mobile = ${reportParamDto.phoneNumber} |
| | | and u.user_mobile like '%${reportParamDto.phoneNumber}%' |
| | | </if> |
| | | <if test="reportParamDto.havaMaterial != ''"> |
| | | <if test="reportParamDto.isInGroup != null"> |
| | | and r.is_in_group = ${reportParamDto.isInGroup} |
| | | </if> |
| | | <if test="reportParamDto.havaMaterial !=null"> |
| | | <if test="reportParamDto.havaMaterial == 1"> |
| | | and r.report_materials is not null |
| | | </if> |
| | |
| | | and r.report_materials is null |
| | | </if> |
| | | </if> |
| | | <if test="reportParamDto.isInGroup != ''"> |
| | | and r.status = ${reportParamDto.isInGroup} |
| | | </where> |
| | | and r.cause_id = #{causeId} order by r.ctime DESC limit #{size},#{current} |
| | | </select> |
| | | |
| | | <select id="getPageByGroupIdCount" resultType="Integer"> |
| | | select count(1) from ( |
| | | select u.user_mobile mobile,u.user_idcard idcard,u.real_name reporterName,r.* |
| | | from report r |
| | | join user u on r.user_id = u.id |
| | | <where> |
| | | 1=1 |
| | | <if test="reportParamDto.people != ''"> |
| | | and (u.real_name like '%${reportParamDto.people}%' or u.user_idcard like '%${reportParamDto.people}%') |
| | | </if> |
| | | <if test="reportParamDto.phoneNumber != ''"> |
| | | and u.user_mobile like '%${reportParamDto.phoneNumber}%' |
| | | </if> |
| | | <if test="reportParamDto.isInGroup != null"> |
| | | and r.is_in_group = ${reportParamDto.isInGroup} |
| | | </if> |
| | | <if test="reportParamDto.havaMaterial !=null"> |
| | | <if test="reportParamDto.havaMaterial == 1"> |
| | | and r.report_materials is not null |
| | | </if> |
| | | <if test="reportParamDto.havaMaterial == 0"> |
| | | and r.report_materials is null |
| | | </if> |
| | | </if> |
| | | </where> |
| | | and gu.group_id = #{groupId} |
| | | and r.cause_id = #{causeId} |
| | | ) as reporter |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | package com.example.jz; |
| | | |
| | | import com.example.jz.auth.DefaultPwdEncoder; |
| | | import com.example.jz.config.MinIOConfig; |
| | | import com.example.jz.service.MinIOService; |
| | | import org.junit.jupiter.api.Test; |
| | |
| | | class JzApplicationTests { |
| | | @Autowired |
| | | MinIOService minIOService; |
| | | @Autowired |
| | | DefaultPwdEncoder defaultPwdEncoder; |
| | | |
| | | @Test |
| | | void contextLoads() { |
| | |
| | | |
| | | @Test |
| | | void test() { |
| | | |
| | | System.out.println(defaultPwdEncoder.encode("123456")); |
| | | } |
| | | |
| | | } |