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

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

parent 6939f2cd
......@@ -181,7 +181,7 @@ public interface IOrgUsrService {
List<OrgUsrExcelDto> exportToExcel();
UserUnitDto getUserUnit(String id, String type, String code);
UserUnitDto getUserUnit(String userId);
/**
* 根据登陆人获取公司部门人员树
......
......@@ -360,14 +360,14 @@ public class OrgUsrController extends BaseController {
/**
* 获取用户单位归属
*
* @param id
* @param userId
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getUserUnit", method = RequestMethod.GET)
@RequestMapping(value = "/{userId}/userUnit", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取用户单位归属", notes = "获取用户单位归属")
public ResponseModel<UserUnitDto> getUserUnit(@RequestParam String id, @RequestParam String type, @RequestParam String code) {
return ResponseHelper.buildResponse(iOrgUsrService.getUserUnit(id, type, code));
public ResponseModel<UserUnitDto> getUserUnit(@PathVariable String userId) {
return ResponseHelper.buildResponse(iOrgUsrService.getUserUnit(userId));
}
}
\ No newline at end of file
......@@ -46,6 +46,11 @@ import java.util.stream.Collectors;
@Service
public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapper> implements IOrgUsrService {
private static final String TYPE = "PERSON,COMPANY";
private static final String CODE = "amosAccount";
@Autowired
DynamicFormInstanceServiceImpl alertFormValueServiceImpl;
@Autowired
......@@ -1003,13 +1008,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
@Override
public UserUnitDto getUserUnit(String id, String type, String code) {
if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(type) && StringUtils.isNotBlank(code)) {
String[] typeArr = type.split(",");
public UserUnitDto getUserUnit(String userId) {
if (StringUtils.isNotBlank(userId)) {
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)) {
throw new RuntimeException("人员绑定单位重复!");
} 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