ylx 7 years ago
parent
commit
f6978b9737

+ 0 - 15
ccb_fund_trusteeship/src/main/java/com/fuzamei/dao/UserAuthoricationDao.java

@@ -19,21 +19,6 @@ public class UserAuthoricationDao {
 	@Autowired
 	private UserAuthoricationMapper userAuthoricationMapper;
 	
-	//根据用户的id号查询用户的角色信息 
-	public List<String> queryUserRoleNames(int userId){
-		return userAuthoricationMapper.queryUserRolenames(userId);
-	}
-	
-	//根据用户的id号查询用户的权限信息 
-	public List<String> queryUserPermissionNames(int userId){
-		return userAuthoricationMapper.queryUserPermissionNames(userId);
-	}
-	
-	//根据用户的id号查询用户的账号名Account名
-	public String queryUserAccount(int userId) {
-		return userAuthoricationMapper.queryUserAccount(userId);
-	}
-	
 	//根据id号查询用户全部的信息
 	public UserDetail queryUserDetailInformation(int userId) {
 		return userAuthoricationMapper.queryUserDetailInformation(userId);

+ 5 - 10
ccb_fund_trusteeship/src/main/java/com/fuzamei/entity/AccountInfo.java

@@ -1,12 +1,11 @@
 package com.fuzamei.entity;
 
 public class AccountInfo {
-	private Integer id;//主键 id
-	private Integer account_id;//账户id
-	private String  account_name;//账户名称
-	private String  account_type;//账户类型
-	private  Double money;//钱
-	
+	private Integer id;					//主键 id
+	private Integer account_id;			//账户id
+	private String account_name;		//账户名称
+	private String account_type;		//账户类型
+	private Double money;				//钱
 	public Integer getId() {
 		return id;
 	}
@@ -19,7 +18,6 @@ public class AccountInfo {
 	public void setAccount_id(Integer account_id) {
 		this.account_id = account_id;
 	}
-
 	public String getAccount_name() {
 		return account_name;
 	}
@@ -38,7 +36,4 @@ public class AccountInfo {
 	public void setMoney(Double money) {
 		this.money = money;
 	}
-	
-	
-	
 }

+ 26 - 42
ccb_fund_trusteeship/src/main/java/com/fuzamei/entity/UserDetail.java

@@ -12,45 +12,12 @@ public class UserDetail {
 	private String private_key;					//私钥
 	private String organization_name;			//机构名称
 	private String person_name;					//人员名称
-	private List<String> role_name;				//角色名称
-	private List<String> authority_name;		//权限名称
+	private List<String> role_name;				//角色名称(多对多)
+	private List<String> authority_name;		//权限名称(多对多)
 	private Double account_balance;				//账户余额
 	private Long create_time;					//账户创建时间
 	private Long update_time;					//账户修改时间
-	private String account_name;//账户名称
-	public String getAccount_name() {
-		return account_name;
-	}
-	public void setAccount_name(String account_name) {
-		this.account_name = account_name;
-	}
-	private Double money;//账户信息表 钱
-	
-	public Double getMoney() {
-		return money;
-	}
-	public void setMoney(Double money) {
-		this.money = money;
-	}
-	public Double getAccount_balance() {
-		return account_balance;
-	}
-	public void setAccount_balance(Double account_balance) {
-		this.account_balance = account_balance;
-	}
-
-	public Long getCreate_time() {
-		return create_time;
-	}
-	public void setCreate_time(Long create_time) {
-		this.create_time = create_time;
-	}
-	public Long getUpdate_time() {
-		return update_time;
-	}
-	public void setUpdate_time(Long update_time) {
-		this.update_time = update_time;
-	}
+	private List<AccountInfo> account_info_list;//账户信息(一对多)		
 	public Integer getId() {
 		return id;
 	}
@@ -117,12 +84,29 @@ public class UserDetail {
 	public void setAuthority_name(List<String> authority_name) {
 		this.authority_name = authority_name;
 	}
-	@Override
-	public String toString() {
-		return "UserDetail [id=" + id + ", user_id=" + user_id + ", account=" + account + ", password=" + password
-				+ ", random=" + random + ", public_key=" + public_key + ", private_key=" + private_key
-				+ ", organization_name=" + organization_name + ", person_name=" + person_name + ", role_name="
-				+ role_name + ", authority_name=" + authority_name + "]";
+	public Double getAccount_balance() {
+		return account_balance;
+	}
+	public void setAccount_balance(Double account_balance) {
+		this.account_balance = account_balance;
+	}
+	public Long getCreate_time() {
+		return create_time;
+	}
+	public void setCreate_time(Long create_time) {
+		this.create_time = create_time;
+	}
+	public Long getUpdate_time() {
+		return update_time;
+	}
+	public void setUpdate_time(Long update_time) {
+		this.update_time = update_time;
+	}
+	public List<AccountInfo> getAccount_info_list() {
+		return account_info_list;
+	}
+	public void setAccount_info_list(List<AccountInfo> account_info_list) {
+		this.account_info_list = account_info_list;
 	}
 	
 }

+ 48 - 156
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/UserAuthoricationMapper.xml

@@ -2,170 +2,56 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fuzamei.mapperInterface.UserAuthoricationMapper"> 
 	
-	<!-- 根据用户的id号查询用户的角色信息 -->
-	<select id="queryUserRolenames" resultType="string">
+	<!-- 查询出一个userId号下的用户所有详细信息包括基本信息,还有角色,权限信息 -->
+	<select id="queryUserDetailInformation" resultMap="UserDetailRM">
 		select 
-			t_role.role_name
+			tu.id,
+			tu.user_id,
+			tu.account,
+			tu.password,
+			tu.random,
+			tu.public_key,
+			tu.private_key,
+			tu.organization_name,
+			tu.person_name,
+			tu.account_balance,
+			tu.update_time,
+			tu.create_time,
+			tr.role_name,
+			tp.authority_name,
+			ai.id as id2,
+			ai.account_id,
+			ai.account_name,
+			ai.account_type,
+			ai.money
 		from 
-			(select 
-				user_role.role_id
-			from 
-				t_user 
-			left join 
-				user_role
-			on
-				t_user.user_id=user_role.user_id
-			where t_user.user_id=#{userId}) temp
+			t_user tu
 		left join 
-			t_role
+			user_role ur
 		on 
-			temp.role_id=t_role.role_id
-	</select>
-	
-	<!-- 根据用户的id号查询用户的权限信息 -->
-	<select id="queryUserPermissionNames" resultType="string">
-		select 
-			t_permission.authority_name
-		from 
-			(select 
-				role_permission.authority_id 
-			from 
-				(select 
-					t_role.role_id,
-					t_role.role_name
-				from 
-					(select 
-						user_role.role_id
-					from 
-						t_user 
-					left join 
-						user_role
-					on
-						t_user.user_id=user_role.user_id
-					where t_user.user_id=#{userId}) temp
-				left join 
-					t_role
-				on 
-					temp.role_id=t_role.role_id) temp 
-			left join 
-				role_permission
-			on 
-				temp.role_id=role_permission.role_id) temp 
+			tu.user_id=ur.user_id
 		left join 
-			t_permission
+			t_role tr
 		on 
-			temp.authority_id=t_permission.authority_id
-	</select>
-	
-	<!-- 根据用户的id号查询用户的账号名Account名 -->
-	<select id="queryUserAccount" resultType="string">
-		select account from t_user where user_id=#{userId};
-	</select>
-	
-	<!-- 查询出一个userId号下的用户所有详细信息包括基本信息,还有角色,权限信息 -->
-	<select id="queryUserDetailInformation" resultMap="UserDetailRM">
-		select 
-			temp.id,
-			temp.user_id,
-			temp.account,
-			temp.password,
-			temp.random,
-			temp.public_key,
-			temp.private_key,
-			temp.account_balance,
-			temp.drawing_account,
-			temp.create_time,
-			temp.update_time,
-			temp.organization_name,
-			temp.person_name,
-			temp.role_name,
-			t_permission.authority_name
-		from 
-			(select 
-				temp.id,
-				temp.user_id,
-				temp.account,
-				temp.password,
-				temp.random,
-				temp.public_key,
-				temp.private_key,
-				temp.account_balance,
-				temp.drawing_account,
-				temp.create_time,
-				temp.update_time,
-				temp.organization_name,
-				temp.person_name,
-				temp.role_id,
-				temp.role_name,
-				role_permission.authority_id
-			from
-				(select 
-					temp.id,
-					temp.user_id,
-					temp.account,
-					temp.password,
-					temp.random,
-					temp.public_key,
-					temp.private_key,
-					temp.account_balance,
-					temp.drawing_account,
-					temp.create_time,
-					temp.update_time,
-					temp.organization_name,
-					temp.person_name,
-					temp.role_id,
-					t_role.role_name
-				from 
-					(select 
-						temp.id,
-						temp.user_id,
-						temp.account,
-						temp.password,
-						temp.random,
-						temp.public_key,
-						temp.private_key,
-						temp.organization_name,
-						temp.person_name,
-						temp.account_balance,
-						temp.drawing_account,
-						temp.create_time,
-						temp.update_time,
-						user_role.role_id
-					from
-						(select 
-							id,
-							user_id,
-							account,
-							password,
-							random,
-							public_key,
-							private_key,
-							account_balance,
-							drawing_account,
-							create_time,
-							update_time,
-							organization_name,
-							person_name
-						from 
-							t_user
-						where 
-							user_id=#{userId}) temp 
-					left join 
-						user_role
-					on 
-						temp.user_id=user_role.user_id) temp 
-				left join 
-					t_role
-				on 
-					temp.role_id=t_role.role_id) temp 
-			left join
-				role_permission
-			on 
-				temp.role_id=role_permission.role_id) temp
+			ur.role_id=tr.role_id
+		left join 
+			role_permission rp 
+		on 
+			rp.role_id = tr.role_id
+		left join 
+			t_permission tp
+		on 
+			tp.authority_id=rp.authority_id
 		left join 
-			t_permission
+			user_account ua
 		on 
-			temp.authority_id=t_permission.authority_id
+			tu.user_id=ua.user_id
+		left join 
+			account_info ai
+		on 
+			ai.account_id=ua.account_id
+		where 
+			tu.user_id=#{userId}
 	</select>
 	<!-- 专门针对queryUserDetailInformation返回值结果用的 -->
 	<resultMap type="com.fuzamei.entity.UserDetail" id="UserDetailRM" autoMapping="true">
@@ -180,5 +66,11 @@
 				<arg column="authority_name"/>
 			</constructor>
 		</collection>
+		<collection property="account_info_list" resultMap="AccountInfoRM"></collection>
 	</resultMap>
+	
+	<resultMap type="com.fuzamei.entity.AccountInfo" id="AccountInfoRM" autoMapping="true">
+		<id column="id2" property="id"/>
+	</resultMap>
+	
 </mapper>

+ 0 - 6
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapperInterface/UserAuthoricationMapper.java

@@ -6,12 +6,6 @@ import com.fuzamei.entity.UserDetail;
 
 public interface UserAuthoricationMapper {
 
-	List<String> queryUserRolenames(int userId);//根据用户的id号查询用户的角色信息
-
-	List<String> queryUserPermissionNames(int userId);//根据用户的id号查询用户的权限信息
-
-	String queryUserAccount(int userId);//根据用户的id号查询用户的账号名Account名
-
 	UserDetail queryUserDetailInformation(int userId);//根据用户的id号查询用户的账号所有信息
 	
 	

+ 2 - 1
ccb_fund_trusteeship/src/main/java/com/fuzamei/service/CapitalTransferService.java

@@ -284,7 +284,8 @@ public class CapitalTransferService {
 		String attachment_name=(String) map.get("attachment_name");//附件名称拿上传文件的名称
 		
 		double  account_balance=userDetail.getAccount_balance();//管理人的账户余额 ????
-		double  money=userDetail.getMoney();//??????????????
+//		double  money=userDetail.getMoney();//??????????????
+		double money=1000;
 	    double minusResult=account_balance-sum_of_money;//账户余额减去划款金额后的结果???
 	    double sumMoney=sum_of_money+money;//划款金额+钱??
 	    

+ 7 - 2
ccb_fund_trusteeship/src/main/java/com/fuzamei/web/BusinessDeclareAction.java

@@ -486,8 +486,13 @@ public class BusinessDeclareAction {
 	@ResponseBody
 	public Map<String, Object> test(@RequestBody String data){
 		try {
-			List<Integer> generateMultiAttachmentIds = attachmentService.generateMultiAttachmentIds(4);
-			return JSONUtil.getJsonMap(200, true, "成功",generateMultiAttachmentIds);
+//			List<Integer> generateMultiAttachmentIds = attachmentService.generateMultiAttachmentIds(4);
+			@SuppressWarnings("unchecked")
+			Map<String, Object> map = JSON.parseObject(data, Map.class);		//将前端传过来的json数据转化为map对象,并将map对象传入service层进行数据校验
+			//首先校验用户权限问题
+			int userId=ValidationUtil.checkAndAssignInt(map.get("userId"));
+			UserDetail user = userAuthoricationService.checkUserAuthority(userId);
+			return JSONUtil.getJsonMap(200, true, "成功",user);
 		} catch (Exception e) {
 			return JSONUtil.getJsonMap(200, true, "失败:"+e.getMessage(),null);
 		}