Commit 9d1782db authored by xinglei's avatar xinglei

*)新增根据用户id查询人员接口

parent b4939220
......@@ -96,4 +96,5 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<Map<String,Object>> queryCompanyIdNew(String bizOrgName);
OrgUsr queryByUserId(@Param("userId")Long userId);
}
package com.yeejoin.amos.boot.module.common.api.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
......@@ -280,4 +281,6 @@ public interface IOrgUsrService {
OrgUsrDto saveOrgPersonFlc(OrgPersonDto OrgPersonDto) throws Exception;
void updateByIdOrgPersonFlc(OrgPersonDto OrgPersonVo, Long id) throws Exception;
JSONObject selectPersonByUserId(Long userId) throws Exception;
}
......@@ -722,4 +722,13 @@ LEFT JOIN (
</select>
<select id="queryByUserId" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT *
FROM cb_org_usr
WHERE is_delete = 0
<if test="userId != null">
AND amos_org_id = #{userId}
</if>
</select>
</mapper>
......@@ -9,6 +9,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -281,4 +282,19 @@ public class OrgPersonController {
// @PathVariable Long id) throws Exception {
// return ResponseHelper.buildResponse(iOrgUsrService.queryCompanyId(id));
// }
/**
* 根据userId查询人员
*
* @param request
* @param userId
* @return
* @throws Exception
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getPersonByUserId/{userId}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据平台用户ID查询人员详情", notes = "根据平台用户ID查询人员详情")
public ResponseModel<JSONObject> selectByUserId(HttpServletRequest request, @PathVariable Long userId) throws Exception {
return ResponseHelper.buildResponse(iOrgUsrService.selectPersonByUserId(userId));
}
}
......@@ -15,6 +15,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -2037,4 +2038,21 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
updateDynamicFormInstance(orgUsr.getSequenceNbr(), OrgPersonVo.getDynamicFormValue());
}
@Override
public JSONObject selectPersonByUserId(Long userId) throws Exception {
OrgUsr orgUsr = orgUsrMapper.queryByUserId(userId);
// 动态表单数据
List<FormValue> formValue = getFormValue(orgUsr.getSequenceNbr());
OrgPersonFormDto orgPersonFormVo = new OrgPersonFormDto(formValue);
BeanUtils.copyProperties(orgUsr, orgPersonFormVo);
OrgUsr parent = getById(orgUsr.getParentId());
if (!ObjectUtils.isEmpty(parent)) {
orgPersonFormVo.setParentName(parent.getBizOrgName());
}
List<FormValue> dynamicFormAlert = orgPersonFormVo.getDynamicFormAlert();
Map<String, String> collect = dynamicFormAlert.stream().collect(HashMap::new, (map, item) -> map.put(item.getKey(), item.getValue()), HashMap::putAll);
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(orgPersonFormVo));
jsonObject.put("map", collect);
return jsonObject;
}
}
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