fanxp 1 year ago
parent
commit
3aca8c723b

+ 1 - 1
Makefile

@@ -2,7 +2,7 @@ merge:
 	git checkout master;git merge dev;git push;git checkout dev;
 
 create-tag:
-	git checkout master;git tag v1.2.0;git push origin --tags;git checkout dev;
+	git checkout master;git tag v1.2.1;git push origin --tags;git checkout dev;
 
 remove-tag:
 	git tag -d v1.1.8;git push origin :refs/tags/v1.1.8;

+ 1 - 1
src/main/java/com/xjrsoft/module/oa/service/impl/NewsServiceImpl.java

@@ -302,7 +302,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
                     for (NewsRelationVo newsRelationVo : newsRelationVoList) {
                         WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
                         weChatSendMessageDto.setUserId(newsRelationVo.getUserName());
-                        weChatSendMessageDto.setTemplateId("sHsmz7LRj7HLd7GSTS3r2uKMhE2f1iDAW15RqSK_6KM");
+                        weChatSendMessageDto.setTemplateId("qmpXORPM1Cocqn503Qa4OkNNQ0uxlj2-ed9m6uWO-v4");
                         weChatSendMessageDto.setUrl(StrUtil.format("{}/pages/message/notice/detail?id={}", commonPropertiesConfig.getDomainApp(), id));
                         weChatSendMessageDto.setMsgId(id.toString());
                         JSONObject data = new JSONObject();

+ 24 - 22
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -417,28 +417,30 @@ public class UserController {
     @PostMapping("/bind-openid")
     @ApiOperation(value = "绑定微信 Openid")
     public  R bindOpenid(@RequestBody BindOpenidDto dto) {
-        User user = userService.getOne(Wrappers.<User>query().lambda().select(User::getId, User::getOpenId,User::getUnionId).eq(User::getId, dto.getId()), false);
-        if (user != null) {
-            if (StrUtil.isNotBlank(user.getOpenId())) {
-                return R.error("该用户已经绑定微信!");
-            }
-
-            long count = userService.count(Wrappers.<User>query().lambda().eq(User::getOpenId, dto.getOpenid()));
-            if(count > 0){
-                return R.error("该用户已经绑定微信!");
-            }
-
-            User updateUser = new User();
-            updateUser.setId(dto.getId());
-            updateUser.setOpenId(dto.getOpenid());
-            return R.ok(userService.updateById(updateUser));
-        }else{
-            long count = userService.count(Wrappers.<User>query().lambda().eq(User::getOpenId, dto.getOpenid()));
-            if(count > 0){
-                return R.error("该用户已经绑定微信!");
-            }
-        }
-        return R.error("该用户不存在!");
+//        User user = userService.getOne(Wrappers.<User>query().lambda().select(User::getId, User::getOpenId,User::getUnionId).eq(User::getId, dto.getId()), false);
+//        if (user != null) {
+//            if (StrUtil.isNotBlank(user.getOpenId())) {
+//                return R.error("该用户已经绑定微信!");
+//            }
+//
+//            long count = userService.count(Wrappers.<User>query().lambda().eq(User::getOpenId, dto.getOpenid()));
+//            if(count > 0){
+//                return R.error("该用户已经绑定微信!");
+//            }
+//
+//            User updateUser = new User();
+//            updateUser.setId(dto.getId());
+//            updateUser.setOpenId(dto.getOpenid());
+//            return R.ok(userService.updateById(updateUser));
+//        }else{
+//            long count = userService.count(Wrappers.<User>query().lambda().eq(User::getOpenId, dto.getOpenid()));
+//            if(count > 0){
+//                return R.error("该用户已经绑定微信!");
+//            }
+//        }
+//        return R.error("该用户不存在!");
+
+        return R.ok(userService.bindOpenid(dto));
     }
 
     @GetMapping("/unbind-openid")

+ 7 - 0
src/main/java/com/xjrsoft/module/organization/service/IUserService.java

@@ -42,6 +42,13 @@ public interface IUserService extends MPJBaseService<User> {
      */
     boolean resetPassword(ResetPasswordDto dto);
 
+    /**
+     * 绑定微信 Openid
+     * @param dto
+     * @return
+     */
+    boolean bindOpenid(BindOpenidDto dto);
+
     /**
      * 批量获取用户信息
      *

+ 38 - 3
src/main/java/com/xjrsoft/module/organization/service/impl/UserServiceImpl.java

@@ -174,9 +174,12 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
         //删除时需要同时删除用户部门关联表和用户角色关联表和用户岗位关系表数据。
         this.removeBatchByIds(ids);
         //根据用户ids去缓存中查询到对应的三个表的数据
-        List<UserDeptRelation> userDeptRelationList = redisUtil.get(GlobalConstant.USER_DEPT_RELATION_CACHE_KEY, new TypeReference<List<UserDeptRelation>>() {});
-        List<UserPostRelation> userPostRelationList = redisUtil.get(GlobalConstant.USER_POST_RELATION_CACHE_KEY, new TypeReference<List<UserPostRelation>>() {});
-        List<UserRoleRelation> userRoleRelationList = redisUtil.get(GlobalConstant.USER_ROLE_RELATION_CACHE_KEY, new TypeReference<List<UserRoleRelation>>() {});
+        List<UserDeptRelation> userDeptRelationList = redisUtil.get(GlobalConstant.USER_DEPT_RELATION_CACHE_KEY, new TypeReference<List<UserDeptRelation>>() {
+        });
+        List<UserPostRelation> userPostRelationList = redisUtil.get(GlobalConstant.USER_POST_RELATION_CACHE_KEY, new TypeReference<List<UserPostRelation>>() {
+        });
+        List<UserRoleRelation> userRoleRelationList = redisUtil.get(GlobalConstant.USER_ROLE_RELATION_CACHE_KEY, new TypeReference<List<UserRoleRelation>>() {
+        });
         //拿用户ids进行过滤,如果存在,就删除
         List<Long> deptRelationIds = userDeptRelationList.stream().filter(u -> ids.contains(u.getUserId())).map(UserDeptRelation::getId).collect(Collectors.toList());
         List<Long> postRelationIds = userPostRelationList.stream().filter(u -> ids.contains(u.getUserId())).map(UserPostRelation::getId).collect(Collectors.toList());
@@ -235,6 +238,38 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
         return updateById(user);
     }
 
+    @Override
+    public boolean bindOpenid(BindOpenidDto dto) {
+        User user = this.getOne(Wrappers.<User>query().lambda().select(User::getId, User::getOpenId, User::getUnionId).eq(User::getId, dto.getId()), false);
+        if (user != null) {
+            if (StrUtil.isNotBlank(user.getOpenId())) {
+                throw new MyException("该用户已经绑定微信");
+            }
+            long count = this.count(Wrappers.<User>query().lambda().eq(User::getOpenId, dto.getOpenid()));
+            if (count > 0) {
+                throw new MyException("该用户已经绑定微信!");
+            }
+            User updateUser = new User();
+            updateUser.setId(dto.getId());
+            updateUser.setOpenId(dto.getOpenid());
+            boolean result = this.updateById(updateUser);
+            // 用户绑定微信后,更新缓存
+            if (result) {
+                CompletableFuture.runAsync(() -> {
+                    List<User> list = list();
+                    redisUtil.set(GlobalConstant.USER_CACHE_KEY, list);
+                });
+            }
+            return result;
+        } else {
+            long count = this.count(Wrappers.<User>query().lambda().eq(User::getOpenId, dto.getOpenid()));
+            if (count > 0) {
+                throw new MyException("该用户已经绑定微信!");
+            }
+        }
+        throw new MyException("该用户不存在!");
+    }
+
     @Override
     public List<UserInfoVo> getUsersInfo(String ids) {
 

+ 0 - 1
src/main/java/com/xjrsoft/module/system/dto/LoginByCodeDto.java

@@ -12,6 +12,5 @@ public class LoginByCodeDto {
     private String code;
 
     @ApiModelProperty("type")
-    @NotBlank(message = "类型不能为空!")
     private Integer type;
 }

+ 7 - 1
src/main/java/com/xjrsoft/module/system/service/impl/LoginServiceImpl.java

@@ -115,7 +115,13 @@ public class LoginServiceImpl implements ILoginService {
     @Override
     public LoginByCodeVo loginByCode(LoginByCodeDto dto) throws Exception {
         LoginByCodeVo result = new LoginByCodeVo();
-        String[] ids = weChatUtil.getOpenid(dto.getCode());
+        String[] ids;
+        if (dto.getType() == 0) {
+            ids = weChatUtil.getMpOpenid(dto.getCode());
+        }else{
+            ids = weChatUtil.getOpenid(dto.getCode());
+        }
+
         if (ids == null) throw new MyException("code无效");
 
         LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();

+ 1 - 1
src/main/java/com/xjrsoft/module/workflow/listener/TaskDelegate.java

@@ -314,7 +314,7 @@ public class TaskDelegate implements TaskListener {
         param.setStartUserName(MapUtil.get(variableMaps, WorkflowConstant.PROCESS_START_USER_NAME_KEY, String.class));
 
         param.setNoticePolicyConfigs(userTaskConfig.getNoticePolicyConfigs());
-        WorkFlowUtil.sendApproveNoticePolicy(param, String.format("《%s》发起了《%s》,待审批!", param.getStartUserName(), param.getSchemaName()));
+        WorkFlowUtil.sendApproveNoticePolicy(param, String.format("【%s】发起了【%s】", param.getStartUserName(), param.getSchemaName()));
         //默认所有任务不需要指定审批人  如果需要指定审批人 会在 launch  和 approve 接口 处理。
 
     }

+ 1 - 1
src/main/resources/application-dev.yml

@@ -64,7 +64,7 @@ xjrsoft:
     druid-password: admin # druid 监控密码
     default-password: "cqtlzjzx2023" #默认密码(用户重置密码后为该密码)
     domain-api: http://10.150.10.139:8888/api #api域名地址
-    domain-app: http://10.150.10.139:8003/# #app域名地址
+    domain-app: https://yxh-web.ngrok.yingcaibx.com/# #app域名地址
     domain-web: http://10.150.10.139:8888 #web域名地址
 #    domain-api: http://127.0.0.1:9000/api #api域名地址
 #    domain-web: http://127.0.0.1:9000 #web域名地址