Commit d453edfd authored by 高建强's avatar 高建强

item:优化获取用户单位归属接口

parent 6939f2cd
...@@ -181,7 +181,7 @@ public interface IOrgUsrService { ...@@ -181,7 +181,7 @@ public interface IOrgUsrService {
List<OrgUsrExcelDto> exportToExcel(); List<OrgUsrExcelDto> exportToExcel();
UserUnitDto getUserUnit(String id, String type, String code); UserUnitDto getUserUnit(String userId);
/** /**
* 根据登陆人获取公司部门人员树 * 根据登陆人获取公司部门人员树
......
...@@ -360,14 +360,14 @@ public class OrgUsrController extends BaseController { ...@@ -360,14 +360,14 @@ public class OrgUsrController extends BaseController {
/** /**
* 获取用户单位归属 * 获取用户单位归属
* *
* @param id * @param userId
* @return * @return
*/ */
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getUserUnit", method = RequestMethod.GET) @RequestMapping(value = "/{userId}/userUnit", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取用户单位归属", notes = "获取用户单位归属") @ApiOperation(httpMethod = "GET", value = "获取用户单位归属", notes = "获取用户单位归属")
public ResponseModel<UserUnitDto> getUserUnit(@RequestParam String id, @RequestParam String type, @RequestParam String code) { public ResponseModel<UserUnitDto> getUserUnit(@PathVariable String userId) {
return ResponseHelper.buildResponse(iOrgUsrService.getUserUnit(id, type, code)); return ResponseHelper.buildResponse(iOrgUsrService.getUserUnit(userId));
} }
} }
\ No newline at end of file
...@@ -46,6 +46,11 @@ import java.util.stream.Collectors; ...@@ -46,6 +46,11 @@ import java.util.stream.Collectors;
@Service @Service
public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapper> implements IOrgUsrService { public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapper> implements IOrgUsrService {
private static final String TYPE = "PERSON,COMPANY";
private static final String CODE = "amosAccount";
@Autowired @Autowired
DynamicFormInstanceServiceImpl alertFormValueServiceImpl; DynamicFormInstanceServiceImpl alertFormValueServiceImpl;
@Autowired @Autowired
...@@ -1003,13 +1008,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1003,13 +1008,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
@Override @Override
public UserUnitDto getUserUnit(String id, String type, String code) { public UserUnitDto getUserUnit(String userId) {
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(type) && StringUtils.isNotBlank(code)) { if (StringUtils.isNotBlank(userId)) {
String[] typeArr = type.split(","); String[] typeArr = TYPE.split(",");
// 业主单位 // 业主单位
List<UserUnitDto> list = orgUsrMapper.getUserUnit(id, typeArr[0], null); List<UserUnitDto> list = orgUsrMapper.getUserUnit(userId, typeArr[0], null);
// 维保单位 // 维保单位
List<DynamicFormInstance> instanceList = alertFormValueServiceImpl.getInstanceByCodeAndValue(code, id); List<DynamicFormInstance> instanceList = alertFormValueServiceImpl.getInstanceByCodeAndValue(CODE, userId);
if (!CollectionUtils.isEmpty(list) && !CollectionUtils.isEmpty(instanceList)) { if (!CollectionUtils.isEmpty(list) && !CollectionUtils.isEmpty(instanceList)) {
throw new RuntimeException("人员绑定单位重复!"); throw new RuntimeException("人员绑定单位重复!");
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment