| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import liquibase.pro.packaged.W; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.constant.DictConstant; |
| | | import org.springblade.common.param.CommonParamSet; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.category.entity.CategoryEntity; |
| | | import org.springblade.modules.category.service.ICategoryService; |
| | | import org.springblade.modules.grid.entity.GridEntity; |
| | | import org.springblade.modules.grid.entity.GridWorkLogEntity; |
| | | import org.springblade.modules.grid.entity.GridmanEntity; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.grid.service.IGridWorkLogService; |
| | | import org.springblade.modules.grid.service.IGridmanService; |
| | | import org.springblade.modules.house.service.IHouseRentalService; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.house.vo.HouseRentalTenantVO; |
| | |
| | | import org.springblade.modules.place.service.IPlaceExtService; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.task.entity.*; |
| | | import org.springblade.modules.task.mapper.TaskMapper; |
| | | import org.springblade.modules.task.service.*; |
| | | import org.springblade.modules.task.vo.TaskVO; |
| | | import org.springblade.modules.task.service.ITaskPlaceRectificationService; |
| | | import org.springblade.modules.task.entity.TaskPlaceSelfCheckEntity; |
| | | import org.springblade.modules.task.service.ITaskPlaceSelfCheckService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @Service |
| | | public class TaskServiceImpl extends ServiceImpl<TaskMapper, TaskEntity> implements ITaskService { |
| | | |
| | | @Autowired |
| | | private IPlaceService placeService; |
| | | @Autowired |
| | | private IPlaceService placeService; |
| | | |
| | | @Autowired |
| | | private IHouseholdService iHouseholdService; |
| | | |
| | | @Autowired |
| | | private IHouseRentalService iHouseRentalService; |
| | | |
| | | @Autowired |
| | | private IDeptService deptService; |
| | | |
| | | @Autowired |
| | | private ICategoryService categoryService; |
| | |
| | | |
| | | @Override |
| | | public IPage<TaskVO> selectTaskPage(IPage<TaskVO> page, TaskVO task) { |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; |
| | | // String roleName = SpringUtils.getRequestParam("roleName"); |
| | | // String communityCode = SpringUtils.getRequestParam("communityCode"); |
| | | // if (!Strings.isBlank(communityCode)) { |
| | | // // 校验社区编号是否合规 |
| | | // if (null != SpringUtils.getBean(IRegionService.class).getById(communityCode)) { |
| | | // task.setCommunityCode(communityCode); |
| | | // } |
| | | // } |
| | | // List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | // Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2; |
| | | // 网格编号集合 |
| | | // List<String> gridCodeList = new ArrayList<>(); |
| | | // 民警角色 |
| | | if (AuthUtil.getUserRole().equals("mj")) { |
| | | task.setUserId(AuthUtil.getUserId()); |
| | | return page.setRecords(baseMapper.selectTaskPageBy(page, task,regionChildCodesList,isAdministrator)); |
| | | } else { |
| | | if (AuthUtil.getUserAccount().equals("18879306957")) { |
| | | task.setCommunityCode("361102003027"); |
| | | task.setUserId(null); |
| | | } |
| | | if (AuthUtil.getUserRole().equals("wgy")) { |
| | | task.setUserId(AuthUtil.getUserId()); |
| | | } |
| | | // 非民警角色 |
| | | List<TaskVO> taskVOS = baseMapper.selectTaskPage(page, task,regionChildCodesList,isAdministrator); |
| | | return page.setRecords(taskVOS); |
| | | // if (!Strings.isBlank(roleName)) { |
| | | // task.setRoleName(roleName); |
| | | // if (roleName.equals("mj")) { |
| | | // regionChildCodesList = SpringUtil.getBean(IPoliceAffairsGridService.class).getCommunityCodeListByUserId(AuthUtil.getUserId()); |
| | | // } |
| | | // if (roleName.equals("wgy")) { |
| | | // gridCodeList = SpringUtil.getBean(IGridService.class).getGridListByUserId(AuthUtil.getUserId()); |
| | | // } |
| | | // } |
| | | // if (AuthUtil.getUserAccount().equals("18879306957")) { |
| | | // task.setCommunityCode("361102003027"); |
| | | // } |
| | | CommonParamSet commonParamSet = new CommonParamSet().invoke(TaskVO.class,task); |
| | | if (null != task.getReportType() && task.getReportType() == 1) { |
| | | // 查询取保候审任务列表(人房相关) |
| | | return page.setRecords(baseMapper.selectTaskPageByPerson(page, task, commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getIsAdministrator(), commonParamSet.getGridCodeList())); |
| | | } |
| | | // 查询非取保候审任务列表(场所相关) |
| | | return page.setRecords(baseMapper.selectTaskPage(page, task, commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getIsAdministrator(), commonParamSet.getGridCodeList())); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<TaskVO> getBailReportingPage(IPage<TaskVO> page, TaskVO task) { |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; |
| | | CommonParamSet commonParamSet = new CommonParamSet().invoke(TaskVO.class, task); |
| | | // 民警角色 |
| | | if (AuthUtil.getUserRole().equals("mj")) { |
| | | task.setUserId(AuthUtil.getUserId()); |
| | | return page.setRecords(baseMapper.selectTaskPageBy(page, task,regionChildCodesList,isAdministrator)); |
| | | return page.setRecords(baseMapper.selectTaskPageBy(page, task, |
| | | commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getIsAdministrator())); |
| | | } else { |
| | | if (AuthUtil.getUserAccount().equals("18879306957")) { |
| | | task.setCommunityCode("361102003027"); |
| | |
| | | task.setUserId(AuthUtil.getUserId()); |
| | | } |
| | | // 非民警角色 |
| | | List<TaskVO> taskVOS = baseMapper.getBailReportingPage(page, task); |
| | | List<TaskVO> taskVOS = baseMapper.getBailReportingPage(page, |
| | | task, |
| | | commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getGridCodeList(), |
| | | commonParamSet.getIsAdministrator()); |
| | | // 返回 |
| | | return page.setRecords(taskVOS); |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Long saveTask(Integer type, String name, Integer frequency, String remark, Long createUser, String houseCode, Integer reportType) { |
| | | public Long saveTask(Integer type, String name, Integer frequency, String remark, Long createUser, |
| | | String houseCode, Integer reportType, Integer status) { |
| | | TaskEntity taskEntity = new TaskEntity(); |
| | | taskEntity.setType(type); |
| | | taskEntity.setName(name); |
| | |
| | | taskEntity.setCreateUser(createUser); |
| | | taskEntity.setHouseCode(houseCode); |
| | | taskEntity.setReportType(reportType); |
| | | taskEntity.setStatus(status); |
| | | return baseMapper.insert(taskEntity) > 0 ? taskEntity.getId() : 0; |
| | | } |
| | | |
| | |
| | | taskVO.setStatus(1); |
| | | taskVO.setUserId(roleType > 0 ? AuthUtil.getUserId() : null); |
| | | taskVO.setNeiCode(neiCode); |
| | | taskVO.setReportType(2); |
| | | taskVO.setReportType(5); |
| | | taskVO.setIsDeleted(0); |
| | | // 查询网格员对应的网格id |
| | | Integer gridId = getGridId(); |
| | | // 标签事件 |
| | | Integer bqsj = baseMapper.selectTaskCount(taskVO); |
| | | CommonParamSet commonParamSet = new CommonParamSet().invoke(TaskVO.class,taskVO); |
| | | |
| | | // 标签报事-二手交易 |
| | | Integer bqsj = baseMapper.selectTaskCount(taskVO,commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getIsAdministrator(),commonParamSet.getGridCodeList()); |
| | | taskVO.setReportType(1); |
| | | // 取保候审 |
| | | Integer qbhs = baseMapper.selectTaskCount(taskVO); |
| | | Integer qbhs = baseMapper.selectTaskCount(taskVO,commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getIsAdministrator(),commonParamSet.getGridCodeList()); |
| | | // 报事报修 |
| | | Integer bsbx = SpringUtils.getBean(ITaskReportForRepairsService.class).getStatistics(roleType > 0 ? AuthUtil.getUserId() : null, neiCode); |
| | | // 住房审核 |
| | | Integer zhsh = iHouseholdService.statistics(roleType > 0 ? AuthUtil.getUserId() : null, neiCode); |
| | | // 住户审核 |
| | | Integer zhsh = iHouseholdService.statistics(roleType > 0 ? AuthUtil.getUserId() : null, neiCode,0); |
| | | // 出租审核 |
| | | HouseRentalTenantVO houseRentalTenantVO = new HouseRentalTenantVO(); |
| | | houseRentalTenantVO.setUserId(roleType > 0 ? AuthUtil.getUserId() : null); |
| | | houseRentalTenantVO.setNeiCode(neiCode); |
| | | Integer czsh = iHouseRentalService.getStatisticsCount(houseRentalTenantVO); |
| | | // 场所审核 |
| | | Integer cssh = SpringUtils.getBean(IPlaceExtService.class).selectCount(roleType > 0 ? AuthUtil.getUserId() : null, neiCode, 1); |
| | | // 走访日志 |
| | | Integer zfrw = SpringUtils.getBean(IGridWorkLogService.class).getGridWorkCountHandleCount(gridId,1); |
| | | // 查询网格员对应的网格id |
| | | String gridCode = getGridCode(); |
| | | Integer zfrw = SpringUtils.getBean(IGridWorkLogService.class).getGridWorkCountHandleCount(gridCode, 1); |
| | | // 消防自查 |
| | | Integer xfzc = SpringUtils.getBean(ITaskPlaceSelfCheckService.class).getCount(neiCode, 1); |
| | | // 消防隐患整改 |
| | | Integer xfyhzg = SpringUtils.getBean(ITaskPlaceRectificationService.class).getCount(neiCode, 1); |
| | | // 居住证申请 |
| | | Integer jzzsq = SpringUtils.getBean(ITaskResidencePermitApplyService.class).getCount(neiCode, 1); |
| | | // 设置 |
| | | objectObjectHashMap.put("qbhs", qbhs); |
| | | objectObjectHashMap.put("bqsj", bqsj); |
| | | objectObjectHashMap.put("bsbx", bsbx); |
| | | objectObjectHashMap.put("zhsh", zhsh); |
| | | objectObjectHashMap.put("czsh", czsh); |
| | | objectObjectHashMap.put("cssh", cssh); |
| | | objectObjectHashMap.put("zfrw", zfrw); |
| | | objectObjectHashMap.put("qbhs", qbhs);// 取保候审 |
| | | objectObjectHashMap.put("bqsj", bqsj);// 标签报事-二手交易 |
| | | objectObjectHashMap.put("bsbx", bsbx);// 报事报修 |
| | | objectObjectHashMap.put("zhsh", zhsh);// 住户审核 |
| | | objectObjectHashMap.put("czsh", czsh);// 出租审核 |
| | | objectObjectHashMap.put("cssh", cssh);// 场所审核 |
| | | objectObjectHashMap.put("zfrw", zfrw);// 走访日志 |
| | | objectObjectHashMap.put("xfzc", xfzc);// 消防自查 |
| | | objectObjectHashMap.put("xfyhzg", xfyhzg);// 消防隐患整改 |
| | | objectObjectHashMap.put("jzzsq", jzzsq);// 居住证申请 |
| | | return objectObjectHashMap; |
| | | } |
| | | |
| | | /** |
| | | * 获取网格员id |
| | | * |
| | | * @return |
| | | */ |
| | | private Integer getGridId() { |
| | | QueryWrapper<GridmanEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted",0).eq("user_id",AuthUtil.getUserId()); |
| | | List<GridmanEntity> list = SpringUtils.getBean(IGridmanService.class).list(wrapper); |
| | | if (list.size()>0){ |
| | | return list.get(0).getGridId(); |
| | | private String getGridCode() { |
| | | GridEntity grid = SpringUtils.getBean(IGridService.class).getGridByUserId(AuthUtil.getUserId()); |
| | | if (null != grid) { |
| | | return grid.getGridCode(); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | taskVO.setUserId(AuthUtil.getUserId()); |
| | | taskVO.setFrequency(1); |
| | | taskVO.setStatus(1); |
| | | Integer disposable = baseMapper.selectTaskCount(taskVO); |
| | | Integer disposable = baseMapper.selectTaskCount(taskVO,null,null,null); |
| | | taskVO.setFrequency(2); |
| | | Integer periodicity = baseMapper.selectTaskCount(taskVO); |
| | | Integer periodicity = baseMapper.selectTaskCount(taskVO,null,null,null); |
| | | objectObjectHashMap.put("disposable", disposable); |
| | | objectObjectHashMap.put("periodicity", periodicity); |
| | | return objectObjectHashMap; |
| | |
| | | |
| | | /** |
| | | * 根据类型创建任务 |
| | | * |
| | | * @param param 参数 |
| | | * @return |
| | | */ |
| | |
| | | */ |
| | | public void createGridWordTask() { |
| | | // 肇事肇祸精神障碍患者走访任务生成,查询标签为:1006 |
| | | List<Integer> list = new ArrayList<Integer>(){{ |
| | | List<Integer> list = new ArrayList<Integer>() {{ |
| | | add(1006); |
| | | }}; |
| | | // 根据人员标签编号集合查询对应的住户(按颜色区分近多少天没有发过任务的住户) |
| | |
| | | |
| | | /** |
| | | * 新增走访任务 |
| | | * |
| | | * @param household |
| | | */ |
| | | public void saveGridWordTask(HouseholdVO household) { |
| | |
| | | */ |
| | | public void createLabelReportingTask() { |
| | | // 打金店/二手车/二手手机任务生成,标签:130808/140304/130604 |
| | | List<String> stringList = new ArrayList<String>(){{ |
| | | List<String> stringList = new ArrayList<String>() {{ |
| | | add("130808"); |
| | | add("140304"); |
| | | add("130604"); |
| | | }}; |
| | | String tableName = "jczz_task_label_reporting_event"; |
| | | // 根据编号集合查询对应的场所(按颜色区分近多少天没有发过任务的场所) |
| | | List<PlaceVO> placeVOList = placeService.getPlaceListByParam(stringList,tableName); |
| | | List<PlaceVO> placeVOList = placeService.getPlaceListByParam(stringList, tableName); |
| | | // 生成任务 |
| | | for (PlaceVO placeVO : placeVOList) { |
| | | String taskName = ""; |
| | | Integer reportType = 3; |
| | | if (placeVO.getLabel().equals("130808")){ |
| | | taskName = DictConstant.DA_JIN_DIAN; |
| | | if (placeVO.getLabel().equals("130808")) { |
| | | taskName = DictConstant.SECOND_HAND_TRANSACTION; |
| | | reportType = 3; |
| | | } |
| | | if (placeVO.getLabel().equals("130604")){ |
| | | if (placeVO.getLabel().equals("130604")) { |
| | | taskName = DictConstant.USED_MOBILE_PHONES; |
| | | reportType = 4; |
| | | } |
| | | if (placeVO.getLabel().equals("140304")){ |
| | | if (placeVO.getLabel().equals("140304")) { |
| | | taskName = DictConstant.USED_CAR; |
| | | reportType = 5; |
| | | } |
| | | // 新增任务 |
| | | TaskEntity taskEntity = saveTaskEntity(placeVO.getHouseCode(), 1, taskName, 2, reportType); |
| | | // 同时新增打金店/二手车/二手手机任务 |
| | | saveGoldShop(placeVO, taskEntity,taskName,reportType); |
| | | saveGoldShop(placeVO, taskEntity, taskName, reportType); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public void createHotelReportingTask() { |
| | | // 旅馆标签为 |
| | | List<String> stringList = new ArrayList<String>(){{ |
| | | List<String> stringList = new ArrayList<String>() {{ |
| | | add("120101"); |
| | | add("120102"); |
| | | add("120103"); |
| | |
| | | }}; |
| | | String tableName = "jczz_task_hotel_reporting"; |
| | | // 根据编号集合查询对应的场所(按颜色区分近多少天没有发过任务的场所) |
| | | List<PlaceVO> placeVOList = placeService.getPlaceListByParam(stringList,tableName); |
| | | List<PlaceVO> placeVOList = placeService.getPlaceListByParam(stringList, tableName); |
| | | // 生成任务 |
| | | for (PlaceVO placeVO : placeVOList) { |
| | | // 新增任务 |
| | |
| | | // 校园安全自查,查询标签为教育的场所 parentNo = 1601 |
| | | String parentNo = "1601"; |
| | | QueryWrapper<CategoryEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted",0).eq("parent_no",parentNo); |
| | | wrapper.eq("is_deleted", 0).eq("parent_no", parentNo); |
| | | List<CategoryEntity> categoryEntityList = categoryService.list(wrapper); |
| | | // 取出编号集合 |
| | | List<String> stringList = categoryEntityList.stream().map(categoryEntity -> categoryEntity.getCategoryNo()).collect(Collectors.toList()); |
| | | // 根据编号集合查询对应的场所(按颜色区分近多少天没有发过任务的场所) |
| | | String tableName = "jczz_task_campus_reporting_event"; |
| | | List<PlaceVO> placeVOList = placeService.getPlaceListByParam(stringList,tableName); |
| | | List<PlaceVO> placeVOList = placeService.getPlaceListByParam(stringList, tableName); |
| | | // 生成任务 |
| | | for (PlaceVO placeVO : placeVOList) { |
| | | // 新增任务 |
| | |
| | | |
| | | /** |
| | | * 新增校园安全检查任务 |
| | | * |
| | | * @param placeVO |
| | | * @param taskEntity |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 新增旅馆安全检查任务 |
| | | * |
| | | * @param placeVO |
| | | * @param taskEntity |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 新增打金店/二手车/二手手机任务 |
| | | * |
| | | * @param placeVO |
| | | * @param taskEntity |
| | | * @param taskName |
| | | * @param reportType |
| | | */ |
| | | private void saveGoldShop(PlaceVO placeVO, TaskEntity taskEntity,String taskName,Integer reportType) { |
| | | private void saveGoldShop(PlaceVO placeVO, TaskEntity taskEntity, String taskName, Integer reportType) { |
| | | TaskLabelReportingEventEntity taskLabelReportingEventEntity = new TaskLabelReportingEventEntity(); |
| | | taskLabelReportingEventEntity.setTaskId(taskEntity.getId()); |
| | | taskLabelReportingEventEntity.setPlaceId(placeVO.getId()); |
| | |
| | | taskLabelReportingEventEntity.setPhoneNumber(placeVO.getPrincipalPhone()); |
| | | taskLabelReportingEventEntity.setLabelName(taskName); |
| | | // 打金店 |
| | | if (reportType==3){ |
| | | if (reportType == 3) { |
| | | taskLabelReportingEventEntity.setEventType("1"); |
| | | } |
| | | // 二手车 |
| | | if (reportType==4){ |
| | | if (reportType == 4) { |
| | | taskLabelReportingEventEntity.setEventType("3"); |
| | | } |
| | | // 二手手机 |
| | | if (reportType==5){ |
| | | if (reportType == 5) { |
| | | taskLabelReportingEventEntity.setEventType("2"); |
| | | } |
| | | // 系统下发 |
| | |
| | | |
| | | /** |
| | | * 插入任务信息 |
| | | * |
| | | * @param houseCode |
| | | * @param type |
| | | * @param taskName |
| | |
| | | // 返回 |
| | | return taskEntity; |
| | | } |
| | | |
| | | /** |
| | | * 任务审核 |
| | | * @param task |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Boolean examine(TaskEntity task) { |
| | | // 二手交易 |
| | | if (task.getReportType().equals(5)) { |
| | | boolean b = updateById(task); |
| | | if (b) { |
| | | ITaskLabelReportingEventService bean = SpringUtils.getBean(ITaskLabelReportingEventService.class); |
| | | return bean.update(Wrappers.<TaskLabelReportingEventEntity>lambdaUpdate() |
| | | .set(TaskLabelReportingEventEntity::getConfirmFlag, task.getStatus()) |
| | | .eq(TaskLabelReportingEventEntity::getTaskId, task.getId())); |
| | | } |
| | | |
| | | } |
| | | // 消防只查 |
| | | if (task.getReportType().equals(2)) { |
| | | boolean b = updateById(task); |
| | | if (b) { |
| | | ITaskPlaceSelfCheckService bean = SpringUtils.getBean(ITaskPlaceSelfCheckService.class); |
| | | return bean.update(Wrappers.<TaskPlaceSelfCheckEntity>lambdaUpdate() |
| | | .set(TaskPlaceSelfCheckEntity::getStatus, task.getStatus()) |
| | | .eq(TaskPlaceSelfCheckEntity::getTaskId, task.getId())); |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |