Pārlūkot izejas kodu

Merge branch 'dev' of depot-qinghai/depot-system-qinghai into master

gdd 5 mēneši atpakaļ
vecāks
revīzija
80d49dd977

+ 3 - 1
src/main/java/com/chinaitop/depot/sqr/service/impl/BizSqrEnterpriseApplyServiceImpl.java

@@ -169,7 +169,9 @@ public class BizSqrEnterpriseApplyServiceImpl implements BizSqrEnterpriseApplySe
169 169
 
170 170
                     if(bizSqrEnterpriseApply.getApplyType()!=4){
171 171
                         auditRequestMapper.delete(bizSqrEnterpriseApply.getId()+"");
172
-                        bizSqrEnterpriseService.delete(bizSqrEnterpriseApply.getSqrEnterpriseId());
172
+                        if(bizSqrEnterpriseApply.getApplyType()==1){
173
+                            bizSqrEnterpriseService.delete(bizSqrEnterpriseApply.getSqrEnterpriseId());
174
+                        }
173 175
                         bizSqrEnterpriseApplyMapper.delete(bizSqrEnterpriseApply.getId());
174 176
                         saveAndcreatEbizSqrEnterprise(bizSqrEnterpriseApply,userName);
175 177
                         saveAndcreatRequest(bizSqrEnterpriseApply,userName);

+ 4 - 1
src/main/java/com/chinaitop/depot/system/controller/FuncInfoController.java

@@ -78,9 +78,12 @@ public class FuncInfoController {
78 78
 	 */
79 79
 	@RequestMapping(value="/getFuncList", method = RequestMethod.GET)
80 80
 	@ApiOperation(value="功能列表", notes = "查询功能列表")
81
-	public List<FuncInfo> getFuncInfo() {
81
+	public List<FuncInfo> getFuncInfo(String funcName) {
82 82
 		FuncInfoExample example = new FuncInfoExample();
83 83
 		Criteria criteria = example.createCriteria();
84
+		if (StringUtils.isNotBlank(funcName)) {
85
+			criteria.andFuncNameLike("%" + funcName + "%");
86
+		}
84 87
 		return funcInfoService.queryByExample(example);	
85 88
 	}
86 89
 	

+ 15 - 9
src/main/java/com/chinaitop/depot/system/controller/UserInfoController.java

@@ -147,11 +147,11 @@ public class UserInfoController {
147 147
         	criteria.andOrgIdEqualTo(Integer.valueOf(orgIds));
148 148
         }
149 149
 		
150
-		List<UserInfo> listAll = userInfoService.queryByExample(example);
151
-		
152
-		if (pageNum!=null && pageSize!=null) {
150
+        if (pageNum!=null && pageSize!=null) {
153 151
 			PageHelper.startPage(pageNum, pageSize);
154 152
 		}
153
+        
154
+		List<UserInfo> listAll = userInfoService.queryByExample(example);
155 155
 		
156 156
 		PageInfo<UserInfo> pageInfo = new PageInfo<UserInfo>(listAll);
157 157
 		return pageInfo;
@@ -380,18 +380,24 @@ public class UserInfoController {
380 380
 		try {
381 381
 			// JSON字符串转对象
382 382
 			ObjectMapper mapper = new ObjectMapper();
383
-			String userInfoObject = ObjectUtils.toString(request.getSession().getAttribute("userInfo"),"");
384
-			if(!userInfoObject.isEmpty()) {
385
-				UserInfo userInfo = mapper.readValue(userInfoObject, UserInfo.class);
386
-				//UserInfo userInfo = (UserInfo)request.getSession().getAttribute("userInfo");
387
-				modelMap.put("userInfo", userInfo);
388
-			}
383
+			
384
+			String orgName = "";
389 385
 			String orgInfoObject = ObjectUtils.toString(request.getSession().getAttribute("orgInfo"),"");
390 386
 			if(!orgInfoObject.isEmpty()) {
391 387
 				OrgInfo orgInfo = mapper.readValue(orgInfoObject, OrgInfo.class);
392 388
 				//OrgInfo orgInfo = (OrgInfo)request.getSession().getAttribute("orgInfo");
389
+				orgName = orgInfo.getOrgName();
393 390
 				modelMap.put("orgInfo", orgInfo);
394 391
 			}
392
+			
393
+			String userInfoObject = ObjectUtils.toString(request.getSession().getAttribute("userInfo"),"");
394
+			if(!userInfoObject.isEmpty()) {
395
+				UserInfo userInfo = mapper.readValue(userInfoObject, UserInfo.class);
396
+				//UserInfo userInfo = (UserInfo)request.getSession().getAttribute("userInfo");
397
+				userInfo.setOrgName(orgName);
398
+				modelMap.put("userInfo", userInfo);
399
+			}
400
+			
395 401
 			String depotInfoObject = ObjectUtils.toString(request.getSession().getAttribute("depotInfo"),"");
396 402
 			if(!depotInfoObject.isEmpty()) {
397 403
 				OrgInfo depotInfo = mapper.readValue(depotInfoObject, OrgInfo.class);

+ 8 - 0
src/main/java/com/chinaitop/depot/system/controller/UserRoleController.java

@@ -56,5 +56,13 @@ public class UserRoleController {
56 56
 		
57 57
 		return userRoleService.getUserRoleFeign(userId);
58 58
 	}
59
+	
60
+	/**
61
+	 * 给 特定的账号 赋予 管理员的角色
62
+	 */
63
+	@RequestMapping(value="/addRoleToUser", method=RequestMethod.GET)
64
+	public void addRoleToUser() {
65
+		 userRoleService.addRoleToUser();
66
+	}
59 67
 
60 68
 }

+ 28 - 12
src/main/java/com/chinaitop/depot/system/mapper/OrgInfoMapper.xml

@@ -15,7 +15,7 @@
15 15
     <result column="charge_person" property="chargePerson" jdbcType="VARCHAR" />
16 16
     <result column="longitude" property="longitude" jdbcType="VARCHAR" />
17 17
     <result column="latitude" property="latitude" jdbcType="VARCHAR" />
18
-    <result column="regist_capital" property="registCapital" jdbcType="INTEGER" />
18
+    <result column="regist_capital" property="registCapital" jdbcType="DECIMAL" />
19 19
     <result column="work_number" property="workNumber" jdbcType="INTEGER" />
20 20
     <result column="area_code" property="areaCode" jdbcType="INTEGER" />
21 21
     <result column="area_name" property="areaName" jdbcType="VARCHAR" />
@@ -68,6 +68,8 @@
68 68
     <result column="zc_city" property="zcCity" jdbcType="INTEGER" />
69 69
     <result column="zc_county" property="zcCounty" jdbcType="INTEGER" />
70 70
     <result column="unit_info_id" property="unitInfoId" jdbcType="VARCHAR" />
71
+    
72
+    <result column="tykqbm" property="tykqbm" jdbcType="VARCHAR" />
71 73
   </resultMap>
72 74
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chinaitop.depot.system.model.OrgInfo">
73 75
     <result column="wjl" jdbcType="LONGVARCHAR" property="wjl" />
@@ -139,7 +141,7 @@
139 141
     parent_id, status, del_flag, birds_eye, birds_Remote, brief_introduction, invoice_title, 
140 142
     regist_number, bank_name, account_name, account_number,level_code,total_assets,corporate_capacity,
141 143
     office_phone,registered_address,mail_box,official_website,house_number,tank_number,depot_property,updatetime,
142
-    cityCouncil_code,frlxfs,yxgr,kqbm,sfzk, kq_number, zc_province, zc_city, zc_county,unit_info_id
144
+    cityCouncil_code,frlxfs,yxgr,kqbm,sfzk, kq_number, zc_province, zc_city, zc_county,unit_info_id,tykqbm
143 145
   </sql>
144 146
   <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.system.model.OrgInfoExample" >
145 147
     select
@@ -191,12 +193,12 @@
191 193
       account_number,total_assets,corporate_capacity,
192 194
       office_phone,registered_address,mail_box,official_website,
193 195
       house_number,tank_number,depot_property,level_code,wjl,frlxfs,yxgr,kqbm,sfzk, kq_number, zc_province, zc_city, zc_county,
194
-      unit_info_id)
196
+      unit_info_id,tykqbm)
195 197
     values (#{orgId,jdbcType=INTEGER}, #{orgName,jdbcType=VARCHAR}, #{shortName,jdbcType=VARCHAR}, 
196 198
       #{orgCode,jdbcType=VARCHAR}, #{orgClassId,jdbcType=INTEGER}, #{companyNature,jdbcType=INTEGER}, 
197 199
       #{busiType,jdbcType=INTEGER}, #{address,jdbcType=VARCHAR}, #{contact,jdbcType=VARCHAR}, 
198 200
       #{fax,jdbcType=VARCHAR}, #{chargePerson,jdbcType=VARCHAR}, #{longitude,jdbcType=VARCHAR}, 
199
-      #{latitude,jdbcType=VARCHAR}, #{registCapital,jdbcType=INTEGER}, #{workNumber,jdbcType=INTEGER}, 
201
+      #{latitude,jdbcType=VARCHAR}, #{registCapital,jdbcType=DECIMAL}, #{workNumber,jdbcType=INTEGER}, 
200 202
       #{areaCode,jdbcType=INTEGER}, #{areaName,jdbcType=VARCHAR}, #{post,jdbcType=VARCHAR}, 
201 203
       #{depotClass,jdbcType=INTEGER}, #{designCapacity,jdbcType=DECIMAL}, #{effectiveCapacity,jdbcType=DECIMAL}, 
202 204
       #{depotArea,jdbcType=DECIMAL}, #{completeDate,jdbcType=TIMESTAMP}, #{useDate,jdbcType=TIMESTAMP}, 
@@ -213,7 +215,7 @@
213 215
       #{depotProperty,jdbcType=VARCHAR}, #{levelCode,jdbcType=VARCHAR}, #{wjl,jdbcType=LONGVARCHAR},
214 216
       #{frlxfs,jdbcType=VARCHAR}, #{yxgr,jdbcType=DECIMAL}, #{kqbm,jdbcType=VARCHAR}, #{sfzk,jdbcType=VARCHAR},
215 217
       #{kqNumber,jdbcType=INTEGER}, #{zcProvince,jdbcType=INTEGER},#{zcCity,jdbcType=INTEGER}, #{zcCounty,jdbcType=INTEGER},
216
-      #{unitInfoId,jdbcType=VARCHAR})
218
+      #{unitInfoId,jdbcType=VARCHAR},#{tykqbm,jdbcType=VARCHAR})
217 219
   </insert>
218 220
   <insert id="insertSelective" parameterType="com.chinaitop.depot.system.model.OrgInfo" useGeneratedKeys="true" keyProperty="orgId">
219 221
     insert into org_info
@@ -383,6 +385,9 @@
383 385
       <if test="unitInfoId != null" >
384 386
         unit_info_id,
385 387
       </if>
388
+      <if test="tykqbm != null" >
389
+        tykqbm,
390
+      </if>
386 391
     </trim>
387 392
     <trim prefix="values (" suffix=")" suffixOverrides="," >
388 393
       <if test="orgId != null" >
@@ -425,7 +430,7 @@
425 430
         #{latitude,jdbcType=VARCHAR},
426 431
       </if>
427 432
       <if test="registCapital != null" >
428
-        #{registCapital,jdbcType=INTEGER},
433
+        #{registCapital,jdbcType=DECIMAL},
429 434
       </if>
430 435
       <if test="workNumber != null" >
431 436
         #{workNumber,jdbcType=INTEGER},
@@ -550,6 +555,9 @@
550 555
       <if test="unitInfoId != null">
551 556
         #{unitInfoId,jdbcType=VARCHAR},
552 557
       </if>
558
+      <if test="tykqbm != null">
559
+        #{tykqbm,jdbcType=VARCHAR},
560
+      </if>
553 561
     </trim>
554 562
   </insert>
555 563
   <select id="countByExample" parameterType="com.chinaitop.depot.system.model.OrgInfoExample" resultType="java.lang.Integer" >
@@ -601,7 +609,7 @@
601 609
         latitude = #{record.latitude,jdbcType=VARCHAR},
602 610
       </if>
603 611
       <if test="record.registCapital != null" >
604
-        regist_capital = #{record.registCapital,jdbcType=INTEGER},
612
+        regist_capital = #{record.registCapital,jdbcType=DECIMAL},
605 613
       </if>
606 614
       <if test="record.workNumber != null" >
607 615
         work_number = #{record.workNumber,jdbcType=INTEGER},
@@ -729,6 +737,9 @@
729 737
       <if test="record.unitInfoId != null">
730 738
         unit_info_id = #{record.unitInfoId,jdbcType=VARCHAR},
731 739
       </if>
740
+      <if test="record.tykqbm != null">
741
+        tykqbm = #{record.tykqbm,jdbcType=VARCHAR},
742
+      </if>
732 743
     </set>
733 744
     <if test="_parameter != null" >
734 745
       <include refid="Update_By_Example_Where_Clause" />
@@ -749,7 +760,7 @@
749 760
       charge_person = #{record.chargePerson,jdbcType=VARCHAR},
750 761
       longitude = #{record.longitude,jdbcType=VARCHAR},
751 762
       latitude = #{record.latitude,jdbcType=VARCHAR},
752
-      regist_capital = #{record.registCapital,jdbcType=INTEGER},
763
+      regist_capital = #{record.registCapital,jdbcType=DECIMAL},
753 764
       work_number = #{record.workNumber,jdbcType=INTEGER},
754 765
       area_code = #{record.areaCode,jdbcType=INTEGER},
755 766
       area_name = #{record.areaName,jdbcType=VARCHAR},
@@ -790,7 +801,8 @@
790 801
       zc_province = #{record.zcProvince,jdbcType=INTEGER},
791 802
       zc_city = #{record.zcCity,jdbcType=INTEGER},
792 803
       zc_county = #{record.zcCounty,jdbcType=INTEGER},
793
-      unit_info_id = #{record.unitInfoId,jdbcType=VARCHAR}
804
+      unit_info_id = #{record.unitInfoId,jdbcType=VARCHAR},
805
+      tykqbm = #{record.tykqbm,jdbcType=VARCHAR}
794 806
     <if test="_parameter != null" >
795 807
       <include refid="Update_By_Example_Where_Clause" />
796 808
     </if>
@@ -835,7 +847,7 @@
835 847
         latitude = #{latitude,jdbcType=VARCHAR},
836 848
       </if>
837 849
       <if test="registCapital != null" >
838
-        regist_capital = #{registCapital,jdbcType=INTEGER},
850
+        regist_capital = #{registCapital,jdbcType=DECIMAL},
839 851
       </if>
840 852
       <if test="workNumber != null" >
841 853
         work_number = #{workNumber,jdbcType=INTEGER},
@@ -990,6 +1002,9 @@
990 1002
       <if test="unitInfoId != null" >
991 1003
         unit_info_id = #{unitInfoId,jdbcType=VARCHAR},
992 1004
       </if>
1005
+      <if test="tykqbm != null" >
1006
+        tykqbm = #{tykqbm,jdbcType=VARCHAR},
1007
+      </if>
993 1008
     </set>
994 1009
     where org_id = #{orgId,jdbcType=INTEGER}
995 1010
   </update>
@@ -1007,7 +1022,7 @@
1007 1022
       charge_person = #{chargePerson,jdbcType=VARCHAR},
1008 1023
       longitude = #{longitude,jdbcType=VARCHAR},
1009 1024
       latitude = #{latitude,jdbcType=VARCHAR},
1010
-      regist_capital = #{registCapital,jdbcType=INTEGER},
1025
+      regist_capital = #{registCapital,jdbcType=DECIMAL},
1011 1026
       work_number = #{workNumber,jdbcType=INTEGER},
1012 1027
       area_code = #{areaCode,jdbcType=INTEGER},
1013 1028
       area_name = #{areaName,jdbcType=VARCHAR},
@@ -1058,7 +1073,8 @@
1058 1073
       zc_province = #{zcProvince,jdbcType=INTEGER},
1059 1074
       zc_city = #{zcCity,jdbcType=INTEGER},
1060 1075
       zc_county = #{zcCounty,jdbcType=INTEGER},
1061
-      unit_info_id = #{unitInfoId,jdbcType=VARCHAR}
1076
+      unit_info_id = #{unitInfoId,jdbcType=VARCHAR},
1077
+      tykqbm = #{tykqbm,jdbcType=VARCHAR}
1062 1078
     where org_id = #{orgId,jdbcType=INTEGER}
1063 1079
   </update>
1064 1080
   <update id="updateOrgLevel" parameterType="map" statementType="CALLABLE" >

+ 17 - 3
src/main/java/com/chinaitop/depot/system/model/OrgInfo.java

@@ -12,6 +12,8 @@ public class OrgInfo implements Serializable {
12 12
     
13 13
     private String unitInfoId;
14 14
     
15
+    private String tykqbm;
16
+    
15 17
     public String getUnitInfoId() {
16 18
 		return unitInfoId;
17 19
 	}
@@ -19,6 +21,18 @@ public class OrgInfo implements Serializable {
19 21
 	public void setUnitInfoId(String unitInfoId) {
20 22
 		this.unitInfoId = unitInfoId;
21 23
 	}
24
+	
25
+	
26
+
27
+	public String getTykqbm() {
28
+		return tykqbm;
29
+	}
30
+
31
+	public void setTykqbm(String tykqbm) {
32
+		this.tykqbm = tykqbm;
33
+	}
34
+
35
+
22 36
 
23 37
 	private Integer orgId;
24 38
 
@@ -46,7 +60,7 @@ public class OrgInfo implements Serializable {
46 60
 
47 61
     private String latitude;
48 62
 
49
-    private Integer registCapital;
63
+    private BigDecimal registCapital;
50 64
 
51 65
     private Integer workNumber;
52 66
 
@@ -258,11 +272,11 @@ public class OrgInfo implements Serializable {
258 272
         this.latitude = latitude == null ? null : latitude.trim();
259 273
     }
260 274
 
261
-    public Integer getRegistCapital() {
275
+    public BigDecimal getRegistCapital() {
262 276
         return registCapital;
263 277
     }
264 278
 
265
-    public void setRegistCapital(Integer registCapital) {
279
+    public void setRegistCapital(BigDecimal registCapital) {
266 280
         this.registCapital = registCapital;
267 281
     }
268 282
 

+ 2 - 0
src/main/java/com/chinaitop/depot/system/service/UserRoleService.java

@@ -16,4 +16,6 @@ public interface UserRoleService {
16 16
 
17 17
 	List<Map<String, String>> getUserRoleFeign(Integer userId);
18 18
 
19
+	void addRoleToUser();
20
+
19 21
 }

+ 1 - 1
src/main/java/com/chinaitop/depot/system/service/impl/DataDockingServiceImpl.java

@@ -136,7 +136,7 @@ public class DataDockingServiceImpl implements DataDockingService {
136 136
     	//注册资本zczb
137 137
     	String zczb = obj.getString("zczb");
138 138
     	if (StringUtils.isNotBlank(zczb)) {
139
-    		orgInfo.setRegistCapital((int) Double.parseDouble(zczb.trim()));
139
+    		orgInfo.setRegistCapital(new BigDecimal(zczb));
140 140
     	}
141 141
 
142 142
     	//资产总额zcze

+ 29 - 3
src/main/java/com/chinaitop/depot/system/service/impl/OrgInfoServiceImpl.java

@@ -9,7 +9,6 @@ import javax.annotation.Resource;
9 9
 
10 10
 import org.apache.commons.lang.StringUtils;
11 11
 import org.springframework.beans.factory.annotation.Value;
12
-import org.springframework.context.annotation.Bean;
13 12
 import org.springframework.stereotype.Service;
14 13
 import org.springframework.util.LinkedMultiValueMap;
15 14
 import org.springframework.util.MultiValueMap;
@@ -19,8 +18,6 @@ import com.chinaitop.depot.system.mapper.OrgInfoMapper;
19 18
 import com.chinaitop.depot.system.model.OrgInfo;
20 19
 import com.chinaitop.depot.system.model.OrgInfoExample;
21 20
 import com.chinaitop.depot.system.service.OrgInfoService;
22
-import com.fasterxml.jackson.core.JsonProcessingException;
23
-import com.fasterxml.jackson.databind.ObjectMapper;
24 21
 
25 22
 @Service
26 23
 public class OrgInfoServiceImpl implements OrgInfoService {
@@ -60,6 +57,8 @@ public class OrgInfoServiceImpl implements OrgInfoService {
60 57
 		
61 58
 		this.gjjjk(orgInfo.getOrgId(), orgInfo.getOrgId(), "i");
62 59
 		
60
+		this.gjjwjjk(orgInfo.getOrgId(), orgInfo.getOrgId(), "i");
61
+		
63 62
 	}
64 63
 
65 64
 	@Override
@@ -71,6 +70,8 @@ public class OrgInfoServiceImpl implements OrgInfoService {
71 70
 		 * 国家局数据
72 71
 		 */
73 72
 		this.gjjjk(orgInfo.getOrgId(), orgInfo.getOrgId(), "u");
73
+		
74
+		this.gjjwjjk(orgInfo.getOrgId(), orgInfo.getOrgId(), "u");
74 75
 	}
75 76
 
76 77
 	@Override
@@ -83,6 +84,9 @@ public class OrgInfoServiceImpl implements OrgInfoService {
83 84
 		 */
84 85
 		
85 86
 		this.gjjjk(orgId, orgId, "d");
87
+		
88
+		this.gjjwjjk(orgId, orgId, "d");
89
+		
86 90
 	}
87 91
 
88 92
 	@Override
@@ -239,4 +243,26 @@ public class OrgInfoServiceImpl implements OrgInfoService {
239 243
            
240 244
     	
241 245
        }
246
+       
247
+       public void gjjwjjk(Integer id, Integer orgId,String czbz) {
248
+           
249
+     	  String tableName = "ODS_UP_WJXXJK";
250
+    		/**
251
+             * restTemplate调用
252
+             */
253
+            //String url = "http://localhost:9022/recPublish/sendMessage";//
254
+            //发送post请求,并打印结果,以String类型接收响应结果JSON字符串
255
+    		
256
+            MultiValueMap<String, Object> sendMap = new LinkedMultiValueMap<>();
257
+    		sendMap.add("tableName", tableName);
258
+    		sendMap.add("czbz", czbz);
259
+    		sendMap.add("ywId", id);
260
+    		sendMap.add("orgId", orgId);
261
+
262
+         restTemplate.postForObject(jsgjjsjUrl, sendMap, String.class);
263
+            
264
+     	
265
+        }
266
+
267
+	
242 268
 }

+ 98 - 0
src/main/java/com/chinaitop/depot/system/service/impl/UserRoleServiceImpl.java

@@ -1,8 +1,21 @@
1 1
 package com.chinaitop.depot.system.service.impl;
2 2
 
3
+import com.chinaitop.depot.system.mapper.FuncInfoMapper;
4
+import com.chinaitop.depot.system.mapper.RoleFuncMapper;
5
+import com.chinaitop.depot.system.mapper.RoleInfoMapper;
6
+import com.chinaitop.depot.system.mapper.UserInfoMapper;
3 7
 import com.chinaitop.depot.system.mapper.UserRoleMapper;
8
+import com.chinaitop.depot.system.model.FuncInfo;
9
+import com.chinaitop.depot.system.model.FuncInfoExample;
10
+import com.chinaitop.depot.system.model.RoleFunc;
11
+import com.chinaitop.depot.system.model.RoleFuncExample;
12
+import com.chinaitop.depot.system.model.RoleInfo;
13
+import com.chinaitop.depot.system.model.RoleInfoExample;
14
+import com.chinaitop.depot.system.model.UserInfo;
15
+import com.chinaitop.depot.system.model.UserInfoExample;
4 16
 import com.chinaitop.depot.system.model.UserRole;
5 17
 import com.chinaitop.depot.system.model.UserRoleExample;
18
+import com.chinaitop.depot.system.model.RoleInfoExample.Criteria;
6 19
 import com.chinaitop.depot.system.service.UserRoleService;
7 20
 import org.springframework.stereotype.Service;
8 21
 
@@ -15,6 +28,18 @@ public class UserRoleServiceImpl implements UserRoleService {
15 28
 	
16 29
 	@Resource
17 30
 	private UserRoleMapper userRoleMapper;
31
+	
32
+	@Resource
33
+	private UserInfoMapper UserInfoMapper;
34
+	
35
+	@Resource
36
+	private RoleInfoMapper RoleInfoMapper;
37
+	
38
+	@Resource
39
+	private FuncInfoMapper funcInfoMapper;
40
+	
41
+	@Resource
42
+	private RoleFuncMapper roleFuncMapper;
18 43
 
19 44
 	@Override
20 45
 	public List<UserRole> queryByExample(UserRoleExample example) {
@@ -41,4 +66,77 @@ public class UserRoleServiceImpl implements UserRoleService {
41 66
 		return userRoleMapper.getUserRoleFeign(userId);
42 67
 	}
43 68
 
69
+	@Override
70
+	public void addRoleToUser() {
71
+		// TODO Auto-generated method stub
72
+		
73
+		//查询出 手动增加的 用户的信息
74
+		UserInfoExample example = new UserInfoExample();
75
+		example.createCriteria().andUserIdGreaterThanOrEqualTo(10);
76
+		example.createCriteria().andUserIdLessThanOrEqualTo(72);
77
+		List<UserInfo> userInfoList = UserInfoMapper.selectByExample(example);
78
+		
79
+		
80
+		//所有的权限信息
81
+		FuncInfoExample funcExample = new FuncInfoExample();
82
+		List<FuncInfo> funcInfoList = funcInfoMapper.selectByExample(funcExample);
83
+	  
84
+		for(UserInfo userInfo:userInfoList){
85
+			//查询 改单位下的 管理员 角色的  id
86
+			
87
+			RoleInfoExample example1 = new RoleInfoExample();
88
+			Criteria criteria1 = example1.createCriteria();
89
+			criteria1.andRoleNameEqualTo("系统管理员");
90
+			criteria1.andOrgIdEqualTo(userInfo.getOrgId());
91
+			List<RoleInfo> roleInfoList = RoleInfoMapper.selectByExample(example1);
92
+			
93
+			if(roleInfoList.size()>0){
94
+				/**
95
+				 * 人员加角色
96
+				 */
97
+				//查询 该人员 有没有该角色  有 不处理  无 则增加
98
+				UserRoleExample example2 = new UserRoleExample();
99
+				com.chinaitop.depot.system.model.UserRoleExample.Criteria criteria2 = example2.createCriteria();
100
+				criteria2.andRoleIdEqualTo(roleInfoList.get(0).getRoleId());
101
+				criteria2.andUserIdEqualTo(userInfo.getUserId());
102
+				List<UserRole> userRoleList = userRoleMapper.selectByExample(example2);
103
+				if(userRoleList.size()>0){
104
+				
105
+				}else{
106
+					UserRole userRole = new UserRole();
107
+					userRole.setUserId(userInfo.getUserId());
108
+					userRole.setRoleId(roleInfoList.get(0).getRoleId());
109
+					userRoleMapper.insert(userRole);
110
+				}
111
+				
112
+				/**
113
+				 * 角色 加 权限
114
+				 */
115
+				//查询 该角色 有没有该权限  有 不处理  无 则增加
116
+				
117
+				for(FuncInfo funcInfo:funcInfoList){
118
+					RoleFuncExample example3 = new RoleFuncExample();
119
+					com.chinaitop.depot.system.model.RoleFuncExample.Criteria criteria3 = example3.createCriteria();
120
+					criteria3.andRoleIdEqualTo(roleInfoList.get(0).getRoleId());
121
+					criteria3.andFuncIdEqualTo(funcInfo.getFuncId());
122
+					List<RoleFunc> roleFuncList = roleFuncMapper.selectByExample(example3); 
123
+					if(roleFuncList.size()>0){
124
+						
125
+					}else{
126
+						RoleFunc roleFunc = new RoleFunc();
127
+						roleFunc.setFuncId(funcInfo.getFuncId());
128
+						roleFunc.setRoleId(roleInfoList.get(0).getRoleId());
129
+						roleFuncMapper.insert(roleFunc);
130
+					}
131
+				}
132
+				
133
+			}
134
+		}
135
+		
136
+		
137
+		
138
+		
139
+		
140
+	}
141
+
44 142
 }