添加数据字典mongo模块,增加兔展属性全部详情接口

This commit is contained in:
wanggeng 2021-11-24 18:45:45 +08:00
parent f63a315c28
commit 6b8bb6c308
8 changed files with 86 additions and 20 deletions

18
pom.xml
View File

@ -69,6 +69,12 @@
<groupId>ink.wgink</groupId> <groupId>ink.wgink</groupId>
<artifactId>login-app</artifactId> <artifactId>login-app</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>ink.wgink</groupId>
<artifactId>module-dictionary</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -105,6 +111,18 @@
<groupId>ink.wgink</groupId> <groupId>ink.wgink</groupId>
<artifactId>login-oauth2-server</artifactId> <artifactId>login-oauth2-server</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>ink.wgink</groupId>
<artifactId>login-base</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ink.wgink</groupId>
<artifactId>mongo-module-dictionary</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<!-- mongodb start --> <!-- mongodb start -->

View File

@ -49,4 +49,14 @@ public class UserExpandAppController extends DefaultBaseController {
return userExpandService.get(userId); return userExpandService.get(userId);
} }
@ApiOperation(value = "拓展属性(全部)详情", notes = "拓展属性(全部)详情接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-whole/{userId}")
public UserExpandDTO getWhole(@PathVariable("userId") String userId) {
return userExpandService.getWhole(userId);
}
} }

View File

@ -59,4 +59,11 @@ public interface IUserExpandService extends IUserExpandBaseService<UserExpandDTO
*/ */
List<UserExpandDTO> listWholeByRoleIdAndAreaCode(String roleId, String areaCode); List<UserExpandDTO> listWholeByRoleIdAndAreaCode(String roleId, String areaCode);
/**
* 详情全部
*
* @param userId
* @return
*/
UserExpandDTO getWhole(String userId);
} }

View File

@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -191,6 +192,25 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
return userExpandDTOs; return userExpandDTOs;
} }
@Override
public UserExpandDTO getWhole(String userId) {
UserExpandDTO userExpandDTO = get(userId);
if (userExpandDTO == null) {
return null;
}
List<DepartmentUserDTO> departmentUserDTOs = departmentUserBaseService.listByUserIds(Arrays.asList(userId));
if (departmentUserDTOs.isEmpty()) {
return userExpandDTO;
}
List<DepartmentPO> departmentPOs = departmentBaseService.listPO(ArrayListUtil.listBeanStringIdValue(departmentUserDTOs, "departmentId", DepartmentUserDTO.class));
if (departmentPOs.isEmpty()) {
return userExpandDTO;
}
setDepartment(userExpandDTO, departmentUserDTOs, departmentPOs);
return userExpandDTO;
}
/** /**
* 设置用户 * 设置用户
* *
@ -255,22 +275,33 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
} }
// 合并内容 // 合并内容
for (UserExpandDTO userExpandDTO : userExpandDTOs) { for (UserExpandDTO userExpandDTO : userExpandDTOs) {
List<DepartmentDTO> departmentDTOs = new ArrayList<>(); setDepartment(userExpandDTO, departmentUserDTOs, departmentPOs);
for (DepartmentUserDTO departmentUserDTO : departmentUserDTOs) {
if (!StringUtils.equals(userExpandDTO.getUserId(), departmentUserDTO.getUserId())) {
continue;
}
for (DepartmentPO departmentPO : departmentPOs) {
if (!StringUtils.equals(departmentUserDTO.getDepartmentId(), departmentPO.getDepartmentId())) {
continue;
}
DepartmentDTO departmentDTO = new DepartmentDTO();
BeanUtils.copyProperties(departmentPO, departmentDTO);
departmentDTOs.add(departmentDTO);
break;
}
}
userExpandDTO.setDepartments(departmentDTOs);
} }
} }
/**
* 设置部门
*
* @param userExpandDTO
* @param departmentUserDTOs
* @param departmentPOs
*/
private void setDepartment(UserExpandDTO userExpandDTO, List<DepartmentUserDTO> departmentUserDTOs, List<DepartmentPO> departmentPOs) {
List<DepartmentDTO> departmentDTOs = new ArrayList<>();
for (DepartmentUserDTO departmentUserDTO : departmentUserDTOs) {
if (!StringUtils.equals(userExpandDTO.getUserId(), departmentUserDTO.getUserId())) {
continue;
}
for (DepartmentPO departmentPO : departmentPOs) {
if (!StringUtils.equals(departmentUserDTO.getDepartmentId(), departmentPO.getDepartmentId())) {
continue;
}
DepartmentDTO departmentDTO = new DepartmentDTO();
BeanUtils.copyProperties(departmentPO, departmentDTO);
departmentDTOs.add(departmentDTO);
break;
}
}
userExpandDTO.setDepartments(departmentDTOs);
}
} }

View File

@ -660,7 +660,7 @@
// 初始化证件类型ID下拉选择 // 初始化证件类型ID下拉选择
function initLegalPersonIdCardCodeSelect() { function initLegalPersonIdCardCodeSelect() {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/d3cbf2d8-d3b7-4530-b1e1-f2b35996999c', []), {}, null, function(code, data, args) { top.restAjax.get(top.restAjax.path('api/data/listbyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('legalPersonIdCardCodeSelectTemplate').innerHTML).render(data, function(html) { laytpl(document.getElementById('legalPersonIdCardCodeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('legalPersonIdCardCodeSelectTemplateBox').innerHTML = html; document.getElementById('legalPersonIdCardCodeSelectTemplateBox').innerHTML = html;
}); });

View File

@ -666,7 +666,7 @@
// 初始化类型ID下拉选择 // 初始化类型ID下拉选择
function initLegalPersonIdCardCodeSelect(selectValue) { function initLegalPersonIdCardCodeSelect(selectValue) {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/d3cbf2d8-d3b7-4530-b1e1-f2b35996999c', []), {}, null, function(code, data, args) { top.restAjax.get(top.restAjax.path('api/data/listbyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('legalPersonIdCardCodeSelectTemplate').innerHTML).render(data, function(html) { laytpl(document.getElementById('legalPersonIdCardCodeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('legalPersonIdCardCodeSelectTemplateBox').innerHTML = html; document.getElementById('legalPersonIdCardCodeSelectTemplateBox').innerHTML = html;
}); });

View File

@ -598,7 +598,7 @@
} }
function initMasterIdCardCodeSelect() { function initMasterIdCardCodeSelect() {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/d3cbf2d8-d3b7-4530-b1e1-f2b35996999c', []), {}, null, function(code, data, args) { top.restAjax.get(top.restAjax.path('api/data/listbyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('masterIdCardCodeSelectTemplate').innerHTML).render(data, function(html) { laytpl(document.getElementById('masterIdCardCodeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('masterIdCardCodeSelectTemplateBox').innerHTML = html; document.getElementById('masterIdCardCodeSelectTemplateBox').innerHTML = html;
}); });

View File

@ -604,7 +604,7 @@
} }
function initMasterIdCardCodeSelect(selectValue) { function initMasterIdCardCodeSelect(selectValue) {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/d3cbf2d8-d3b7-4530-b1e1-f2b35996999c', []), {}, null, function(code, data, args) { top.restAjax.get(top.restAjax.path('api/data/listbyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('masterIdCardCodeSelectTemplate').innerHTML).render(data, function(html) { laytpl(document.getElementById('masterIdCardCodeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('masterIdCardCodeSelectTemplateBox').innerHTML = html; document.getElementById('masterIdCardCodeSelectTemplateBox').innerHTML = html;
}); });