diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsCorrectionVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsCorrectionVO.java new file mode 100644 index 0000000..9a7e92a --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsCorrectionVO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo; + +import lombok.Data; + +@Data +public class EnterpriseInspectionsCorrectionVO { + + private Long inspectionsId; + private String correctName; + private Long creator; + private Long enterpriseId; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java index f559924..f14ac09 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java @@ -154,6 +154,12 @@ public class UserController { return success(userService.getSimpleUserZGList()); } + @GetMapping({"/simple-user-by-userType"}) + @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项") + public CommonResult> getSimpleEnterpriseUserList(Integer type) { + return success(userService.getSimpleEnterpriseUserList(type)); + } + @GetMapping("/get") @Operation(summary = "获得用户详情") @Parameter(name = "id", description = "编号", required = true, example = "1024") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java index 54edde2..8a87e64 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java @@ -49,5 +49,8 @@ public interface EnterpriseInspectionsMapper extends BaseMapperX inspectionsCorrectionList(); + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/InspectionsSendStartMessageJob.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/InspectionsSendStartMessageJob.java index 874044b..b1a3373 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/InspectionsSendStartMessageJob.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/InspectionsSendStartMessageJob.java @@ -5,12 +5,14 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; import cn.iocoder.yudao.module.system.api.social.SocialClientApi; import cn.iocoder.yudao.module.system.api.social.dto.SocialWxaSubscribeMessageSendReqDTO; +import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.EnterpriseInspectionsCorrectionVO; import cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo.TaskInfoRespVO; import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO; import cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections.EnterpriseInspectionsMapper; import cn.iocoder.yudao.module.system.service.enterprise.EnterpriseService; +import cn.iocoder.yudao.module.system.service.enterpriseinspections.EnterpriseInspectionsService; import cn.iocoder.yudao.module.system.service.inspectionslog.InspectionsLogService; import cn.iocoder.yudao.module.system.service.taskinfo.TaskInfoService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -18,6 +20,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import javax.annotation.Resource; +import javax.swing.*; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,43 +38,38 @@ public class InspectionsSendStartMessageJob implements JobHandler { EnterpriseInspectionsMapper enterpriseInspectionsMapper; @Resource EnterpriseService enterpriseService; + @Resource + EnterpriseInspectionsService enterpriseInspectionsService; @Override public String execute(String param) throws Exception { //要发送的信息 - - final Long id = Long.valueOf(param); - final InspectionsLogDO inspectionsLog = inspectionsLogService.getInspectionsLog(id); - if (inspectionsLog != null && inspectionsLog.getCreator() != null) { - - final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(id); - if (enterpriseInspectionsDO != null) { - final EnterpriseDO enterprise = enterpriseService.getEnterprise(enterpriseInspectionsDO.getEnterpriseId()); - - try { - Long userId = Long.valueOf(inspectionsLog.getCreator()); - //发送消息); - SocialWxaSubscribeMessageSendReqDTO reqDTO = new SocialWxaSubscribeMessageSendReqDTO(); - reqDTO.setUserType(1); - reqDTO.setTemplateTitle("环保任务通知"); - reqDTO.setPage("sub/task/detail?id="+inspectionsLog.getInspectionsId()); - reqDTO.setUserId(userId); - Map message = new HashMap<>(); - message.put("thing2", enterprise.getEnterprisesName()); - message.put("time3", DateUtil.format(inspectionsLog.getCorrectionTime(), DateUtils.FORMAT_YEAR_MONTH_DAY)); -// message.put("thing4", beforeTaskInfo.getDescription()); -// message.put("time5", DateUtil.format(beforeTaskInfo.getEndDate().atStartOfDay(), DateUtils.FORMAT_YEAR_MONTH_DAY)); - reqDTO.setMessages(message); - socialClientApi.sendWxaSubscribeMessage(reqDTO); + final List enterpriseInspectionsCorrectionVOS = enterpriseInspectionsMapper.inspectionsCorrectionList(); + int num = 0; + if (enterpriseInspectionsCorrectionVOS != null && enterpriseInspectionsCorrectionVOS.size() > 0) { + for (final EnterpriseInspectionsCorrectionVO item : enterpriseInspectionsCorrectionVOS) { + final InspectionsLogDO inspectionsLogNew = enterpriseInspectionsService.getInspectionsLogNew(item.getInspectionsId()); + if (inspectionsLogNew != null && inspectionsLogNew.getStatus() == 3) { + final EnterpriseDO enterprise = enterpriseService.getEnterprise(item.getEnterpriseId()); + num ++ ; + try { + SocialWxaSubscribeMessageSendReqDTO reqDTO = new SocialWxaSubscribeMessageSendReqDTO(); + reqDTO.setUserType(1); + reqDTO.setTemplateTitle("整改任务通知"); + reqDTO.setPage("sub/task/detail?id=" + item.getInspectionsId()); + reqDTO.setUserId(Long.valueOf(item.getCreator())); + Map message = new HashMap<>(); + message.put("thing2", enterprise.getEnterprisesName()); + message.put("time3", DateUtil.format(inspectionsLogNew.getCorrectionTime(), DateUtils.FORMAT_YEAR_MONTH_DAY)); + reqDTO.setMessages(message); + socialClientApi.sendWxaSubscribeMessage(reqDTO); + } catch (Exception e) { + log.error("任务发送通知错误:", e.toString()); + } } - catch (Exception e){ - log.error("任务发送通知错误:",e.toString()); - } - - } } - return "发送整个信息成功"; + return "发送整改任务数量:" + num; } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java index 9e324e3..8d229e4 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java @@ -138,19 +138,20 @@ public class EnterpriseServiceImpl implements EnterpriseService { validateEnterpriseExists(updateReqVO.getId()); //如果图片有改变 先删除 在重新添加 - if (updateReqVO.getFileIds().length > 0) { + if (updateReqVO.getFileIds() != null && updateReqVO.getFileIds().length > 0) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(FileInfoDO::getUnitId, updateReqVO.getId().toString()); fileInfoMapper.delete(wrapper); } - - for (Long fileId : updateReqVO.getFileIds()) { - FileInfoDO fileInfoDO = new FileInfoDO(); - fileInfoDO.setDictData(1l); //文件类型 - fileInfoDO.setDictType(644l); - fileInfoDO.setUnitId(updateReqVO.getId().toString()); - fileInfoDO.setInfraFileId(fileId); - fileInfoMapper.insert(fileInfoDO); + if (updateReqVO.getFileIds() != null && updateReqVO.getFileIds().length > 0) { + for (Long fileId : updateReqVO.getFileIds()) { + FileInfoDO fileInfoDO = new FileInfoDO(); + fileInfoDO.setDictData(1l); //文件类型 + fileInfoDO.setDictType(644l); + fileInfoDO.setUnitId(updateReqVO.getId().toString()); + fileInfoDO.setInfraFileId(fileId); + fileInfoMapper.insert(fileInfoDO); + } } // 更新 @@ -191,24 +192,8 @@ public class EnterpriseServiceImpl implements EnterpriseService { @Override public PageResult getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) { - //根据不同身份查询企业 - //专管员查询 user_id - //队长 查询部门 所有的 user_id in -// QueryWrapper roleDOQueryWrapper = new QueryWrapper<>(); -// roleDOQueryWrapper.eq("user_id", getLoginUserId()); -// final List userRoleDOS = userRoleMapper.selectList(roleDOQueryWrapper); -// final List collect = userRoleDOS.stream().map(item -> item.getRoleId()).collect(Collectors.toList()); -// //判断 collect 里面是否包含 roleId = 11 -// if (collect.contains(11L)) { -//// //队长 -//// pageReqVO.setUserId(null); -//// pageReqVO.setDeptId(null); -// } else if (collect.contains(155L)) { -// //专管员 -// pageReqVO.setUserId(getLoginUserId()); -// } -// pageReqVO.setCreate(getLoginUserId().toString()); + final PageResult enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO); if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) { diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java index 7bd5a14..0f89ee2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java @@ -332,22 +332,6 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { //插入图片 fileInfoService.saveFilesByDictData(createReqVO.getFileIds(), 644l,2l, updateObj.getId().toString()); -// if (createReqVO.getStatus() == 3 && createReqVO.getCorrectionTime() != null ) { -// try { -// JobSaveReqVO jobSaveReqVO = new JobSaveReqVO(); -// jobSaveReqVO.setName("整改任务到期提醒"); -// jobSaveReqVO.setHandlerName("inspectionsSendStartMessageJob"); -// jobSaveReqVO.setHandlerParam(updateObj.getId().toString()); -// jobSaveReqVO.setCronExpression(this.generateCronExpression(createReqVO.getCorrectionTime())); -// jobSaveReqVO.setRetryCount(1); -// jobSaveReqVO.setRetryInterval(0); -// jobSaveReqVO.setMonitorTimeout(0); -// jobService.createInspectionsJob(jobSaveReqVO); -// } catch (Throwable e) { -// throw new RuntimeException(e); -// } -// } - //插入签到人 方便查询 if (signInLogDOS == null || signInLogDOS.size() > 0) { List newList = new ArrayList<>(); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java index ae04b4e..89dad96 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java @@ -228,4 +228,6 @@ public interface AdminUserService { void userAudit(UserAuditLogSaveReqVO auditLogSaveReqVO); List getSimpleUserZGList(); + + List getSimpleEnterpriseUserList(Integer type); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index 81d5215..1240257 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -602,6 +602,14 @@ public class AdminUserServiceImpl implements AdminUserService { return list; } + @Override + public List getSimpleEnterpriseUserList(Integer type) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(type != null, AdminUserDO::getUserType, type); + wrapper.select(AdminUserDO::getRealName, AdminUserDO::getMobile); + return adminUserMapper.selectList(wrapper); + } + public void bindSocialUser(Long userId, AuthUser authUser) { // SocialUserDO socialUser = new SocialUserDO(); // socialUser.setUserId(userId); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterpriseinspections/EnterpriseInspections.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterpriseinspections/EnterpriseInspections.xml new file mode 100644 index 0000000..834dae0 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterpriseinspections/EnterpriseInspections.xml @@ -0,0 +1,24 @@ + + + + + + + + +