Explorar o código

财务模块拆分

wangqiang hai 1 ano
pai
achega
27e7ffdf42
Modificáronse 18 ficheiros con 409 adicións e 66 borrados
  1. 5 0
      jeeplus-module/jeeplus-test/pom.xml
  2. 1 1
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementInfo/mapper/xml/ReimbursementInfoMapper.xml
  3. 13 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/roster/service/RosterBaseService.java
  4. 5 0
      jeeplus-platform/jeeplus-admin/pom.xml
  5. 19 10
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/LoginController.java
  6. 77 6
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/UserController.java
  7. 16 0
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/domain/User.java
  8. 55 33
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/xml/UserMapper.xml
  9. 26 4
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/UserService.java
  10. 5 1
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/dto/UserDTO.java
  11. 117 0
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/utils/RestTemplateService2.java
  12. 15 0
      jeeplus-plugins/jeeplus-center/pom.xml
  13. 2 6
      jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/centerservice/config/RestTemplateConfig.java
  14. 5 1
      jeeplus-plugins/jeeplus-flowable/pom.xml
  15. 38 0
      jeeplus-plugins/jeeplus-mail/src/main/java/com/jeeplus/mail/controller/MailBoxController.java
  16. 1 1
      jeeplus-plugins/jeeplus-mail/src/main/java/com/jeeplus/mail/mapper/xml/MailBoxMapper.xml
  17. 1 0
      jeeplus-plugins/pom.xml
  18. 8 3
      jeeplus-web/src/main/resources/application-development.yml

+ 5 - 0
jeeplus-module/jeeplus-test/pom.xml

@@ -26,6 +26,11 @@
     <dependencies>
         <dependency>
             <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-center</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
             <artifactId>jeeplus-admin</artifactId>
             <version>${project.parent.version}</version>
         </dependency>

+ 1 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementInfo/mapper/xml/ReimbursementInfoMapper.xml

@@ -127,7 +127,7 @@
 			sys_user a
 			LEFT JOIN sys_office b ON a.office_id = b.id
 		WHERE
-			a.del_flag = 0 and a.is_admin is null
+			a.del_flag = 0
 			<if test="name != null and name != ''">
 				and a.`name` LIKE CONCAT ('%', #{name}, '%')
 			</if>

+ 13 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/roster/service/RosterBaseService.java

@@ -3,6 +3,7 @@ package com.jeeplus.test.roster.service;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -22,6 +23,7 @@ import com.jeeplus.sys.service.dto.CertDTO;
 import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.service.mapstruct.CertWrapper;
 import com.jeeplus.sys.utils.DictUtils;
+import com.jeeplus.sys.utils.RestTemplateService2;
 import com.jeeplus.sys.utils.StringUtils;
 import com.jeeplus.sys.utils.UserUtils;
 import com.jeeplus.test.cw.common.CommonUtils;
@@ -43,6 +45,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -97,6 +100,9 @@ public class RosterBaseService extends ServiceImpl<RosterBaseMapper, RosterBase>
     @Autowired
     private CertService certService;
 
+    @Resource
+    private RestTemplateService2 restTemplateService2;
+
     public IPage<RosterBaseDTO> findList(Page<RosterBaseDTO> page, RosterBaseDTO rosterBaseDTO) throws Exception {
         RosterBase rosterBase = RosterBaseWrapper.INSTANCE.toEntity(rosterBaseDTO);
         QueryWrapper<RosterBase> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( rosterBase, RosterBase.class );
@@ -234,6 +240,13 @@ public class RosterBaseService extends ServiceImpl<RosterBaseMapper, RosterBase>
                     rosterBaseDTO.setPostIdList(userPost);
                 }
                 // 获取用户的管理部门
+                //根据用户id从人力资源中获取用户的管理的部门id
+                Map<String, Object> paramMap = new HashMap<>();
+                paramMap.put("id", user.getId());
+                Object userInfo = restTemplateService2.getHuman("/sys/user/queryById", "", paramMap);
+                //将object转为userDto对象
+                UserDTO dto = JSON.parseObject(JSON.toJSONString(userInfo), UserDTO.class);
+                user.setManageOfficeIds(dto.getManageOfficeIds());
                 if (StringUtils.isNotBlank(user.getManageOfficeIds())) {
                     rosterBaseDTO.setManageOfficeIds(user.getManageOfficeIds());
                 }

+ 5 - 0
jeeplus-platform/jeeplus-admin/pom.xml

@@ -26,6 +26,11 @@
     <dependencies>
         <dependency>
             <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-center</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
             <artifactId>jeeplus-common</artifactId>
             <version>${project.parent.version}</version>
         </dependency>

+ 19 - 10
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/LoginController.java

@@ -8,6 +8,7 @@ import cn.hutool.captcha.LineCaptcha;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.extra.servlet.ServletUtil;
+import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.jeeplus.aop.logging.annotation.ApiLog;
 import com.jeeplus.common.redis.RedisUtils;
@@ -28,6 +29,7 @@ import com.jeeplus.sys.service.SysConfigService;
 import com.jeeplus.sys.service.UserService;
 import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.utils.DictUtils;
+import com.jeeplus.sys.utils.RestTemplateService2;
 import com.jeeplus.sys.utils.StringUtils;
 import com.jeeplus.sys.utils.UserUtils;
 import io.swagger.annotations.Api;
@@ -61,10 +63,7 @@ import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 import java.io.IOException;
 import java.nio.file.AccessDeniedException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -86,6 +85,9 @@ public class LoginController {
 
     @Autowired
     private RedisUtils redisUtils;
+
+    @Autowired
+    private RestTemplateService2 restTemplateService;
     /**
      * 用户登录
      * @param loginForm
@@ -122,7 +124,7 @@ public class LoginController {
             }
         }
         //根据登录名查询登录信息
-        List<UserDTO> loginUserList = userService.getUserIdByLoginOrMobile(username);
+        /*List<UserDTO> loginUserList = userService.getUserIdByLoginOrMobile(username);
         if(null != loginUserList){
             if (loginUserList.size()>1){
                 throw new DisabledException ( "登录名存在重复,请使用手机号进行登录或联系管理员" );
@@ -133,7 +135,14 @@ public class LoginController {
                     username = loginUserList.get(0).getLoginName();
                 }
             }
-        }
+        }*/
+        Map<String, Object> paramMap = new HashMap<>();
+        paramMap.put("loginName", loginUserName);
+        Object userInfo = restTemplateService.getHuman("/sys/user/queryDetailByLoginName", "", paramMap);
+        //将object转为userDto对象
+        UserDTO dto = JSON.parseObject(JSON.toJSONString(userInfo), UserDTO.class);
+        //将登录的用户信息存放到redis中(在线状态key中)
+        RedisUtils.getInstance().set(CacheNames.USER_CACHE_LOGIN_ONLINE_LOGIN_NAME + loginUserName , dto);
 
         SecurityUtils.login (username, password, authenticationManager  ); //登录操作spring security
 
@@ -156,10 +165,10 @@ public class LoginController {
 
         userDTO.setToken(token);
         //将登录的用户信息存放到redis中(在线状态key中)
-        RedisUtils.getInstance().set(CacheNames.USER_CACHE_LOGIN_ONLINE_LOGIN_NAME + loginUserName , userDTO);
-        if(!"123456".equals(password) && !DaoAuthenticationProvider.getValue().equals(password)){
-            userService.updateUserUpPassword(userDTO);
-        }
+//        RedisUtils.getInstance().set(CacheNames.USER_CACHE_LOGIN_ONLINE_LOGIN_NAME + loginUserName , userDTO);
+//        if(!"123456".equals(password) && !DaoAuthenticationProvider.getValue().equals(password)){
+//            userService.updateUserUpPassword(userDTO);
+//        }
 
         return responseUtil.ok ( );
     }

+ 77 - 6
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -16,6 +16,7 @@ import com.google.gson.Gson;
 import com.jeeplus.aop.demo.annotation.DemoMode;
 import com.jeeplus.aop.logging.annotation.ApiLog;
 import com.jeeplus.common.beanvalidator.BeanValidators;
+import com.jeeplus.common.redis.RedisUtils;
 import com.jeeplus.common.utils.FileUtils;
 import com.jeeplus.common.utils.ResponseUtil;
 import com.jeeplus.config.properties.FileProperties;
@@ -24,6 +25,7 @@ import com.jeeplus.core.excel.ExportMode;
 import com.jeeplus.core.excel.utils.EasyPoiUtil;
 import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.security.util.SecurityUtils;
+import com.jeeplus.sys.constant.CacheNames;
 import com.jeeplus.sys.constant.CommonConstants;
 import com.jeeplus.sys.domain.Office;
 import com.jeeplus.sys.domain.User;
@@ -88,6 +90,12 @@ public class UserController {
     @Autowired
     private OfficeWrapper officeWrapper;
 
+    @Resource
+    private RestTemplateService2 restTemplateService2;
+
+    @Value("${IS_USE_CAS_LOGIN}")
+    private String isUseCasLogin;
+
     /**
      * 根据id查询用户
      *
@@ -98,7 +106,7 @@ public class UserController {
     @GetMapping("queryById")
     @ApiOperation(value = "查询用户")
     public ResponseEntity queryById(@RequestParam("id") String id) {
-        UserDTO userDTO = userService.get ( id );
+        /*UserDTO userDTO = userService.get ( id );
         if(StringUtils.isNotBlank(userDTO.getManageOfficeIds())){
             //获取当前人管理的部门id
             List<String> manageOfficeIdList=Arrays.asList(userDTO.getManageOfficeIds().split(","));
@@ -147,7 +155,12 @@ public class UserController {
             }
 
         }
-        return ResponseEntity.ok ( userDTO );
+        return ResponseEntity.ok ( userDTO );*/
+        //调用人力资源系统的查询用户功能
+        Map<String, Object> paramMap = new HashMap<>();
+        paramMap.put("id", id);
+        Object userInfo = restTemplateService2.getHuman("/sys/user/queryById", "", paramMap);
+        return ResponseEntity.ok ( userInfo );
     }
 
     /**
@@ -165,7 +178,7 @@ public class UserController {
         QueryWrapper <UserDTO> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( userDTO, UserDTO.class );
         // 管理员查询不限制
         if (!UserUtils.getCurrentUserDTO().isAdmin()) {
-            queryWrapper.isNull("a.is_admin");
+//            queryWrapper.isNull("a.is_admin");
             if (ObjectUtil.isNotEmpty(userDTO)){
                 if (ObjectUtil.isNotEmpty(userDTO.getCompanyDTO()) && ObjectUtil.isNotEmpty(userDTO.getOfficeDTO())) {
                     OfficeDTO officeDTO = UserUtils.getCurrentUserDTO().getOfficeDTO();
@@ -225,6 +238,22 @@ public class UserController {
             }
         }
         IPage <UserDTO> result = userService.findPage ( page, queryWrapper );
+        List<UserDTO> records = result.getRecords();
+
+        StringBuffer buffer = new StringBuffer();
+        for (int i=0;i<records.size();i++){
+            buffer.append(records.get(i).getId());
+            if (i==records.size()-1){
+
+            } else {
+                buffer.append(",");
+            }
+        }
+        //调用人力资源系统的查询用户信息功能,
+        Map<String, Object> paramMap = new HashMap<>();
+        paramMap.put("buffer", buffer);
+        List<UserDTO> userInfo = (List<UserDTO>) restTemplateService2.getHuman("/sys/user/getAllUserInfo", "", paramMap);
+        result.setRecords(userInfo);
         return ResponseEntity.ok ( result );
     }
 
@@ -531,7 +560,7 @@ public class UserController {
     @RequestMapping("savePwd")
     @ApiOperation(value = "修改密码")
     public ResponseEntity savePwd(String oldPassword, String newPassword) {
-        UserDTO userDTO = UserUtils.getCurrentUserDTO ( );
+        /*UserDTO userDTO = UserUtils.getCurrentUserDTO ( );
         if ( StrUtil.isNotBlank ( oldPassword ) && StrUtil.isNotBlank ( newPassword ) ) {
             if ( SecurityUtils.validatePassword ( oldPassword, userDTO.getPassword ( ) ) ) {
                 User user = new User ( userDTO.getId ( ) );
@@ -544,7 +573,41 @@ public class UserController {
                 return ResponseEntity.badRequest ( ).body ( "修改密码失败,旧密码错误!" );
             }
         }
-        return ResponseEntity.badRequest ( ).body ( "参数错误!" );
+        return ResponseEntity.badRequest ( ).body ( "参数错误!" );*/
+        UserDTO userDTO = UserUtils.getCurrentUserDTO ( );
+        //判断是否启用了cas登录
+        if (isUseCasLogin.equals("true")){
+            Map<String, Object> paramMap = new HashMap<>();
+            paramMap.put("name", userDTO.getName());
+            paramMap.put("password", newPassword);
+            paramMap.put("mobile", userDTO.getMobile());
+            String token = "";
+            Object res = restTemplateService2.getCas("/test/update", token, paramMap);
+            String s = res.toString();
+            if (s.equals("true")){
+                User user = new User ( userDTO.getId ( ) );
+                user.setPassword ( SecurityUtils.encryptPassword ( newPassword ) );
+                userService.updateById(user);
+                return ResponseEntity.ok ( "修改密码成功!" );
+            }else {
+                return ResponseEntity.ok ( "修改密码失败!" );
+            }
+        } else {
+            //向人力资源系统发送修改密码请求
+            Map<String, Object> paramMap = new HashMap<>();
+            paramMap.put("mobile", userDTO.getMobile());
+            paramMap.put("newPassword", newPassword);
+            Object userInfo = restTemplateService2.getHuman("/sys/user/savePwdChild", "", paramMap);
+            String s = userInfo.toString();
+            if (s.equals("true")){
+                User user = new User ( userDTO.getId ( ) );
+                user.setPassword ( SecurityUtils.encryptPassword ( newPassword ) );
+                userService.updateById(user);
+                return ResponseEntity.ok ( "修改密码成功!" );
+            } else {
+                return ResponseEntity.ok ( "修改密码失败!" );
+            }
+        }
     }
 
 
@@ -776,7 +839,15 @@ public class UserController {
     public ResponseEntity<Boolean> isUpdatePassword() {
         // 返回结果  true为以修改  false为未修改
         UserDTO userDTO = UserUtils.getCurrentUserDTO();
-        Boolean updatePassword = userService.isUpdatePassword(userDTO.getId());
+        //从redis中获取当前用户信息
+        Boolean updatePassword;
+        UserDTO dto = (UserDTO) RedisUtils.getInstance().get(CacheNames.USER_CACHE_LOGIN_ONLINE_LOGIN_NAME + userDTO.getLoginName());
+        if (dto.getUpPassword().equals("true")){
+            updatePassword = true;
+        } else {
+            updatePassword = false;
+        }
+//        Boolean updatePassword = userService.isUpdatePassword(userDTO.getId());
         return ResponseEntity.ok(updatePassword);
     }
 }

+ 16 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/domain/User.java

@@ -3,6 +3,7 @@
  */
 package com.jeeplus.sys.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.jeeplus.core.domain.BaseEntity;
 import com.jeeplus.core.query.Query;
@@ -47,11 +48,13 @@ public class User extends BaseEntity {
     /**
      * 密码
      */
+    @TableField(exist = false)
     private String password;
 
     /**
      * 工号
      */
+    @TableField(exist = false)
     private String no;
 
     /**
@@ -63,11 +66,13 @@ public class User extends BaseEntity {
     /**
      * 邮箱
      */
+    @TableField(exist = false)
     private String email;
 
     /**
      * 电话
      */
+    @TableField(exist = false)
     private String phone;
 
     /**
@@ -78,53 +83,64 @@ public class User extends BaseEntity {
     /**
      * 最后登录IP
      */
+    @TableField(exist = false)
     private String loginIp;
 
     /**
      * 最后登录日期
      */
+    @TableField(exist = false)
     private Date loginDate;
 
     /**
      * 是否允许登陆
      */
+    @TableField(exist = false)
     private String loginFlag;
 
     /**
      * 头像
      */
+    @TableField(exist = false)
     private String photo;
 
     /**
      * 二维码
      */
+    @TableField(exist = false)
     private String qrCode;
 
     /**
      * 签名
      */
+    @TableField(exist = false)
     private String sign;
 
     /**
      * 备注
      */
+    @TableField(exist = false)
     private String remarks;
 
     /**
      * 超级管理员标志
      */
+    @TableField(exist = false)
     private Boolean isAdmin;
 
     /**
      * 是否获取其他服务待办
      */
+    @TableField(exist = false)
     private String otherServiceFlag;
 
     /**
      * 是否修改过密码,1为是
      */
+    @TableField(exist = false)
     private String upPassword;
 
+    @TableField(exist = false)
     private String manageOfficeIds;   //管理的部门id
 
     private String rosterId;   // 花名册id

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 55 - 33
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/mapper/xml/UserMapper.xml


+ 26 - 4
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/UserService.java

@@ -6,11 +6,13 @@ package com.jeeplus.sys.service;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson2.JSON;
 import com.jeeplus.sys.domain.*;
 import com.jeeplus.sys.mapper.OfficeMapper;
 import com.jeeplus.sys.service.dto.CertDTO;
 import com.jeeplus.sys.service.dto.LoginUserOnlineDTO;
 import com.jeeplus.sys.service.mapstruct.CertWrapper;
+import com.jeeplus.sys.utils.RestTemplateService2;
 import com.jeeplus.sys.utils.ServletUtils;
 import com.jeeplus.sys.utils.ip.AddressUtils;
 import com.jeeplus.sys.utils.ip.IpUtils;
@@ -71,6 +73,9 @@ public class UserService  extends ServiceImpl<UserMapper, User> {
 	@Autowired
 	private RosterBaseCService rosterBaseCService;
 
+	@Autowired
+	private RestTemplateService2 restTemplateService;
+
 	/**
 	 * 单一登录判断,是否允许登录
 	 * @return
@@ -101,6 +106,16 @@ public class UserService  extends ServiceImpl<UserMapper, User> {
 	 * @return
 	 */
 	public UserDTO get(String id) {
+		//调用人力资源的方法,来获取用户的完整信息
+		/*StringBuffer buffer = new StringBuffer();
+		buffer.append(id);
+		Map<String, Object> paramMap = new HashMap<>();
+		paramMap.put("buffer", buffer);
+		Object object = restTemplateService.getHuman("/sys/user/getAllUserInfo", "", paramMap);
+		//将object转为List<UserDTO>对象
+		List<UserDTO> userInfo = JSON.parseArray(JSON.toJSONString(object), UserDTO.class);
+		UserDTO dto = userInfo.get(0);
+		return dto;*/
 		QueryWrapper queryWrapper = new QueryWrapper ();
 		queryWrapper.eq ("a.id", id);
 		return baseMapper.get (queryWrapper);
@@ -111,9 +126,9 @@ public class UserService  extends ServiceImpl<UserMapper, User> {
 	 * @param loginName
 	 * @return
 	 */
-	@Cacheable(cacheNames = CacheNames.USER_CACHE_LOGIN_NAME, key = "#loginName")
+//	@Cacheable(cacheNames = CacheNames.USER_CACHE_LOGIN_NAME, key = "#loginName")
 	public UserDTO getUserByLoginName(String loginName) {
-		QueryWrapper queryWrapper = new QueryWrapper ();
+		/*QueryWrapper queryWrapper = new QueryWrapper ();
 		queryWrapper.eq ("a.login_name", loginName);
 		queryWrapper.eq("a.del_flag","0");
 		UserDTO userDTO = baseMapper.get(queryWrapper);
@@ -134,8 +149,8 @@ public class UserService  extends ServiceImpl<UserMapper, User> {
 		userDTO.setLoginIp(ip);
 		userDTO.setLoginLocation(address);
 		userDTO.setOs(os);
-		userDTO.setBrowser(browser);
-
+		userDTO.setBrowser(browser);*/
+		UserDTO userDTO = (UserDTO)RedisUtils.getInstance().get(CacheNames.USER_CACHE_LOGIN_ONLINE_LOGIN_NAME + loginName);
 		return userDTO;
 	}
 
@@ -156,6 +171,13 @@ public class UserService  extends ServiceImpl<UserMapper, User> {
 	 * @return
 	 */
 	public UserDTO getUserByLoginNameNoCache(String loginName) {
+		//调用人力资源系统的方法,获取用户的完整信息
+//		Map<String, Object> paramMap = new HashMap<>();
+//		paramMap.put("loginName", loginName);
+//		Object userInfo = restTemplateService.getHuman("/sys/user/queryDetailByLoginName", "", paramMap);
+//		//将object转为userDto对象
+//		UserDTO dto = JSON.parseObject(JSON.toJSONString(userInfo), UserDTO.class);
+//		return dto;
 		QueryWrapper queryWrapper = new QueryWrapper ();
 		queryWrapper.eq ("a.login_name", loginName);
 		return baseMapper.get (queryWrapper);

+ 5 - 1
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/service/dto/UserDTO.java

@@ -47,10 +47,14 @@ public class  UserDTO extends BaseDTO {
     /**
      * 密码
      */
-    @JsonIgnore
+//    @JsonIgnore
     @Length(min = 1, max = 100)
     private String password;
 
+    /**
+     * 是否修改过密码,1为是
+     */
+    private String upPassword;
 
     /**
      * 姓名

+ 117 - 0
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/utils/RestTemplateService2.java

@@ -0,0 +1,117 @@
+package com.jeeplus.sys.utils;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.*;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+import java.nio.charset.Charset;
+import java.util.Map;
+import java.util.Objects;
+
+@Component
+public class RestTemplateService2 {
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    /**
+     * 访问get接口 - 人力资源 系统
+     * @param path 接口路径
+     * @param token token
+     * @param paramMap 请求参数-路径后
+     * @return
+     */
+    public Object getHuman(String path, String token, Map<String, Object> paramMap) {
+        return httpRequest(HttpMethod.GET, token, paramMap, null, Global.getConfig("HUMAN_PATH"), path);
+    }
+
+    /**
+     * 访问post接口 - 人力资源 系统
+     * @param path 接口路径
+     * @param token token
+     * @param paramMap 请求参数-路径后
+     * @param bodyMap 请求参数-请求体
+     * @return
+     */
+    public Object postHuman(String path, String token, Map<String, Object> paramMap, Map<String, Object> bodyMap) {
+        return httpRequest(HttpMethod.POST, token, paramMap, bodyMap, Global.getConfig("HUMAN_PATH"), path);
+    }
+
+    /**
+     * 访问post接口 - CAS 系统
+     * @param path 接口路径
+     * @param token token
+     * @param paramMap 请求参数-路径后
+     * @param bodyMap 请求参数-请求体
+     * @return
+     */
+    public Object postCas(String path, String token, Map<String, Object> paramMap, Map<String, Object> bodyMap) {
+        return httpRequest(HttpMethod.POST, token, paramMap, bodyMap, Global.getConfig("CAS_PATH"), path);
+    }
+
+    /**
+     * 访问get接口 - CAS 系统
+     * @param path 接口路径
+     * @param token token
+     * @param paramMap 请求参数-路径后
+     * @return
+     */
+    public Object getCas(String path, String token, Map<String, Object> paramMap) {
+        return httpRequest(HttpMethod.GET, token, paramMap, null, Global.getConfig("CAS_PATH"), path);
+    }
+
+    /**
+     * 访问远程接口方法
+     * @param method 请求类型
+     * @param token token
+     * @param paramMap 请求参数-路径后
+     * @param bodyMap 请求参数-请求体
+     * @param hostAddress 服务host地址
+     * @param path 接口路径
+     * @return
+     */
+    public Object httpRequest(HttpMethod method, String token, Map<String, Object> paramMap, Map<String, Object> bodyMap, String hostAddress, String path) {
+        JSONObject jsonObject = new JSONObject();
+        if (CollectionUtil.isNotEmpty(bodyMap)) {
+            jsonObject = new JSONObject(bodyMap); // 另一端接口需要使用@RequestBody来接收此参数
+        }
+        String url = getUrl(hostAddress, path, paramMap);
+        HttpHeaders httpHeaders = new HttpHeaders();
+//        httpHeaders.add("token",token);
+        httpHeaders.add("Accept", MediaType.ALL_VALUE);
+        httpHeaders.add("cookie", "jeeplus.session.id=0635611b0f5a4401836262c7d23ae98e");
+        httpHeaders.setContentType(new MediaType("application","json", Charset.forName("UTF-8")));
+        HttpEntity<Object> entity = new HttpEntity<>(jsonObject,httpHeaders);
+        ResponseEntity<Object> responseEntity = restTemplate.exchange(url, method, entity, Object.class);
+        return responseEntity.getBody();
+    }
+
+    /**
+     * 将参数拼接到请求路径中
+     * @param hostAddress 服务host地址
+     * @param path 接口路径
+     * @param map 请求参数
+     * @return
+     */
+    public String getUrl(String hostAddress, String path, Map<String, Object> map) {
+        String url = hostAddress + path;
+        StringBuilder paramStr = new StringBuilder();
+        if (CollectionUtil.isNotEmpty(map)) {
+            for (String key : map.keySet()) {
+                Object o = map.get(key);
+                if (Objects.nonNull(o)) {
+//                    String value = URLEncoder.encode(o.toString(), "utf-8");
+                    paramStr.append("&").append(key).append("=").append(o);
+                }
+            }
+        }
+        if (StringUtils.isNotBlank(paramStr.toString())){
+            String param = paramStr.substring(1).toString(); // 去掉第一个&
+            url = url + "?" + param;
+        }
+        return url;
+    }
+}

+ 15 - 0
jeeplus-plugins/jeeplus-center/pom.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>jeeplus-plugins</artifactId>
+        <groupId>org.jeeplus</groupId>
+        <version>9.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>jeeplus-center</artifactId>
+
+
+</project>

+ 2 - 6
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/centerservice/config/RestTemplateConfig.java

@@ -1,19 +1,14 @@
-package com.jeeplus.centerservice.config;
+package com.jeeplus.center.config;
 
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.MediaType;
 import org.springframework.http.client.ClientHttpRequestFactory;
 import org.springframework.http.client.SimpleClientHttpRequestFactory;
-import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.converter.StringHttpMessageConverter;
 import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 import org.springframework.web.client.RestTemplate;
 
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 @Configuration
@@ -41,6 +36,7 @@ public class RestTemplateConfig {
             List<MediaType> mediaTypes = new ArrayList<>();
             mediaTypes.add(MediaType.TEXT_PLAIN);
             mediaTypes.add(MediaType.TEXT_HTML);
+//            mediaTypes.add(new MediaType("text", "plain", StandardCharsets.UTF_8));
             setSupportedMediaTypes(mediaTypes);
         }
     }

+ 5 - 1
jeeplus-plugins/jeeplus-flowable/pom.xml

@@ -24,7 +24,11 @@
 
 
     <dependencies>
-
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-center</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.jeeplus</groupId>
             <artifactId>jeeplus-admin</artifactId>

+ 38 - 0
jeeplus-plugins/jeeplus-mail/src/main/java/com/jeeplus/mail/controller/MailBoxController.java

@@ -3,9 +3,11 @@
  */
 package com.jeeplus.mail.controller;
 
+import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.common.redis.RedisUtils;
 import com.jeeplus.common.utils.ResponseUtil;
 import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.mail.domain.MailBox;
@@ -16,11 +18,19 @@ import com.jeeplus.mail.service.MailComposeService;
 import com.jeeplus.mail.service.MailTrashService;
 import com.jeeplus.mail.service.dto.MailBoxDTO;
 import com.jeeplus.mail.service.mapstruct.MailBoxWrapper;
+import com.jeeplus.sys.constant.CacheNames;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.RestTemplateService2;
 import com.jeeplus.sys.utils.UserUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 
 /**
  * 收件箱Controller
@@ -44,11 +54,39 @@ public class MailBoxController {
     @Autowired
     private MailBoxWrapper mailBoxWrapper;
 
+    @Autowired
+    private RestTemplateService2 restTemplateService;
+
     @GetMapping("list")
     public ResponseEntity list(MailBoxDTO mailBoxDTO, Page <MailBoxDTO> page) throws Exception {
         mailBoxDTO.setReceiver ( UserUtils.getCurrentUserDTO () );
         QueryWrapper <MailBoxDTO> queryWrapper = QueryWrapperGenerator.buildQueryCondition (mailBoxDTO, MailBoxDTO.class);
         IPage <MailBoxDTO> result = mailBoxService.findPage (page, queryWrapper);
+        //获取所有的发件人id,去人力资源系统中获取头像信息
+        List<MailBoxDTO> records = result.getRecords();
+        if (records.size()>0){
+            StringBuffer buffer = new StringBuffer();
+            for (int i=0;i<records.size();i++){
+                buffer.append(records.get(i).getSender().getId());
+                if (i==records.size()-1){
+
+                } else {
+                    buffer.append(",");
+                }
+            }
+            Map<String, Object> paramMap = new HashMap<>();
+            paramMap.put("buffer", buffer);
+            Object object = restTemplateService.getHuman("/sys/user/getAllUserInfo", "", paramMap);
+            //将object转为List<UserDTO>对象
+            List<UserDTO> userInfo = JSON.parseArray(JSON.toJSONString(object), UserDTO.class);
+            for (UserDTO user : userInfo) {
+                for (MailBoxDTO record : records) {
+                    if (record.getSender().getId().equals(user.getId())) {
+                        record.getSender().setPhoto(user.getPhoto());
+                    }
+                }
+            }
+        }
         return ResponseEntity.ok (result);
     }
 

+ 1 - 1
jeeplus-plugins/jeeplus-mail/src/main/java/com/jeeplus/mail/mapper/xml/MailBoxMapper.xml

@@ -12,7 +12,7 @@
         a.mail_id AS "mail.id",
         receiver.name AS "receiver.name",
         sender.name AS "sender.name",
-        sender.photo AS "sender.photo",
+--         sender.photo AS "sender.photo",
         mail.title AS "mailDTO.title",
         mail.overview AS "mailDTO.overview",
         mail.content AS "mailDTO.content"

+ 1 - 0
jeeplus-plugins/pom.xml

@@ -26,6 +26,7 @@
         <module>jeeplus-tools</module>
         <module>jeeplus-ureport</module>
         <module>jeeplus-wps</module>
+        <module>jeeplus-center</module>
     </modules>
 
 

+ 8 - 3
jeeplus-web/src/main/resources/application-development.yml

@@ -47,8 +47,8 @@ spring:
       datasource:
         master:
           username: root
-          password: 123456
-          url: jdbc:mysql://127.0.0.1:3306/cw_master?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&nullCatalogMeansCurrent=true&serverTimezone=Asia/Shanghai
+          password: root
+          url: jdbc:mysql://127.0.0.1:3306/access_process_finance?allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&nullCatalogMeansCurrent=true&serverTimezone=Asia/Shanghai
           driver-class-name: com.mysql.cj.jdbc.Driver
 
           #oracle database settings
@@ -84,7 +84,7 @@ spring:
     host: localhost
     port: 6379
     expireTime: 3600000 #单位秒
-    database: 1
+    database: 3
     password:
   mvc.servlet.load-on-startup: 1
   jmx:
@@ -147,6 +147,8 @@ swagger:
   enable: false
 
 #cas服务端的地址
+#cas:当需要启用cas时改为true
+IS_USE_CAS_LOGIN: false
 cas:
   server-url-prefix: http://www.casserver.com:8443
 #oss配置
@@ -260,3 +262,6 @@ CCPM_TASK:  13,102,39
 
 #各服务引用状态 =》 (若包含,则进行获取该服务的流程信息)
 INQUIRE_STATUS: ccpm
+
+HUMAN_PATH: http://127.0.0.1:8085
+CAS_PATH: http://www.casserver.com:8443