فهرست منبع

用户信息,机构信息,修改, 删除,审核接口

wangfeng 6 سال پیش
والد
کامیت
d4b021cdec

+ 1 - 0
user-service/src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -34,6 +34,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/user/resetPassword").permitAll()
                 .antMatchers("/userInfo/getUserInfoPag").permitAll()
                 .antMatchers("/user/getPermission").permitAll()
+                .antMatchers("/userInfo/updateUserInfoAll").permitAll()
                 .antMatchers("/**").authenticated();
 //        .antMatchers("/**").permitAll();
     }

+ 2 - 1
user-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -48,7 +48,8 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/userver/verifySmsVerification", request)
                 || matchers("/userInfo/getUserInfoPag", request)
                 || matchers("/user/getPermission", request)
-
+                || matchers("/userInfo/updateUserInfoAll", request)
+                
                 || matchers("/", request)){
                     return;
                 } else {

+ 9 - 3
user-service/src/main/java/com/diagbot/entity/User.java

@@ -75,18 +75,24 @@ public class User implements Serializable {
     /**
      * 用户类型
      */
-    private String type;
+    private Integer type;
 
 
 
-    public String getType() {
+    
+
+	public Integer getType() {
 		return type;
 	}
 
-	public void setType(String type) {
+	public void setType(Integer type) {
 		this.type = type;
 	}
 
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+
 	public Long getId() {
         return id;
     }

+ 72 - 78
user-service/src/main/java/com/diagbot/entity/UserInfo.java

@@ -17,142 +17,136 @@ import com.baomidou.mybatisplus.annotation.TableName;
 public class UserInfo implements Serializable{
 	
 	 private static final long serialVersionUID = 1L;
-	 
-	 /**
-	     * 用户ID
-	     */
-	    @TableId(value = "id", type = IdType.AUTO)
-	    private Long userId;
-
-	    /**
-	     * 记录创建时间
-	     */
-	    private Date userGmtCreate;
-	   
-	    /**
-	     * 用户名
-	     */
-	    private String userName;
 
-	    /**
-	     * 联系人
-	     */
-	    private String linKman;
-
-	    /**
-	     * 邮箱
-	     */
-	    private String email;
-	    /**
-	     * 机构ID
-	     */
 	    @TableId(value = "id", type = IdType.AUTO)
-	    private Long orgId;
-
-	    /**
-	     * 记录创建时间
-	     */
-	    private Date orgGmtCreate;
-
-
-	    /**
-	     * 机构名称
-	     */
-	    private String orgName;
-
-
+	    private Long userId;//用户ID
+	    private Date userGmtCreate;//记录创建时间
+	    private String userName;// 用户名
+	    private String linKman;//联系人
+	    private String email;// 邮箱
+	    @TableId(value = "id", type = IdType.AUTO)
+	    private Long orgId;//机构ID
+	    private Date orgGmtCreate;//记录创建时间
+	    private String orgName;//机构名称
+	    private String orgType;//机构属性
+	    private String orgPrincipal;//负责人
+	    private String orgAddress;//机构地址
+	    private Long orgParentId;//上级机构id
+	    private Integer orgSubNum;//下属机构数量
+	    private String autPosition;//岗位信息
+	    private String autIsReject;//是否通过认证 N:未通过,Y:已通过
+	    private String autStatus;//认证状态
 		public Long getUserId() {
 			return userId;
 		}
-
-
 		public void setUserId(Long userId) {
 			this.userId = userId;
 		}
-
-
 		public Date getUserGmtCreate() {
 			return userGmtCreate;
 		}
-
-
 		public void setUserGmtCreate(Date userGmtCreate) {
 			this.userGmtCreate = userGmtCreate;
 		}
-
-
 		public String getUserName() {
 			return userName;
 		}
-
-
 		public void setUserName(String userName) {
 			this.userName = userName;
 		}
-
-
 		public String getLinKman() {
 			return linKman;
 		}
-
-
 		public void setLinKman(String linKman) {
 			this.linKman = linKman;
 		}
-
-
 		public String getEmail() {
 			return email;
 		}
-
-
 		public void setEmail(String email) {
 			this.email = email;
 		}
-
-
 		public Long getOrgId() {
 			return orgId;
 		}
-
-
 		public void setOrgId(Long orgId) {
 			this.orgId = orgId;
 		}
-
-
 		public Date getOrgGmtCreate() {
 			return orgGmtCreate;
 		}
-
-
 		public void setOrgGmtCreate(Date orgGmtCreate) {
 			this.orgGmtCreate = orgGmtCreate;
 		}
-
-
 		public String getOrgName() {
 			return orgName;
 		}
-
-
 		public void setOrgName(String orgName) {
 			this.orgName = orgName;
 		}
-
-
+		public String getOrgType() {
+			return orgType;
+		}
+		public void setOrgType(String orgType) {
+			this.orgType = orgType;
+		}
+		public String getOrgPrincipal() {
+			return orgPrincipal;
+		}
+		public void setOrgPrincipal(String orgPrincipal) {
+			this.orgPrincipal = orgPrincipal;
+		}
+		public String getOrgAddress() {
+			return orgAddress;
+		}
+		public void setOrgAddress(String orgAddress) {
+			this.orgAddress = orgAddress;
+		}
+		public Long getOrgParentId() {
+			return orgParentId;
+		}
+		public void setOrgParentId(Long orgParentId) {
+			this.orgParentId = orgParentId;
+		}
+		public Integer getOrgSubNum() {
+			return orgSubNum;
+		}
+		public void setOrgSubNum(Integer orgSubNum) {
+			this.orgSubNum = orgSubNum;
+		}
+		public String getAutPosition() {
+			return autPosition;
+		}
+		public void setAutPosition(String autPosition) {
+			this.autPosition = autPosition;
+		}
+		public String getAutIsReject() {
+			return autIsReject;
+		}
+		public void setAutIsReject(String autIsReject) {
+			this.autIsReject = autIsReject;
+		}
+		public String getAutStatus() {
+			return autStatus;
+		}
+		public void setAutStatus(String autStatus) {
+			this.autStatus = autStatus;
+		}
 		public static long getSerialversionuid() {
 			return serialVersionUID;
 		}
-
-
 		@Override
 		public String toString() {
 			return "UserInfo [userId=" + userId + ", userGmtCreate=" + userGmtCreate + ", userName=" + userName
 					+ ", linKman=" + linKman + ", email=" + email + ", orgId=" + orgId + ", orgGmtCreate="
-					+ orgGmtCreate + ", orgName=" + orgName + "]";
+					+ orgGmtCreate + ", orgName=" + orgName + ", orgType=" + orgType + ", orgPrincipal=" + orgPrincipal
+					+ ", orgAddress=" + orgAddress + ", orgParentId=" + orgParentId + ", orgSubNum=" + orgSubNum
+					+ ", autPosition=" + autPosition + ", autIsReject=" + autIsReject + ", autStatus=" + autStatus
+					+ "]";
 		}
-	    
+
+
+		
 	    
 
 }

+ 115 - 0
user-service/src/main/java/com/diagbot/entity/UserInfoOrganizations.java

@@ -0,0 +1,115 @@
+package com.diagbot.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 
+ * @author wangfeng
+ * @Description: 用于修改用户信息及机构信息
+ * @date 2018年9月18日 下午3:06:58
+ */
+public class UserInfoOrganizations implements Serializable {
+	
+	  private String isDeleted;//删除
+	  private Date gmtModified;//修改时间
+	  private String modifier;//修改人id
+	  private String email;//邮箱
+	  private String principal;//负责人
+	  private String address;//单位地址
+	  private Integer type;//机构属性
+	  private String position;//岗位部门
+	  private String isReject;//是否通过认证 N:未通过,Y:已通过
+	  private Integer rejectType;//未通过类型
+	  private String rejectComment;//认证被拒理由
+	  private String status;//认证状态(0:未认证,1:已认证,2:认证中)
+	  private Long userId;//用户id
+	public String getIsDeleted() {
+		return isDeleted;
+	}
+	public void setIsDeleted(String isDeleted) {
+		this.isDeleted = isDeleted;
+	}
+	public Date getGmtModified() {
+		return gmtModified;
+	}
+	public void setGmtModified(Date gmtModified) {
+		this.gmtModified = gmtModified;
+	}
+	public String getModifier() {
+		return modifier;
+	}
+	public void setModifier(String modifier) {
+		this.modifier = modifier;
+	}
+	public String getEmail() {
+		return email;
+	}
+	public void setEmail(String email) {
+		this.email = email;
+	}
+	public String getPrincipal() {
+		return principal;
+	}
+	public void setPrincipal(String principal) {
+		this.principal = principal;
+	}
+	public String getAddress() {
+		return address;
+	}
+	public void setAddress(String address) {
+		this.address = address;
+	}
+	public Integer getType() {
+		return type;
+	}
+	public void setType(Integer type) {
+		this.type = type;
+	}
+	public String getPosition() {
+		return position;
+	}
+	public void setPosition(String position) {
+		this.position = position;
+	}
+	public String getIsReject() {
+		return isReject;
+	}
+	public void setIsReject(String isReject) {
+		this.isReject = isReject;
+	}
+	public Integer getRejectType() {
+		return rejectType;
+	}
+	public void setRejectType(Integer rejectType) {
+		this.rejectType = rejectType;
+	}
+	public String getRejectComment() {
+		return rejectComment;
+	}
+	public void setRejectComment(String rejectComment) {
+		this.rejectComment = rejectComment;
+	}
+	public String getStatus() {
+		return status;
+	}
+	public void setStatus(String status) {
+		this.status = status;
+	}
+	public Long getUserId() {
+		return userId;
+	}
+	public void setUserId(Long userId) {
+		this.userId = userId;
+	}
+	@Override
+	public String toString() {
+		return "UserInfoOrganizations [isDeleted=" + isDeleted + ", gmtModified=" + gmtModified + ", modifier="
+				+ modifier + ", email=" + email + ", principal=" + principal + ", address=" + address + ", type=" + type
+				+ ", position=" + position + ", isReject=" + isReject + ", rejectType=" + rejectType
+				+ ", rejectComment=" + rejectComment + ", status=" + status + ", userId=" + userId + "]";
+	}
+	  
+	  
+
+}

+ 4 - 1
user-service/src/main/java/com/diagbot/mapper/UserMapper.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.entity.User;
 import com.diagbot.entity.UserInfo;
+import com.diagbot.entity.UserInfoOrganizations;
 
 import org.apache.ibatis.annotations.Param;
 
@@ -25,5 +26,7 @@ public interface UserMapper extends BaseMapper<User> {
 
     IPage<User> selectUserListPage(Page page, @Param("user") User user);
     
-    IPage<UserInfo> selectUserInfoListPage(Page page);
+    IPage<UserInfo> selectUserInfoListPage(Page page,@Param("userInfo") UserInfo userInfo);
+    
+    public Integer updateUserInfoAll(UserInfoOrganizations userInfo);
 }

+ 4 - 1
user-service/src/main/java/com/diagbot/service/UserService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.entity.User;
 import com.diagbot.entity.UserInfo;
+import com.diagbot.entity.UserInfoOrganizations;
 
 import javafx.scene.control.Pagination;
 
@@ -25,5 +26,7 @@ public interface UserService extends IService<User> {
 
     IPage<User> selectUserListPage(Page<User> page, User user);
     
-    public IPage<UserInfo>  selectUserInfoListPage(Page<UserInfo> page);
+    public IPage<UserInfo>  selectUserInfoListPage(Page<UserInfo> page,UserInfo userInfo);
+    
+    public Integer updateUserInfoAll(UserInfoOrganizations userInfo);
 }

+ 9 - 2
user-service/src/main/java/com/diagbot/service/impl/UserServiceImpl.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.entity.User;
 import com.diagbot.entity.UserInfo;
+import com.diagbot.entity.UserInfoOrganizations;
 import com.diagbot.mapper.UserMapper;
 import com.diagbot.service.UserService;
 import org.springframework.stereotype.Service;
@@ -32,8 +33,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         return baseMapper.selectUserListPage(page, user);
     }
     @Override
-    public IPage<UserInfo>  selectUserInfoListPage(Page<UserInfo> page){
-    	return baseMapper.selectUserInfoListPage(page);
+    public IPage<UserInfo>  selectUserInfoListPage(Page<UserInfo> page,UserInfo userInfo){
+    	return baseMapper.selectUserInfoListPage(page, userInfo);
     	
     }
+
+	@Override
+	public Integer  updateUserInfoAll(UserInfoOrganizations userInfo) {
+		return baseMapper.updateUserInfoAll(userInfo);
+		
+	}
 }

+ 18 - 3
user-service/src/main/java/com/diagbot/web/UserInfoController.java

@@ -1,5 +1,8 @@
 package com.diagbot.web;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -11,6 +14,7 @@ import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.User;
 import com.diagbot.entity.UserInfo;
+import com.diagbot.entity.UserInfoOrganizations;
 import com.diagbot.facade.UserFacade;
 
 import io.swagger.annotations.ApiOperation;
@@ -32,10 +36,21 @@ public class UserInfoController {
 	    @PostMapping("/getUserInfoPag")
 	    @SysLogger("getUserInfoPag")
 //	    @ApiIgnore
-	    public RespDTO getUserInfoPag(Page page){
-	        IPage<UserInfo> user=  userFacade.selectUserInfoListPage(page);
+	    public RespDTO getUserInfoPag(Page page,String orgName,String autStatus ){
+	    	UserInfo userInfo =new UserInfo();
+	    	userInfo.setOrgName(orgName);
+	    	userInfo.setAutStatus(autStatus);
+	        IPage<UserInfo> user=  userFacade.selectUserInfoListPage(page,userInfo);
 	        return RespDTO.onSuc(user);
 	    }
-	
+	    
+	    @ApiOperation(value = "修改用户信息和机构信息以及删除用户信息和机构信息", notes = "用户信息和机构信息")
+	    @PostMapping("/updateUserInfoAll")
+	    @SysLogger("updateUserInfoAll")
+	    public RespDTO updateUserInfoAll(UserInfoOrganizations userInfo){
+	         int res= userFacade.updateUserInfoAll(userInfo);
+	         
+	        return RespDTO.onSuc("成功"+res);
+	    }
 	
 }

+ 77 - 0
user-service/src/main/resources/mapper/UserInfoMapper.xml

@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.UserInfoMapper">
+    <select id="selectUserInfoPage"  parameterType="com.diagbot.entity.UserInfo" resultType="com.diagbot.entity.UserInfo">
+		SELECT
+		u.id AS userId,
+		u.gmt_create as userGmtCreate,
+		u.username as userName,
+		u.linkman as linKman,
+		u.email as email,
+		org.id AS orgId,
+		org.gmt_create as orgGmtCreate,
+		org.name as orgName
+		FROM sys_user u
+		LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
+		LEFT JOIN sys_organization org ON uorg.organization_id = org.id
+		WHERE u.is_deleted = 'N' AND u.TYPE = "0" ORDER BY u.gmt_create DESC
+	</select>
+	<select id="selectUserInfoListPage"  resultType="com.diagbot.entity.UserInfo">
+	 SELECT
+		u.id AS userId,
+		u.gmt_create AS userGmtCreate,
+		u.username AS userName,
+		u.linkman AS linKman,
+		u.email AS email,
+		org.id AS orgId,
+		org.gmt_create AS orgGmtCreate,
+		org.name AS orgName,
+		org.type as orgType,
+		org.principal AS orgPrincipal,
+		org.address as orgAddress,
+		org.parent_id as orgParent_id,
+		org.sub_num as orgSub_num,
+		aut.position as autPosition,
+		aut.is_reject as autIsReject,
+		aut.status as autStatus
+		FROM sys_user u
+		LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
+		LEFT JOIN sys_organization org ON uorg.organization_id = org.id
+	        LEFT JOIN sys_user_authentication aut ON u.id = aut.user_id
+		WHERE u.is_deleted = 'N' AND u.TYPE = "0" 
+		<if test="userInfo.orgName != null">
+		 AND org.name LIKE CONCAT('%', #{userInfo.orgName}, '%') 
+		 </if>
+		 <if test="userInfo.autStatus != null">
+	     AND aut.status = #{userInfo.autStatus}  
+	     </if>
+	     ORDER BY  u.gmt_create DESC
+	</select>
+	
+	<update id="updateUserInfoAll" parameterType="java.util.Map" >
+	UPDATE sys_user u ,sys_user_organization a ,
+	sys_organization b ,sys_user_authentication c
+	SET
+	<if test="isDeleted !=null">
+	 u.is_deleted = #{isDeleted},a.is_deleted=  #{isDeleted},b.is_deleted=  #{isDeleted},c.is_deleted= #{isDeleted},
+	</if>
+	<if test="email != null">
+	u.gmt_modified=#{gmtModified},u.modifier=#{modifier},
+	u.email=#{email},
+	</if>
+	<if test="principal != null || address != null || type != null">
+	b.gmt_modified=#{gmtModified},b.modifier=#{modifier},
+	b.principal=#{principal},b.address=#{address},b.type=#{type}
+	</if>
+	<if test="position != null ||">
+	c.gmt_modified=#{gmtModified},c.modifier=#{modifier},
+	c.position=#{position},c.is_reject=#{isReject},c.reject_type=#{rejectType},
+	c.reject_comment=#{rejectComment},c.status = #{status}
+	</if>
+	WHERE u.id = #{userId} 
+	AND c.user_id= #{userId} 
+	AND a.user_id = #{userId} 
+	AND a.organization_id =b.id
+</update>
+
+</mapper>

+ 100 - 2
user-service/src/main/resources/mapper/UserMapper.xml

@@ -42,7 +42,7 @@
 		ORDER BY gmt_create DESC
 	</select> -->
 	
-    <select id="selectUserInfoListPage"  resultType="com.diagbot.entity.UserInfo">
+    <select id="selectUserInfoPage"  parameterType="com.diagbot.entity.UserInfo" resultType="com.diagbot.entity.UserInfo">
 		SELECT
 		u.id AS userId,
 		u.gmt_create as userGmtCreate,
@@ -55,6 +55,104 @@
 		FROM sys_user u
 		LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
 		LEFT JOIN sys_organization org ON uorg.organization_id = org.id
-		WHERE u.is_deleted = 'N' AND u.TYPE = "0" ORDER BY u.gmt_create DESC
+		WHERE u.is_deleted = 'N' AND u.TYPE = 0 ORDER BY u.gmt_create DESC
 	</select>
+	<select id="selectUserInfoListPage"  resultType="com.diagbot.entity.UserInfo">
+	 SELECT
+		u.id AS userId,
+		u.gmt_create AS userGmtCreate,
+		u.username AS userName,
+		u.linkman AS linKman,
+		u.email AS email,
+		org.id AS orgId,
+		org.gmt_create AS orgGmtCreate,
+		org.name AS orgName,
+		org.type as orgType,
+		org.principal AS orgPrincipal,
+		org.address as orgAddress,
+		org.parent_id as orgParent_id,
+		org.sub_num as orgSub_num,
+		aut.position as autPosition,
+		aut.is_reject as autIsReject,
+		aut.status as autStatus
+		FROM sys_user u
+		LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
+		LEFT JOIN sys_organization org ON uorg.organization_id = org.id
+	        LEFT JOIN sys_user_authentication aut ON u.id = aut.user_id
+		WHERE u.is_deleted = 'N' AND u.TYPE = 0
+		<if test="userInfo.orgName != null">
+		 AND org.name LIKE CONCAT('%', #{userInfo.orgName}, '%') 
+		 </if>
+		 <if test="userInfo.autStatus != null">
+	     AND aut.status = #{userInfo.autStatus}  
+	     </if>
+	     ORDER BY  u.gmt_create DESC
+	</select>
+	
+	<update id="updateUserInfoAll" parameterType="com.diagbot.entity.UserInfoOrganizations" >
+	UPDATE sys_user u ,sys_user_organization a ,
+	sys_organization b ,sys_user_authentication c
+	SET  u.remark = "0" 
+	<if test="isDeleted !=null">
+	 ,u.is_deleted = #{isDeleted}
+	 ,a.is_deleted=  #{isDeleted}
+	 ,b.is_deleted=  #{isDeleted}
+	 ,c.is_deleted= #{isDeleted}
+	</if>
+	<if test="email != null">
+	    <if test="gmtModified !=null"> 
+	      ,u.gmt_modified=#{gmtModified}
+	   </if>
+	   <if test="modifier != modifier">
+	      ,u.modifier=#{modifier}
+	   </if>
+	  ,u.email=#{email}
+	</if>
+	<if test="principal != null || address != null || type != null">
+	     <if test="gmtModified !=null"> 
+	       ,b.gmt_modified=#{gmtModified}
+	     </if>
+	     <if test="modifier != null">
+	      ,b.modifier=#{modifier}
+	     </if>
+		<if test="principal != null">
+		  ,b.principal=#{principal}
+		</if>
+		<if test="address != null">
+		  ,b.address=#{address}
+		</if>
+		<if test="type != null">
+		  ,b.type=#{type}
+		</if>
+	</if>
+	
+	<if test="position != null || isReject != null || rejectType !=null || rejectComment !=null || status != null">
+	    <if test="gmtModified !=null">
+		  ,c.gmt_modified=#{gmtModified}
+		</if>
+		<if test="modifier != null">
+		  ,c.modifier=#{modifier}
+		</if>
+		<if test="position != null">
+		  ,c.position=#{position}
+		</if>
+		<if test="isReject != null">
+		 ,c.is_reject=#{isReject}
+		</if>
+		<if test="rejectType !=null">
+		  ,c.reject_type=#{rejectType}
+		</if>
+		<if test="rejectComment !=null">
+		  ,c.reject_comment=#{rejectComment}
+		</if>
+		<if test="status != null">
+		  ,c.status = #{status}
+		</if>
+	</if>
+	WHERE u.id = #{userId} 
+	AND c.user_id= #{userId} 
+	AND a.user_id = #{userId} 
+	AND a.organization_id =b.id
+</update>
+
 </mapper>