Browse Source

站内信, 整改, 过期

master
DX 2 weeks ago
parent
commit
6f3fac2b77
  1. 2
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
  2. 18
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/airqualitycollection/QualityCollectionController.java
  3. 49
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/airqualitycollection/vo/QualityCollectionExcelVO.java
  4. 33
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/airqualitycollection/vo/QualityCollectionRespVO.java
  5. 13
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java
  6. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthPermissionInfoRespVO.java
  7. 27
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java
  8. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java
  9. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java
  10. 9
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/LabelValueLongVO.java
  11. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java
  12. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsCorrectionVO.java
  13. 5
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java
  14. 18
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java
  15. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/PassOnSaveVO.java
  16. 19
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/HomeController.java
  17. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/EnterpriseNumVO.java
  18. 12
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/ExecCorrectionCountVO.java
  19. 13
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/HomeGroupMonthVO.java
  20. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/HomeSelectVO.java
  21. 29
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/PolicyController.java
  22. 12
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyRespVO.java
  23. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/QualificationExpiredVO.java
  24. 16
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/TagLibraryController.java
  25. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryRespVO.java
  26. 48
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java
  27. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java
  28. 5
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java
  29. 22
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java
  30. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/DeptUserReqVO.java
  31. 10
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserDeptVO.java
  32. 5
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/airqualitycollection/QualityCollectionDO.java
  33. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java
  34. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java
  35. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java
  36. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/airqualitycollection/QualityCollectionMapper.java
  37. 5
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyMessageMapper.java
  38. 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taglibrary/TagLibraryMapper.java
  39. 18
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java
  40. 10
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java
  41. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/InspectionsSendStartMessageJob.java
  42. 54
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/QualificationTimeOutSendStartMessageJob.java
  43. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java
  44. 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/airqualitycollection/QualityCollectionService.java
  45. 15
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/airqualitycollection/QualityCollectionServiceImpl.java
  46. 16
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java
  47. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java
  48. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java
  49. 60
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java
  50. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java
  51. 95
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java
  52. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationServiceImpl.java
  53. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java
  54. 7
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java
  55. 5
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java
  56. 94
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java
  57. 9
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java
  58. 24
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java
  59. 26
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/util/EntityUtils.java
  60. 24
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/util/SingleValueToListDeserializer.java
  61. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/util/StringUtil.java
  62. 12
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/jobinfo/JobInfoMapper.xml
  63. 2
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/notifyMessage/NotifyMessage.xml
  64. 3
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml
  65. 135
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml
  66. 45
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/users/AdminUser.xml

2
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java

@ -194,6 +194,8 @@ public interface ErrorCodeConstants {
ErrorCode ENTERPRISE_INSPECTIONS_STATUS_ERROR2 = new ErrorCode(1-003-002-001, "任务不能转给自己");
ErrorCode ENTERPRISE_INSPECTIONS_STATUS_ERROR3 = new ErrorCode(1-003-002-002, "请选择要转交的检查记录");
ErrorCode ENTERPRISE_INSPECTIONS_STATUS_ERROR4 = new ErrorCode(1-003-002-002, "此状态下不能删除任务");
ErrorCode SIGN_IN_LOG_ERROR = new ErrorCode(1-003-005-001, "打卡记录不存在");

18
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/airqualitycollection/QualityCollectionController.java

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.system.controller.admin.airqualitycollection;
import com.alibaba.excel.EasyExcel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
@ -24,6 +26,7 @@ import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.system.controller.admin.airqualitycollection.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.airqualitycollection.QualityCollectionDO;
import cn.iocoder.yudao.module.system.service.airqualitycollection.QualityCollectionService;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@ -33,6 +36,7 @@ import javax.validation.Valid;
@RestController
@RequestMapping("/system/quality-collection")
@Validated
@Slf4j
public class QualityCollectionController {
@Resource
@ -92,4 +96,18 @@ public class QualityCollectionController {
BeanUtils.toBean(list, QualityCollectionRespVO.class));
}
@PostMapping("/upload-excel")
@Operation(summary = "导入空气质量采集 Excel")
// @PreAuthorize("@ss.hasPermission('system:quality-collection:upload')")
public void uploadExcel(@RequestParam("file") MultipartFile file, @RequestParam("type") Long type) throws IOException {
// 2. 使用 EasyExcel 读取(替换 ExcelUtils)
List<QualityCollectionExcelVO> list = EasyExcel.read(file.getInputStream())
.head(QualityCollectionExcelVO.class)
.sheet()
.doReadSync();
// 3. 打印读取结果
qualityCollectionService.saveList(list, type);
}
}

49
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/airqualitycollection/vo/QualityCollectionExcelVO.java

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.system.controller.admin.airqualitycollection.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.thoughtworks.xstream.converters.time.LocalDateTimeConverter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 空气质量采集 Response VO")
@Data
@Accessors(chain = false)
public class QualityCollectionExcelVO {
@ExcelProperty(value = "城市", index = 0)
private String city;
@ExcelProperty(value = "区县", index = 1)
private String qx;
@ExcelProperty(value = "站点", index = 2)
private String siteName;
@ExcelProperty(value = "时间", index = 3)
private LocalDateTime time;
@ExcelProperty(value = "PM2.s(ugim3)", index = 4)
private String pm25;
@ExcelProperty(value = "PM10(μg/m3)", index = 5)
private String pm10;
@ExcelProperty(value = "SO2(μg/m3)", index = 6)
private String so2;
@ExcelProperty(value = "NO2(μg/m3)", index = 7)
private String no2;
@ExcelProperty(value = "NO2(μg/m3)", index = 8)
private String no;
@ExcelProperty(value = "NOx(μg/m3)", index = 9)
private String nOx;
@ExcelProperty(value = "CO(mg/m3)", index = 10)
private String co;
@ExcelProperty(value = "O3(μg/m3)", index = 11)
private String o3;
}

33
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/airqualitycollection/vo/QualityCollectionRespVO.java

@ -15,7 +15,6 @@ import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
public class QualityCollectionRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24697")
@ExcelProperty("主键")
private Long id;
@Schema(description = "站点名称", example = "赵六")
@ -35,44 +34,46 @@ public class QualityCollectionRespVO {
@ExcelProperty("PM2.s(ugim3)")
private Double pm25;
@Schema(description = "PMo(ug/m3")
@ExcelProperty("PMo(ug/m3")
@Schema(description = "PM10(μg/m3)")
@ExcelProperty("PM10(μg/m3)")
private Double pm10;
@Schema(description = "sOz(ug/m3)")
@ExcelProperty("sOz(ug/m3)")
@Schema(description = "SO2(μg/m3)")
@ExcelProperty("SO2(μg/m3)")
private Double so2;
@Schema(description = "NOz(ug/m3)")
@ExcelProperty("NOz(ug/m3)")
@Schema(description = "NO2(μg/m3)")
@ExcelProperty("NO2(μg/m3)")
private Double no2;
@Schema(description = "NO(Hg/m3)")
@ExcelProperty("NO(Hg/m3)")
@Schema(description = "NO2(μg/m3)")
@ExcelProperty("NO2(μg/m3)")
private Double no;
@Schema(description = "NOx(Hg/m3)")
@ExcelProperty("NOx(Hg/m3)")
@Schema(description = "NOx(μg/m3)")
@ExcelProperty("NOx(μg/m3)")
private Double nOx;
@Schema(description = "CO(mg/m3)")
@ExcelProperty("CO(mg/m3)")
private Double co;
@Schema(description = "0з(ug/m3)")
@ExcelProperty("0з(ug/m3)")
@Schema(description = "O3(μg/m3)")
@ExcelProperty("O3(μg/m3)")
private Double o3;
@Schema(description = "时间")
@ExcelProperty("时间")
private LocalDateTime time;
@Schema(description = "备用1", example = "你猜")
@ExcelProperty("备用1")
private String remark;
@Schema(description = "备用2")
@ExcelProperty("备用2")
private String remark2;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
}

13
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java

@ -17,11 +17,13 @@ import cn.iocoder.yudao.module.system.api.social.dto.SocialWxQrcodeReqDTO;
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.*;
import cn.iocoder.yudao.module.system.convert.auth.AuthConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper;
import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum;
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService;
@ -81,12 +83,13 @@ public class AuthController {
@Resource
private SocialUserService socialUserService;
@Resource
private StringRedisTemplate stringRedisTemplate;
@Resource
private OAuth2TokenService oAuth2TokenService;
@Resource
private DeptMapper deptMapper;
@PostMapping("/login")
@PermitAll
@ -152,6 +155,14 @@ public class AuthController {
if (user == null) {
return success(null);
}
if (user.getDeptId() != null) {
final DeptDO deptDO = deptMapper.selectById(user.getDeptId());
if (deptDO != null) {
user.setDeptName(deptDO.getName());
}
}
log.info("useruseruseruseruseruseruser:{}", user);
// 1.2 获得角色列表
Set<Long> roleIds = permissionService.getUserRoleIdListByUserId(getLoginUserId());

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthPermissionInfoRespVO.java

@ -62,6 +62,9 @@ public class AuthPermissionInfoRespVO {
@Schema(description = "用户类型", example = "1")
private Integer userType;
@Schema(description = "用户所属部门")
private String deptName;
}
@Schema(description = "管理后台 - 登录用户的菜单信息 Response VO")

27
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java

@ -19,6 +19,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMappe
import cn.iocoder.yudao.module.system.dal.mysql.fileInfo.FileInfoMapper;
import cn.iocoder.yudao.module.system.dal.mysql.qualification.EnterpriseQualificationMapper;
import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper;
import cn.iocoder.yudao.module.system.service.dept.DeptService;
import cn.iocoder.yudao.module.system.service.enterprise.EnterpriseServiceImpl;
import cn.iocoder.yudao.module.system.service.enterprisetag.EnterpriseTagService;
import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService;
@ -84,6 +85,8 @@ public class EnterpriseController {
private TagLibraryService tagLibraryService;
@Resource
private FileInfoService fileInfoService;
@Resource
private DeptService deptService;
@PostMapping("/create")
@Operation(summary = "创建企业")
@ -207,7 +210,13 @@ public class EnterpriseController {
pageResult.getList().forEach(item->{
final AdminUserDO user = adminUserService.getUser(Long.valueOf(item.getUserId()));
if (user != null) {
item.setInviterName(user.getNickname());
item.setInviterName(user.getRealName());
if (user.getDeptId() != null) {
final DeptDO dept = deptService.getDept(user.getDeptId());
if (dept!= null) {
item.setInviterNameDept(dept.getName());
}
}
}
final List<TagLibraryDO> tagLibraryDOS = tagLibraryService.listByEnterpriseId(item.getId());
@ -224,6 +233,18 @@ public class EnterpriseController {
}
});
if (pageReqVO.getCreateDeptId() != null) {
//查出改部门下所有用户
List<Long> deptIds = new ArrayList<>();
deptIds.add(pageReqVO.getCreateDeptId());
final List<AdminUserDO> userList = adminUserService.getUserListByDeptIds(deptIds);
if (userList!= null && userList.size() > 0) {
List<Long> collect = userList.stream().map(item1 -> item1.getId()).collect(Collectors.toList());
final List<EnterpriseDO> collect1 = pageResult.getList().stream().filter(item -> collect.contains(item.getCreator())).collect(Collectors.toList());
}
}
return success(BeanUtils.toBean(pageResult, EnterpriseRespVO.class));
}
@ -261,6 +282,10 @@ public class EnterpriseController {
final AdminUserDO user = adminUserService.getUser(Long.valueOf(item.getUserId()));
if (user != null) {
item.setInviterName(user.getRealName());
final DeptDO dept = deptService.getDept(user.getDeptId());
if (dept != null) {
item.setInviterNameDept(dept.getName());
}
}
// 企业标签

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java

@ -101,5 +101,8 @@ public class EnterprisePageReqVO extends PageParam {
@Schema(description = "排除企业id")
private Long excludeEnterpriseId;
@Schema(description = "发布部门")
private Long createDeptId;
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java

@ -26,6 +26,10 @@ public class EnterpriseRespVO {
@ExcelProperty("所属部门ID")
private Long departmentId;
@Schema(description = "所属部门名称", example = "10990")
@ExcelProperty("所属部门名称")
private String inviterNameDept;
@Schema(description = "管辖人员ID", example = "30445")
@ExcelProperty("管辖人员ID")
private Long userId;

9
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/LabelValueLongVO.java

@ -0,0 +1,9 @@
package cn.iocoder.yudao.module.system.controller.admin.enterprise.vo;
import lombok.Data;
@Data
public class LabelValueLongVO {
private Long value;
private String label;
}

6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java

@ -83,8 +83,7 @@ public class EnterpriseInspectionsController {
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')")
public CommonResult<EnterpriseInspectionsRespVO> getEnterpriseInspections(@RequestParam("id") Long id) {
EnterpriseInspectionsDO enterpriseInspections = enterpriseInspectionsService.getEnterpriseInspections(id);
return success(BeanUtils.toBean(enterpriseInspections, EnterpriseInspectionsRespVO.class));
return success(enterpriseInspectionsService.getEnterpriseInspections(id));
}
@GetMapping("/getEnterpriseInspectionsByTaskId")
@ -92,8 +91,7 @@ public class EnterpriseInspectionsController {
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')")
public CommonResult<EnterpriseInspectionsRespVO> getEnterpriseInspectionsByTaskId(@RequestParam("id") Long id) {
EnterpriseInspectionsDO enterpriseInspections = enterpriseInspectionsService.getEnterpriseInspections(id);
return success(BeanUtils.toBean(enterpriseInspections, EnterpriseInspectionsRespVO.class));
return success(enterpriseInspectionsService.getEnterpriseInspections(id));
}
@GetMapping("/page")

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsCorrectionVO.java

@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class EnterpriseInspectionsCorrectionVO {

5
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java

@ -54,12 +54,11 @@ public class EnterpriseInspectionsPageReqVO extends PageParam {
//任务开始时间
@Schema(description = "任务开始时间", example = "27002")
private LocalDateTime TaskStartTime;
private LocalDateTime taskStartTime;
//任务结束时间
@Schema(description = "任务结束时间", example = "27002")
private LocalDateTime TaskEndTime;
private LocalDateTime taskEndTime;
}

18
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java

@ -28,6 +28,10 @@ public class EnterpriseInspectionsRespVO {
@ExcelProperty("任务名称")
private String taskName;
@Schema(description = "当前任务状态", example = "29150")
@ExcelProperty("当前任务状态")
private Integer status;
@Schema(description = "任务开始时间", example = "27002")
private LocalDateTime TaskStartTime;
@ -53,20 +57,30 @@ public class EnterpriseInspectionsRespVO {
@ExcelProperty("企业地址")
private String enterpriseAddress;
@Schema(description = "发布部门", example = "综合部")
@ExcelProperty("发布部门")
private String createDeptName;
@Schema(description = "任务类型", example = "27002")
@ExcelProperty("任务类型")
private List<String> tagList;
@Schema(description = "任务类型", example = "27002")
@ExcelProperty("任务类型")
private String taskType;
@Schema(description = "进度状态", example = "1")
@ExcelProperty("进度状态")
private String inspectionStatus;
@Schema(description = "执法部门", example = "一大队")
@ExcelProperty("执法部门")
private String department;
@Schema(description = "执法部门id", example = "1")
@ExcelProperty("执法部门id")
private Long deptId;
@Schema(description = "执法人员", example = "张三")
@ExcelProperty("执法人员")
private String inspectName;

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/PassOnSaveVO.java

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo;
import cn.iocoder.yudao.module.system.util.SingleValueToListDeserializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.Data;
import java.util.List;
@ -7,6 +9,7 @@ import java.util.List;
@Data
public class PassOnSaveVO {
//转交的执法记录id 转交是否需要审核
@JsonDeserialize(using = SingleValueToListDeserializer.class)
private List<Long> inspectionsId;
//转给的专管员id
private Long userId;

19
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/HomeController.java

@ -3,9 +3,7 @@ package cn.iocoder.yudao.module.system.controller.admin.home;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.EnterpriseNumVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeCountResVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeSelectVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.*;
import cn.iocoder.yudao.module.system.service.home.HomeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -53,4 +51,19 @@ public class HomeController {
return success(homeService.appCount2(homeSelectVO));
}
@GetMapping("/taskNumDoing")
@Operation(summary = "近6个月执法走势")
@DataPermission(enable = false) // 关闭数据权限,避免只查看自己时,查询不到部门。
public CommonResult<List<HomeGroupMonthVO>> taskNumDoing(HomeSelectVO homeSelectVO) {
return success(homeService.taskNumDoing(homeSelectVO));
}
@GetMapping("/execCorrectionCount")
@Operation(summary = "执法整改统计")
@DataPermission(enable = false) // 关闭数据权限,避免只查看自己时,查询不到部门。
public CommonResult<List<ExecCorrectionCountVO>> taskNum(HomeSelectVO homeSelectVO) {
return success(homeService.execCorrectionCount(homeSelectVO));
}
}

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/EnterpriseNumVO.java

@ -5,5 +5,7 @@ import lombok.Data;
@Data
public class EnterpriseNumVO {
private String name;
private String deptName;
private String realName;
private Integer count;
}

12
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/ExecCorrectionCountVO.java

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.system.controller.admin.home.vo;
import lombok.Data;
@Data
public class ExecCorrectionCountVO {
private String realName;
private Integer inspectionCount;
private Long correctionCount;
}

13
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/HomeGroupMonthVO.java

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.system.controller.admin.home.vo;
import lombok.Data;
@Data
public class HomeGroupMonthVO {
private String month;
private Integer taskCount;
private Integer inspectionCount;
}

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/home/vo/HomeSelectVO.java

@ -24,5 +24,8 @@ public class HomeSelectVO {
//用户id
private Long userId;
//长度
private Integer size;
}

29
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/PolicyController.java

@ -1,7 +1,11 @@
package cn.iocoder.yudao.module.system.controller.admin.policy;
import cn.iocoder.yudao.module.system.controller.admin.maxkb.vo.MaxkbdocumentVo;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.dept.DeptService;
import cn.iocoder.yudao.module.system.service.maxkb.MaxkbApiService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
@ -44,6 +48,10 @@ public class PolicyController {
@Resource
private MaxkbApiService maxkbApiService;
@Resource
private AdminUserService adminUserService;
@Resource
private DeptService deptService;
@Value("${yudao.web.url}")
private String webUrl;
@ -117,7 +125,24 @@ public class PolicyController {
@Operation(summary = "获得政策法规分页")
public CommonResult<PageResult<PolicyRespVO>> getPolicyPage(@Valid PolicyPageReqVO pageReqVO) {
PageResult<PolicyDO> pageResult = policyService.getPolicyPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, PolicyRespVO.class));
final PageResult<PolicyRespVO> bean = BeanUtils.toBean(pageResult, PolicyRespVO.class);
if (bean.getList() != null) {
bean.getList().forEach(item->{
final Long userId = Long.valueOf(item.getCreator());
final AdminUserDO user = adminUserService.getUser(userId);
if(user != null) {
item.setCreateName(user.getRealName());
if (user.getDeptId() != null) {
final Long deptId = user.getDeptId();
final DeptDO deptName = deptService.getDept(deptId);
if (deptName != null) {
item.setCreateDeptName(deptName.getName());
}
}
}
});
}
return success(bean);
}
@ -133,4 +158,4 @@ public class PolicyController {
BeanUtils.toBean(list, PolicyRespVO.class));
}
}
}

12
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyRespVO.java

@ -27,6 +27,16 @@ public class PolicyRespVO {
@ExcelProperty("名称")
private String name;
@Schema(description = "发布人", example = "王五")
@ExcelProperty("发布人")
private String createName;
@Schema(description = "发布人部门", example = "王五")
@ExcelProperty("发布人部门")
private String createDeptName;
private String creator;
@Schema(description = "生效日期", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应)
@JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求)
@ -37,4 +47,4 @@ public class PolicyRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
}

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/QualificationExpiredVO.java

@ -8,6 +8,8 @@ import java.time.LocalDateTime;
public class QualificationExpiredVO {
//公司名称
private String enterpriseName;
//资质类型
private Integer qualificationName;
//过期时间
private LocalDateTime expiryDate;
//用户id

16
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/TagLibraryController.java

@ -78,6 +78,21 @@ public class TagLibraryController {
return success(BeanUtils.toBean(pageResult, TagLibraryRespVO.class));
}
@GetMapping("/pageInfo")
@Operation(summary = "获得标签分页")
public CommonResult<PageResult<TagLibraryRespVO>> page(TagLibraryPageReqVO pageReqVO) {
PageResult<TagLibraryDO> pageResult = tagLibraryService.page(pageReqVO);
final PageResult<TagLibraryRespVO> bean = BeanUtils.toBean(pageResult, TagLibraryRespVO.class);
bean.getList().forEach(tagLibraryDO -> {
final TagLibraryDO tagLibrary = tagLibraryService.getTagLibrary(tagLibraryDO.getParentId());
if (tagLibrary != null) {
tagLibraryDO.setParentName(tagLibrary.getTagName());
}
});
return success(bean);
}
@GetMapping("/list")
@Operation(summary = "获得标签分页")
// @PreAuthorize("@ss.hasPermission('system:tag-library:query')")
@ -93,7 +108,6 @@ public class TagLibraryController {
public CommonResult<List<TagLibraryRespVO>> childrenList(Long id) {
List<TagLibraryDO> pageResult = tagLibraryService.childrenList(id);
return success(BeanUtils.toBean(pageResult, TagLibraryRespVO.class));
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryRespVO.java

@ -25,6 +25,10 @@ public class TagLibraryRespVO {
@ExcelProperty("父标签的ID")
private Integer parentId;
@Schema(description = "父标签标题", example = "30648")
@ExcelProperty("父标签标题")
private String parentName;
@Schema(description = "标签层级(一级、二级、三级)", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("标签层级(一级、二级、三级)")
private Integer tagLevel;

48
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java

@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.infra.api.job.JobApi;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.EnterprisePageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueLongVO;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueVO;
import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.EnterpriseInspectionsPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.EnterpriseInspectionsSaveReqVO;
@ -161,6 +162,18 @@ public class TaskInfoController {
});
//执法人员 执法人员所在部门
final Long userId = item.getUserId();
final AdminUserDO user = adminUserService.getUser(userId);
if (user != null) {
item.setInviterName(user.getRealName());
final Long deptId = user.getDeptId();
final DeptDO dept = deptService.getDept(deptId);
if (dept != null) {
item.setInviterNameDept(dept.getName());
}
}
item.setTagListName(labelValueVOList);
}
@ -185,7 +198,6 @@ public class TaskInfoController {
}
@GetMapping("/appGet")
@Operation(summary = "获得任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@ -217,11 +229,12 @@ public class TaskInfoController {
@PreAuthorize("@ss.hasPermission('system:task-info:query')")
public CommonResult<PageResult<TaskInfoRespVO>> getTaskInfoPage(@Valid TaskInfoPageReqVO pageReqVO) {
PageResult<TaskInfoDO> pageResult = taskInfoService.getTaskInfoPage(pageReqVO);
AdminUserDO user = adminUserService.getUser(SecurityFrameworkUtils.getLoginUserId());
DeptDO dept= deptService.getDept(user.getDeptId());
EnterpriseInspectionsPageReqVO enterpriseInspectionsPageReqVO=new EnterpriseInspectionsPageReqVO();
pageResult.getList().forEach(item->{
final Long creator = Long.valueOf(item.getCreator());
AdminUserDO user = adminUserService.getUser(creator);
DeptDO dept= deptService.getDept(user.getDeptId());
if (dept != null) {
item.setDeptName(dept.getName());
}
@ -239,6 +252,24 @@ public class TaskInfoController {
item.setTaskTypeName(tagLibraryService.getTagLibrary(Integer.valueOf(item.getTaskType())).getTagName());
});
//按发布部门查询
if (pageReqVO.getDeptId()!= null) {
List<Long> deptIds = new ArrayList<>();
deptIds.add(pageReqVO.getDeptId());
final List<AdminUserDO> userListByDeptIds = adminUserService.getUserListByDeptIds(deptIds);
if (!userListByDeptIds.isEmpty()) {
List<Long> longs = CollectionUtils.convertList(userListByDeptIds, AdminUserDO::getId);
final List<TaskInfoDO> collect = pageResult.getList().stream().filter(item -> longs.contains(Long.valueOf(item.getCreator()))).collect(Collectors.toList());
pageResult.setList(collect);
Long count = collect.size() > 0 ? Long.valueOf(collect.size()) :0l;
pageResult.setTotal(count);
}
}
return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class));
}
@ -251,6 +282,13 @@ public class TaskInfoController {
return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class));
}
@GetMapping("/appSelectCreateDept")
@Operation(summary = "发布部门查询")
@PreAuthorize("@ss.hasPermission('system:task-info:query')")
public CommonResult<List<LabelValueLongVO>> appSelectCreateDept() {
return success(taskInfoService.appSelectCreateDept());
}
@GetMapping("/appPageByEnterpriseId")
@Operation(summary = "获得任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。分页")
// @PreAuthorize("@ss.hasPermission('system:task-info:query')")
@ -272,6 +310,8 @@ public class TaskInfoController {
BeanUtils.toBean(list, TaskInfoRespVO.class));
}
@GetMapping("/testInsertUserArea")
@Operation(summary = "获得任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。分页")
// @PreAuthorize("@ss.hasPermission('system:task-info:query')")

6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java

@ -94,4 +94,10 @@ public class TaskInfoPageReqVO extends PageParam {
@Schema(description = "企业id", example = "1")
private Long enterpriseId;
@Schema(description = "创建部门", example = "1")
private Long createDeptId;
@Schema(description = "企业所所属区域")
private Integer region;
}

5
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java

@ -146,9 +146,4 @@ public class TaskInfoRespVO {
//任务类型名称
private String taskTypeName;
}

22
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java

@ -159,8 +159,8 @@ public class UserController {
@GetMapping({"/simple-zg-list"})
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
public CommonResult<List<DeptUserReqVO>> getSimpleUserZGList() {
return success(userService.getSimpleUserZGList());
public CommonResult<List<DeptUserReqVO>> getSimpleUserZGList(@RequestParam(value = "deptId", required = false) Long deptId) {
return success(userService.getSimpleUserZGList(deptId));
}
@GetMapping({"/simple-user-by-userType"})
@ -233,4 +233,22 @@ public class UserController {
return success(true);
}
@PutMapping("/enterprise_manager_list")
@Operation(summary = "专管员列表,邀请过企业的都是专管员")
public CommonResult<List<UserDeptVO>> enterpriseManagerList() {
return success(userService.enterpriseManagerList());
}
@GetMapping("/deptByMenu")
@Operation(summary = "根据权限查询部门")
public CommonResult<List<DeptDO>> deptByMenu() {
return success(userService.deptByMenu());
}
@GetMapping("/enterprise_manager_dept_list")
@Operation(summary = "专管员部门查询")
public CommonResult<List<DeptDO>> enterpriseManagerDeptList() {
return success(userService.enterpriseManagerDeptList());
}
}

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/DeptUserReqVO.java

@ -17,4 +17,7 @@ public class DeptUserReqVO {
@Schema(description = "部门名称", example = "IT 部")
private String deptName;
@Schema(description = "头像", example = "IT 部")
private String avatar;
}

10
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserDeptVO.java

@ -0,0 +1,10 @@
package cn.iocoder.yudao.module.system.controller.admin.user.vo.user;
import lombok.Data;
@Data
public class UserDeptVO {
private Long userId;
private String realName;
private Long deptName;
}

5
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/airqualitycollection/QualityCollectionDO.java

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.dal.dataobject.airqualitycollection;
import com.sun.xml.bind.v2.TODO;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
@ -64,7 +65,7 @@ public class QualityCollectionDO extends BaseDO {
/**
* NOx(Hg/m3)
*/
private Double nOx;
private Double nox;
/**
* CO(mg/m3)
*/
@ -82,4 +83,4 @@ public class QualityCollectionDO extends BaseDO {
*/
private String remark2;
}
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java

@ -104,6 +104,10 @@ public class EnterpriseDO extends BaseDO {
@TableField(exist = false)
private String inviterName;
//邀请人所在部门
@TableField(exist = false)
private String inviterNameDept;
@TableField(exist = false)
private List<LabelValueVO> tagListName;
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java

@ -88,11 +88,11 @@ public class EnterpriseInspectionsDO extends BaseDO {
//任务开始时间
@TableField(exist = false)
private LocalDateTime TaskStartTime;
private LocalDateTime taskStartTime;
//任务结束时间
@TableField(exist = false)
private LocalDateTime TaskEndTime;
private LocalDateTime taskEndTime;
}

6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java

@ -60,6 +60,12 @@ public class AdminUserDO extends TenantBaseDO {
* 部门 ID
*/
private Long deptId;
/*
部门名称
*/
@TableField(exist = false)
private String deptName;
/**
* 岗位编号数组
*/

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/airqualitycollection/QualityCollectionMapper.java

@ -27,7 +27,7 @@ public interface QualityCollectionMapper extends BaseMapperX<QualityCollectionDO
.eqIfPresent(QualityCollectionDO::getSo2, reqVO.getSo2())
.eqIfPresent(QualityCollectionDO::getNo2, reqVO.getNo2())
.eqIfPresent(QualityCollectionDO::getNo, reqVO.getNo())
.eqIfPresent(QualityCollectionDO::getNOx, reqVO.getNOx())
.eqIfPresent(QualityCollectionDO::getNox, reqVO.getNOx())
.eqIfPresent(QualityCollectionDO::getCo, reqVO.getCo())
.eqIfPresent(QualityCollectionDO::getO3, reqVO.getO3())
.eqIfPresent(QualityCollectionDO::getRemark, reqVO.getRemark())
@ -36,4 +36,4 @@ public interface QualityCollectionMapper extends BaseMapperX<QualityCollectionDO
.orderByDesc(QualityCollectionDO::getId));
}
}
}

5
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyMessageMapper.java

@ -14,18 +14,21 @@ import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
@Mapper
public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> {
default PageResult<NotifyMessageDO> selectPage(NotifyMessagePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<NotifyMessageDO>()
.eqIfPresent(NotifyMessageDO::getUserId, reqVO.getUserId())
.eqIfPresent(NotifyMessageDO::getUserId, getLoginUserId())
.eqIfPresent(NotifyMessageDO::getUserType, reqVO.getUserType())
.eqIfPresent(NotifyMessageDO::getTemplateId, reqVO.getTemplateId())
.likeIfPresent(NotifyMessageDO::getTemplateCode, reqVO.getTemplateCode())
.eqIfPresent(NotifyMessageDO::getTemplateType, reqVO.getTemplateType())
.eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus())
.betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime())
.orderByAsc(NotifyMessageDO::getReadStatus)
.orderByDesc(NotifyMessageDO::getCreateTime));
}

1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taglibrary/TagLibraryMapper.java

@ -23,6 +23,7 @@ public interface TagLibraryMapper extends BaseMapperX<TagLibraryDO> {
.eqIfPresent(TagLibraryDO::getParentId, reqVO.getParentId())
.eqIfPresent(TagLibraryDO::getTagLevel, reqVO.getTagLevel())
.eqIfPresent(TagLibraryDO::getTagType, reqVO.getTagType())
.neIfPresent(TagLibraryDO::getParentId, 0)
.betweenIfPresent(TagLibraryDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(TagLibraryDO::getSort));
}

18
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java

@ -5,11 +5,9 @@ import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueLongVO;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.EnterpriseNumVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeExecFinishVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeGroupCountVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeSelectVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -27,7 +25,7 @@ public interface TaskInfoMapper extends BaseMapperX<TaskInfoDO> {
default PageResult<TaskInfoDO> selectPage(TaskInfoPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<TaskInfoDO>()
.eqIfPresent(TaskInfoDO::getTitle, reqVO.getTitle())
.likeIfPresent(TaskInfoDO::getTitle, reqVO.getTitle())
.eqIfPresent(TaskInfoDO::getTaskNumber, reqVO.getTaskNumber())
.eqIfPresent(TaskInfoDO::getDescription, reqVO.getDescription())
.eqIfPresent(TaskInfoDO::getExecCycle, reqVO.getExecCycle())
@ -35,8 +33,7 @@ public interface TaskInfoMapper extends BaseMapperX<TaskInfoDO> {
.eqIfPresent(TaskInfoDO::getPriority, reqVO.getPriority())
.eqIfPresent(TaskInfoDO::getStatus, reqVO.getStatus())
.betweenIfPresent(TaskInfoDO::getStartDate, reqVO.getStartDate())
.betweenIfPresent(TaskInfoDO::getEndDate, reqVO.getEndDate())
.betweenIfPresent(TaskInfoDO::getCreateTime, reqVO.getCreateTime())
.betweenIfPresent(TaskInfoDO::getEndDate, reqVO.getStartDate())
.eqIfPresent(TaskInfoDO::getParentId, reqVO.getParentId())
.eqIfPresent(TaskInfoDO::getParentType, reqVO.getParentType())
.eqIfPresent(TaskInfoDO::getTaskStep, reqVO.getTaskStep())
@ -68,6 +65,8 @@ public interface TaskInfoMapper extends BaseMapperX<TaskInfoDO> {
//优化任务查询
IPage<TaskInfoDO> selectMyPage(Page<TaskInfoDO> page, @Param("params") TaskInfoPageReqVO reqVO);
List<LabelValueLongVO> appSelectCreateDept(Map<String, Long> map);
//根据企业id查任务
IPage<TaskInfoDO> selectPageByEnterpriseId(Page<TaskInfoDO> page, @Param("reqVO") TaskInfoPageReqVO reqVO);
@ -83,4 +82,9 @@ public interface TaskInfoMapper extends BaseMapperX<TaskInfoDO> {
//整改次数排序
List<EnterpriseNumVO> selectEnterpriseStatus(HomeSelectVO homeSelectVO);
//近6个月的执法走势
List<HomeGroupMonthVO> taskNumDoing(HomeSelectVO homeSelectVO);
//近6个月的执法走势
Long selectCorrectionCount(HomeSelectVO homeSelectVO);
}

10
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java

@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.system.dal.mysql.user;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserDeptVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
@ -57,4 +59,12 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
@Delete("delete from system_oauth2_refresh_token where user_id = #{userId}")
Long deleteOauth2RefreshAuth(Long userId);
//查询所有邀请过企业的管理员
List<UserDeptVO> enterpriseManagerList();
//查询发布过任务的部门
List<DeptDO> deptByMenu();
//查询所有邀请过企业的部门
List<DeptDO> enterpriseManagerDeptList();
}

8
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/InspectionsSendStartMessageJob.java

@ -55,8 +55,6 @@ public class InspectionsSendStartMessageJob implements JobHandler {
for (final EnterpriseInspectionsCorrectionVO item : enterpriseInspectionsCorrectionVOS) {
final InspectionsLogDO inspectionsLogNew = enterpriseInspectionsService.getInspectionsLogNew(item.getInspectionsId());
//站内信发送通知
if (inspectionsLogNew != null && inspectionsLogNew.getStatus() == 3) {
//站内信发送通知
@ -68,7 +66,7 @@ public class InspectionsSendStartMessageJob implements JobHandler {
notifyMessage.setTemplateCode("correction_messages");
Map<String, Object> templateParams = new HashMap<>();
templateParams.put("title", enterpriseService.getEnterprise(item.getEnterpriseId()).getEnterprisesName());
templateParams.put("correctionTime", inspectionsLogNew.getCorrectionTime());
templateParams.put("endTime", DateUtil.format(inspectionsLogNew.getCorrectionTime(), DateUtils.FORMAT_YEAR_MONTH_DAY));
templateParams.put("url", "/sub/task/record?taskId="+item.getTaskId() +"&recordId=" + item.getEnterpriseId() +"&enterpriseId=" + item.getEnterpriseId());
notifyMessage.setTemplateParams(templateParams);
@ -83,8 +81,8 @@ public class InspectionsSendStartMessageJob implements JobHandler {
reqDTO.setUserId(Long.valueOf(item.getCreator()));
Map<String, String> message = new HashMap<>();
message.put("thing5", enterprise.getEnterprisesName());
message.put("time8", DateUtil.format(inspectionsLogNew.getCorrectionTime(), DateUtils.FORMAT_YEAR_MONTH_DAY));
message.put("time9", item.getFeedback());
message.put("thing8", item.getFeedback() );
message.put("time9", DateUtil.format(inspectionsLogNew.getCorrectionTime(), DateUtils.FORMAT_YEAR_MONTH_DAY));
reqDTO.setMessages(message);
socialClientApi.sendWxaSubscribeMessage(reqDTO);
} catch (Exception e) {

54
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/QualificationTimeOutSendStartMessageJob.java

@ -8,13 +8,16 @@ import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDT
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.qualification.vo.QualificationExpiredVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
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.dal.mysql.qualification.EnterpriseQualificationMapper;
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import cn.iocoder.yudao.module.system.service.enterprise.EnterpriseService;
import cn.iocoder.yudao.module.system.service.inspectionslog.InspectionsLogService;
import cn.iocoder.yudao.module.system.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@ -33,43 +36,50 @@ public class QualificationTimeOutSendStartMessageJob implements JobHandler {
EnterpriseQualificationMapper enterpriseQualificationMapper;
@Resource
NotifyMessageSendApi notifyMessageSendApi;
@Resource
DictDataService dictDataService;
@Override
public String execute(String param) throws Exception {
//要发送的信息
final Long id = Long.valueOf(param);
final List<QualificationExpiredVO> qualificationExpiredVOS = enterpriseQualificationMapper.expiredList();
if (qualificationExpiredVOS != null && qualificationExpiredVOS.size() > 0) {
qualificationExpiredVOS.forEach(item->{
try {
//发送消息
SocialWxaSubscribeMessageSendReqDTO reqDTO = new SocialWxaSubscribeMessageSendReqDTO();
reqDTO.setUserType(1);
reqDTO.setTemplateTitle("认证到期提醒");
reqDTO.setPage("sub/enterprise/detail?id="+item.getEnterpriseId());
reqDTO.setUserId(item.getUserId());
Map<String, String> message = new HashMap<>();
message.put("phrase1", item.getEnterpriseName());
message.put("data2", DateUtil.format(item.getExpiryDate(), DateUtils.FORMAT_YEAR_MONTH_DAY));
final DictDataDO enterpriseQua = dictDataService.getDictData("enterprise_qua", item.getQualificationName().toString());
reqDTO.setMessages(message);
socialClientApi.sendWxaSubscribeMessage(reqDTO);
//发送消息
if (item.getEnterpriseName() != null && item.getExpiryDate() != null) {
SocialWxaSubscribeMessageSendReqDTO reqDTO = new SocialWxaSubscribeMessageSendReqDTO();
reqDTO.setUserType(1);
reqDTO.setTemplateTitle("证书到期通知");
reqDTO.setPage("sub/enterprise/detail?id="+item.getEnterpriseId());
reqDTO.setUserId(item.getUserId());
Map<String, String> message = new HashMap<>();
message.put("thing1", StringUtil.truncateString(enterpriseQua.getLabel(), 15));
message.put("thing2", StringUtil.truncateString(item.getEnterpriseName(), 15));
message.put("time4", DateUtil.format(item.getExpiryDate(), DateUtils.FORMAT_YEAR_MONTH_DAY));
message.put("phrase3", "到期");
reqDTO.setMessages(message);
socialClientApi.sendWxaSubscribeMessage(reqDTO);
}
//保存站内信
NotifySendSingleToUserReqDTO notifyMessage = new NotifySendSingleToUserReqDTO();
notifyMessage.setUserId(Long.valueOf(item.getUserId()));
notifyMessage.setTemplateCode("qualification_expiry_date");
Map<String, Object> templateParams = new HashMap<>();
templateParams.put("title", item.getEnterpriseName());
templateParams.put("endTime", item.getExpiryDate());
templateParams.put("url", "/sub/enterprise/detail?id="+ item.getEnterpriseId());
notifyMessage.setTemplateParams(templateParams);
notifyMessageSendApi.sendSingleMessageToAdmin(notifyMessage);
}
catch (Exception e){
log.error("任务发送通知错误:",e.toString());
}
//保存站内信
NotifySendSingleToUserReqDTO notifyMessage = new NotifySendSingleToUserReqDTO();
notifyMessage.setUserId(Long.valueOf(item.getUserId()));
notifyMessage.setTemplateCode("qualification_expiry_date");
Map<String, Object> templateParams = new HashMap<>();
templateParams.put("title", item.getEnterpriseName());
templateParams.put("endTime", DateUtil.format(item.getExpiryDate(), DateUtils.FORMAT_YEAR_MONTH_DAY));
templateParams.put("url", "/sub/enterprise/detail?id="+ item.getEnterpriseId());
notifyMessage.setTemplateParams(templateParams);
notifyMessageSendApi.sendSingleMessageToAdmin(notifyMessage);
});
}

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java

@ -92,7 +92,7 @@ public class TaskSendStartMessageJob implements JobHandler {
templateParams.put("url", "sub/task/detail?id="+ enterpriseInspectionsDO.getTaskId());
notifyMessage.setTemplateParams(templateParams);
notifyMessageSendApi.sendSingleMessageToMember(notifyMessage);
notifyMessageSendApi.sendSingleMessageToAdmin(notifyMessage);
enterpriseInspectionsDO.setStatus(2);
list.add(enterpriseInspectionsDO);

1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/airqualitycollection/QualityCollectionService.java

@ -53,4 +53,5 @@ public interface QualityCollectionService {
*/
PageResult<QualityCollectionDO> getQualityCollectionPage(QualityCollectionPageReqVO pageReqVO);
void saveList(List<QualityCollectionExcelVO> list, Long type);
}

15
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/airqualitycollection/QualityCollectionServiceImpl.java

@ -72,4 +72,19 @@ public class QualityCollectionServiceImpl implements QualityCollectionService {
return qualityCollectionMapper.selectPage(pageReqVO);
}
@Override
public void saveList(List<QualityCollectionExcelVO> list, Long type) {
List<QualityCollectionDO> collectionDOS = new ArrayList<>();
if (!list.isEmpty()) {
list.forEach(item->{
QualityCollectionDO collectionDO = new QualityCollectionDO();
collectionDO.setType(type);
BeanUtils.copyProperties(item, collectionDO);
collectionDOS.add(collectionDO);
});
qualityCollectionMapper.insertBatch(collectionDOS);
}
}
}

16
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.system.service.auth;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
@ -322,6 +325,15 @@ public class AdminAuthServiceImpl implements AdminAuthService {
AdminUserDO user = null;
if (socialUserDO == null ) {
// String userInfoUrl = "https://api.weixin.qq.com/sns/userinfo" +
// "?access_token=" + authUser.getToken() +
// "&openid=" + authUser.getUuid() +
// "&lang=zh_CN";
// String userInfoResponse = HttpUtil.get(userInfoUrl);
// JSONObject userInfoJson = JSONUtil.parseObj(userInfoResponse);
// String nickname = userInfoJson.getStr("nickname");
// 未找到社交用户,插入记录
SocialUserDO socialUser = new SocialUserDO();
socialUser.setType(reqVO.getType());
@ -498,13 +510,13 @@ public class AdminAuthServiceImpl implements AdminAuthService {
private List<RoleDO> getRolesByIds(List<Long> roleIds) {
return roleMapper.selectList(new LambdaQueryWrapper<RoleDO>()
.in(RoleDO::getId, roleIds)
.select(RoleDO::getName));
.select(RoleDO::getName, RoleDO::getCode));
}
private RoleNameAndSelectTypeVO buildRoleVO(AdminUserDO user, Long userId, List<RoleDO> roles) {
RoleNameAndSelectTypeVO vo = new RoleNameAndSelectTypeVO();
Set<String> roleNames = roles.stream()
.map(RoleDO::getName)
.map(RoleDO::getCode)
.collect(Collectors.toSet());
if (hasAdminPrivileges(roleNames)) {

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java

@ -33,6 +33,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.jni.FileInfo;
import org.checkerframework.checker.units.qual.A;
import org.springframework.stereotype.Service;
@ -64,6 +65,7 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
*/
@Service
@Validated
@Slf4j
public class EnterpriseServiceImpl implements EnterpriseService {
@Resource
@ -323,6 +325,7 @@ public class EnterpriseServiceImpl implements EnterpriseService {
public PageResult<EnterpriseDO> getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) {
RoleNameAndSelectTypeVO typeVO = authService.roleTypeByUserId();
if ("self".equals(typeVO.getRoleName())) {
pageReqVO.setUserId(typeVO.getValue());
}

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java

@ -46,7 +46,7 @@ public interface EnterpriseInspectionsService {
* @param id 编号
* @return 企业检查记录表用于记录与企业相关的环保检查信息
*/
EnterpriseInspectionsDO getEnterpriseInspections(Long id);
EnterpriseInspectionsRespVO getEnterpriseInspections(Long id);
List<EnterpriseInspectionsDO> getListByUserIdAndTaskName(Long userId, String taskName);

60
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java

@ -28,6 +28,7 @@ import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import cn.iocoder.yudao.module.system.service.inspectionslog.InspectionsLogService;
import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.module.system.util.EntityUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
@ -35,6 +36,7 @@ import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@ -152,39 +154,73 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
}
@Override
public EnterpriseInspectionsDO getEnterpriseInspections(Long id) {
public EnterpriseInspectionsRespVO getEnterpriseInspections(Long id) {
EnterpriseInspectionsRespVO enterpriseInspectionsRespVO = new EnterpriseInspectionsRespVO();
final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(id);
if (enterpriseInspectionsDO == null) {
throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS);
}
BeanUtils.copyProperties(enterpriseInspectionsDO, enterpriseInspectionsRespVO);
//查询任务相关
final TaskInfoDO taskInfoDO = taskInfoMapper.selectById(enterpriseInspectionsDO.getTaskId());
if (taskInfoDO == null) {
throw exception(TASK_INFO_NOT_EXISTS);
}
enterpriseInspectionsDO.setTaskName(taskInfoDO.getTitle());
enterpriseInspectionsDO.setTaskName(taskInfoDO.getTitle());
enterpriseInspectionsDO.setTaskNumber(taskInfoDO.getTaskNumber());
enterpriseInspectionsRespVO.setTaskName(taskInfoDO.getTitle());
enterpriseInspectionsRespVO.setTaskId(taskInfoDO.getId());
//任务类型
final TagLibraryDO tagLibrary = tagLibraryService.getTagLibrary(taskInfoDO.getTaskType());
enterpriseInspectionsRespVO.setTaskType(tagLibrary.getTagName());
//任务当前状态
QueryWrapper<InspectionsLogDO> wrapper = new QueryWrapper<>();
wrapper.eq("inspections_id", id);
wrapper.orderByDesc("create_time");
final List<InspectionsLogDO> list = inspectionsLogMapper.selectList(wrapper);
if (!list.isEmpty()) {
enterpriseInspectionsRespVO.setStatus(list.get(0).getStatus());
} else {
enterpriseInspectionsRespVO.setStatus(0);
}
//企业相关
final EnterpriseDO enterpriseDO = enterpriseMapper.selectById(enterpriseInspectionsDO.getEnterpriseId());
if (enterpriseDO == null) {
throw exception(ENTERPRISE_NOT_EXISTS);
}
//任务类型
enterpriseInspectionsDO.setEnterpriseName(enterpriseDO.getEnterprisesName());
enterpriseInspectionsRespVO.setEnterpriseName(enterpriseDO.getEnterprisesName());
enterpriseInspectionsRespVO.setEnterpriseId(enterpriseDO.getId());
//查询的是执法人
final AdminUserDO user = adminUserService.getUser(enterpriseInspectionsDO.getUserId());
if (user == null) {
throw exception(USER_NOT_EXISTS);
}
enterpriseInspectionsDO.setInspectName(user.getRealName());
enterpriseInspectionsRespVO.setInspectName(user.getRealName());
final DeptDO dept = deptService.getDept(user.getDeptId());
if (dept!= null) {
enterpriseInspectionsRespVO.setDepartment(dept.getName());
enterpriseInspectionsRespVO.setDeptId(dept.getId());
}
enterpriseInspectionsDO.setDepartment(dept.getName());
//查询发布人部门
final Long userId = Long.valueOf(taskInfoDO.getCreator());
final AdminUserDO user1 = adminUserService.getUser(userId);
if (user1 != null) {
final DeptDO dept2 = deptService.getDept(user1.getDeptId());
if (dept2!= null) {
enterpriseInspectionsRespVO.setCreateDeptName(dept2.getName());
}
}
return enterpriseInspectionsDO;
return enterpriseInspectionsRespVO;
}
@Override
@ -197,6 +233,7 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
}
}
//按照部门查询
if (pageReqVO.getDepartmentId() != null && pageReqVO.getUserId() == null) {
final List<AdminUserDO> adminUserDOS = adminUserMapper.selectList(new QueryWrapper<AdminUserDO>().eq("dept_id", pageReqVO.getDepartmentId()));
@ -228,6 +265,7 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
}
}
final PageResult<EnterpriseInspectionsDO> enterpriseInspectionsDOPageResult = enterpriseInspectionsMapper.selectPage(pageReqVO);
if ( enterpriseInspectionsDOPageResult.getList() != null && enterpriseInspectionsDOPageResult.getList().size() > 0 ) {
enterpriseInspectionsDOPageResult.getList().forEach(item->{
@ -264,8 +302,6 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
}
item.setEnterpriseName(enterpriseDO.getEnterprisesName());
item.setEnterpriseAddress(enterpriseDO.getAddress());

8
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java

@ -1,9 +1,7 @@
package cn.iocoder.yudao.module.system.service.home;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.EnterpriseNumVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeCountResVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeSelectVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.*;
import java.util.List;
@ -13,4 +11,8 @@ public interface HomeService {
List<EnterpriseNumVO> appCount2(HomeSelectVO homeSelectVO);
List<LabelValueVO> getUserArea();
List<HomeGroupMonthVO> taskNumDoing(HomeSelectVO homeSelectVO);
List<ExecCorrectionCountVO> execCorrectionCount(HomeSelectVO homeSelectVO);
}

95
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java

@ -1,24 +1,15 @@
package cn.iocoder.yudao.module.system.service.home;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.RoleNameAndSelectTypeVO;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueVO;
import cn.iocoder.yudao.module.system.controller.admin.home.vo.*;
import cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo.TaskInfoPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO;
import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO;
import cn.iocoder.yudao.module.system.dal.dataobject.userarea.UserAreaDO;
import cn.iocoder.yudao.module.system.dal.mysql.enterprise.EnterpriseMapper;
import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper;
import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper;
import cn.iocoder.yudao.module.system.dal.mysql.userarea.UserAreaMapper;
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
import cn.iocoder.yudao.module.system.service.auth.AdminAuthServiceImpl;
import cn.iocoder.yudao.module.system.service.dept.DeptService;
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import cn.iocoder.yudao.module.system.service.taskinfo.TaskInfoService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -41,13 +32,19 @@ public class HomeServiceImpl implements HomeService{
private TaskInfoMapper taskInfoMapper;
@Resource
private AdminAuthService authService;
@Resource
private UserAreaMapper userAreaMapper;
@Resource
private DictDataService dictDataService;
@Override
public HomeCountResVO appCount1(HomeSelectVO homeSelectVO) {
if (homeSelectVO.getSelectWeek() != null) {
// 1. 获取周的日期
final LocalDateTime[] weekDate = this.getWeekDate(homeSelectVO.getSelectWeek());
homeSelectVO.setTime(weekDate);
}
// 1. 初始化参数处理
processDeptSelection(homeSelectVO);
@ -220,29 +217,9 @@ public class HomeServiceImpl implements HomeService{
List<LabelValueVO> labelValueVOS = new ArrayList<>();
RoleNameAndSelectTypeVO typeVO = authService.roleTypeByUserId();
if ("director".equals(typeVO.getRoleName())) {
//局长返回整个字典
final List<DictDataDO> enterprisesArea = dictDataService.getDictDataList(0, "enterprises_area");
enterprisesArea.forEach(item-> {
LabelValueVO labelValueVO = new LabelValueVO();
labelValueVO.setLabel(item.getLabel());
labelValueVO.setValue(Integer.valueOf(item.getValue()));
labelValueVOS.add(labelValueVO);
});
} else {
// LambdaQueryWrapper<UserAreaDO> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(UserAreaDO::getUserId, getLoginUserId());
// final List<UserAreaDO> userAreaDOS = userAreaMapper.selectList(wrapper);
// if (userAreaDOS != null && userAreaDOS.size() > 0) {
// userAreaDOS.forEach(item->{
// LabelValueVO labelValueVO = new LabelValueVO();
// final DictDataDO enterprisesArea = dictDataService.getDictData("enterprises_area", item.getArea().toString());
// labelValueVO.setLabel(enterprisesArea.getLabel());
// labelValueVO.setValue(Integer.valueOf(item.getArea()));
// labelValueVOS.add(labelValueVO);
// });
// }
if ("self".equals(typeVO.getRoleName())) {
//专管员看自己
LambdaQueryWrapper<EnterpriseDO> enterpriseDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
enterpriseDOLambdaQueryWrapper.eq(EnterpriseDO::getUserId, getLoginUserId());
final List<EnterpriseDO> enterpriseDOS = enterpriseMapper.selectList(enterpriseDOLambdaQueryWrapper);
@ -256,10 +233,60 @@ public class HomeServiceImpl implements HomeService{
labelValueVOS.add(labelValueVO);
});
}
} else {
//其他人看所有
final List<DictDataDO> enterprisesArea = dictDataService.getDictDataList(0, "enterprises_area");
enterprisesArea.forEach(item-> {
LabelValueVO labelValueVO = new LabelValueVO();
labelValueVO.setLabel(item.getLabel());
labelValueVO.setValue(Integer.valueOf(item.getValue()));
labelValueVOS.add(labelValueVO);
});
}
return labelValueVOS;
}
@Override
public List<HomeGroupMonthVO> taskNumDoing(HomeSelectVO homeSelectVO) {
return taskInfoMapper.taskNumDoing(homeSelectVO);
}
@Override
public List<ExecCorrectionCountVO> execCorrectionCount(HomeSelectVO homeSelectVO) {
if (homeSelectVO.getSelectWeek() != null) {
// 1. 获取周的日期
final LocalDateTime[] weekDate = this.getWeekDate(homeSelectVO.getSelectWeek());
homeSelectVO.setTime(weekDate);
}
List<ExecCorrectionCountVO> execCorrectionCountVOList = new ArrayList<>();
final List<HomeGroupCountVO> homeGroupCountVOS = taskInfoMapper.selectHomeGroupCount(homeSelectVO);
if (!homeGroupCountVOS.isEmpty()) {
homeGroupCountVOS.forEach(item->{
if (item.getFinishCount() == 0) return;
ExecCorrectionCountVO correctionCountVO = new ExecCorrectionCountVO();
correctionCountVO.setRealName(item.getName());
correctionCountVO.setInspectionCount(item.getFinishCount());
homeSelectVO.setUserId(item.getUserId());
final Long correctionCount = taskInfoMapper.selectCorrectionCount(homeSelectVO);
correctionCountVO.setCorrectionCount(correctionCount);
execCorrectionCountVOList.add(correctionCountVO);
});
}
if (execCorrectionCountVOList.isEmpty()) {
ExecCorrectionCountVO correctionCountVO = new ExecCorrectionCountVO();
correctionCountVO.setRealName("");
correctionCountVO.setInspectionCount(0);
correctionCountVO.setCorrectionCount(0L);
execCorrectionCountVOList.add(correctionCountVO);
}
return execCorrectionCountVOList;
}
//查企业
public Integer getEnterpriseCount(HomeSelectVO homeSelectVO) {
@ -274,6 +301,4 @@ public class HomeServiceImpl implements HomeService{
return enterpriseCount.intValue();
}
}

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationServiceImpl.java

@ -103,7 +103,7 @@ public class EnterpriseQualificationServiceImpl implements EnterpriseQualificati
@Override
public PageResult<EnterpriseQualificationDO> getEnterpriseQualificationPage(EnterpriseQualificationPageReqVO pageReqVO) {
if (pageReqVO.getEnterpriseName() != null) {
if (pageReqVO.getEnterpriseName() != null) {
LambdaQueryWrapper<EnterpriseDO> wrapper = new LambdaQueryWrapper<>();
wrapper.like(EnterpriseDO::getEnterprisesName, pageReqVO.getEnterpriseName());
List<EnterpriseDO> enterpriseDOList = enterpriseMapper.selectList(wrapper);

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java

@ -64,4 +64,6 @@ public interface TagLibraryService {
List<TagLibraryDO> listByEnterpriseId(Long enterpriseId);
List<TagLibraryDO> listSetParentId(List<TagLibraryDO> tagLibraryDOS);
PageResult<TagLibraryDO> page(TagLibraryPageReqVO pageReqVO);
}

7
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.service.taglibrary;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTagDO;
import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO;
@ -158,6 +159,12 @@ public class TagLibraryServiceImpl implements TagLibraryService {
}
@Override
public PageResult<TagLibraryDO> page(TagLibraryPageReqVO pageReqVO) {
return tagLibraryMapper.selectPage(pageReqVO);
}
public TagLibraryDO findTopTag(Map<Integer, TagLibraryDO> integerTagLibraryDOMap,TagLibraryDO tagLibraryDOBot) {
if(tagLibraryDOBot.getParentId() == 0)
return tagLibraryDOBot;

5
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.system.service.taskinfo;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueLongVO;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueVO;
import cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -70,4 +73,6 @@ public interface TaskInfoService {
void taskExec(TaskInfoSaveReqVO updateReqVO);
void test();
List<LabelValueLongVO> appSelectCreateDept();
}

94
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java

@ -11,6 +11,8 @@ import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDT
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.auth.vo.RoleNameAndSelectTypeVO;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueLongVO;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueVO;
import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.EnterpriseInspectionsPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.tasktag.vo.TaskTagPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
@ -30,6 +32,7 @@ import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
import cn.iocoder.yudao.module.system.service.dept.DeptService;
import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.module.system.util.EntityUtils;
import cn.iocoder.yudao.module.system.util.StringUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -157,15 +160,27 @@ public class TaskInfoServiceImpl implements TaskInfoService {
@Override
public void deleteTaskInfo(Long id) {
// 校验存在
validateTaskInfoExists(id);
final TaskInfoDO taskInfoDO = validateTaskInfoExists(id);
//先删除对应的执法记录
if (taskInfoDO.getStatus() > 1) {
throw exception(ENTERPRISE_INSPECTIONS_STATUS_ERROR4);
}
QueryWrapper<EnterpriseInspectionsDO> wrapper = new QueryWrapper<>();
wrapper.eq("task_id", taskInfoDO.getId());
enterpriseInspectionsMapper.delete(wrapper);
// //删除任务标签
// taskTagMapper.delete(new LambdaQueryWrapper<TaskTagDO>().eq(TaskTagDO::getTaskId, taskInfoDO.getId()));
// 删除
taskInfoMapper.deleteById(id);
}
private void validateTaskInfoExists(Long id) {
if (taskInfoMapper.selectById(id) == null) {
private TaskInfoDO validateTaskInfoExists(Long id) {
final TaskInfoDO taskInfoDO = taskInfoMapper.selectById(id);
if (taskInfoDO == null) {
throw exception(TASK_INFO_NOT_EXISTS);
}
return taskInfoDO;
}
@Override
@ -175,6 +190,12 @@ public class TaskInfoServiceImpl implements TaskInfoService {
@Override
public PageResult<TaskInfoDO> getTaskInfoPage(TaskInfoPageReqVO pageReqVO) {
//时间范围查询
if (pageReqVO.getSelectWeek() != null) {
final LocalDateTime[] weekDate = EntityUtils.getWeekDate(pageReqVO.getSelectWeek());
pageReqVO.setStartDate(weekDate);
}
return taskInfoMapper.selectPage(pageReqVO);
}
@ -187,6 +208,13 @@ public class TaskInfoServiceImpl implements TaskInfoService {
//当天到任务
queryWrapperX.eqIfPresent(TaskInfoDO::getStartDate,DateUtil.format(new Date(), "yyyy-MM-dd"));
Calendar calendar = Calendar.getInstance();
// 获取小时(24 小时制)
int hour24 = calendar.get(Calendar.HOUR_OF_DAY);
queryWrapperX.eqIfPresent(TaskInfoDO::getExecCycle, hour24);
List<TaskInfoDO> taskInfoDOS = taskInfoMapper.selectList(queryWrapperX);
Map<Long, TaskInfoDO> taskMap = CollectionUtils.convertMap(taskInfoDOS, TaskInfoDO::getId);
@ -208,51 +236,23 @@ public class TaskInfoServiceImpl implements TaskInfoService {
return taskInfoRespVOS;
}
@Override
public void sendTask(Long taskId) {
final TaskInfoDO taskInfoDO = taskInfoMapper.selectById(taskId);
if (taskInfoDO == null) {
throw exception(TASK_INFO_NOT_EXISTS);
}
//
//发送订阅消息给微信
}
@Override
public PageResult<TaskInfoDO> getTaskInfoAppPage(TaskInfoPageReqVO pageReqVO) {
//按时间查询
if (pageReqVO.getSelectWeek() != null) {
LocalDateTime now = LocalDateTime.now();
pageReqVO.setEndTime(now);
LocalDateTime startTime = null;
switch (pageReqVO.getSelectWeek()) {
case 4:
startTime = now.minusDays(3); // 三天前
break;
case 3:
startTime = now.minusWeeks(1); // 一周前
break;
case 2:
startTime = now.minusMonths(1); // 一月前
break;
case 1:
startTime = now.minusYears(1); // 一年前
break;
}
pageReqVO.setStartTime(startTime);
final LocalDateTime[] weekDate = EntityUtils.getWeekDate(pageReqVO.getSelectWeek());
pageReqVO.setStartTime(weekDate[0]);
pageReqVO.setEndTime(weekDate[1]);
}
RoleNameAndSelectTypeVO typeVO = authService.roleTypeByUserId();
@ -265,7 +265,9 @@ public class TaskInfoServiceImpl implements TaskInfoService {
}
Page<TaskInfoDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
log.info("taskInfoDOIPage:{}", pageReqVO);
final IPage<TaskInfoDO> taskInfoDOIPage = taskInfoMapper.selectMyPage(page, pageReqVO);
final PageResult<TaskInfoDO> taskInfoDOPageResult = new PageResult<>(taskInfoDOIPage.getRecords(), taskInfoDOIPage.getTotal());
if (taskInfoDOPageResult.getList() != null && taskInfoDOPageResult.getList().size() > 0) {
@ -282,7 +284,10 @@ public class TaskInfoServiceImpl implements TaskInfoService {
if (item.getCreator() != null) {
final Long value = Long.valueOf(item.getCreator());
final DeptDO deptDO = deptService.getByUserId(value);
item.setDeptName(deptDO.getName());
if (deptDO != null) {
item.setDeptName(deptDO.getName());
}
}
});
}
@ -404,4 +409,21 @@ public class TaskInfoServiceImpl implements TaskInfoService {
});
}
@Override
public List<LabelValueLongVO> appSelectCreateDept() {
Map<String, Long> map = new HashMap<>();
RoleNameAndSelectTypeVO typeVO = authService.roleTypeByUserId();
if ("self".equals(typeVO.getRoleName())) {
map.put("userId", typeVO.getValue());
}
if ("queue".equals(typeVO.getRoleName())) {
map.put("deptId", typeVO.getDeptId());
}
return taskInfoMapper.appSelectCreateDept(map);
}
}

9
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java

@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfi
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*;
import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.UserAuditLogSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import com.xingyuv.jushauth.model.AuthUser;
@ -227,9 +228,15 @@ public interface AdminUserService {
void userAudit(UserAuditLogSaveReqVO auditLogSaveReqVO);
List<DeptUserReqVO> getSimpleUserZGList();
List<DeptUserReqVO> getSimpleUserZGList(Long deptId);
List<AdminUserDO> getSimpleEnterpriseUserList(Integer type);
void testDeleteUser(Long id);
List<UserDeptVO> enterpriseManagerList();
List<DeptDO> deptByMenu();
List<DeptDO> enterpriseManagerDeptList();
}

24
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java

@ -629,7 +629,7 @@ public class AdminUserServiceImpl implements AdminUserService {
}
@Override
public List<DeptUserReqVO> getSimpleUserZGList() {
public List<DeptUserReqVO> getSimpleUserZGList(Long deptId) {
List<DeptUserReqVO> list = new ArrayList<>();
LambdaQueryWrapper<AdminUserDO> wrapper = new LambdaQueryWrapper<>();
@ -637,12 +637,14 @@ public class AdminUserServiceImpl implements AdminUserService {
wrapper.eq(AdminUserDO::getStatus, CommonStatusEnum.ENABLE.getStatus());
wrapper.isNotNull(AdminUserDO::getDeptId);
wrapper.ne(AdminUserDO::getId, 1);
wrapper.eq(deptId != null, AdminUserDO::getDeptId, deptId);
final List<AdminUserDO> adminUserDOS = userMapper.selectList(wrapper);
adminUserDOS.forEach(item->{
DeptUserReqVO deptUserReqVO = new DeptUserReqVO();
deptUserReqVO.setId(item.getId());
deptUserReqVO.setRealName(item.getRealName());
deptUserReqVO.setAvatar(item.getAvatar());
final DeptDO dept = deptService.getDept(item.getDeptId());
if (dept != null) {
deptUserReqVO.setDeptName(dept.getName());
@ -692,13 +694,19 @@ public class AdminUserServiceImpl implements AdminUserService {
LogRecordContext.putVariable("user", user);
}
public void bindSocialUser(Long userId, AuthUser authUser) {
// SocialUserDO socialUser = new SocialUserDO();
// socialUser.setUserId(userId);
// socialUser.setType(SocialTypeEnum.WECHAT_MINI_APP.getType());
// socialUser.setOpenId(authUser.getUuid());
// socialUser.setUnionId(authUser.getToken().getUnionId());
// socialUserMapper.insert(socialUser);
@Override
public List<UserDeptVO> enterpriseManagerList() {
return adminUserMapper.enterpriseManagerList();
}
@Override
public List<DeptDO> deptByMenu() {
return adminUserMapper.deptByMenu();
}
@Override
public List<DeptDO> enterpriseManagerDeptList() {
return adminUserMapper.enterpriseManagerDeptList();
}
/**

26
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/util/EntityUtils.java

@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.system.annotation.PrimaryKey;
import com.baomidou.mybatisplus.annotation.TableName;
import java.lang.reflect.Field;
import java.time.LocalDateTime;
public class EntityUtils {
@ -53,5 +54,30 @@ public class EntityUtils {
}
return false; // 未找到
}
public static LocalDateTime[] getWeekDate(Integer selectWeek) {
//按时间查询
LocalDateTime now = LocalDateTime.now();
LocalDateTime[] dateList = new LocalDateTime[2];
switch (selectWeek) {
case 4:
dateList[0] = now.minusDays(3); // 三天前
break;
case 3:
dateList[0] = now.minusWeeks(1); // 一周前
break;
case 2:
dateList[0] = now.minusMonths(1); // 一月前
break;
case 1:
dateList[0] = now.minusYears(1); // 一年前
break;
}
dateList[1] = now;
return dateList;
}
}

24
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/util/SingleValueToListDeserializer.java

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.system.util;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
public class SingleValueToListDeserializer extends StdDeserializer<List<Long>> {
public SingleValueToListDeserializer() {
super(List.class);
}
@Override
public List<Long> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
// 如果是数组,直接解析
if (p.isExpectedStartArrayToken()) {
return new ObjectMapper().readValue(p, List.class);
}
// 如果是单个值,转为单元素列表
return Collections.singletonList(p.getLongValue());
}
}

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/util/StringUtil.java

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.system.util;
import java.time.LocalDateTime;
public class StringUtil {
/*
字符串截取, 超过长度用...

12
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/jobinfo/JobInfoMapper.xml

@ -1,12 +0,0 @@
<?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.jobinfo.JobInfoMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

2
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/notifyMessage/NotifyMessage.xml

@ -14,7 +14,7 @@
resultType="cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueVO">
select count(*) as value, template_id as label
from system_notify_message
where deleted = 0 and user_id = #{userId}
where deleted = 0 AND read_status = 0 AND user_id = #{userId}
group by template_id
</select>
</mapper>

3
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml

@ -11,8 +11,9 @@
<select id="expiredList"
resultType="cn.iocoder.yudao.module.system.controller.admin.qualification.vo.QualificationExpiredVO">
select
e.enterprises_name as name,
e.enterprises_name as enterpriseName,
eq.expiry_date as expiryDate,
eq.qualification_name as qualificationName,
e.user_id as userId,
e.id as enterpriseId
from

135
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml

@ -15,10 +15,12 @@
count(DISTINCT ei.id) as taskExecNum,
SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) AS taskFinishNum
FROM task_info t
left join enterprise_inspections ei on t.id = ei.task_id
left join inspections_log il on ei.id = il.inspections_id
left join enterprises e on e.id = ei.enterprise_id
left join tag_library tl on tl.id = t.task_type
left join enterprise_inspections ei on t.id = ei.task_id
left join inspections_log il on ei.id = il.inspections_id
left join enterprises e on e.id = ei.enterprise_id
left join tag_library tl on tl.id = t.task_type
left join system_users su on su.id = t.creator
left join system_dept sd on sd.id = su.dept_id
WHERE
t.deleted = 0 and ei.deleted = 0 and ei.status = 2
<if test="params.userId != null and params.userId != ''">
@ -27,15 +29,21 @@
<if test="params.priority != null and params.priority != ''">
AND t.priority = #{params.priority}
</if>
<if test="params.createDeptId != null and params.createDeptId != ''">
AND sd.id = #{params.createDeptId}
</if>
<if test="params.status != null and params.status != ''">
AND t.status = #{params.status}
</if>
<if test="params.deptId != null and params.deptId != ''">
AND e.department_id = #{params.deptId}
</if>
<if test="params.endTime != null and params.endTime != ''">
<if test="params.endTime != null">
AND t.end_date between #{params.startTime} and #{params.endTime}
</if>
<if test="params.region != null and params.region != ''">
AND e.region = #{params.region}
</if>
<if test="params.tagList != null and params. tagList != ''">
AND t.task_type = #{params.tagList}
</if>
@ -43,6 +51,8 @@
</select>
<select id="selectPageByEnterpriseId" resultType="cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO">
SELECT
t.*
@ -57,6 +67,7 @@
<select id="selectHomeGroupCount" resultType="cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeGroupCountVO">
SELECT
su.`real_name` as name,
su.`id` as userId,
SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) as finishCount,
COUNT(DISTINCT ei.id) as execCount,
round( SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) /COUNT(DISTINCT ei.id) * 100,1) as completionRate
@ -70,6 +81,12 @@
system_users su on su.id = ei.user_id
WHERE
ei.deleted = 0 AND e.deleted = 0 and ei.status = 2 and e.region = #{region}
<if test="time != null">
AND ei.create_time between
<foreach collection="time" item="item" separator="and" open="" close="">
#{item}
</foreach>
</if>
GROUP BY
ei.user_id
order by
@ -78,11 +95,11 @@
<select id="selectEnterpriseNum" resultType="cn.iocoder.yudao.module.system.controller.admin.home.vo.EnterpriseNumVO">
select
DATEDIFF(eq.expiry_date, NOW()) AS count,
e.enterprises_name as name
from
enterprise_qualification eq
LEFT JOIN
enterprises e ON eq.enterprise_id = e.id
e.enterprises_name as name,
su.real_name as realName
from enterprise_qualification eq
LEFT JOIN enterprises e ON eq.enterprise_id = e.id
LEFT JOIN system_users su on su.id = e.user_id
WHERE
e.deleted = 0 and eq.deleted = 0 AND eq.expiry_date &lt; DATE_ADD(NOW(), INTERVAL 16 DAY) and e.region = #{region}
<if test="deptId != null and deptId != ''">
@ -97,17 +114,22 @@
#{i}
</foreach>
</if>
ORDER BY count ASC ;
ORDER BY count ASC
<if test="size != null and size != ''">
limit #{size}
</if>
</select>
<select id="selectEnterpriseStatus" resultType="cn.iocoder.yudao.module.system.controller.admin.home.vo.EnterpriseNumVO">
SELECT
e.enterprises_name as name,
sd.name as deptName,
sum(CASE WHEN il.status=3 THEN 1 ELSE 0 END) as count
FROM
enterprise_inspections ei
LEFT JOIN inspections_log il on il.inspections_id = ei.id
LEFT JOIN enterprises e ON e.id = ei.enterprise_id
LEFT JOIN system_dept sd on sd.id = e.department_id
<where>
ei.deleted = 0 and il.status = 3 and e.region = #{region}
<if test="deptId != null and deptId != ''">
@ -120,7 +142,10 @@
</foreach>
</if>
</where>
GROUP BY e.enterprises_name order by count desc;
GROUP BY e.enterprises_name, sd.name order by count desc
<if test="size != null and size != ''">
limit #{size}
</if>
</select>
<select id="selectHomeExecFinish" resultType="cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeExecFinishVO">
@ -128,11 +153,11 @@
count( DISTINCT ei.id) as execCount,
SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) AS finishCount
FROM task_info t
left join enterprise_inspections ei on t.id = ei.task_id
left join inspections_log il on ei.id = il.inspections_id
left join enterprises e on e.id = ei.enterprise_id
left join task_tag tt on t.id = tt.task_id
left join tag_library tl on tl.id = tt.tag_id
left join enterprise_inspections ei on t.id = ei.task_id
left join inspections_log il on ei.id = il.inspections_id
left join enterprises e on e.id = ei.enterprise_id
left join task_tag tt on t.id = tt.task_id
left join tag_library tl on tl.id = tt.tag_id
WHERE
t.deleted = 0 and ei.deleted = 0 and ei.status = 2 and e.region = #{region}
<if test="deptId != null and deptId != ''">
@ -146,5 +171,81 @@
</if>
GROUP By t.id
</select>
<select id="appSelectCreateDept"
resultType="cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.LabelValueLongVO">
SELECT
DISTINCT sd.id as value,
sd.name as label
FROM task_info t
left join enterprise_inspections ei on t.id = ei.task_id
left join enterprises e on e.id = ei.enterprise_id
left join system_users su on su.id = t.creator
left join system_dept sd on sd.id = su.dept_id
WHERE
t.deleted = 0 and ei.deleted = 0 and ei.status = 2
<if test="userId != null and userId != ''">
AND ei.user_id = #{userId}
</if>
<if test="deptId != null and deptId != ''">
AND e.department_id = #{deptId}
</if>
</select>
<select id="taskNumDoing"
resultType="cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeGroupMonthVO">
SELECT
dates.month,
COALESCE(COUNT(DISTINCT stats.task_id), 0) AS taskCount,
COALESCE(COUNT(DISTINCT stats.inspection_id), 0) AS inspectionCount
FROM (
-- 手动生成近6个月的月份
SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 5 MONTH), '%Y-%m') AS month
UNION SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 4 MONTH), '%Y-%m')
UNION SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 3 MONTH), '%Y-%m')
UNION SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 2 MONTH), '%Y-%m')
UNION SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 MONTH), '%Y-%m')
UNION SELECT DATE_FORMAT(NOW(), '%Y-%m')
) dates
LEFT JOIN (
-- 实际数据统计子查询
SELECT
DATE_FORMAT(ei.create_time, '%Y-%m') AS month,
t.id AS task_id,
ei.id AS inspection_id
FROM
task_info t
LEFT JOIN enterprise_inspections ei ON t.id = ei.task_id
LEFT JOIN enterprises e ON e.id = ei.enterprise_id
WHERE
t.deleted = 0
AND ei.deleted = 0
AND ei.status = 2
<if test="region != null and region != ''">
AND e.region = #{region}
</if>
AND ei.create_time >= DATE_SUB(NOW(), INTERVAL 6 MONTH)
) stats ON dates.month = stats.month
GROUP BY dates.month
ORDER BY dates.month
</select>
<select id="selectCorrectionCount"
resultType="java.lang.Long">
select
count(*)
from inspections_log il
left join enterprise_inspections ei on il.inspections_id = ei.id
where ei.deleted = 0 and il.status = 3
<if test="region != null and region != ''">
and ei.enterprise_id in (select id from enterprises where region = #{region})
</if>
<if test="time != null">
and il.create_time between
<foreach collection="time" item="item" separator="and" open="" close="">
#{item}
</foreach>
</if>
<if test="userId != null and userId != ''">
and il.creator = #{userId}
</if>
</select>
</mapper>

45
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/users/AdminUser.xml

@ -0,0 +1,45 @@
<?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.user.AdminUserMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="enterpriseManagerList"
resultType="cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserDeptVO">
select
DISTINCT su.id as userId, su.real_name as realName, sd.name as deptName
FROM system_users su
LEFT JOIN enterprises e on su.id = e.user_id
LEFT JOIN system_dept sd on su.dept_id = sd.id
WHERE
su.real_name is not NULL and su.deleted = 0 and sd.deleted = 0
</select>
<select id="deptByMenu" resultType="cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO">
select
DISTINCT sd.id, sd.name
FROM task_info t
LEFT JOIN system_users su on su.id = t.creator
LEFT JOIN system_dept sd on su.dept_id = sd.id
WHERE su.deleted = 0 and sd.deleted = 0 and t.deleted = 0
</select>
<select id="enterpriseManagerDeptList"
resultType="cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO">
select
DISTINCT sd.*
FROM enterprises e
LEFT JOIN system_users su on su.id = e.user_id
LEFT JOIN system_dept sd on e.department_id = sd.id
WHERE
su.real_name is not NULL and su.deleted = 0 and sd.deleted = 0
</select>
</mapper>
Loading…
Cancel
Save