From b494af3443a84c0cfab701e04b24216c23995992 Mon Sep 17 00:00:00 2001 From: zy <276996223@qq.com> Date: Mon, 17 Feb 2025 16:33:18 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enterprise/EnterpriseController.java | 22 ++++++++++++++++--- .../enterprise/EnterpriseServiceImpl.java | 10 ++++++++- 2 files changed, 28 insertions(+), 4 deletions(-) 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 a654e96..51ad83b 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 @@ -138,8 +138,24 @@ public class EnterpriseController { } //获取标签 - final List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); - enterprise.setTagList(tagLibraryDOS.stream().map(item->item.getTagName()).collect(Collectors.toList())); +// final List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); +// enterprise.setTagList(tagLibraryDOS.stream().map(item->item.getTagName()).collect(Collectors.toList())); + + // 获取标签 + List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); + if (tagLibraryDOS != null) { + enterprise.setTagList(tagLibraryDOS.stream() + .map(TagLibraryDO::getTagName) + .collect(Collectors.toList())); + } else { + // 处理 tagLibraryDOS 为 null 的情况,这里可以设置一个空列表 + enterprise.setTagList(Collections.emptyList()); + } + + + + //通过userID获取专管人 + enterprise.setInviterName(adminUserService.getUser(Long.valueOf(enterprise.getUserId())).getNickname()); //获取资质 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -163,7 +179,7 @@ public class EnterpriseController { enterprise.setQualificationList(enterpriseQualificationList); } - //获取企业标签 + return success(BeanUtils.toBean(enterprise, EnterpriseRespVO.class)); } 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 d26d8e2..c5781f8 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 @@ -59,6 +59,8 @@ public class EnterpriseServiceImpl implements EnterpriseService { private EnterpriseTagMapper enterpriseTagMapper; @Resource private UserRoleMapper userRoleMapper; + @Resource + private AdminUserService adminUserService; @Override @Transactional @@ -106,8 +108,14 @@ public class EnterpriseServiceImpl implements EnterpriseService { @Override @Transactional public Long pccreateEnterprise(EnterpriseSaveReqVO createReqVO) { + //专管员所属部门 + final AdminUserDO user = adminUserService.getUser(createReqVO.getUserId()); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + createReqVO.setDeptId(user.getDeptId()); EnterpriseDO enterprise = BeanUtils.toBean(createReqVO, EnterpriseDO.class); - enterprise.setDepartmentId(1L); + enterprise.setDepartmentId(createReqVO.getDeptId()); enterpriseMapper.insert(enterprise); if (createReqVO.getFileIds() != null && createReqVO.getFileIds().length > 0) { for (Long fileId : createReqVO.getFileIds()) { From 1ce23175cec32376071273c1886b266ffbed148a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Mon, 17 Feb 2025 16:35:26 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B6=88=E6=81=AF=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/system/job/TaskSendStartMessageJob.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java index 01ea879..f856932 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java @@ -38,7 +38,7 @@ public class TaskSendStartMessageJob implements JobHandler { SocialWxaSubscribeMessageSendReqDTO reqDTO = new SocialWxaSubscribeMessageSendReqDTO(); reqDTO.setUserType(1); reqDTO.setTemplateTitle("环保任务通知"); - reqDTO.setPage("pages/index"); + reqDTO.setPage("sub/task/detail?id="+beforeTaskInfo.getId()); reqDTO.setUserId(x.getUserId()); Map message = new HashMap<>(); message.put("thing2", beforeTaskInfo.getTitle()); From 69f88eb197c5256e07094514dd303ce0f3d49045 Mon Sep 17 00:00:00 2001 From: zy <276996223@qq.com> Date: Tue, 18 Feb 2025 09:49:19 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=BB=E5=8A=A1BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/taskinfo/vo/TaskInfoSaveReqVO.java | 10 ++-------- .../system/service/taskinfo/TaskInfoServiceImpl.java | 1 + 2 files changed, 3 insertions(+), 8 deletions(-) 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 ecef9b3..146de60 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 @@ -55,16 +55,10 @@ public class TaskInfoSaveReqVO { private String status; @Schema(description = "任务计划开始时间") - @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) - @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDate startDate; + private LocalDateTime startDate; @Schema(description = "任务计划结束时间") - @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) - @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDate endDate; + private LocalDateTime endDate; @Schema(description = "父任务id", example = "30399") private Long parentId; 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 dd3f248..d5de43e 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 @@ -89,6 +89,7 @@ public class TaskInfoServiceImpl implements TaskInfoService { String time = ""; time = DateUtil.format(new Date(), "yyyyMMddHHmm"); serialNumber = "HB" + time; + //随机数 taskInfo.setTaskNumber(serialNumber); taskInfoMapper.insert(taskInfo); From 47c4bbf9cac1a915b125370c2629eacaadfade76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Tue, 18 Feb 2025 10:37:48 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=97=A5=E6=9C=9F=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=9B=9E=E6=98=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/taskinfo/vo/TaskInfoRespVO.java | 15 +++++++++++++-- .../admin/taskinfo/vo/TaskInfoSaveReqVO.java | 10 ++++++++-- .../system/job/TaskSendStartMessageJob.java | 4 ++-- 3 files changed, 23 insertions(+), 6 deletions(-) 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 32ee6af..c8a62cd 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 @@ -5,6 +5,11 @@ import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.Enter 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 com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -59,11 +64,17 @@ public class TaskInfoRespVO { @Schema(description = "任务计划开始时间") @ExcelProperty("任务计划开始时间") - private LocalDateTime startDate; + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate startDate; @Schema(description = "任务计划结束时间") @ExcelProperty("任务计划结束时间") - private LocalDateTime endDate; + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate endDate; @Schema(description = "任务创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("任务创建时间") 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 146de60..ecef9b3 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 @@ -55,10 +55,16 @@ public class TaskInfoSaveReqVO { private String status; @Schema(description = "任务计划开始时间") - private LocalDateTime startDate; + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate startDate; @Schema(description = "任务计划结束时间") - private LocalDateTime endDate; + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate endDate; @Schema(description = "父任务id", example = "30399") private Long parentId; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java index f856932..6ae2415 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java @@ -42,9 +42,9 @@ public class TaskSendStartMessageJob implements JobHandler { reqDTO.setUserId(x.getUserId()); Map message = new HashMap<>(); message.put("thing2", beforeTaskInfo.getTitle()); - message.put("time3", DateUtil.format(beforeTaskInfo.getStartDate(), DateUtils.FORMAT_YEAR_MONTH_DAY)); + message.put("time3", DateUtil.format(beforeTaskInfo.getStartDate().atStartOfDay(), DateUtils.FORMAT_YEAR_MONTH_DAY)); message.put("thing4", beforeTaskInfo.getDescription()); - message.put("time5", DateUtil.format(beforeTaskInfo.getEndDate(), DateUtils.FORMAT_YEAR_MONTH_DAY)); + message.put("time5", DateUtil.format(beforeTaskInfo.getEndDate().atStartOfDay(), DateUtils.FORMAT_YEAR_MONTH_DAY)); reqDTO.setMessages(message); socialClientApi.sendWxaSubscribeMessage(reqDTO); }