fanxw %!s(int64=2) %!d(string=hai) anos
pai
achega
5f5e8835d5

+ 16 - 0
src/main/java/com/chinaitop/depot/system/controller/UserInfoController.java

@@ -191,6 +191,22 @@ public class UserInfoController {
191 191
 		return pageInfo;
192 192
 	}
193 193
 
194
+	@RequestMapping(value="/checkRepeat", method = RequestMethod.GET)
195
+	@ApiOperation(value="检查同一个库下相同身份证号的人是否已存在", notes = "")
196
+	@ApiImplicitParams({
197
+		@ApiImplicitParam(name = "orgId", value = "组织机构编码", paramType = "query"),
198
+		@ApiImplicitParam(name = "sfzhm", value = "身份证号", paramType = "query")
199
+	})
200
+	public String checkRepeat(Integer orgId, String sfzhm) {
201
+		String flag = "false";
202
+		try {
203
+			flag = userInfoService.checkRepeat(orgId, sfzhm);
204
+		} catch (Exception e) {
205
+			e.printStackTrace();
206
+		}
207
+		return flag;
208
+	}
209
+
194 210
 	/**
195 211
 	 * 查找审批用户信息
196 212
 	 * @param roleName	角色名称

+ 9 - 0
src/main/java/com/chinaitop/depot/system/service/UserInfoService.java

@@ -131,4 +131,13 @@ public interface UserInfoService {
131 131
 	Map<String, Object> save(String userInfoJson, String userRoleIds,
132 132
 							 String crkRoleIds, String wsdlUrl,
133 133
 							 String FLATID, String KEY) throws Exception;
134
+
135
+	/**
136
+	 * 检查同一个库下相同身份证号的人是否已存在
137
+	 * @param orgId
138
+	 * @param sfzhm
139
+	 * @return
140
+	 * @throws Exception
141
+	 */
142
+	String checkRepeat(Integer orgId, String sfzhm) throws Exception;
134 143
 }

+ 34 - 15
src/main/java/com/chinaitop/depot/system/service/impl/UserInfoServiceImpl.java

@@ -1,5 +1,18 @@
1 1
 package com.chinaitop.depot.system.service.impl;
2 2
 
3
+import java.math.BigInteger;
4
+import java.security.MessageDigest;
5
+import java.util.ArrayList;
6
+import java.util.HashMap;
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+import javax.annotation.Resource;
11
+
12
+import org.apache.commons.lang3.StringUtils;
13
+import org.springframework.stereotype.Service;
14
+import org.springframework.transaction.annotation.Transactional;
15
+
3 16
 import com.chinaitop.depot.system.mapper.UserBusinessMapper;
4 17
 import com.chinaitop.depot.system.mapper.UserInfoMapper;
5 18
 import com.chinaitop.depot.system.mapper.UserRoleMapper;
@@ -10,25 +23,11 @@ import com.chinaitop.depot.system.model.UserRole;
10 23
 import com.chinaitop.depot.system.model.UserRoleExample;
11 24
 import com.chinaitop.depot.system.service.UserInfoService;
12 25
 import com.chinaitop.depot.system.service.UserOrgService;
13
-
14 26
 import com.chinaitop.depot.utils.NetStateUtil;
15 27
 import com.chinaitop.depot.utils.SHA1Util;
16 28
 import com.chinaitop.depot.webservice.ExchangeServer;
17 29
 import com.chinaitop.depot.webservice.IExchangeService;
18 30
 import com.fasterxml.jackson.databind.ObjectMapper;
19
-import org.apache.commons.lang3.StringUtils;
20
-import org.springframework.stereotype.Service;
21
-import org.springframework.transaction.annotation.Transactional;
22
-
23
-import javax.annotation.Resource;
24
-
25
-import java.math.BigInteger;
26
-import java.security.MessageDigest;
27
-import java.util.ArrayList;
28
-import java.util.HashMap;
29
-import java.util.List;
30
-import java.util.Map;
31
-import java.util.regex.Pattern;
32 31
 
33 32
 @Service
34 33
 public class UserInfoServiceImpl implements UserInfoService {
@@ -267,7 +266,7 @@ public class UserInfoServiceImpl implements UserInfoService {
267 266
 									String FLATID, String KEY) throws Exception {
268 267
 		Map<String, Object> modelMap = new HashMap<>();
269 268
 
270
-		Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
269
+		//Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
271 270
 		// JSON字符串转对象
272 271
 		ObjectMapper mapper = new ObjectMapper();
273 272
 		UserInfo userInfo = (UserInfo)mapper.readValue(userInfoJson, UserInfo.class);
@@ -312,4 +311,24 @@ public class UserInfoServiceImpl implements UserInfoService {
312 311
 		return modelMap;
313 312
 	}
314 313
 
314
+	@Override
315
+	public String checkRepeat(Integer orgId, String sfzhm) throws Exception {
316
+		String flag = "false";
317
+		UserInfoExample example = new UserInfoExample();
318
+		Criteria criteria = example.createCriteria();
319
+		if (null != orgId) {
320
+			criteria.andOrgIdEqualTo(orgId);
321
+		}
322
+
323
+		if (StringUtils.isNotBlank(sfzhm)) {
324
+			criteria.andSfzhmEqualTo(sfzhm);
325
+		}
326
+
327
+		List<UserInfo> list =  queryByExample(example);
328
+		if (null == list || list.size() == 0) {
329
+			flag = "true";
330
+		}
331
+		return flag;
332
+	}
333
+
315 334
 }