diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index 8fa1964..5effb1e 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java @@ -191,4 +191,19 @@ public interface ErrorCodeConstants { ErrorCode ENTERPRISE_INSPECTIONS_STATUS_ERROR = new ErrorCode(1-003-002-000, "此状态下,不能转发执法任务"); + ErrorCode ENTERPRISE_INSPECTIONS_STATUS_ERROR2 = new ErrorCode(1-003-002-001, "任务不能转给自己"); + + ErrorCode SIGN_IN_LOG_ERROR = new ErrorCode(1-003-005-001, "打卡记录不存在"); + + ErrorCode SIGN_IN_LOG_ERROR2 = new ErrorCode(1-003-005-001, "已经打卡,不能重复打卡"); + + ErrorCode SIGN_IN_LOG_ERROR3 = new ErrorCode(1-003-005-002, "此状态不能打卡"); + + ErrorCode SIGN_IN_LOG_ERROR4 = new ErrorCode(1-003-005-003, "执行人还未打卡"); + + ErrorCode SIGN_IN_LOG_ERROR5 = new ErrorCode(1-003-005-003, "只有当前企业执行人才能提交审核"); + + ErrorCode SIGN_IN_LOG_ERROR6 = new ErrorCode(1-003-005-003, "超过2人才能打开"); + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java index 9f96fe4..0b356e0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java @@ -1,10 +1,15 @@ package cn.iocoder.yudao.module.system.controller.admin.auth; +import cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.StrUtil; +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.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; import cn.iocoder.yudao.framework.security.config.SecurityProperties; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; @@ -12,11 +17,14 @@ 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.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.enums.logger.LoginLogTypeEnum; import cn.iocoder.yudao.module.system.service.auth.AdminAuthService; +import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService; import cn.iocoder.yudao.module.system.service.permission.MenuService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.permission.RoleService; @@ -28,6 +36,7 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -38,10 +47,13 @@ import javax.validation.Valid; import java.util.Collections; import java.util.List; import java.util.Set; +import java.util.concurrent.TimeUnit; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.AUTH_THIRD_LOGIN_NOT_BIND; @Tag(name = "管理后台 - 认证") @RestController @@ -70,6 +82,12 @@ public class AuthController { private SocialUserService socialUserService; + @Resource + private StringRedisTemplate stringRedisTemplate; + + @Resource + private OAuth2TokenService oAuth2TokenService; + @PostMapping("/login") @PermitAll @Operation(summary = "使用账号密码登录") @@ -99,7 +117,7 @@ public class AuthController { } @PermitAll - @PostMapping("/web_login") + @PostMapping("/web_code_login") @Operation(summary = "后台调用小程序微信扫码登录") public CommonResult webLogin(@RequestBody @Valid SocialWxQrcodeReqDTO reqVO) { return success(socialClientService.getWxaQrcode(reqVO)); @@ -198,4 +216,45 @@ public class AuthController { return success(authService.socialLogin(reqVO)); } + + @PostMapping("/social-login-openid") + @PermitAll + @Operation(summary = "社交快捷登录,使用 code 授权码", description = "适合未登录的用户,但是社交账号已绑定用户") + public CommonResult socialQuickLoginOpenId(@RequestBody AuthSocialLoginReqVO reqVO) { + OAuth2AccessTokenDO accessToken = oAuth2TokenService.getAccessToken(reqVO.getOpenid()); + Long userId = accessToken.getUserId(); + List socialUserList = socialUserService.getSocialUserList(userId, UserTypeEnum.MEMBER.getValue()); + //判断是否为对象空 + if(!CollUtil.isEmpty(socialUserList) && StrUtil.isNotEmpty(reqVO.getCode())){ + stringRedisTemplate.opsForValue().set(reqVO.getCode(), JsonUtils.toJsonString(socialUserList.get(0)),10, TimeUnit.MINUTES); + return success(true); + } + return success(false); + } + + @PostMapping("/social-qr-login-openid") + @PermitAll + @Operation(summary = "社交快捷登录,使用 code 授权码", description = "适合未登录的用户,但是社交账号已绑定用户") + public CommonResult qrLoginCode(@RequestBody AuthSocialLoginReqVO reqVO) { + String json = stringRedisTemplate.opsForValue().get(reqVO.getCode()); + + //判断是否为对象空 + if(StrUtil.isNotEmpty(json)){ + SocialUserDO socialUserDO = JsonUtils.parseObject(json, SocialUserDO.class); + AuthSocialLoginReqVO authSocialLoginReqVO=new AuthSocialLoginReqVO(); + authSocialLoginReqVO.setCode(socialUserDO.getCode()); + authSocialLoginReqVO.setType(socialUserDO.getType()); + authSocialLoginReqVO.setState(socialUserDO.getState()); + authSocialLoginReqVO.setOpenid(socialUserDO.getOpenid()); + AuthLoginRespVO authLoginRespVO = authService.socialLogin(authSocialLoginReqVO); + if(ObjUtil.isNotEmpty(authLoginRespVO)){ + stringRedisTemplate.delete(reqVO.getCode()); + return success(authLoginRespVO); + } + + } + return success(null); + + } + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthSocialLoginReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthSocialLoginReqVO.java index 0cacb6f..ad5670e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthSocialLoginReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthSocialLoginReqVO.java @@ -34,4 +34,7 @@ public class AuthSocialLoginReqVO { @Schema(description = "用户类型" ) private Integer userType; + @Schema(description = "社交 openid", example = "oz-Jdt0kd_jdhUxJHQdBJMlOFN7w") + private String openid; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java index 85e078d..5165da1 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java @@ -85,6 +85,13 @@ public class EnterpriseController { return success(enterpriseService.createEnterprise(createReqVO)); } + @PostMapping("/pccreate") + @Operation(summary = "PC端创建企业") +// @PreAuthorize("@ss.hasPermission('system:enterprise:create')") + public CommonResult pccreateEnterprise(@RequestBody EnterpriseSaveReqVO createReqVO) { + return success(enterpriseService.pccreateEnterprise(createReqVO)); + } + @PutMapping("/update") @Operation(summary = "更新企业") // @PreAuthorize("@ss.hasPermission('system:enterprise:update')") @@ -139,7 +146,6 @@ public class EnterpriseController { pageResult.getList().forEach(item->{ item.setInviterName(adminUserService.getUser(Long.valueOf(item.getUserId())).getNickname()); }); - return success(BeanUtils.toBean(pageResult, EnterpriseRespVO.class)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java index 18ce982..24f3fa6 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java @@ -17,6 +17,10 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ToString(callSuper = true) public class EnterprisePageReqVO extends PageParam { + + @Schema(description = "ID", example = "10990") + private Long Id; + @Schema(description = "所属部门ID", example = "10990") private Long departmentId; @@ -35,6 +39,10 @@ public class EnterprisePageReqVO extends PageParam { @Schema(description = "企业地址") private String address; + @Schema(description = "企业状态") + private Long enterprisesStatus; + + @Schema(description = "环保负责人姓名", example = "张三") private String contactName; @@ -54,6 +62,9 @@ public class EnterprisePageReqVO extends PageParam { @Schema(description = "企业经纬度") private String gpsLocation; + @Schema(description = "签到半径") + private String signRadius; + @Schema(description = "创建人") private String create; @@ -64,9 +75,15 @@ public class EnterprisePageReqVO extends PageParam { @Schema(description = "修改人") private String updater; +// @Schema(description = "管理部门", example = "26433") +// private Long deptId; + @Schema(description = "邀请人") private String inviterName; + @Schema(description = "邀请人") + private List ids; + @Schema(description = "根据标签类型过滤") private List tagList; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java index 34b0106..13e3a2d 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java @@ -44,6 +44,12 @@ public class EnterpriseRespVO { @ExcelProperty("企业地址") private String address; + + @Schema(description = "企业状态") + @ExcelProperty("企业状态") + private Long enterprisesStatus; + + @Schema(description = "环保负责人姓名", example = "张三") @ExcelProperty("环保负责人姓名") private String contactName; @@ -68,6 +74,10 @@ public class EnterpriseRespVO { @ExcelProperty("企业经纬度") private String gpsLocation; + @Schema(description = "签到半径") + @ExcelProperty("签到半径") + private String signRadius; + @Schema(description = "创建人") @ExcelProperty("创建人") private String createBy; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java index 94374e7..eb2c43b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.enterprise.vo; +import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -34,6 +35,10 @@ public class EnterpriseSaveReqVO { @Schema(description = "企业地址") private String address; + @Schema(description = "企业状态") + private Long enterprisesStatus; + + @Schema(description = "环保负责人姓名", example = "张三") private String contactName; @@ -52,6 +57,10 @@ public class EnterpriseSaveReqVO { @Schema(description = "企业经纬度") private String gpsLocation; + + @Schema(description = "签到半径") + private String signRadius; + @Schema(description = "创建人") private String createBy; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java index 34f8903..5227328 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; @@ -46,11 +47,18 @@ public class EnterpriseInspectionsController { } @PostMapping("/passOn") - @Operation(summary = "执法记录转交") - @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:create')") + @Operation(summary = "执法记录变更") + @PreAuthorize("@ss.hasPermission('system:enterpriseinspections:index')") public CommonResult passOn(@Valid @RequestBody PassOnSaveVO passOnSaveVO) { enterpriseInspectionsService.passOn(passOnSaveVO); - return success("转发成功"); + return success("添加成功"); + } + + @GetMapping("/changeSelectUser") + @Operation(summary = "根据部门返回部门下的其他人员") +// @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:create')") + public CommonResult> changeSelectUser(Long deptId) { + return success(enterpriseInspectionsService.changeSelectUser(deptId)); } @PutMapping("/update") @@ -79,14 +87,34 @@ public class EnterpriseInspectionsController { return success(BeanUtils.toBean(enterpriseInspections, EnterpriseInspectionsRespVO.class)); } + @GetMapping("/getEnterpriseInspectionsByTaskId") + @Operation(summary = "根据任务id查询自己偶发") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") + public CommonResult getEnterpriseInspectionsByTaskId(@RequestParam("id") Long id) { + EnterpriseInspectionsDO enterpriseInspections = enterpriseInspectionsService.getEnterpriseInspections(id); + return success(BeanUtils.toBean(enterpriseInspections, EnterpriseInspectionsRespVO.class)); + } + @GetMapping("/page") @Operation(summary = "获得企业检查记录表,用于记录与企业相关的环保检查信息。分页") - @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") +// @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") public CommonResult> getEnterpriseInspectionsPage(@Valid EnterpriseInspectionsPageReqVO pageReqVO) { PageResult pageResult = enterpriseInspectionsService.getEnterpriseInspectionsPage(pageReqVO); return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class)); } + //listByUserIdAndTaskName + @GetMapping("/getListByUserIdAndTaskName") + @Operation(summary = "PC端获得企业检查记录表,用于记录与企业相关的环保检查信息。分页") + @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") + public CommonResult> getListByUserIdAndTaskName(@RequestParam("userId") Long userId, + @RequestParam("taskName") String taskName) { + List pageResult = enterpriseInspectionsService.getListByUserIdAndTaskName(userId, taskName); + return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class)); + } + + @GetMapping("/pcpage") @Operation(summary = "PC端获得企业检查记录表,用于记录与企业相关的环保检查信息。分页") @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java index 7fc1dc5..2b56c17 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java @@ -21,8 +21,32 @@ public class EnterpriseInspectionsPageReqVO extends PageParam { @Schema(description = "企业ID", example = "27002") private Long enterpriseId; + @Schema(description = "用户id", example = "1") + private Long userId; + + @Schema(description = "企业名称", example = "27002") + private String enterpriseName; + + @Schema(description = "任务名称", example = "1") + private String taskName ; + + @Schema(description = "企业名称", example = "27002") + private List enterpriseList; + + @Schema(description = "任务名称", example = "1") + private List taskList; + @Schema(description = "创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] createTime; -} \ No newline at end of file + @Schema(description = "任务状态", example = "1") + private Integer inspectionsStatus; + + @Schema(description = "按部门") + private Long departmentId; + @Schema(description = "按部门查询的用户id集合") + private List userIds; + + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java index 95e0c16..ec089b4 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java @@ -24,6 +24,10 @@ public class EnterpriseInspectionsRespVO { @ExcelProperty("任务名称") private String taskName; + @Schema(description = "任务编码", example = "29150") + @ExcelProperty("任务编码") + private String taskNumber; + @Schema(description = "企业ID", example = "27002") @ExcelProperty("企业ID") private Long enterpriseId; @@ -32,6 +36,10 @@ public class EnterpriseInspectionsRespVO { @ExcelProperty("企业名称") private String enterpriseName; + @Schema(description = "企业地址", example = "27002") + @ExcelProperty("企业地址") + private String enterpriseAddress; + @Schema(description = "任务类型", example = "27002") @ExcelProperty("任务类型") private List tagList; @@ -40,6 +48,8 @@ public class EnterpriseInspectionsRespVO { @ExcelProperty("进度状态") private String inspectionStatus; + + @Schema(description = "执法部门", example = "一大队") @ExcelProperty("执法部门") private String department; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/SelectUserChangeVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/SelectUserChangeVO.java new file mode 100644 index 0000000..c045328 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/SelectUserChangeVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Data +public class SelectUserChangeVO { + @Schema(description = "用户ID", example = "3876") + private Long userId; + @Schema(description = "用户姓名", example = "29150") + private String realName; + @Schema(description = "部门名称", example = "29150") + private List roleName; + @Schema(description = "部门名称", example = "29150") + private String avatar; + + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java index 53cc0f6..8beddf5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java @@ -1,6 +1,9 @@ package cn.iocoder.yudao.module.system.controller.admin.inspectionslog; +import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.PassOnSaveVO; +import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; @@ -34,27 +37,44 @@ import javax.validation.Valid; @RestController @RequestMapping("/system/inspections-log") @Validated +@Slf4j public class InspectionsLogController { @Resource private InspectionsLogService inspectionsLogService; + @Resource + private FileInfoService fileInfoService; + + @PostMapping("/signIn") + @Operation(summary = "创建打卡") + public CommonResult createInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) { + inspectionsLogService.createInspectionsLog(createReqVO); + return success("打卡成功"); + } - @PostMapping("/create") - @Operation(summary = "创建检查结果日志") - @PreAuthorize("@ss.hasPermission('system:inspections-log:create')") - public CommonResult createInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) { - return success(inspectionsLogService.createInspectionsLog(createReqVO)); + @PutMapping("/confirmSignIn") + @Operation(summary = "确认打卡") + public CommonResult confirmSignIn(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) { + log.info("createReqVO:{}", createReqVO); + inspectionsLogService.confirmSignIn(createReqVO); + return success("打卡成功"); + } + + @GetMapping("/signInList") + @Operation(summary = "打卡记录") +// @PreAuthorize("@ss.hasPermission('system:inspections-log:create')") + public CommonResult> signInList(Long inspectionsId) { + return success(inspectionsLogService.signInList(inspectionsId)); } @PutMapping("/cooperateWithSignIn") - @Operation(summary = "协同人员打开") + @Operation(summary = "协同人员打卡") @PreAuthorize("@ss.hasPermission('system:inspections-log:update')") public CommonResult cooperateWithSignIn(Long inspectionsLogId) { inspectionsLogService.cooperateWithSignIn(inspectionsLogId); return success(true); } - @PutMapping("/update") @Operation(summary = "更新检查结果日志") @PreAuthorize("@ss.hasPermission('system:inspections-log:update')") @@ -81,9 +101,17 @@ public class InspectionsLogController { return success(BeanUtils.toBean(inspectionsLog, InspectionsLogRespVO.class)); } - @GetMapping("/page") + @PostMapping("/inspectionsAudit") + @Operation(summary = "审核") + @PreAuthorize("@ss.hasPermission('system:enterpriseinspections:index')") + public CommonResult inspectionsAudit(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) { + inspectionsLogService.inspectionsAudit(createReqVO); + return success("审核成功"); + } + + @GetMapping("/appList") @Operation(summary = "获得检查结果日志分页") - @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") +// @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") public CommonResult> getInspectionsLogPage(@Valid InspectionsLogPageReqVO pageReqVO) { PageResult pageResult = inspectionsLogService.getInspectionsLogPage(pageReqVO); return success(BeanUtils.toBean(pageResult, InspectionsLogRespVO.class)); @@ -94,6 +122,15 @@ public class InspectionsLogController { @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") public CommonResult> getInspectionsLogList(@Valid InspectionsLogPageReqVO pageReqVO) { List list = inspectionsLogService.list(pageReqVO); + + if (list != null && list.size() > 0) { + list.forEach(item->{ + //图片相关 + final List> fileList = fileInfoService.getFileList("644", "2", item.getId().toString()); + item.setFileList(fileList); + }); + } + return success(BeanUtils.toBean(list, InspectionsLogRespVO.class)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogAppListVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogAppListVO.java new file mode 100644 index 0000000..abcddd9 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogAppListVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo; + +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +@Data +public class InspectionsLogAppListVO { + + private Long userId; + + private String realName; + + private String deptName; + + private String avtar; + + private LocalDateTime time; + + private Boolean isInspect; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java index a7b3a03..82a1ad5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java @@ -21,8 +21,8 @@ public class InspectionsLogPageReqVO extends PageParam { @Schema(description = "检查状态1.签到2.通过.3整改", example = "2") private Integer status; - @Schema(description = "检查人员签到位置信息,格式:经纬度") - private String gpsLocation; + @Schema(description = "默认状态", example = "2") + private Integer mrStatus; @Schema(description = "反馈信息") private String feedBack; @@ -37,4 +37,4 @@ public class InspectionsLogPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] createTime; -} \ No newline at end of file +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java index b1aa3e1..2f47c5e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java @@ -27,10 +27,6 @@ public class InspectionsLogRespVO { @DictFormat("Inspections_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 private Integer status; - @Schema(description = "检查人员签到位置信息,格式:经纬度") - @ExcelProperty("检查人员签到位置信息,格式:经纬度") - private String gpsLocation; - @Schema(description = "反馈信息") @ExcelProperty("反馈信息") private String feedBack; @@ -47,4 +43,12 @@ public class InspectionsLogRespVO { @ExcelProperty("创建时间") private LocalDateTime createTime; -} \ No newline at end of file + @Schema(description = "相关文件") + private List> fileList; + + @Schema(description = "执法人员列表", example = "李四") + @ExcelProperty("执法人员列表") + private List userList; + + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java index 404ff66..a6ee30d 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java @@ -10,7 +10,7 @@ import java.util.*; @Data public class InspectionsLogSaveReqVO { - @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2308") + @Schema(description = "主键", example = "2308") private Long id; @Schema(description = "检查记录id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18375") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/maxkb/MaxkbController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/maxkb/MaxkbController.java new file mode 100644 index 0000000..46ed0fd --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/maxkb/MaxkbController.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.system.controller.admin.maxkb; + +import cn.iocoder.yudao.module.system.controller.admin.maxkb.vo.MaxkbdocumentVo; +import cn.iocoder.yudao.module.system.service.maxkb.MaxkbApiService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.annotation.security.PermitAll; + +@Tag(name = "管理后台 - maxkb") +@RestController +@RequestMapping("/system/maxkb") +@Validated +@Slf4j +public class MaxkbController { + @Resource + MaxkbApiService maxkbApiService; + + @PostMapping("/pushWeb") + @PermitAll + @Operation(summary = "导入知识库") + public void pushWebUrl(MaxkbdocumentVo maxkbdocumentVo) { + maxkbApiService.pushWebUrl(maxkbdocumentVo); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/maxkb/vo/MaxkbdocumentVo.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/maxkb/vo/MaxkbdocumentVo.java new file mode 100644 index 0000000..dbbf3d7 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/maxkb/vo/MaxkbdocumentVo.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.system.controller.admin.maxkb.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.util.List; + +@Data +public class MaxkbdocumentVo { + public String[] source_url_list; + public String selector; + @JsonIgnore + public String id; +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/SignInLogController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/SignInLogController.java new file mode 100644 index 0000000..54ede80 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/SignInLogController.java @@ -0,0 +1,96 @@ +package cn.iocoder.yudao.module.system.controller.admin.signinlog; + +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + + +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.system.controller.admin.signinlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.signinlog.SignInLogDO; +import cn.iocoder.yudao.module.system.service.signinlog.SignInLogService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "管理后台 - 协调人员打卡记录") +@RestController +@RequestMapping("/system/sign-in-log") +@Validated +public class SignInLogController { + + @Resource + private SignInLogService signInLogService; + + @PostMapping("/signIn") + @Operation(summary = "创建协调人员打卡记录") + @PreAuthorize("@ss.hasPermission('system:sign-in-log:create')") + public CommonResult createSignInLog(@Valid @RequestBody SignInLogSaveReqVO createReqVO) { + return success(signInLogService.createSignInLog(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新协调人员打卡记录") + @PreAuthorize("@ss.hasPermission('system:sign-in-log:update')") + public CommonResult updateSignInLog(@Valid @RequestBody SignInLogSaveReqVO updateReqVO) { + signInLogService.updateSignInLog(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除协调人员打卡记录") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:sign-in-log:delete')") + public CommonResult deleteSignInLog(@RequestParam("id") Long id) { + signInLogService.deleteSignInLog(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得协调人员打卡记录") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:sign-in-log:query')") + public CommonResult getSignInLog(@RequestParam("id") Long id) { + SignInLogDO signInLog = signInLogService.getSignInLog(id); + return success(BeanUtils.toBean(signInLog, SignInLogRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得协调人员打卡记录分页") + @PreAuthorize("@ss.hasPermission('system:sign-in-log:query')") + public CommonResult> getSignInLogPage(@Valid SignInLogPageReqVO pageReqVO) { + PageResult pageResult = signInLogService.getSignInLogPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, SignInLogRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出协调人员打卡记录 Excel") + @PreAuthorize("@ss.hasPermission('system:sign-in-log:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportSignInLogExcel(@Valid SignInLogPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = signInLogService.getSignInLogPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "协调人员打卡记录.xls", "数据", SignInLogRespVO.class, + BeanUtils.toBean(list, SignInLogRespVO.class)); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogPageReqVO.java new file mode 100644 index 0000000..a9e558d --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogPageReqVO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.system.controller.admin.signinlog.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 协调人员打卡记录分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class SignInLogPageReqVO extends PageParam { + + @Schema(description = "执法记录id", example = "19972") + private Long insId; + + @Schema(description = "用户id", example = "30997") + private Long userId; + + @Schema(description = "用户名称", example = "张三") + private String realName; + + /** + * 检查人员签到位置信息,格式:经纬度 + */ + private String gpsLocation; + + //知否是执行人 + private Boolean isInspect; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogRespVO.java new file mode 100644 index 0000000..eb593b7 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogRespVO.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.system.controller.admin.signinlog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 协调人员打卡记录 Response VO") +@Data +@ExcelIgnoreUnannotated +public class SignInLogRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "10998") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "执法记录id", example = "19972") + @ExcelProperty("执法记录id") + private Long insId; + + @Schema(description = "用户id", example = "30997") + @ExcelProperty("用户id") + private Long userId; + + @Schema(description = "用户名称", example = "张三") + @ExcelProperty("用户名称") + private String realName; + + /** + * 检查人员签到位置信息,格式:经纬度 + */ + private String gpsLocation; + + //知否是执行人 + private Boolean isInspect; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogSaveReqVO.java new file mode 100644 index 0000000..f8c2133 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogSaveReqVO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.system.controller.admin.signinlog.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; + +@Schema(description = "管理后台 - 协调人员打卡记录新增/修改 Request VO") +@Data +public class SignInLogSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "10998") + private Long id; + + @Schema(description = "执法记录id", example = "19972") + private Long insId; + + @Schema(description = "用户id", example = "30997") + private Long userId; + + @Schema(description = "用户名称", example = "张三") + private String realName; + + /** + * 检查人员签到位置信息,格式:经纬度 + */ + private String gpsLocation; + + //知否是执行人 + private Boolean isInspect; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java index 6ff7364..1e65152 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java @@ -1,11 +1,28 @@ package cn.iocoder.yudao.module.system.controller.admin.taskinfo; +import cn.hutool.core.collection.CollUtil; +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.enterpriseinspections.vo.EnterpriseInspectionsPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.EnterpriseInspectionsSaveReqVO; +import cn.iocoder.yudao.module.system.controller.admin.tasktag.vo.TaskTagPageReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; +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.taglibrary.TagLibraryDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; import cn.iocoder.yudao.module.system.service.dept.DeptService; +import cn.iocoder.yudao.module.system.service.enterprise.EnterpriseService; +import cn.iocoder.yudao.module.system.service.enterpriseinspections.EnterpriseInspectionsService; +import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService; +import cn.iocoder.yudao.module.system.service.tasktag.TaskTagService; 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.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; @@ -15,6 +32,7 @@ import io.swagger.v3.oas.annotations.Operation; import java.util.*; import java.io.IOException; +import java.util.stream.Collectors; import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -35,6 +53,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +@Slf4j @Tag(name = "管理后台 - 任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。") @RestController @RequestMapping("/system/task-info") @@ -47,7 +66,16 @@ public class TaskInfoController { private AdminUserService adminUserService; @Resource private DeptService deptService; - + @Resource + private EnterpriseInspectionsService enterpriseInspectionsService; + @Resource + private TaskTagService taskTagService; + @Resource + private EnterpriseService enterpriseService; + @Resource + private TagLibraryService tagLibraryService; + @Resource + private AdminUserMapper adminUserMapper; @PostMapping("/create") @Operation(summary = "创建任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。") @@ -60,6 +88,19 @@ public class TaskInfoController { @Operation(summary = "更新任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。") @PreAuthorize("@ss.hasPermission('system:task-info:update')") public CommonResult updateTaskInfo(@Valid @RequestBody TaskInfoSaveReqVO updateReqVO) { + List eid=updateReqVO.getEnterpriseIds(); + if (eid == null || eid.isEmpty()) { + return success(false); + } + int del=enterpriseInspectionsService.deleteEnterpriseInspectionsTaskId(updateReqVO.getId()); + EnterpriseInspectionsSaveReqVO enterpriseInspectionsSaveReqVO=new EnterpriseInspectionsSaveReqVO(); + for(Long enterprise:eid) { + enterpriseInspectionsSaveReqVO.setTaskId(updateReqVO.getId()); + enterpriseInspectionsSaveReqVO.setEnterpriseId(enterprise); + if(del>0){ + enterpriseInspectionsService.createEnterpriseInspections(enterpriseInspectionsSaveReqVO); + } + } taskInfoService.updateTaskInfo(updateReqVO); return success(true); } @@ -79,7 +120,56 @@ public class TaskInfoController { @PreAuthorize("@ss.hasPermission('system:task-info:query')") public CommonResult getTaskInfo(@RequestParam("id") Long id) { TaskInfoDO taskInfo = taskInfoService.getTaskInfo(id); + //获取任务包含企业 + EnterpriseInspectionsPageReqVO enterpriseInspectionsPageReqVO=new EnterpriseInspectionsPageReqVO(); + enterpriseInspectionsPageReqVO.setTaskId(taskInfo.getId()); + List enterpriseInspectionsides=enterpriseInspectionsService.getEnterpriseInspectionsList(enterpriseInspectionsPageReqVO); + EnterprisePageReqVO enterprisePageReqVO=new EnterprisePageReqVO(); + List longs = CollectionUtils.convertList(enterpriseInspectionsides, EnterpriseInspectionsDO::getEnterpriseId); + enterprisePageReqVO.setIds(longs); + List enterpriseIdes=enterpriseService.getEnterpriseList(enterprisePageReqVO); + TaskInfoRespVO bean = BeanUtils.toBean(taskInfo, TaskInfoRespVO.class); + bean.setEnterpriseIdes(enterpriseIdes); + + //获取任务标签 + TaskTagPageReqVO taskTagPageReqVO=new TaskTagPageReqVO(); + taskTagPageReqVO.setTaskId(taskInfo.getId()); + List taskTagides=taskTagService.getTaskTagList(taskTagPageReqVO); + + List taglongs = CollectionUtils.convertList(enterpriseInspectionsides, EnterpriseInspectionsDO::getEnterpriseId); + + + bean.setTaskTagIdes(taskTagides); + + return success(bean); + + } + + + @GetMapping("/appGet") + @Operation(summary = "获得任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:task-info:query')") + public CommonResult appGet(@RequestParam("id") Long id) { + TaskInfoDO taskInfo = taskInfoService.getTaskInfo(id); + if (taskInfo != null) { + //标签 + final List tagLibraryDOS = tagLibraryService.listByTaskId(taskInfo.getId()); + if (CollUtil.isNotEmpty(tagLibraryDOS)) { + taskInfo.setTagList(tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList())); + } + //发布部门 + final Long userId = Long.valueOf(taskInfo.getCreator()); + AdminUserDO user = adminUserMapper.selectById(userId); + if (user != null && user.getDeptId() != null) { + final DeptDO dept = deptService.getDept(user.getDeptId()); + taskInfo.setDeptName(dept.getName()); + } + + } + return success(BeanUtils.toBean(taskInfo, TaskInfoRespVO.class)); + } @GetMapping("/page") @@ -89,9 +179,19 @@ public class TaskInfoController { PageResult pageResult = taskInfoService.getTaskInfoPage(pageReqVO); AdminUserDO user = adminUserService.getUser(SecurityFrameworkUtils.getLoginUserId()); DeptDO dep= deptService.getDept( user.getDeptId()); + EnterpriseInspectionsPageReqVO enterpriseInspectionsPageReqVO=new EnterpriseInspectionsPageReqVO(); + pageResult.getList().forEach(item->{ item.setPublishDep(dep.getName()); item.setCreateName(adminUserService.getUser(Long.valueOf(item.getCreator())).getRealName()); + enterpriseInspectionsPageReqVO.setTaskId(item.getId()); + List enterpriseInspectionsides=enterpriseInspectionsService.getEnterpriseInspectionsList(enterpriseInspectionsPageReqVO); + EnterprisePageReqVO enterprisePageReqVO=new EnterprisePageReqVO(); + List longs = CollectionUtils.convertList(enterpriseInspectionsides, EnterpriseInspectionsDO::getEnterpriseId); + enterprisePageReqVO.setIds(longs); + List enterpriseIdes=enterpriseService.getEnterpriseList(enterprisePageReqVO); + item.setEnterpriseIdes(enterpriseIdes); + }); return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class)); } @@ -110,6 +210,14 @@ public class TaskInfoController { return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class)); } + @GetMapping("/appPage") + @Operation(summary = "获得任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。分页") + @PreAuthorize("@ss.hasPermission('system:task-info:query')") + public CommonResult> appPage(@Valid TaskInfoPageReqVO pageReqVO) { + PageResult pageResult = taskInfoService.getTaskInfoAppPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class)); + } + @GetMapping("/export-excel") @Operation(summary = "导出任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。 Excel") @PreAuthorize("@ss.hasPermission('system:task-info:export')") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java index 9f08545..458f8bc 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo; +import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; import lombok.*; import java.time.LocalDate; @@ -63,4 +64,18 @@ public class TaskInfoPageReqVO extends PageParam { @Schema(description = "总共几步") private Integer taskTotal; + + @Schema(description = "企业集合", example = "1") + private List enterpriseInspectionsIdes; + + /* + 小程序查询用 + */ + + @Schema(description = "任务标签集合", example = "1") + private List tagList; + + @Schema(description = "按时间查询", example = "1") + private Integer selectWeek; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java index 8201a65..b67f19d 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java @@ -1,5 +1,9 @@ package cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo; +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.taglibrary.TagLibraryDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -21,6 +25,7 @@ public class TaskInfoRespVO { @ExcelProperty("任务ID,主键") private Long id; + private Integer reverseStauts; //任务编号 @Schema(description = "任务编号", example = "你猜") @@ -94,6 +99,35 @@ public class TaskInfoRespVO { @ExcelProperty("发布部门") private String publishDep; + @Schema(description = "企业集合") + @ExcelProperty("企业集合") + private List enterpriseIdes; + + @Schema(description = "标签集合") + @ExcelProperty("标签集合") + private List taskTagIdes; + + @Schema(description = "标签集合") + @ExcelProperty("标签集合") + private List tagLibraryIds; + + //任务总数 + private Integer taskExecNum; + + //已完成数 + private Integer taskFinishNum; + + //任务标签 + private List tagList; + + //发布部门 + private String deptName; + + + + + + diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoSaveReqVO.java index 573d6d0..7d28ab0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoSaveReqVO.java @@ -16,6 +16,9 @@ public class TaskInfoSaveReqVO { @Schema(description = "任务ID,主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4541") private Long id; + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED) + private String taskNumber; + @Schema(description = "任务标题", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "任务标题不能为空") private String title; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java index 3b89970..f559924 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java @@ -122,6 +122,22 @@ public class UserController { pageResult.getTotal())); } + + @GetMapping("/pcpage") + @Operation(summary = "获得用户分页列表") + public CommonResult> getPcUserPage(@Valid UserPageReqVO pageReqVO) { + // 获得用户分页列表 + PageResult pageResult = userService.getUserPage(pageReqVO); + if (CollUtil.isEmpty(pageResult.getList())) { + return success(new PageResult<>(pageResult.getTotal())); + } + // 拼接数据 + Map deptMap = deptService.getDeptMap( + convertList(pageResult.getList(), AdminUserDO::getDeptId)); + return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap), + pageResult.getTotal())); + } + @GetMapping({"/list-all-simple", "/simple-list"}) @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项") public CommonResult> getSimpleUserList() { @@ -132,6 +148,12 @@ public class UserController { return success(UserConvert.INSTANCE.convertSimpleList(list, deptMap)); } + @GetMapping({"/simple-zg-list"}) + @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项") + public CommonResult> getSimpleUserZGList() { + return success(userService.getSimpleUserZGList()); + } + @GetMapping("/get") @Operation(summary = "获得用户详情") @Parameter(name = "id", description = "编号", required = true, example = "1024") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/DeptUserReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/DeptUserReqVO.java new file mode 100644 index 0000000..4ee73b3 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/DeptUserReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class DeptUserReqVO { + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String realName; + + @Schema(description = "部门ID", example = "我是一个用户") + private Long deptId; + @Schema(description = "部门名称", example = "IT 部") + private String deptName; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java index 192e053..4037005 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java @@ -23,7 +23,7 @@ public class UserSaveReqVO { @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao") @NotBlank(message = "用户账号不能为空") - @Pattern(regexp = "^[a-zA-Z0-9]{4,30}$", message = "用户账号由 数字、字母 组成") + @Pattern(regexp = "^[a-zA-Z0-9_]{4,30}$", message = "用户账号由 数字、字母 组成") @Size(min = 4, max = 30, message = "用户账号长度为 4-30 个字符") @DiffLogField(name = "用户账号") private String username; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/weixin/WeChatController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/weixin/WeChatController.java new file mode 100644 index 0000000..3570255 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/weixin/WeChatController.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.system.controller.admin.weixin; + +import cn.iocoder.yudao.module.system.service.weixin.TokenValidatorService; +import cn.iocoder.yudao.module.system.service.weixin.WeChatService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.annotation.security.PermitAll; + +@RestController +@RequestMapping("/wechat") +@PermitAll +public class WeChatController { + + @Resource + private WeChatService weChatService; + + @Resource + private TokenValidatorService tokenValidatorService; + + + private static final String TOKEN = "hbts"; + + @GetMapping("/send") + @PermitAll + public String sendMessage() { + try { + String accessToken = weChatService.getAccessToken(); + String openId = "ogEz46_ADXNd_SmC9f57tYZkswRg"; // 替换为用户的 OpenID + String templateId = "E8RK91cPLMios6ZHoKx6FJOV4H2kodx6yPWYp7jpLJY"; // 替换为订阅消息模板 ID + weChatService.sendSubscribeMessage(accessToken, openId, templateId); + return "Message sent successfully"; + } catch (Exception e) { + e.printStackTrace(); + return "Failed to send message"; + } + } + + + + @GetMapping("/push") + @PermitAll + public String validate(@RequestParam("signature") String signature, + @RequestParam("timestamp") String timestamp, + @RequestParam("nonce") String nonce, + @RequestParam("echostr") String echostr) { + if (tokenValidatorService.validateToken(TOKEN, signature, timestamp, nonce)) { + return echostr; + } + return ""; + } +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java index 275f666..b14d2a6 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java @@ -55,6 +55,11 @@ public class EnterpriseDO extends BaseDO { * 企业地址 */ private String address; + + /** + * 企业状态 + */ + private Long enterprisesStatus ; /** * 环保负责人姓名 */ @@ -79,6 +84,16 @@ public class EnterpriseDO extends BaseDO { * 企业经纬度 */ private String gpsLocation; + /** + * 签到半径 + */ + private String signRadius; + + +// /** +// * 管理部门 +// */ +// private Long deptId; @TableField(exist = false) private Integer audit; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java index be2a3fa..f610cb8 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java @@ -43,21 +43,36 @@ public class EnterpriseInspectionsDO extends BaseDO { */ private Long userId; - //状态 1.任务未启动 2. 任务已启动 3.已转交,未执行不展示 4.已转交,整改中,留痕 + //状态 1.任务未启动 2. 任务已启动 4.已转交,整改中,留痕 private Integer status; + //任务编号 + @TableField(exist = false) + private String taskNumber; + //任务名称 @TableField(exist = false) private String taskName; + //企业名称 @TableField(exist = false) private String enterpriseName; + + //企业名称 + @TableField(exist = false) + private String enterpriseAddress; + //进度状态 @TableField(exist = false) private Integer inspectionStatus; - //标签集合 + //企业标签集合 @TableField(exist = false) private List tagList; + + //任务标签 + @TableField(exist = false) + private String taskTag; + //执法部门 @TableField(exist = false) private String department; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java index 03df04b..31a4340 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog; +import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO; import com.sun.xml.bind.v2.TODO; import lombok.*; import java.util.*; @@ -38,10 +39,6 @@ public class InspectionsLogDO extends BaseDO { * 枚举 {@link TODO Inspections_status 对应的类} */ private Integer status; - /** - * 检查人员签到位置信息,格式:经纬度 - */ - private String gpsLocation; /** * 反馈信息 */ @@ -55,8 +52,13 @@ public class InspectionsLogDO extends BaseDO { */ private String inspectName; + @TableField(exist = false) + private List userList; + //协同人员的id 还是要加上 会有同名的情况 private String cooperateWithIds; //协同人员是否可以看到任务记录 - + //相关文件 + @TableField(exist = false) + private List> fileList; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/signinlog/SignInLogDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/signinlog/SignInLogDO.java new file mode 100644 index 0000000..e167396 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/signinlog/SignInLogDO.java @@ -0,0 +1,49 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.signinlog; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 协调人员打卡记录 DO + * + * @author 芋道源码 + */ +@TableName("sign_in_log") +@KeySequence("sign_in_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SignInLogDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 执法记录id + */ + private Long insId; + /** + * 用户id + */ + private Long userId; + + private String realName; + + /** + * 检查人员签到位置信息,格式:经纬度 + */ + private String gpsLocation; + + //知否是执行人 + private Boolean isInspect; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java index 44d828e..4270eeb 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java @@ -1,10 +1,16 @@ package cn.iocoder.yudao.module.system.dal.dataobject.taskinfo; +import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; +import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; +import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; +import com.alibaba.excel.annotation.ExcelProperty; import com.sun.xml.bind.v2.TODO; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.List; import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; @@ -30,8 +36,9 @@ public class TaskInfoDO extends BaseDO { @TableId private Long id; + //任务编号 - @TableField(exist = false) +// @TableField(exist = false) private String taskNumber; /** * 任务标题 @@ -94,10 +101,22 @@ public class TaskInfoDO extends BaseDO { @TableField(exist = false) private String publishDep; + //企业集合 + @TableField(exist = false) + private List enterpriseIdes; + //任务总数 + @TableField(exist = false) + private Integer taskExecNum; + //已完成数 + @TableField(exist = false) + private Integer taskFinishNum; + @TableField(exist = false) + private List tagList; - - + //发布部门 + @TableField(exist = false) + private String deptName; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java index d252e46..6b6757b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java @@ -9,6 +9,9 @@ import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.*; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; +import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; + /** * 企业 Mapper * @@ -25,6 +28,7 @@ public interface EnterpriseMapper extends BaseMapperX { .eqIfPresent(EnterpriseDO::getRegion, reqVO.getRegion()) .likeIfPresent(EnterpriseDO::getEnterprisesName, reqVO.getEnterprisesName()) .eqIfPresent(EnterpriseDO::getAddress, reqVO.getAddress()) + .eqIfPresent(EnterpriseDO::getEnterprisesStatus, reqVO.getEnterprisesStatus()) .likeIfPresent(EnterpriseDO::getContactName, reqVO.getContactName()) .eqIfPresent(EnterpriseDO::getEnvironmentalContactPhone, reqVO.getEnvironmentalContactPhone()) .eqIfPresent(EnterpriseDO::getRegistrationNumber, reqVO.getRegistrationNumber()) @@ -33,12 +37,33 @@ public interface EnterpriseMapper extends BaseMapperX { .eqIfPresent(EnterpriseDO::getGpsLocation, reqVO.getGpsLocation()) .betweenIfPresent(EnterpriseDO::getCreateTime, reqVO.getCreateTime()) .eqIfPresent(EnterpriseDO::getUpdater, reqVO.getUpdater()) - .or(w->w.eq(EnterpriseDO::getCreator, reqVO.getCreate())) +// .or(w->w.eq( EnterpriseDO::getCreator, getLoginUserId())) .orderByDesc(EnterpriseDO::getId)); } default List selectListByStatus() { return selectList(); } - + default List selectList(EnterprisePageReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(EnterpriseDO::getId, reqVO.getId()) + .eqIfPresent(EnterpriseDO::getDepartmentId, reqVO.getDepartmentId()) + .eqIfPresent(EnterpriseDO::getUserId, reqVO.getUserId()) + .eqIfPresent(EnterpriseDO::getType, reqVO.getType()) + .eqIfPresent(EnterpriseDO::getRegion, reqVO.getRegion()) + .likeIfPresent(EnterpriseDO::getEnterprisesName, reqVO.getEnterprisesName()) + .eqIfPresent(EnterpriseDO::getAddress, reqVO.getAddress()) + .eqIfPresent(EnterpriseDO::getEnterprisesStatus, reqVO.getEnterprisesStatus()) + .likeIfPresent(EnterpriseDO::getContactName, reqVO.getContactName()) + .eqIfPresent(EnterpriseDO::getEnvironmentalContactPhone, reqVO.getEnvironmentalContactPhone()) + .eqIfPresent(EnterpriseDO::getRegistrationNumber, reqVO.getRegistrationNumber()) + .eqIfPresent(EnterpriseDO::getIntroduction, reqVO.getIntroduction()) + .betweenIfPresent(EnterpriseDO::getEstablishmentDate, reqVO.getEstablishmentDate()) + .eqIfPresent(EnterpriseDO::getGpsLocation, reqVO.getGpsLocation()) + .eqIfPresent(EnterpriseDO::getCreator, reqVO.getCreate()) + .betweenIfPresent(EnterpriseDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(EnterpriseDO::getUpdater, reqVO.getUpdater()) + .inIfPresent(EnterpriseDO::getId,reqVO.getIds()) + .orderByDesc(EnterpriseDO::getId)); + } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java index 152ed44..bd341ac 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections; import java.util.*; -import java.util.stream.Collectors; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -21,18 +20,33 @@ public interface EnterpriseInspectionsMapper extends BaseMapperX selectPage(EnterpriseInspectionsPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(EnterpriseInspectionsDO::getTaskId, reqVO.getTaskId()) + .eqIfPresent(EnterpriseInspectionsDO::getUserId, reqVO.getUserId()) .eqIfPresent(EnterpriseInspectionsDO::getEnterpriseId, reqVO.getEnterpriseId()) .betweenIfPresent(EnterpriseInspectionsDO::getCreateTime, reqVO.getCreateTime()) + .inIfPresent(EnterpriseInspectionsDO::getEnterpriseId, reqVO.getEnterpriseList()) + .inIfPresent(EnterpriseInspectionsDO::getTaskId, reqVO.getTaskList()) + .inIfPresent(EnterpriseInspectionsDO::getUserId, reqVO.getUserIds()) .orderByDesc(EnterpriseInspectionsDO::getId)); } - default PageResult selectPageGroup(EnterpriseInspectionsPageReqVO reqVO) { + default PageResult selectAppPage(EnterpriseInspectionsPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(EnterpriseInspectionsDO::getTaskId, reqVO.getTaskId()) + .eqIfPresent(EnterpriseInspectionsDO::getUserId, reqVO.getUserId()) .eqIfPresent(EnterpriseInspectionsDO::getEnterpriseId, reqVO.getEnterpriseId()) .betweenIfPresent(EnterpriseInspectionsDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(EnterpriseInspectionsDO::getId).groupBy(EnterpriseInspectionsDO::getTaskId) - ); + .orderByDesc(EnterpriseInspectionsDO::getId)); } + + + default List selectList(EnterpriseInspectionsPageReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(EnterpriseInspectionsDO::getTaskId, reqVO.getTaskId()) + .eqIfPresent(EnterpriseInspectionsDO::getEnterpriseId, reqVO.getEnterpriseId()) + .betweenIfPresent(EnterpriseInspectionsDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(EnterpriseInspectionsDO::getId)); + } + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java index 6ed1422..00a21a2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java @@ -21,7 +21,7 @@ public interface InspectionsLogMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(InspectionsLogDO::getInspectionsId, reqVO.getInspectionsId()) .eqIfPresent(InspectionsLogDO::getStatus, reqVO.getStatus()) - .eqIfPresent(InspectionsLogDO::getGpsLocation, reqVO.getGpsLocation()) + .gtIfPresent(InspectionsLogDO::getStatus, reqVO.getMrStatus()) .eqIfPresent(InspectionsLogDO::getFeedBack, reqVO.getFeedBack()) .likeIfPresent(InspectionsLogDO::getCooperateWithName, reqVO.getCooperateWithName()) .likeIfPresent(InspectionsLogDO::getInspectName, reqVO.getInspectName()) @@ -29,4 +29,4 @@ public interface InspectionsLogMapper extends BaseMapperX { .orderByDesc(InspectionsLogDO::getId)); } -} \ No newline at end of file +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/signinlog/SignInLogMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/signinlog/SignInLogMapper.java new file mode 100644 index 0000000..f6c899f --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/signinlog/SignInLogMapper.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.system.dal.mysql.signinlog; + +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.dal.dataobject.inspectionslog.InspectionsLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.signinlog.SignInLogDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.signinlog.vo.*; + +/** + * 协调人员打卡记录 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface SignInLogMapper extends BaseMapperX { + + default PageResult selectPage(SignInLogPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(SignInLogDO::getInsId, reqVO.getInsId()) + .eqIfPresent(SignInLogDO::getUserId, reqVO.getUserId()) + .eqIfPresent(SignInLogDO::getGpsLocation, reqVO.getGpsLocation()) + .betweenIfPresent(SignInLogDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(SignInLogDO::getId)); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java index 6ea61eb..33b487b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java @@ -20,6 +20,7 @@ public interface TaskInfoMapper extends BaseMapperX { default PageResult selectPage(TaskInfoPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(TaskInfoDO::getTitle, reqVO.getTitle()) + .eqIfPresent(TaskInfoDO::getTaskNumber, reqVO.getTaskNumber()) .eqIfPresent(TaskInfoDO::getDescription, reqVO.getDescription()) .eqIfPresent(TaskInfoDO::getExecCycle, reqVO.getExecCycle()) .eqIfPresent(TaskInfoDO::getTaskType, reqVO.getTaskType()) @@ -35,4 +36,28 @@ public interface TaskInfoMapper extends BaseMapperX { .orderByDesc(TaskInfoDO::getId)); } + default PageResult selectAppPage(TaskInfoPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(TaskInfoDO::getTitle, reqVO.getTitle()) + .eqIfPresent(TaskInfoDO::getTaskNumber, reqVO.getTaskNumber()) + .eqIfPresent(TaskInfoDO::getDescription, reqVO.getDescription()) + .eqIfPresent(TaskInfoDO::getExecCycle, reqVO.getExecCycle()) + .eqIfPresent(TaskInfoDO::getTaskType, reqVO.getTaskType()) + .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()) + .eqIfPresent(TaskInfoDO::getParentId, reqVO.getParentId()) + .eqIfPresent(TaskInfoDO::getParentType, reqVO.getParentType()) + .eqIfPresent(TaskInfoDO::getTaskStep, reqVO.getTaskStep()) + .eqIfPresent(TaskInfoDO::getTaskTotal, reqVO.getTaskTotal()) + .inIfPresent(TaskInfoDO::getId, reqVO.getTagList()) + .gtIfPresent(TaskInfoDO::getStatus, 1) + .orderByAsc(TaskInfoDO::getStatus)); + } + + + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tasktag/TaskTagMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tasktag/TaskTagMapper.java index 8a43317..d49ac61 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tasktag/TaskTagMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tasktag/TaskTagMapper.java @@ -5,6 +5,8 @@ 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.enterpriseinspections.vo.EnterpriseInspectionsPageReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.system.controller.admin.tasktag.vo.*; @@ -25,4 +27,16 @@ public interface TaskTagMapper extends BaseMapperX { .orderByDesc(TaskTagDO::getId)); } + + + + default List selectList(TaskTagPageReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(TaskTagDO::getTaskId, reqVO.getTaskId()) + .eqIfPresent(TaskTagDO::getTagId, reqVO.getTagId()) + .betweenIfPresent(TaskTagDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(TaskTagDO::getId)); + } + + } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index f1e83f7..74192e4 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java @@ -174,7 +174,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { @Override public AuthLoginRespVO socialLogin(AuthSocialLoginReqVO reqVO) { // 使用 code 授权码,进行登录。然后,获得到绑定的用户编号 - SocialUserRespDTO socialUser = socialUserService.getSocialUserByCode(UserTypeEnum.ADMIN.getValue(), reqVO.getType(), + SocialUserRespDTO socialUser = socialUserService.getSocialUserByCode(UserTypeEnum.MEMBER.getValue(), reqVO.getType(), reqVO.getCode(), reqVO.getState()); if (socialUser == null || socialUser.getUserId() == null) { throw exception(AUTH_THIRD_LOGIN_NOT_BIND); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java index 94a4435..5ffbbd3 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSaveReqV import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper; import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; import org.springframework.cache.annotation.CacheEvict; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java index ce5151d..c747a68 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java @@ -23,6 +23,15 @@ public interface EnterpriseService { */ Long createEnterprise(EnterpriseSaveReqVO createReqVO); + /** + * PC创建企业 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long pccreateEnterprise(EnterpriseSaveReqVO createReqVO); + + /** * 更新企业 * @@ -53,5 +62,8 @@ public interface EnterpriseService { */ PageResult getEnterprisePage(EnterprisePageReqVO pageReqVO); + + List getEnterpriseList(EnterprisePageReqVO pageReqVO); + PageResult getEnterpriseByUserId(EnterprisePageReqVO pageReqVO); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java index b1d1eb2..0143068 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTag import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.mysql.enterpriseauditlog.EnterpriseAuditLogMapper; import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper; @@ -104,6 +105,29 @@ public class EnterpriseServiceImpl implements EnterpriseService { return enterprise.getId(); } + + + @Override + @Transactional + public Long pccreateEnterprise(EnterpriseSaveReqVO createReqVO) { + EnterpriseDO enterprise = BeanUtils.toBean(createReqVO, EnterpriseDO.class); + enterprise.setDepartmentId(1L); + enterpriseMapper.insert(enterprise); + if (createReqVO.getFileIds() != null && createReqVO.getFileIds().length > 0) { + for (Long fileId : createReqVO.getFileIds()) { + FileInfoDO fileInfoDO = new FileInfoDO(); + fileInfoDO.setDictData(1l); //文件类型 + fileInfoDO.setDictType(644l); + fileInfoDO.setUnitId(enterprise.getId().toString()); + fileInfoDO.setInfraFileId(fileId); + fileInfoMapper.insert(fileInfoDO); + } + } + // 返回 + return enterprise.getId(); + } + + @Override public void updateEnterprise(EnterpriseSaveReqVO updateReqVO) { // 校验存在 @@ -155,6 +179,13 @@ public class EnterpriseServiceImpl implements EnterpriseService { return enterpriseDOPageResult; } + + @Override + public List getEnterpriseList(EnterprisePageReqVO pageReqVO) { + return enterpriseMapper.selectList(pageReqVO); + } + + @Override public PageResult getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) { //根据不同身份查询企业 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java index dbd72e8..9f06899 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java @@ -4,7 +4,8 @@ import java.util.*; import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import javax.validation.Valid; @@ -37,6 +38,8 @@ public interface EnterpriseInspectionsService { */ void deleteEnterpriseInspections(Long id); + void passOn(PassOnSaveVO passOnSaveVO); + /** * 获得企业检查记录表,用于记录与企业相关的环保检查信息。 * @@ -45,6 +48,12 @@ public interface EnterpriseInspectionsService { */ EnterpriseInspectionsDO getEnterpriseInspections(Long id); + List getListByUserIdAndTaskName(Long userId, String taskName); + + int deleteEnterpriseInspectionsTaskId(Long taskId); + + InspectionsLogDO getInspectionsLogNew(Long inspectionsId); + /** * 获得企业检查记录表,用于记录与企业相关的环保检查信息。分页 * @@ -53,5 +62,8 @@ public interface EnterpriseInspectionsService { */ PageResult getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO); - void passOn(PassOnSaveVO passOnSaveVO); + + List getEnterpriseInspectionsList(EnterpriseInspectionsPageReqVO pageReqVO); + + List changeSelectUser(Long deptId); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java index 5323612..fa0f290 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java @@ -3,17 +3,28 @@ package cn.iocoder.yudao.module.system.service.enterpriseinspections; import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.signinlog.SignInLogDO; import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO; import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; 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.dal.mysql.enterprise.EnterpriseMapper; import cn.iocoder.yudao.module.system.dal.mysql.inspectionslog.InspectionsLogMapper; +import cn.iocoder.yudao.module.system.dal.mysql.permission.RoleMapper; +import cn.iocoder.yudao.module.system.dal.mysql.permission.UserRoleMapper; +import cn.iocoder.yudao.module.system.dal.mysql.signinlog.SignInLogMapper; import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper; import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper; import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; +import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; import cn.iocoder.yudao.module.system.service.dept.DeptService; +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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -21,6 +32,8 @@ import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; + import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -32,6 +45,8 @@ import cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections.Enterprise import javax.annotation.Resource; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; /** @@ -60,6 +75,16 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe private AdminUserService adminUserService; @Resource private DeptService deptService; + @Resource + private TagLibraryService tagLibraryService; + @Resource + private AdminUserMapper adminUserMapper; + @Resource + private UserRoleMapper userRoleMapper; + @Resource + private RoleMapper roleMapper; + @Resource + private SignInLogMapper signInLogMapper; @Override public Long createEnterpriseInspections(EnterpriseInspectionsSaveReqVO createReqVO) { @@ -70,6 +95,25 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe return enterpriseInspections.getId(); } + /** + * 根据执行记录id查询打卡记录 + * + * @param inspectionsId + * @Author dx + * @Date 2025-02-14 上午11:55 + **/ + public List getSingnInLogList(Long inspectionsId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(InspectionsLogDO::getInspectionsId, inspectionsId); + wrapper.eq(InspectionsLogDO::getStatus, 1); + wrapper.orderByDesc(InspectionsLogDO::getCreateTime); + List list = inspectionsLogMapper.selectList(wrapper); + if (list != null) { + return signInLogMapper.selectList(new LambdaQueryWrapper().eq(SignInLogDO::getInsId, list.get(0).getId())); + } + return Collections.emptyList(); + } + @Override @@ -88,7 +132,15 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe // 删除 enterpriseInspectionsMapper.deleteById(id); } + @Override + @Transactional(rollbackFor = Exception.class) + public int deleteEnterpriseInspectionsTaskId(Long taskId) { + LambdaQueryWrapper taskMembersDOLambdaQueryWrapper = new LambdaQueryWrapper<>(); + taskMembersDOLambdaQueryWrapper.eq(EnterpriseInspectionsDO::getTaskId, taskId); + // 删除 + return enterpriseInspectionsMapper.delete(taskMembersDOLambdaQueryWrapper); + } private void validateEnterpriseInspectionsExists(Long id) { if (enterpriseInspectionsMapper.selectById(id) == null) { throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); @@ -97,12 +149,93 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe @Override public EnterpriseInspectionsDO getEnterpriseInspections(Long id) { - return enterpriseInspectionsMapper.selectById(id); + + final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(id); + if (enterpriseInspectionsDO == null) { + throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + } + + 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()); + + final EnterpriseDO enterpriseDO = enterpriseMapper.selectById(enterpriseInspectionsDO.getEnterpriseId()); + if (enterpriseDO == null) { + throw exception(ENTERPRISE_NOT_EXISTS); + } + //任务类型 + enterpriseInspectionsDO.setEnterpriseName(enterpriseDO.getEnterprisesName()); + + final AdminUserDO user = adminUserService.getUser(enterpriseInspectionsDO.getUserId()); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + enterpriseInspectionsDO.setInspectName(user.getRealName()); + + final DeptDO dept = deptService.getDept(user.getDeptId()); + + enterpriseInspectionsDO.setDepartment(dept.getName()); + + return enterpriseInspectionsDO; } @Override public PageResult getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO) { + //根据角色显示不同 + /* + 管理员,局长,查全部 + 检查员,查自己的 + 队长 查本部门 + */ + Long loginUserId = getLoginUserId(); + final AdminUserDO user1 = adminUserService.getUser(loginUserId); + if (user1.getPostIds().contains(1l) || user1.getPostIds().contains(2l)) { + //全部 + } else if (user1.getPostIds().contains(4l)) { + //本部门 + pageReqVO.setDepartmentId(user1.getDeptId()); + + } else if (user1.getPostIds().contains(5l)) { + //自己 + pageReqVO.setUserId(loginUserId); + } + + //按照部门查询 + if (pageReqVO.getDepartmentId() != null) { + final List adminUserDOS = adminUserMapper.selectList(new QueryWrapper().eq("dept_id", pageReqVO.getDepartmentId())); + if (adminUserDOS != null || adminUserDOS.size() > 0) { + final List collect = adminUserDOS.stream().map(item -> item.getId()).collect(Collectors.toList()); + pageReqVO.setUserIds(collect); + } + } + + //根据企业名称查询 + if (pageReqVO.getEnterpriseName() != null) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(EnterpriseDO::getEnterprisesName, pageReqVO.getEnterpriseName()); + final List enterpriseDOS = enterpriseMapper.selectList(wrapper); + if (enterpriseDOS != null || enterpriseDOS.size() > 0) { + final List collect = enterpriseDOS.stream().map(item -> item.getId()).collect(Collectors.toList()); + pageReqVO.setEnterpriseList(collect); + } + } + + //根据任务名称查询 + if (pageReqVO.getTaskName() != null) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(TaskInfoDO::getTitle, pageReqVO.getTaskName()); + final List taskInfoDOS = taskInfoMapper.selectList(wrapper); + if (taskInfoDOS != null || taskInfoDOS.size() > 0) { + final List collect = taskInfoDOS.stream().map(item -> item.getId()).collect(Collectors.toList()); + pageReqVO.setTaskList(collect); + } + } + final PageResult enterpriseInspectionsDOPageResult = enterpriseInspectionsMapper.selectPage(pageReqVO); if ( enterpriseInspectionsDOPageResult.getList() != null && enterpriseInspectionsDOPageResult.getList().size() > 0 ) { enterpriseInspectionsDOPageResult.getList().forEach(item->{ @@ -114,53 +247,73 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe } item.setTaskName(taskInfoDO.getTitle()); - //查询任务标签 - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("task_id", taskInfoDO.getId()); - final List taskTagDOS = taskTagMapper.selectList(wrapper); - - List tagList = new ArrayList<>(); - if (taskTagDOS != null && taskTagDOS.size() > 0) { - taskTagDOS.forEach(taskTagItem->{ - final TagLibraryDO tagLibraryDO = tagLibraryMapper.selectById(taskTagItem.getTagId()); - if (tagLibraryDO != null) { - tagList.add(tagLibraryDO.getTagName()); - } - }); - } - - item.setTagList(tagList); - //查询企业 final EnterpriseDO enterpriseDO = enterpriseMapper.selectById(item.getEnterpriseId()); if (enterpriseDO == null) { throw exception(ENTERPRISE_NOT_EXISTS); } + + //查询企业标签 + final List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterpriseDO.getId()); + if (tagLibraryDOS != null) { + item.setTagList(tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList())); + } + + item.setEnterpriseName(enterpriseDO.getEnterprisesName()); + item.setEnterpriseAddress(enterpriseDO.getAddress()); + + //查询执行的最新一条记录 + final InspectionsLogDO inspectionsLogNew = this.getInspectionsLogNew(item.getId()); + if (inspectionsLogNew != null) { + item.setInspectionStatus(inspectionsLogNew.getStatus()); + //执行人,协同执法 + //查询打卡记录 + final List singnInLogList = this.getSingnInLogList(item.getId()); + if (singnInLogList != null && singnInLogList.size() > 0) { + final List collect = singnInLogList.stream().filter(signInLogDO -> signInLogDO.getIsInspect() == false).map(item2 -> item2.getRealName()).collect(Collectors.toList()); + if (collect != null && collect.size() > 0) { + item.setCooperateWithName(String.join(",", collect)); + } + final List collect2 = singnInLogList.stream().filter(signInLogDO -> signInLogDO.getIsInspect() == true).map(item2 -> item2.getRealName()).collect(Collectors.toList()); + if (collect2 != null && collect2.size() > 0) { + item.setInspectName(String.join(",", collect2)); + } + } - //查询检查记录 - QueryWrapper inspectionsLogWrapper = new QueryWrapper<>(); - inspectionsLogWrapper.eq("inspections_id", item.getId()); - inspectionsLogWrapper.orderByDesc("create_time"); - final List inspectionsLogDOS = inspectionsLogMapper.selectList(inspectionsLogWrapper); - if (inspectionsLogDOS != null && inspectionsLogDOS.size() > 0) { - item.setInspectionStatus(inspectionsLogDOS.get(0).getStatus()); - item.setInspectName(inspectionsLogDOS.get(0).getInspectName()); - item.setCooperateWithName(inspectionsLogDOS.get(0).getCooperateWithName()); - item.setExecTime(inspectionsLogDOS.get(0).getCreateTime()); + item.setExecTime(inspectionsLogNew.getCreateTime()); //根据执法人员id 查询其所属部门 - final Long userId = Long.valueOf(inspectionsLogDOS.get(0).getCreator()); + final Long userId = Long.valueOf(inspectionsLogNew.getCreator()); final AdminUserDO user = adminUserService.getUser(userId); + if (user == null) { throw exception(USER_NOT_EXISTS); } + final DeptDO dept = deptService.getDept(user.getDeptId()); item.setDepartment(dept.getName()); + } else { + + //根据执法人员id 查询其所属部门 + if (item.getUserId() != null) { + final Long userId = Long.valueOf(item.getUserId()); + final AdminUserDO user = adminUserService.getUser(userId); + item.setInspectName(user.getRealName()); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + } } }); } + if (pageReqVO.getInspectionsStatus() != null) { + final List collect = enterpriseInspectionsDOPageResult.getList().stream().filter(item -> item.getInspectionStatus() == pageReqVO.getInspectionsStatus()).collect(Collectors.toList()); + enterpriseInspectionsDOPageResult.setList(collect); + enterpriseInspectionsDOPageResult.setTotal(Long.valueOf(collect.size())); + } + return enterpriseInspectionsDOPageResult; } @@ -174,6 +327,11 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe //循环记录id列表 passOnSaveVO.getInspectionsId().forEach(item->{ final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(item); + + if (enterpriseInspectionsDO.getUserId() == passOnSaveVO.getUserId()) { + throw exception(ENTERPRISE_INSPECTIONS_STATUS_ERROR2); + } + if (enterpriseInspectionsDO == null) { throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); } @@ -186,32 +344,54 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe //已经开始 就要判断是否是整改状态 整改状态才能转 enterpriseInspectionsDO.setStatus(4); } else { - enterpriseInspectionsDO.setStatus(3); + enterpriseInspectionsDO.setStatus(1); + enterpriseInspectionsDO.setUserId(passOnSaveVO.getUserId()); } enterpriseInspectionsMapper.updateById(enterpriseInspectionsDO); - AdminUserDO user = adminUserService.getUser(passOnSaveVO.getUserId()); - if (user == null) { - throw exception(USER_NOT_EXISTS); - } - EnterpriseInspectionsDO inspectionsDO = new EnterpriseInspectionsDO(); - inspectionsDO.setEnterpriseId(enterpriseInspectionsDO.getEnterpriseId()); - inspectionsDO.setTaskId(enterpriseInspectionsDO.getTaskId()); +// if (enterpriseInspectionsDO.getStatus() == 4) { +// AdminUserDO user = adminUserService.getUser(passOnSaveVO.getUserId()); +// if (user == null) { +// throw exception(USER_NOT_EXISTS); +// } +// EnterpriseInspectionsDO inspectionsDO = new EnterpriseInspectionsDO(); +// inspectionsDO.setEnterpriseId(enterpriseInspectionsDO.getEnterpriseId()); +// inspectionsDO.setTaskId(enterpriseInspectionsDO.getTaskId()); +// inspectionsDO.setUserId(passOnSaveVO.getUserId()); +// inspectionsDO.setInspectName(user.getRealName()); +// enterpriseInspectionsMapper.insert(inspectionsDO); +// } - inspectionsDO.setUserId(passOnSaveVO.getUserId()); - inspectionsDO.setInspectName(user.getRealName()); - enterpriseInspectionsMapper.insert(inspectionsDO); } else { throw exception(ENTERPRISE_INSPECTIONS_STATUS_ERROR); } - }); + } - + @Override + public List getListByUserIdAndTaskName(Long userId, String taskName) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(EnterpriseInspectionsDO::getUserId, userId); + wrapper.eq(EnterpriseInspectionsDO::getTaskName, taskName); + + final List enterpriseInspectionsDOS = enterpriseInspectionsMapper.selectList(wrapper); + //筛选出可以转交的检查记录 + List list = new ArrayList<>(); + if (enterpriseInspectionsDOS != null && enterpriseInspectionsDOS.size() > 0) { + enterpriseInspectionsDOS.forEach(item->{ + final InspectionsLogDO inspectionsLogNew = this.getInspectionsLogNew(item.getId()); + if (inspectionsLogNew == null || inspectionsLogNew.getStatus() == 3) { + //已经开始 就要判断是否是整改状态 整改状态才能转 + list.add(item); + } + }); + } + return list; } //获得检测记录最新一条 + @Override public InspectionsLogDO getInspectionsLogNew(Long inspectionsId) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("inspections_id", inspectionsId); @@ -221,7 +401,52 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe return null; } return inspectionsLogDOS.get(0); + } + + + @Override + public List getEnterpriseInspectionsList(EnterpriseInspectionsPageReqVO pageReqVO) { + return enterpriseInspectionsMapper.selectList(pageReqVO); } + @Override + public List changeSelectUser(Long deptId) { + List list = new ArrayList<>(); + + List adminUserDOS; + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.isNotNull(AdminUserDO::getRealName); + wrapper.ne(AdminUserDO::getId, 1L); + if (deptId != null) { + wrapper.eq(AdminUserDO::getDeptId, deptId); + } + adminUserDOS = adminUserMapper.selectList(wrapper); + + if (adminUserDOS != null && adminUserDOS.size() > 0) { + adminUserDOS.forEach(item-> { + SelectUserChangeVO userChangeVO = new SelectUserChangeVO(); + userChangeVO.setUserId(item.getId()); + userChangeVO.setRealName(item.getRealName()); + userChangeVO.setAvatar(item.getAvatar()); + + QueryWrapper roleDOQueryWrapper = new QueryWrapper<>(); + roleDOQueryWrapper.eq("user_id", item.getId()); + List userRoleDOS = userRoleMapper.selectList(roleDOQueryWrapper); + if (userRoleDOS != null && userRoleDOS.size() > 0) { + //查询角色名称 + List roleIds = userRoleDOS.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList()); + List roleDOS = roleMapper.selectBatchIds(roleIds); + if (roleDOS != null && roleDOS.size() > 0) { + List roleNames = roleDOS.stream().map(RoleDO::getName).collect(Collectors.toList()); + userChangeVO.setRoleName(roleNames); + } + } + list.add(userChangeVO); + }); + }; + + return list; + } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java index 99ac82a..108f145 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java @@ -53,4 +53,5 @@ public interface FileInfoService { */ PageResult getFileInfoPage(FileInfoPageReqVO pageReqVO); + List> getFileList(String dictType, String dictData, String unitId); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java index 1f78139..f2b99ec 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java @@ -1,10 +1,14 @@ package cn.iocoder.yudao.module.system.service.fileInfo; +import cn.iocoder.yudao.module.infra.api.file.FileApi; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; + import cn.iocoder.yudao.module.system.controller.admin.fileInfo.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -30,6 +34,9 @@ public class FileInfoServiceImpl implements FileInfoService { @Resource private FileInfoMapper fileInfoMapper; + @Resource + private FileApi fileApi; + @Override public Long createFileInfo(FileInfoSaveReqVO createReqVO) { // 插入 @@ -72,4 +79,23 @@ public class FileInfoServiceImpl implements FileInfoService { return fileInfoMapper.selectPage(pageReqVO); } + @Override + public List> getFileList(String dictType, String dictData, String unitId) { + + List> mapList = new ArrayList<>(); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(FileInfoDO::getDictType, dictType); + wrapper.eq(FileInfoDO::getDictData, dictData); + wrapper.eq(FileInfoDO::getUnitId, unitId); + final List collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList()); + + if (!collect.isEmpty()) { + final List> list = fileApi.listFile(collect); + mapList.addAll(list); + } + + return mapList; + } + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java index 77a7c84..327f1a9 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.module.system.dal.dataobject.signinlog.SignInLogDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import javax.validation.Valid; @@ -22,7 +23,7 @@ public interface InspectionsLogService { * @param createReqVO 创建信息 * @return 编号 */ - Long createInspectionsLog(@Valid InspectionsLogSaveReqVO createReqVO); + void createInspectionsLog(@Valid InspectionsLogSaveReqVO createReqVO); /** * 更新检查结果日志 @@ -57,4 +58,11 @@ public interface InspectionsLogService { List list(InspectionsLogPageReqVO pageReqVO); void cooperateWithSignIn(Long inspectionsLogId); + + void confirmSignIn(InspectionsLogSaveReqVO createReqVO); + + void inspectionsAudit(InspectionsLogSaveReqVO createReqVO); + + List signInList(Long inspectionsId); + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java index 8a5a2fa..8984787 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java @@ -1,11 +1,17 @@ package cn.iocoder.yudao.module.system.service.inspectionslog; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; +import cn.iocoder.yudao.module.system.dal.dataobject.signinlog.SignInLogDO; import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections.EnterpriseInspectionsMapper; +import cn.iocoder.yudao.module.system.dal.mysql.signinlog.SignInLogMapper; import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper; +import cn.iocoder.yudao.module.system.service.dept.DeptService; +import cn.iocoder.yudao.module.system.service.enterpriseinspections.EnterpriseInspectionsService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import com.alibaba.excel.util.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.stereotype.Service; @@ -13,6 +19,8 @@ import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; + import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -45,65 +53,69 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { private EnterpriseInspectionsMapper enterpriseInspectionsMapper; @Resource private TaskInfoMapper taskInfoMapper; + @Resource + private SignInLogMapper signInLogMapper; + @Resource + private EnterpriseInspectionsService enterpriseInspectionsService; + @Resource + private DeptService deptService; @Override - public Long createInspectionsLog(InspectionsLogSaveReqVO createReqVO) { - //当前用户id - Long loginUserId = getLoginUserId(); - AdminUserDO user = adminUserService.getUser(loginUserId); - //根据查询出的列表判断执行到哪一步 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(InspectionsLogDO::getInspectionsId, createReqVO.getInspectionsId()); - wrapper.orderByDesc(InspectionsLogDO::getCreateTime); - List list = inspectionsLogMapper.selectList(wrapper); + @Transactional + public void createInspectionsLog(InspectionsLogSaveReqVO createReqVO) { - if (list == null || list.size() == 0) { - //签到 - createReqVO.setStatus(1); - createReqVO.setInspectId(loginUserId); - createReqVO.setInspectName(user.getRealName()); + //查询执法记录 + EnterpriseInspectionsDO inspections = enterpriseInspectionsMapper.selectById(createReqVO.getInspectionsId()); + if (inspections == null) { + throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); } - if (list != null && createReqVO.getStatus() != null && createReqVO.getStatus() == 1) { - //请不要重复签到 - throw exception(INSPECTIONS_SUCCESS); - } + //当前用户id + Long loginUserId = getLoginUserId(); + final AdminUserDO user = adminUserService.getUser(loginUserId); - if (list != null && list.get(0).getStatus() == 2) { - throw exception(INSPECTIONS_SUCCESS); - } + //根据查询出的列表判断执行到哪一步 + final InspectionsLogDO inspectionsLogNew = enterpriseInspectionsService.getInspectionsLogNew(createReqVO.getInspectionsId()); + + //没有记录和整改状态为打卡 + if (inspectionsLogNew == null || (inspectionsLogNew != null && inspectionsLogNew.getStatus() == 3)) { + createReqVO.setStatus(0); + InspectionsLogDO inspectionsLog = BeanUtils.toBean(createReqVO, InspectionsLogDO.class); + final int insert = inspectionsLogMapper.insert(inspectionsLog); + if (insert > 0) { + final SignInLogDO signInLogDO = new SignInLogDO(); + signInLogDO.setInsId(inspectionsLog.getId()); + signInLogDO.setUserId(loginUserId); + signInLogDO.setRealName(user.getRealName()); + signInLogDO.setGpsLocation(createReqVO.getGpsLocation()); + if (loginUserId == inspections.getUserId()) { + signInLogDO.setIsInspect(true); + } + signInLogMapper.insert(signInLogDO); + } - // 插入 - InspectionsLogDO inspectionsLog = BeanUtils.toBean(createReqVO, InspectionsLogDO.class); - inspectionsLogMapper.insert(inspectionsLog); + } else { - //整改需要重新创建子任务 - if (list != null && createReqVO.getStatus() != null && createReqVO.getStatus() == 3) { + //查看打卡记录 + final List signInLog = this.getSignInLog(inspectionsLogNew.getId()); + if (signInLog == null) { + throw exception(SIGN_IN_LOG_ERROR); + } - //查询父任务,和执法记录 - EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(createReqVO.getInspectionsId()); - if (enterpriseInspectionsDO == null) { - throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + //查看当前用户是否已打卡 + final List collect = signInLog.stream().map(SignInLogDO::getUserId).collect(Collectors.toList()); + if(collect.contains(loginUserId)) { + throw exception(SIGN_IN_LOG_ERROR2); } - //添加子任务 - TaskInfoDO taskInfo = new TaskInfoDO(); - taskInfo.setTitle(enterpriseInspectionsDO.getEnterpriseId() + "-" + "整改任务"); - taskInfo.setTaskType(1); //整改默认是普通专项任务类型 - taskInfo.setParentId(enterpriseInspectionsDO.getTaskId()); - taskInfo.setParentType(21); //父子任务类型 - taskInfoMapper.insert(taskInfo); - //添加执法记录 - EnterpriseInspectionsDO enterpriseInspectionsDO1 = new EnterpriseInspectionsDO(); - enterpriseInspectionsDO1.setUserId(getLoginUserId()); - enterpriseInspectionsDO1.setEnterpriseId(enterpriseInspectionsDO.getEnterpriseId()); - enterpriseInspectionsDO1.setTaskId(taskInfo.getId()); - enterpriseInspectionsDO1.setStatus(2); //整改任务默认是启动的状态 - enterpriseInspectionsMapper.insert(enterpriseInspectionsDO1); - } - - // 返回 - return inspectionsLog.getId(); + signInLogMapper.insert(new SignInLogDO().setInsId(inspectionsLogNew.getId()).setUserId(loginUserId).setRealName(user.getRealName())); + } + } + + public List getSignInLog(Long insId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SignInLogDO::getInsId, insId); + return signInLogMapper.selectList(wrapper); } @Override @@ -136,14 +148,115 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { @Override public PageResult getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO) { - return inspectionsLogMapper.selectPage(pageReqVO); + //不显示待确认签到的状态 + pageReqVO.setPageNo(-1); + if (pageReqVO.getStatus() == null) { + pageReqVO.setMrStatus(0); + } + final PageResult inspectionsLogDOPageResult = inspectionsLogMapper.selectPage(pageReqVO); + if (inspectionsLogDOPageResult.getList() != null && inspectionsLogDOPageResult.getList().size() > 0) { + inspectionsLogDOPageResult.getList().forEach(item->{ + final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(item.getInspectionsId()); + if (enterpriseInspectionsDO == null) { + throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + } + + + item.setUserList(this.getInspectionsLogAppListVO2(item.getId())); + }); + } + + + return inspectionsLogDOPageResult; + } + + + //封装 + public List getInspectionsLogAppListVO2(Long insId) { + List appListVO = new ArrayList<>(); + + //取最新一条签到状态 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(InspectionsLogDO::getStatus, 1); + wrapper.eq(InspectionsLogDO::getInspectionsId, insId); + wrapper.orderByDesc(InspectionsLogDO::getCreateTime); + final List list = inspectionsLogMapper.selectList(wrapper); + + if (list != null) { + final Long id = list.get(0).getId(); + final List signInLog = this.getSignInLog(id); + if (signInLog != null && signInLog.size() > 0) { + signInLog.forEach(signInLogDO->{ + final AdminUserDO user = adminUserService.getUser(signInLogDO.getUserId()); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + InspectionsLogAppListVO appListVO1 = new InspectionsLogAppListVO(); + appListVO1.setRealName(signInLogDO.getRealName()); + appListVO1.setTime(signInLogDO.getCreateTime()); + appListVO1.setUserId(signInLogDO.getUserId()); + appListVO1.setIsInspect(signInLogDO.getIsInspect()); + final DeptDO dept = deptService.getDept(user.getDeptId()); + if (dept != null) { + appListVO1.setDeptName(dept.getName()); + } + appListVO1.setAvtar(user.getAvatar()); + appListVO.add(appListVO1); + }); + } + } + + + return appListVO; + } + + + //封装 + public List getInspectionsLogAppListVO(Long insId) { + List appListVO = new ArrayList<>(); + + //取最新一条签到状态 + final List signInLog = this.getSignInLog(insId); + if (signInLog != null && signInLog.size() > 0) { + signInLog.forEach(signInLogDO->{ + final AdminUserDO user = adminUserService.getUser(signInLogDO.getUserId()); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + InspectionsLogAppListVO appListVO1 = new InspectionsLogAppListVO(); + appListVO1.setRealName(signInLogDO.getRealName()); + appListVO1.setTime(signInLogDO.getCreateTime()); + appListVO1.setUserId(signInLogDO.getUserId()); + appListVO1.setIsInspect(signInLogDO.getIsInspect()); + final DeptDO dept = deptService.getDept(user.getDeptId()); + if (dept != null) { + appListVO1.setDeptName(dept.getName()); + } + appListVO1.setAvtar(user.getAvatar()); + appListVO.add(appListVO1); + }); + } + return appListVO; } @Override + @Transactional public List list(InspectionsLogPageReqVO pageReqVO) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("inspections_id", pageReqVO.getInspectionsId()); - return inspectionsLogMapper.selectList(wrapper); + final List list = inspectionsLogMapper.selectList(wrapper); + if (list != null && list.size() > 0) { + //把签到记录起来 + List appListVO = new ArrayList<>(); + list.forEach(item->{ + if (item.getStatus() != null && item.getStatus() == 1) { + final List inspectionsLogAppListVO2 = this.getInspectionsLogAppListVO2(item.getInspectionsId()); + if (inspectionsLogAppListVO2 != null) {} + } + }); + + } + return list; } /** @@ -174,6 +287,86 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { } inspectionsLogMapper.updateById(inspectionsLogDO); + + //插入协同人员打卡记录表 + SignInLogDO signInLogDO = new SignInLogDO(); + signInLogDO.setInsId(inspectionsLogId); + signInLogDO.setUserId(getLoginUserId()); + signInLogMapper.insert(signInLogDO); + } + + @Override + public void confirmSignIn(InspectionsLogSaveReqVO createReqVO) { + + //查询执法记录 + final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(createReqVO.getInspectionsId()); + if (enterpriseInspectionsDO == null) { + throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + } + //根据查询出的列表判断执行到哪一步 + final InspectionsLogDO inspectionsLogNew = enterpriseInspectionsService.getInspectionsLogNew(createReqVO.getInspectionsId()); + if (inspectionsLogNew == null) { + throw exception(INSPECTIONS_LOG_NOT_EXISTS); + } + + final List signInLog = this.getSignInLog(inspectionsLogNew.getId()); + if (signInLog == null) { + throw exception(SIGN_IN_LOG_ERROR); + } + + //打卡记录里面必须有执行人 + final List collect = signInLog.stream().map(item -> item.getUserId()).collect(Collectors.toList()); + if(!collect.contains(enterpriseInspectionsDO.getUserId())) { + throw exception(SIGN_IN_LOG_ERROR4); + } + + if (signInLog.size() < 2) { + throw exception(SIGN_IN_LOG_ERROR6); + } + + //查看状态等于0 并且起到人员大于2 修改状态 + if (inspectionsLogNew.getStatus() == 0) { + inspectionsLogNew.setStatus(1); + inspectionsLogMapper.updateById(inspectionsLogNew); + } + } + + @Override + @Transactional + public void inspectionsAudit(InspectionsLogSaveReqVO createReqVO) { + + //查询执法记录 + final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(createReqVO.getInspectionsId()); + if (enterpriseInspectionsDO == null) { + throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + } + + //只有当前企业执行人才能提交审核 + if (enterpriseInspectionsDO.getUserId() != getLoginUserId()) { + throw exception(SIGN_IN_LOG_ERROR5); + } + + InspectionsLogDO updateObj = BeanUtils.toBean(createReqVO, InspectionsLogDO.class); + inspectionsLogMapper.insert(updateObj); + + //修改执行记录状态 + + } + + @Override + public List signInList(Long inspectionsId) { + + //查询最新状态 + final InspectionsLogDO inspectionsLogDO = enterpriseInspectionsService.getInspectionsLogNew(inspectionsId); + if (inspectionsLogDO != null) { + //如果当前状态不是待确认打卡的状态报错 +// if (inspectionsLogDO.getStatus() != 0) { +// throw exception(SIGN_IN_LOG_ERROR3); +// } + //根据记录查询 + return this.getInspectionsLogAppListVO(inspectionsLogDO.getId()); + } + return Collections.emptyList(); } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/maxkb/MaxkbApiService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/maxkb/MaxkbApiService.java new file mode 100644 index 0000000..24220b7 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/maxkb/MaxkbApiService.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.system.service.maxkb; + +import cn.iocoder.yudao.module.system.controller.admin.maxkb.vo.MaxkbdocumentVo; + +import java.util.List; + +public interface MaxkbApiService { + + public void getAccessToken() ; + + public void pushWebUrl(MaxkbdocumentVo maxkbdocumentVo) ; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/maxkb/MaxkbApiServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/maxkb/MaxkbApiServiceImpl.java new file mode 100644 index 0000000..94cd3c9 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/maxkb/MaxkbApiServiceImpl.java @@ -0,0 +1,72 @@ +package cn.iocoder.yudao.module.system.service.maxkb; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import cn.iocoder.yudao.framework.common.util.http.HttpUtils; +import cn.iocoder.yudao.module.infra.api.config.ConfigApi; +import cn.iocoder.yudao.module.system.controller.admin.maxkb.vo.MaxkbdocumentVo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +@Service +@Slf4j +public class MaxkbApiServiceImpl implements MaxkbApiService { + + + static final String MAXKB_ACCOUNT_URL = "maxkb-account-url"; + static final String MAXKB_ACCOUNT_USER = "maxkb-account-user"; + static final String MAXKB_ACCOUNT_PASSWORD = "maxkb-account-password"; + + static final String MAXKB_ACCOUNT_TOKEN = "maxkb-account-url-token"; + + @Resource + private StringRedisTemplate stringRedisTemplate; + + @Resource + private ConfigApi configApi; + @Override + public void getAccessToken() { + String accountUrl = configApi.getConfigValueByKey(MAXKB_ACCOUNT_URL); + String accountUser = configApi.getConfigValueByKey(MAXKB_ACCOUNT_USER); + String accountPassword = configApi.getConfigValueByKey(MAXKB_ACCOUNT_PASSWORD); + JSONObject jsonObject=new JSONObject(); + jsonObject.set("username",accountUser); + jsonObject.set("password",accountPassword); + String s = HttpUtils.post(accountUrl+"/api/user/login", null,jsonObject.toString()); + if(s!=null){ + JSONObject res = new JSONObject(s); + stringRedisTemplate.opsForValue().set(MAXKB_ACCOUNT_TOKEN, res.getStr("data"),10, TimeUnit.MINUTES); + } + } + + @Override + public void pushWebUrl(MaxkbdocumentVo maxkbdocumentVo) { + + String s = HttpUtils.post(configApi.getConfigValueByKey(MAXKB_ACCOUNT_URL) + "/api/dataset/"+maxkbdocumentVo.getId()+"/document/web",getMaxkbHeager(), JSONUtil.toJsonStr(maxkbdocumentVo)); + log.info("web知识库返回信息"+s); + } + + private MapgetMaxkbHeager(){ + String token = stringRedisTemplate.opsForValue().get(MAXKB_ACCOUNT_TOKEN); + if(StrUtil.isEmpty(token)){ + getAccessToken(); + token = stringRedisTemplate.opsForValue().get(MAXKB_ACCOUNT_TOKEN); + } + Map map=new HashMap<>(); + map.put("authorization",token); + map.put("content-type","application/json"); + return map; + } + + // /api/dataset/bff33a78-e5bd-11ef-825e-0242ac110003/document/web + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogService.java new file mode 100644 index 0000000..85ae52b --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogService.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.system.service.signinlog; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.signinlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.signinlog.SignInLogDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +import javax.validation.Valid; + +/** + * 协调人员打卡记录 Service 接口 + * + * @author 芋道源码 + */ +public interface SignInLogService { + + /** + * 创建协调人员打卡记录 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createSignInLog(@Valid SignInLogSaveReqVO createReqVO); + + /** + * 更新协调人员打卡记录 + * + * @param updateReqVO 更新信息 + */ + void updateSignInLog(@Valid SignInLogSaveReqVO updateReqVO); + + /** + * 删除协调人员打卡记录 + * + * @param id 编号 + */ + void deleteSignInLog(Long id); + + /** + * 获得协调人员打卡记录 + * + * @param id 编号 + * @return 协调人员打卡记录 + */ + SignInLogDO getSignInLog(Long id); + + /** + * 获得协调人员打卡记录分页 + * + * @param pageReqVO 分页查询 + * @return 协调人员打卡记录分页 + */ + PageResult getSignInLogPage(SignInLogPageReqVO pageReqVO); + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogServiceImpl.java new file mode 100644 index 0000000..c60e896 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogServiceImpl.java @@ -0,0 +1,74 @@ +package cn.iocoder.yudao.module.system.service.signinlog; + +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.signinlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.signinlog.SignInLogDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import cn.iocoder.yudao.module.system.dal.mysql.signinlog.SignInLogMapper; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; + +/** + * 协调人员打卡记录 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class SignInLogServiceImpl implements SignInLogService { + + @Resource + private SignInLogMapper signInLogMapper; + + @Override + public Long createSignInLog(SignInLogSaveReqVO createReqVO) { + // 插入 + SignInLogDO signInLog = BeanUtils.toBean(createReqVO, SignInLogDO.class); + signInLogMapper.insert(signInLog); + // 返回 + return signInLog.getId(); + } + + @Override + public void updateSignInLog(SignInLogSaveReqVO updateReqVO) { + // 校验存在 + validateSignInLogExists(updateReqVO.getId()); + // 更新 + SignInLogDO updateObj = BeanUtils.toBean(updateReqVO, SignInLogDO.class); + signInLogMapper.updateById(updateObj); + } + + @Override + public void deleteSignInLog(Long id) { + // 校验存在 + validateSignInLogExists(id); + // 删除 + signInLogMapper.deleteById(id); + } + + private void validateSignInLogExists(Long id) { + if (signInLogMapper.selectById(id) == null) { + throw exception(USER_NOT_EXISTS); + } + } + + @Override + public SignInLogDO getSignInLog(Long id) { + return signInLogMapper.selectById(id); + } + + @Override + public PageResult getSignInLogPage(SignInLogPageReqVO pageReqVO) { + return signInLogMapper.selectPage(pageReqVO); + } +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java index c256fec..3fc2657 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java @@ -56,4 +56,10 @@ public interface TagLibraryService { List list(String[] codeList); List childrenList(Long id); + + //根据任务id差标签 + List listByTaskId(Long taskId); + + //根据企业id标签查标签 + List listByEnterpriseId(Long enterpriseId); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java index ca7a06b..6ceb520 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java @@ -1,5 +1,10 @@ package cn.iocoder.yudao.module.system.service.taglibrary; +import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTagDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; +import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper; +import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.poi.ss.formula.functions.T; import org.springframework.stereotype.Service; @@ -15,6 +20,7 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; @@ -30,6 +36,10 @@ public class TagLibraryServiceImpl implements TagLibraryService { @Resource private TagLibraryMapper tagLibraryMapper; + @Resource + private TaskTagMapper taskTagMapper; + @Resource + private EnterpriseTagMapper enterpriseTagMapper; @Override public Integer createTagLibrary(TagLibrarySaveReqVO createReqVO) { @@ -104,6 +114,32 @@ public class TagLibraryServiceImpl implements TagLibraryService { return tagLibraryMapper.selectList(wrapper); } + @Override + public List listByTaskId(Long taskId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(TaskTagDO::getTaskId, taskId); + final List taskTagDOS = taskTagMapper.selectList(wrapper); + if (taskTagDOS != null && taskTagDOS.size() > 0) { + final List tagLibraryDOS = tagLibraryMapper.selectByIds(taskTagDOS.stream().map(TaskTagDO::getTagId).collect(Collectors.toList())); + return tagLibraryDOS; + } + + return null; + } + + @Override + public List listByEnterpriseId(Long enterpriseId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(EnterpriseTagDO::getEnterpriseId, enterpriseId); + final List enterpriseTagDOS = enterpriseTagMapper.selectList(wrapper); + if (enterpriseTagDOS != null && enterpriseTagDOS.size() > 0) { + final List tagLibraryDOS = tagLibraryMapper.selectByIds(enterpriseTagDOS.stream().map(EnterpriseTagDO::getTagId).collect(Collectors.toList())); + return tagLibraryDOS; + } + + return null; + } + // 递归构建树 private List buildTree(List tags, Integer parentId) { List tree = new ArrayList<>(); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java index a570089..15c7e3c 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoService.java @@ -53,7 +53,10 @@ public interface TaskInfoService { */ PageResult getTaskInfoPage(TaskInfoPageReqVO pageReqVO); +// List getTaskInfoList(TaskInfoPageReqVO pageReqVO); + //定时执行任务 void sendTask(Long taskId); + PageResult getTaskInfoAppPage(TaskInfoPageReqVO pageReqVO); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java index 33c3da5..f986d0f 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java @@ -1,22 +1,33 @@ package cn.iocoder.yudao.module.system.service.taskinfo; -import cn.iocoder.yudao.framework.security.core.LoginUser; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateUtil; +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.tasktag.vo.TaskTagPageReqVO; 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.dataobject.taglibrary.TagLibraryDO; import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.mysql.enterprise.EnterpriseMapper; import cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections.EnterpriseInspectionsMapper; -import cn.iocoder.yudao.module.system.dal.mysql.inspectionslog.InspectionsLogMapper; +import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper; import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; +import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.*; +import java.util.stream.Collectors; + 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; @@ -29,7 +40,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper; import javax.annotation.Resource; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; +import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; /** @@ -39,6 +50,7 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; */ @Service @Validated +@Slf4j public class TaskInfoServiceImpl implements TaskInfoService { @Resource @@ -52,13 +64,24 @@ public class TaskInfoServiceImpl implements TaskInfoService { @Resource private EnterpriseInspectionsMapper enterpriseInspectionsMapper; @Resource - private InspectionsLogMapper inspectionsLogMapper; + private TagLibraryMapper tagLibraryMapper; + @Resource + private AdminUserService adminUserService; + @Resource + private AdminUserMapper adminUserMapper; @Override @Transactional public Long createTaskInfo(TaskInfoSaveReqVO createReqVO) { // 插入 + TaskInfoDO taskInfo = BeanUtils.toBean(createReqVO, TaskInfoDO.class); + String serialNumber = ""; + String time = ""; + time = DateUtil.format(new Date(), "yyyyMMddHHmm"); + serialNumber = "HB" + time; + taskInfo.setTaskNumber(serialNumber); + taskInfoMapper.insert(taskInfo); //添加任务标签 @@ -68,14 +91,7 @@ public class TaskInfoServiceImpl implements TaskInfoService { }); } -// -// //添加定时任务 -// JobSaveReqVO jobSaveReqVO = new JobSaveReqVO(); -// try { -// jobApi.createJob(jobSaveReqVO); -// } catch (Throwable e) { -// throw new RuntimeException(e); -// } + //添加企业范围 if (!createReqVO.getEnterpriseIds().isEmpty() && createReqVO.getEnterpriseIds().size() > 0) { List list = new ArrayList<>(); @@ -88,13 +104,26 @@ public class TaskInfoServiceImpl implements TaskInfoService { EnterpriseInspectionsDO inspection = new EnterpriseInspectionsDO(); inspection.setTaskId(taskInfo.getId()); inspection.setEnterpriseId(item); - //专管员 - inspection.setUserId(enterpriseDO.getUserId()); + + if (enterpriseDO.getUserId() != null) { + inspection.setCreator(enterpriseDO.getUserId().toString()); + } + list.add(inspection); }); enterpriseInspectionsMapper.insertBatch(list); } + if(taskInfo.getId()>0){ +// //添加定时任务 +// JobSaveReqVO jobSaveReqVO = new JobSaveReqVO(); +// try { +// jobApi.createJob(jobSaveReqVO); +// } catch (Throwable e) { +// throw new RuntimeException(e); +// } + + } // 返回 return taskInfo.getId(); @@ -148,25 +177,10 @@ public class TaskInfoServiceImpl implements TaskInfoService { @Override public PageResult getTaskInfoPage(TaskInfoPageReqVO pageReqVO) { -// final Long loginUserId = getLoginUserId(); - //根据分配表反查任务表 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(EnterpriseInspectionsDO::getCreator, getLoginUserId()); - List list = enterpriseInspectionsMapper.selectList(wrapper); - if (!list.isEmpty() && list.size() > 0) { - final List> data = new ArrayList<>(); - list.forEach(item->{ -// Map map = new HashMap<>(); -// map.put("id", item.getTaskId().toString()); -// map.put("name", item.get) -// taskIds.add(item.getTaskId()); - }); - } - - return taskInfoMapper.selectPage(pageReqVO); } + @Override public void sendTask(Long taskId) { final TaskInfoDO taskInfoDO = taskInfoMapper.selectById(taskId); @@ -181,4 +195,105 @@ public class TaskInfoServiceImpl implements TaskInfoService { } + @Override + public PageResult getTaskInfoAppPage(TaskInfoPageReqVO pageReqVO) { + + //按标签查询 + if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(TaskTagDO::getTagId, pageReqVO.getTagList()); + final List taskTagDOS = taskTagMapper.selectList(wrapper); + if (taskTagDOS != null && taskTagDOS.size() > 0) { + pageReqVO.setTagList(taskTagDOS.stream().map(item->item.getTaskId()).collect(Collectors.toList())); + } + } + + //按时间查询 + if (pageReqVO.getSelectWeek() != null) { + LocalDateTime now = LocalDateTime.now(); + LocalDateTime[] dateList = new LocalDateTime[2]; + + switch (pageReqVO.getSelectWeek()) { + case 1: + dateList[0] = now.minusDays(3); // 三天前 + break; + case 2: + dateList[0] = now.minusWeeks(1); // 一周前 + break; + case 3: + dateList[0] = now.minusMonths(1); // 一月前 + break; + case 4: + dateList[0] = now.minusYears(1); // 一年前 + break; + } + dateList[1] = now; + pageReqVO.setEndDate(dateList); + } + + final PageResult taskInfoDOPageResult = taskInfoMapper.selectAppPage(pageReqVO); + if (taskInfoDOPageResult.getList() != null && taskInfoDOPageResult.getList().size() > 0) { + taskInfoDOPageResult.getList().forEach(item->{ + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("task_id", item.getId()); + //根据不同的角色查询 + /* + 管理员,局长,查全部 + 检查员,查自己的 + 队长 查本部门 + */ + Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); + + final AdminUserDO user1 = adminUserService.getUser(loginUserId); + if (user1.getPostIds().contains(1l) || user1.getPostIds().contains(2l)) { + //全部 + } else if (user1.getPostIds().contains(4l)) { + //本部门 + final List adminUserDOS = adminUserMapper.selectList(new QueryWrapper().eq("dept_id", user1.getDeptId())); + + if (adminUserDOS != null || adminUserDOS.size() > 0) { + final List collect = adminUserDOS.stream().map(res -> res.getId()).collect(Collectors.toList()); + wrapper.in("user_id", collect); + } + + } else if (user1.getPostIds().contains(5l)) { + //自己 + wrapper.eq("user_id", loginUserId); + } + + item.setTaskExecNum(0); + + List enterpriseInspectionsDOList = enterpriseInspectionsMapper.selectList(wrapper); + log.info("enterpriseInspectionsDOList:{}", enterpriseInspectionsDOList); + if (enterpriseInspectionsDOList != null && enterpriseInspectionsDOList.size() > 0) { + item.setTaskExecNum(enterpriseInspectionsDOList.size()); + final List collect = enterpriseInspectionsDOList.stream().filter(res -> res.getStatus() == 5).collect(Collectors.toList()); + item.setTaskFinishNum(collect.size()); + } + + //获取任务标签 + QueryWrapper wrapper1 = new QueryWrapper<>(); + wrapper1.eq("task_id", item.getId()); + List taskTagDOList = taskTagMapper.selectList(wrapper1); + if (taskTagDOList != null && taskTagDOList.size() > 0) { + final List collect = taskTagDOList.stream().map(TaskTagDO::getTagId).collect(Collectors.toList()); + final List tagLibraryDOS = tagLibraryMapper.selectByIds(collect); + if (tagLibraryDOS != null && tagLibraryDOS.size() > 0) { + item.setTagList(tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList())); + } + } + enterpriseInspectionsMapper.selectList(); + }); + } + + //筛选出 TaskExecNum 为0的 + if (taskInfoDOPageResult.getList() != null && taskInfoDOPageResult.getList().size() > 0) { + final List collect = taskInfoDOPageResult.getList().stream().filter(res -> res.getTaskExecNum() > 0).collect(Collectors.toList()); + taskInfoDOPageResult.setList(collect); + taskInfoDOPageResult.setTotal(Long.valueOf(collect.size())); + } + + return taskInfoDOPageResult; + } + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tasktag/TaskTagService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tasktag/TaskTagService.java index a4b8638..b9494aa 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tasktag/TaskTagService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tasktag/TaskTagService.java @@ -53,4 +53,14 @@ public interface TaskTagService { */ PageResult getTaskTagPage(TaskTagPageReqVO pageReqVO); + + + /** + * 获得任务标签关联分页 + * + * @param pageReqVO 分页查询 + * @return 任务标签关联分页 + */ + List getTaskTagList(TaskTagPageReqVO pageReqVO); + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tasktag/TaskTagServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tasktag/TaskTagServiceImpl.java index ac4b4bf..529acc4 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tasktag/TaskTagServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tasktag/TaskTagServiceImpl.java @@ -72,4 +72,10 @@ public class TaskTagServiceImpl implements TaskTagService { return taskTagMapper.selectPage(pageReqVO); } + @Override + public List getTaskTagList(TaskTagPageReqVO pageReqVO) { + return taskTagMapper.selectList(pageReqVO); + } + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java index fe948dd..ae04b4e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java @@ -7,10 +7,7 @@ import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthRegisterReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportExcelVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; +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.user.AdminUserDO; import com.xingyuv.jushauth.model.AuthUser; @@ -229,4 +226,6 @@ public interface AdminUserService { AdminUserDO autoRegisterUser(AuthUser authUser, int userType); void userAudit(UserAuditLogSaveReqVO auditLogSaveReqVO); + + List getSimpleUserZGList(); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index df56022..81d5215 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -17,10 +17,7 @@ import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthRegisterReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportExcelVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; +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.dept.UserPostDO; @@ -36,6 +33,7 @@ import cn.iocoder.yudao.module.system.service.dept.PostService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.tenant.TenantService; import cn.iocoder.yudao.module.system.service.userAuditlog.UserAuditLogService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.mzt.logapi.context.LogRecordContext; import com.mzt.logapi.service.impl.DiffParseFunction; @@ -52,6 +50,7 @@ import javax.validation.ConstraintViolationException; import java.io.InputStream; import java.time.LocalDateTime; import java.util.*; +import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; @@ -93,6 +92,8 @@ public class AdminUserServiceImpl implements AdminUserService { private ConfigApi configApi; @Resource private UserAuditLogMapper userAuditLogMapper; + @Resource + private AdminUserMapper adminUserMapper; @Override @Transactional(rollbackFor = Exception.class) @@ -579,6 +580,28 @@ public class AdminUserServiceImpl implements AdminUserService { } + @Override + public List getSimpleUserZGList() { + + List list = new ArrayList<>(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.isNotNull(AdminUserDO::getRealName); + wrapper.eq(AdminUserDO::getStatus, CommonStatusEnum.ENABLE.getStatus()); + wrapper.isNotNull(AdminUserDO::getDeptId); + + final List adminUserDOS = userMapper.selectList(wrapper); + adminUserDOS.forEach(item->{ + DeptUserReqVO deptUserReqVO = new DeptUserReqVO(); + deptUserReqVO.setId(item.getId()); + deptUserReqVO.setRealName(item.getRealName()); + final DeptDO dept = deptService.getDept(item.getDeptId()); + deptUserReqVO.setDeptName(dept.getName()); + list.add(deptUserReqVO); + }); + + return list; + } + public void bindSocialUser(Long userId, AuthUser authUser) { // SocialUserDO socialUser = new SocialUserDO(); // socialUser.setUserId(userId); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/weixin/TokenValidatorService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/weixin/TokenValidatorService.java new file mode 100644 index 0000000..a6725c4 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/weixin/TokenValidatorService.java @@ -0,0 +1,42 @@ +package cn.iocoder.yudao.module.system.service.weixin; + +import org.springframework.stereotype.Service; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; + +@Service +public class TokenValidatorService { + public static boolean validateToken(String token, String signature, String timestamp, String nonce) { + String[] arr = new String[]{token, timestamp, nonce}; + // 对 token、timestamp 和 nonce 按字典序排序 + Arrays.sort(arr); + StringBuilder content = new StringBuilder(); + for (String s : arr) { + content.append(s); + } + String tempStr = sha1Encode(content.toString()); + // 将加密后的字符串与 signature 进行对比 + return tempStr!= null && tempStr.equals(signature); + } + private static String sha1Encode(String str) { + try { + MessageDigest digest = MessageDigest.getInstance("SHA-1"); + digest.update(str.getBytes()); + byte[] bytes = digest.digest(); + StringBuilder hexStr = new StringBuilder(); + for (byte b : bytes) { + String hex = Integer.toHexString(0xFF & b); + if (hex.length() == 1) { + hexStr.append('0'); + } + hexStr.append(hex); + } + return hexStr.toString(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return null; + } +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/weixin/WeChatService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/weixin/WeChatService.java new file mode 100644 index 0000000..4a37e9f --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/weixin/WeChatService.java @@ -0,0 +1,67 @@ +package cn.iocoder.yudao.module.system.service.weixin; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Service +public class WeChatService { + @Autowired + private ObjectMapper objectMapper; + @Value("${wx.miniapp.appid}") + private String APP_ID ; // 替换为你的小程序 AppID + @Value("${wx.miniapp.secret}") + private String APP_SECRET; // 替换为你的小程序 AppSecret + + /** + * 获取微信 Access Token + */ + public String getAccessToken() throws Exception { + String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + APP_ID + "&secret=" + APP_SECRET; + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpGet httpGet = new HttpGet(url); + String response = EntityUtils.toString(httpClient.execute(httpGet).getEntity()); + httpClient.close(); + + ObjectMapper mapper = new ObjectMapper(); + JsonNode node = mapper.readTree(response); + return node.get("access_token").asText(); + } + + + /** + * 发送订阅消息 + */ + public void sendSubscribeMessage(String accessToken, String openId, String templateId) throws Exception { + String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken; + + // 构建消息内容 + ObjectNode data = objectMapper.createObjectNode(); + data.put("touser", openId); // 用户的 OpenID + data.put("template_id", templateId); // 订阅消息模板 ID + data.put("page", "/sub/common/waiting"); // 点击消息跳转的小程序页面 + data.put("data", objectMapper.createObjectNode() + .put("thing1", objectMapper.createObjectNode().put("value", "Hello, World!")) + .at("thing2")); + + // 发送 HTTP 请求 + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(url); + httpPost.setHeader("Content-Type", "application/json"); + httpPost.setEntity(new StringEntity(data.toString())); + String response = EntityUtils.toString(httpClient.execute(httpPost).getEntity()); + httpClient.close(); + + System.out.println("订阅消息发送结果: " + response); + } + + +} diff --git a/yudao-server/src/main/resources/application-dev.yaml b/yudao-server/src/main/resources/application-dev.yaml index a74c80c..16ab13e 100644 --- a/yudao-server/src/main/resources/application-dev.yaml +++ b/yudao-server/src/main/resources/application-dev.yaml @@ -145,16 +145,16 @@ logging: wx: # 参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档 mp: # 公众号配置(必填) - app-id: wx041349c6f39b268b - secret: 5abee519483bc9f8cb37ce280e814bd0 + app-id: wx6d80755768234f3b + secret: c8180f2ab1b8454d403c7aa336782e21 # 存储配置,解决 AccessToken 的跨节点的共享 config-storage: type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取 key-prefix: wx # Redis Key 的前缀 http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台 miniapp: # 小程序配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md 文档 - appid: wx63c280fe3248a3e7 - secret: 6f270509224a7ae1296bbf1c8cb97aed + appid: wx6d80755768234f3b + secret: c8180f2ab1b8454d403c7aa336782e21 config-storage: type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取 key-prefix: wa # Redis Key 的前缀 diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 81a9141..09ccef5 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -46,7 +46,7 @@ spring: primary: master datasource: master: - url: jdbc:mysql://127.0.0.1:3306/hb-yudao?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://192.168.2.5:3306/hb-yudao?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -55,7 +55,7 @@ spring: # url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例 username: root - password: 123123 + password: jingke@123 # username: sa # SQL Server 连接的示例 # password: Yudao@2024 # SQL Server 连接的示例 # username: SYSDBA # DM 连接的示例 @@ -185,8 +185,8 @@ wx: mp: # 公众号配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档 # app-id: wx041349c6f39b268b # 测试号(牛希尧提供的) # secret: 5abee519483bc9f8cb37ce280e814bd0 - app-id: wx5b23ba7a5589ecbb # 测试号(自己的) - secret: 2a7b3b20c537e52e74afd395eb85f61f + app-id: wx6d80755768234f3b # 测试号(自己的) + secret: c8180f2ab1b8454d403c7aa336782e21 # app-id: wxa69ab825b163be19 # 测试号(Kongdy 提供的) # secret: bd4f9fab889591b62aeac0d7b8d8b4a0 # 存储配置,解决 AccessToken 的跨节点的共享 diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index be7fbe7..9edf6e5 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -259,6 +259,7 @@ yudao: - /admin-api/pay/notify/** # 支付回调通知,不携带租户编号 - /jmreport/* # 积木报表,无法携带租户编号 - /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,无法携带租户编号 + - /admin-api/system/wechat/** ignore-tables: - system_tenant - system_tenant_package