Commit 750025ed authored by Shen's avatar Shen

1. swagger配置优化

2. 机构人员查询接口(adamin和api)重构
3. 机构服务人员添加状态,100为待审核,101为审核通过
parent 96f69661
......@@ -2,6 +2,7 @@ package io.hmit.common.config;
import io.hmit.common.constant.Constant;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
......@@ -30,10 +31,13 @@ public class SwaggerConfig {
// http://localhost:8080/swagger-ui.html 原路径
// http://localhost:8080/doc.html bootstrap版本路径
@Value("${QR.domain}")
private String QRPath;
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
// .host("byyl.zjhmit.com")
.host(QRPath)
.apiInfo(apiInfo())
.select()
//加了ApiOperation注解的类,生成接口文档
......
......@@ -17,6 +17,7 @@ import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.security.user.SecurityUser;
import io.hmit.modules.serviceOrder.dto.UserDTO;
import io.hmit.modules.serviceOrder.entity.UserEntity;
import io.hmit.modules.serviceOrder.excel.UserExcel;
import io.hmit.modules.serviceOrder.service.RoleUserService;
import io.hmit.modules.serviceOrder.service.UserService;
......@@ -72,9 +73,22 @@ public class UserController {
return new Result<PageData<UserDTO>>().ok(page);
}
@GetMapping("staffPage")
@ApiOperation(value = "根据机构Id获取工作人员", notes = "状态为100时为待审核,101为正常")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = "orgId", value = "机构id", paramType = "query", dataType="String")
})
public Result<PageData<UserDTO>> staffPage(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<UserDTO> page = userService.getOrgStaff(params);
return new Result<PageData<UserDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@RequiresPermissions("serviceOrder:user:info")
public Result<UserDTO> get(@PathVariable("id") Long id){
UserDTO data = userService.get(id);
data.setRoleIdList(roleUserService.getRoleIdList(data.getId()));
......@@ -85,7 +99,6 @@ public class UserController {
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@RequiresPermissions("serviceOrder:user:save")
public Result save(@RequestBody UserDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
......@@ -99,7 +112,6 @@ public class UserController {
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@RequiresPermissions("serviceOrder:user:update")
public Result update(@RequestBody UserDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
......@@ -113,7 +125,6 @@ public class UserController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@RequiresPermissions("serviceOrder:user:delete")
public Result delete(@RequestBody Long[] ids){
//校验数据
AssertUtils.isArrayEmpty(ids, "id");
......
......@@ -14,7 +14,11 @@ import java.util.List;
*/
@Mapper
public interface UserDao extends BaseDao<UserEntity> {
UserEntity getUserByUserId(Long userId);
List<Long> getAllOrganizationStaff(Long userId);
List<UserEntity> getOrgStaff(Long orgId);
}
......@@ -53,6 +53,12 @@ public class UserDTO implements Serializable {
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "身份证号")
private Long idCardNo;
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "角色ID列表")
private List<Long> roleIdList;
......
......@@ -55,6 +55,14 @@ public class UserEntity extends BaseEntity {
* 详细地址
*/
private String address;
/**
* 身份证号
*/
private Long idCardNo;
/**
* 状态
*/
private Integer status;
/**
* 所属社区名称
*/
......
......@@ -19,6 +19,9 @@ public interface UserService extends CrudService<UserEntity, UserDTO> {
void saveOrUpdateUserRole(Long userId, List<Long> roleIdList);
UserEntity getUserByUserId(Long userId);
PageData<UserEntity> getOrganizationAllUsers(Map<String, Object> params, Long userId);
PageData<UserDTO> getOrgStaff(Map<String, Object> params);
}
......@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.SubListForPageUtil;
import io.hmit.modules.serviceOrder.dao.UserDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.UserDTO;
import io.hmit.modules.serviceOrder.entity.UserEntity;
import io.hmit.modules.serviceOrder.service.RoleUserService;
......@@ -29,6 +31,10 @@ public class UserServiceImpl extends CrudServiceImpl<UserDao, UserEntity, UserDT
@Autowired
private RoleUserService roleUserService;
@Autowired
private UserDao userDao;
@Override
public QueryWrapper<UserEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
......@@ -63,4 +69,10 @@ public class UserServiceImpl extends CrudServiceImpl<UserDao, UserEntity, UserDT
return getPageData(list, page.getTotal(), UserEntity.class);
}
@Override
public PageData<UserDTO> getOrgStaff(Map<String, Object> params) {
List<UserEntity> list = userDao.getOrgStaff(Long.parseLong(params.get("orgId").toString()));
return getPageData(SubListForPageUtil.getSubList(params, list), list.size(), UserDTO.class);
}
}
......@@ -75,4 +75,5 @@ QR:
download-path: D:/upload/pension/
# download-path: /home/websoft/java_jar/pension_service/myfile/
# download-path: /home/resourse/bsqzc/ D:/123/ /home/websoft/java_jar/pension_service/myfile/
#此处修改需要在io.hmit.modules.security.config.WebMvcConfig 修改静态资源位置
\ No newline at end of file
domain: 192.168.10.61:8088
# domain: byyl.zjhmit.com
\ No newline at end of file
......@@ -27,5 +27,9 @@
WHERE pou.user_id = tu.id and tu.user_id = #{userId});
</select>
<select id="getOrgStaff" resultType="io.hmit.modules.serviceOrder.entity.UserEntity">
SELECT tu.id, tu.user_id, tu.username, tu.mobile, tu.openid, tu.address_area, tu.address, tu.id_card_no, tu.status
FROM tb_user tu, pension_organization_user pou WHERE tu.id = pou.service_id AND pou.organization_id = #{orgId}
</select>
</mapper>
......@@ -40,4 +40,6 @@ public interface UserDao extends BaseDao<UserEntity> {
*/
List<UserAddressDTO> findUserAddressByUsernameOrMobile(String username, String mobile);
List<UserEntity> getOrgStaff(Long userId);
}
......@@ -11,6 +11,7 @@ import io.hmit.common.validator.ValidatorUtils;
import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.dto.UserInfoDTO;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.ReservationDTO;
......@@ -368,8 +369,9 @@ public class PensionOrderController {
/**
* 本机构全部人员
*/
@Deprecated
@Login
@GetMapping("organizationStaff")
@GetMapping("organizationStaff2")
@ApiOperation(value = "本机构全部人员(机构)")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
......@@ -377,12 +379,28 @@ public class PensionOrderController {
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<UserEntity>> organizationStaff(@ApiIgnore @LoginUser UserEntity user,
public Result<PageData<UserEntity>> organizationStaff2(@ApiIgnore @LoginUser UserEntity user,
@ApiIgnore @RequestParam Map<String, Object> params){
PageData<UserEntity> page = userService.getOrganizationAllUsers(params, user.getId());
return new Result<PageData<UserEntity>>().ok(page);
}
/**
* 本机构全部人员
*/
@Login
@GetMapping("organizationStaff")
@ApiOperation(value = "本机构全部人员(机构)")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType="int")
})
public Result<PageData<UserInfoDTO>> organizationStaff(@ApiIgnore @LoginUser UserEntity user,
@ApiIgnore @RequestParam Map<String, Object> params){
PageData<UserInfoDTO> page = userService.getOrganizationStaff(params, user.getId());
return new Result<PageData<UserInfoDTO>>().ok(page);
}
/**
* 机构处理
*/
......
......@@ -43,6 +43,8 @@ public interface UserService extends BaseService<UserEntity> {
PageData<UserEntity> getOrganizationAllUsers(Map<String, Object> params, Long userId);
PageData<UserInfoDTO> getOrganizationStaff(Map<String, Object> params, Long userId);
OrgUserInfoDTO getOrgUserByUserId(Long userId);
ServiceUserInfoDTO getServiceUserByUserId(Long userId);
......
......@@ -7,6 +7,7 @@ import io.hmit.common.exception.HmitException;
import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.BaseServiceImpl;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.common.utils.SubListForPageUtil;
import io.hmit.common.validator.AssertUtils;
import io.hmit.dao.UserDao;
import io.hmit.dto.*;
......@@ -124,6 +125,12 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
return getPageData(list, page.getTotal(), UserEntity.class);
}
@Override
public PageData<UserInfoDTO> getOrganizationStaff(Map<String, Object> params, Long userId) {
List<UserEntity> list = userDao.getOrgStaff(userId);
return getPageData(SubListForPageUtil.getSubList(params, list), list.size(), UserInfoDTO.class);
}
@Override
public OrgUserInfoDTO getOrgUserByUserId(Long userId) {
return userDao.getOrgUserByUserId(userId);
......
......@@ -56,4 +56,10 @@
</if>
</select>
<select id="getOrgStaff" resultType="io.hmit.entity.UserEntity">
SELECT tu.* FROM tb_user tu, pension_organization_user pou
WHERE tu.id = pou.service_id AND tu.status != 100
AND pou.organization_id = (SELECT pous.organization_id FROM pension_organization_user pous WHERE pous.service_id = #{userId})
</select>
</mapper>
\ No newline at end of file
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