From 8d89747fe48b0ff36507aa3892e0dfd918dd5b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E4=B9=85=E5=93=A5?= <787952492@qq.com> Date: Fri, 24 Jun 2022 11:36:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=20=20=E6=88=90=E5=91=98?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/CpUser/CpUserServiceImpl.java | 9 +++- .../module/farm/annotation/FarmMsgAspect.java | 42 ++----------------- .../statistical/StatisticalController.java | 4 +- 3 files changed, 13 insertions(+), 42 deletions(-) diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImpl.java index c343e0f5..df1eed86 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/CpUser/CpUserServiceImpl.java @@ -110,7 +110,13 @@ public class CpUserServiceImpl extends ServiceImpl implem public void cpUserSync() throws WxErrorException { WxCpConfigStorage config = wxCpService.getWxCpConfigStorage(); List departList = wxCpService.getDepartmentService().list(null); - List userList = wxCpService.getUserService().listByDepartment(1L, true, 0); + + //根据部门id获取部门成员信息 + //6 旭清回鄉生態農業發展公司 + //35 回鄉信息技术公司 + List userList = wxCpService.getUserService().listByDepartment(6L, true, 0); + userList.addAll(wxCpService.getUserService().listByDepartment(35L, true, 0)); + List rs = CpUserConvert.INSTANCE.convertListFromWxApi(userList); @@ -120,7 +126,6 @@ public class CpUserServiceImpl extends ServiceImpl implem List nowUsersIds = nowUsers.stream().map(CpUserDO::getUserId).collect(Collectors.toList()); rs.removeIf(cpUserDO -> nowUsersIds.contains(cpUserDO.getUserId())); - this.saveBatch(rs); // 已经离职的员工 设置删除 diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/annotation/FarmMsgAspect.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/annotation/FarmMsgAspect.java index e12cff0a..2c6eff2f 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/annotation/FarmMsgAspect.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/annotation/FarmMsgAspect.java @@ -108,20 +108,10 @@ public class FarmMsgAspect { AdminUserDO adminUser = adminUserMapper.selectOne(AdminUserDO::getId, getLoginUserId()); CpUserDO user = cpUserMapper.selectOne(CpUserDO::getUserId, adminUser.getCpUserId()); - StringBuilder description = new StringBuilder() - .append(user.getName()) - .append(" ") - .append(farmMsgDTO.getOperation().getDesc()) - .append(farmMsgDTO.getType().getDesc()) - .append(":") - .append(ObjectUtil.isEmpty(farmMsgDTO.getMsg()) ? farmMsgDTO.getTitle() : farmMsgDTO.getMsg()) - .append("(其中有你)"); - if (!toUserStr.contains("WeiLaiKeQi")){ - return object; - } +// if (!toUserStr.contains("WeiLaiKeQi")){ +// return object; +// } if (!farmMsgDTO.getNoSendMsg()){ - //企业微信内部发送信息 - //this.sendCpMsg(description.toString(), toUserStr); //企业微信小程序通知消息 this.sendMiniMsg(user, farmMsgDTO, toUserStr); } @@ -141,31 +131,6 @@ public class FarmMsgAspect { return object; } - - public void sendCpMsg(String desc, String userStr) throws Throwable{ - // 构造一个企业推送消息 - WxCpMessage message = new WxCpMessage(); - // 发企业微信 - WxCpMessageService wxCpMessageService = wxCpService.getMessageService(); - - //消息类型 必填 此处固定为 文本卡片 - message.setMsgType("textcard"); - //企业应用id 必填 - message.setAgentId(wxCpService.getWxCpConfigStorage().getAgentId()); - //消息标题 必填 - message.setTitle("回乡农场通知"); - //消息描述 必填 - message.setDescription(desc); - //点击后跳转链接 必填 - message.setUrl("https://www.baidu.com"); - - //接受消息成员 选填 - message.setToUser(userStr); - log.info("企业微信消息发送内容:{}", message); - WxCpMessageSendResult result = wxCpMessageService.send(message); - log.info("企业微信消息发送结果:{}",result); - } - //发送小程序通知消息 public void sendMiniMsg(CpUserDO createUser, FarmMsgDTO farmMsgDTO, String toUserStr) throws WxErrorException { // 发小程序 @@ -181,6 +146,7 @@ public class FarmMsgAspect { message.setAppId(appid); message.setTitle(farmMsgDTO.getType().getDesc() + farmMsgDTO.getOperation().getDesc() + "通知"); message.setDescription(LocalDateTimeUtil.formatNormal(LocalDateTime.now())); + message.setPage(farmMsgDTO.getType().equals(FarmMsgTypeEnum.PROJECT) ? "pages/project/index" : "pages/task/index"); Map map2 = new HashMap<>(); map2.put("发起人", createUser.getName()); diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/StatisticalController.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/StatisticalController.java index 9d5cbf63..b2504263 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/StatisticalController.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/statistical/StatisticalController.java @@ -115,12 +115,12 @@ public class StatisticalController { if (taskDO.getCropId().equals(cropDO.getId())){ if (cropMap.containsKey(cropDO.getId())){ CakeSeries cakeSeries = cropMap.get(cropDO.getId()); - cakeSeries.setValue(cakeSeries.getValue() + taskDO.getCropNum()); + cakeSeries.setValue(cakeSeries.getValue() + (taskDO.getCropNum() == null ? 0 : taskDO.getCropNum())); }else{ CakeSeries cakeSeries = CakeSeries.builder() .name(cropDO.getName()) - .value(taskDO.getCropNum()) + .value(taskDO.getCropNum() == null ? 0 : taskDO.getCropNum()) .labelText("不知道说啥") .build(); cropMap.put(cropDO.getId(), cakeSeries);