Browse Source

整改

master
DX 1 month ago
parent
commit
f66ec5bd03
  1. 13
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsCorrectionVO.java
  2. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java
  3. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java
  4. 58
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/InspectionsSendStartMessageJob.java
  5. 37
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java
  6. 16
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java
  7. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java
  8. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java
  9. 24
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterpriseinspections/EnterpriseInspections.xml

13
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;
}

6
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<List<AdminUserDO>> getSimpleEnterpriseUserList(Integer type) {
return success(userService.getSimpleEnterpriseUserList(type));
}
@GetMapping("/get")
@Operation(summary = "获得用户详情")
@Parameter(name = "id", description = "编号", required = true, example = "1024")

3
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<EnterpriseInspe
.orderByDesc(EnterpriseInspectionsDO::getId));
}
//整改数据
List<EnterpriseInspectionsCorrectionVO> inspectionsCorrectionList();
}

58
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<String, String> 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<EnterpriseInspectionsCorrectionVO> 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<String, String> 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;
}
}

37
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<FileInfoDO> 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<EnterpriseDO> getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) {
//根据不同身份查询企业
//专管员查询 user_id
//队长 查询部门 所有的 user_id in
// QueryWrapper<UserRoleDO> roleDOQueryWrapper = new QueryWrapper<>();
// roleDOQueryWrapper.eq("user_id", getLoginUserId());
// final List<UserRoleDO> userRoleDOS = userRoleMapper.selectList(roleDOQueryWrapper);
// final List<Long> 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<EnterpriseDO> enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO);
if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) {

16
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<SignInLogDO> newList = new ArrayList<>();

2
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<DeptUserReqVO> getSimpleUserZGList();
List<AdminUserDO> getSimpleEnterpriseUserList(Integer type);
}

8
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<AdminUserDO> getSimpleEnterpriseUserList(Integer type) {
LambdaQueryWrapper<AdminUserDO> 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);

24
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterpriseinspections/EnterpriseInspections.xml

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections.EnterpriseInspectionsMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="inspectionsCorrectionList"
resultType="cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.EnterpriseInspectionsCorrectionVO">
select
el.*, ei.enterprise_id
from
enterprise_inspections ei
LEFT JOIN
inspections_log el ON ei.id = el.inspections_id
WHERE
ei.deleted = 0 and el.correction_time &lt; NOW()
</select>
</mapper>
Loading…
Cancel
Save