From 4e7bc6a290c6e918cf0243e960f38c2f146e5e3a Mon Sep 17 00:00:00 2001 From: schry <2433098676@qq.com> Date: Sun, 9 Jul 2023 22:15:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E4=BC=81=E4=B8=9A=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/ResgitserCertController.java | 15 ++++++++++ .../purchase/userPersonController.java | 22 ++++++++++++-- .../controller/sup/UserComanyController.java | 29 +++++++++++++++++++ .../glxp/api/dao/sup/UserCompanyMapper.java | 3 ++ .../req/auth/FilterUserComapanyRequest.java | 3 ++ .../glxp/api/res/sup/UserCompanyResponse.java | 5 +++- .../api/service/sup/UserCompanyService.java | 3 ++ .../sup/impl/UserCompanyServiceImpl.java | 12 ++++++++ .../mybatis/mapper/sup/UserCompanyMapper.xml | 15 ++++++++++ 9 files changed, 104 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/auth/ResgitserCertController.java b/src/main/java/com/glxp/api/controller/auth/ResgitserCertController.java index c2f4267..ba67ed0 100644 --- a/src/main/java/com/glxp/api/controller/auth/ResgitserCertController.java +++ b/src/main/java/com/glxp/api/controller/auth/ResgitserCertController.java @@ -7,6 +7,7 @@ import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.entity.sup.UserCertEntity; import com.glxp.api.entity.sup.UserCertSetEntity; +import com.glxp.api.exception.JsonException; import com.glxp.api.req.purchase.certRequest; import com.glxp.api.req.system.DeleteCompanyFileRequest; import com.glxp.api.res.PageSimpleResponse; @@ -18,9 +19,12 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.io.File; import java.util.Date; import java.util.List; @@ -59,6 +63,7 @@ public class ResgitserCertController { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } + certRequest.setBusinessId(Long.valueOf(getCompanyId())); List userCertEntities = userCertService.selectBybId(certRequest); PageInfo pageInfo; pageInfo = new PageInfo<>(userCertEntities); @@ -68,6 +73,16 @@ public class ResgitserCertController { return ResultVOUtils.success(pageSimpleResponse); } + public String getCompanyId() { + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + if (attributes == null) { + throw new JsonException(ResultEnum.NOT_NETWORK); + } + HttpServletRequest request = attributes.getRequest(); + String companyId = request.getHeader("companyId"); + return companyId; + } + //资质证书添加 @PostMapping("/reg/company/cert/isertCert") diff --git a/src/main/java/com/glxp/api/controller/purchase/userPersonController.java b/src/main/java/com/glxp/api/controller/purchase/userPersonController.java index 54e98db..23d3760 100644 --- a/src/main/java/com/glxp/api/controller/purchase/userPersonController.java +++ b/src/main/java/com/glxp/api/controller/purchase/userPersonController.java @@ -7,6 +7,7 @@ import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.entity.sup.UserPersonEntity; +import com.glxp.api.exception.JsonException; import com.glxp.api.req.auth.UserPersonFilterRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.service.sup.UserPersonService; @@ -14,11 +15,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.util.List; /** @@ -33,11 +38,14 @@ public class userPersonController { private UserPersonService userPersonService; @ApiOperation(value = "获取用户个人信息", response = UserPersonEntity.class) - @PostMapping("/sup/company/person/filterList") - public BaseResponse filterCompanyCert(@RequestBody UserPersonFilterRequest userPersonFilterRequest, BindingResult bindingResult) { + @GetMapping("/sup/company/person/filterList") + public BaseResponse filterCompanyCert(UserPersonFilterRequest userPersonFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } + if (StrUtil.isBlank(userPersonFilterRequest.getCompanyId())) { + userPersonFilterRequest.setCompanyId(getCompanyId()); + } QueryWrapper and; if (StrUtil.isNotBlank(userPersonFilterRequest.getUserName())) { and = new QueryWrapper().like("userName", userPersonFilterRequest.getUserName()).and(i -> i.eq("companyId", userPersonFilterRequest.getCompanyId())); @@ -82,5 +90,15 @@ public class userPersonController { return ResultVOUtils.success(); } + public String getCompanyId() { + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + if (attributes == null) { + throw new JsonException(ResultEnum.NOT_NETWORK); + } + HttpServletRequest request = attributes.getRequest(); + String companyId = request.getHeader("companyId"); + return companyId; + } + } diff --git a/src/main/java/com/glxp/api/controller/sup/UserComanyController.java b/src/main/java/com/glxp/api/controller/sup/UserComanyController.java index 6c77efa..bfbf2be 100644 --- a/src/main/java/com/glxp/api/controller/sup/UserComanyController.java +++ b/src/main/java/com/glxp/api/controller/sup/UserComanyController.java @@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.controller.BaseController; import com.glxp.api.entity.basic.ProductInfoEntity; import com.glxp.api.entity.sup.UserCompanyEntity; import com.glxp.api.entity.sup.UserCompanyOnlineEntity; +import com.glxp.api.exception.JsonException; import com.glxp.api.req.auth.FilterUserComapanyRequest; import com.glxp.api.req.basic.ProductInfoFilterRequest; import com.glxp.api.res.PageSimpleResponse; @@ -26,9 +28,12 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.List; @@ -91,6 +96,20 @@ public class UserComanyController extends BaseController { return ResultVOUtils.success(pageSimpleResponse); } + @ApiOperation(value = "查询注册企业信息",response = UserCompanyEntity.class) + @AuthRuleAnnotation("") + @GetMapping("udi/auth/user/comapny/filterRegCompany") + public BaseResponse filterRegCompanyInfo(FilterUserComapanyRequest filterUserComapanyRequest) { + + filterUserComapanyRequest.setId(getCompanyId()); + UserCompanyResponse userCompanyResponse = userCompanyService.filterCompanyInfo(filterUserComapanyRequest); +// PageInfo pageInfo = new PageInfo<>(userCompanyEntities); +// PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); +// pageSimpleResponse.setTotal(pageInfo.getTotal()); +// pageSimpleResponse.setList(userCompanyEntities); + return ResultVOUtils.success(userCompanyResponse); + } + @Resource UserCompanyOnlineService userCompanyOnlineService; @@ -140,4 +159,14 @@ public class UserComanyController extends BaseController { return ResultVOUtils.success(pageSimpleResponse); } + public String getCompanyId() { + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + if (attributes == null) { + throw new JsonException(ResultEnum.NOT_NETWORK); + } + HttpServletRequest request = attributes.getRequest(); + String companyId = request.getHeader("companyId"); + return companyId; + } + } diff --git a/src/main/java/com/glxp/api/dao/sup/UserCompanyMapper.java b/src/main/java/com/glxp/api/dao/sup/UserCompanyMapper.java index bd371ff..ca75b3d 100644 --- a/src/main/java/com/glxp/api/dao/sup/UserCompanyMapper.java +++ b/src/main/java/com/glxp/api/dao/sup/UserCompanyMapper.java @@ -5,6 +5,7 @@ import com.glxp.api.entity.basic.ProductInfoEntity; import com.glxp.api.entity.sup.UserCompanyEntity; import com.glxp.api.req.auth.FilterUserComapanyRequest; import com.glxp.api.req.basic.ProductInfoFilterRequest; +import com.glxp.api.res.sup.UserCompanyResponse; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -13,4 +14,6 @@ import java.util.List; public interface UserCompanyMapper extends BaseMapper { List filterCompanyName(FilterUserComapanyRequest filterUserComapanyRequest); + + UserCompanyResponse filterCompanyInfo(FilterUserComapanyRequest filterUserComapanyRequest); } diff --git a/src/main/java/com/glxp/api/req/auth/FilterUserComapanyRequest.java b/src/main/java/com/glxp/api/req/auth/FilterUserComapanyRequest.java index b0a2a3e..a8730d0 100644 --- a/src/main/java/com/glxp/api/req/auth/FilterUserComapanyRequest.java +++ b/src/main/java/com/glxp/api/req/auth/FilterUserComapanyRequest.java @@ -12,6 +12,9 @@ public class FilterUserComapanyRequest extends ListPageRequest { @ApiModelProperty(value = "查询键") private String searchKey; + @ApiModelProperty(value = "企业ID") + private String id; + @ApiModelProperty(value = "企业名称") private String companyName; diff --git a/src/main/java/com/glxp/api/res/sup/UserCompanyResponse.java b/src/main/java/com/glxp/api/res/sup/UserCompanyResponse.java index 77883f8..494ed3c 100644 --- a/src/main/java/com/glxp/api/res/sup/UserCompanyResponse.java +++ b/src/main/java/com/glxp/api/res/sup/UserCompanyResponse.java @@ -32,6 +32,9 @@ public class UserCompanyResponse extends UserCompanyEntity { @ApiModelProperty(value = "备注") private String remark; - private Integer companyType; + private String mobile; + private String realName; + private String fmobile; + private String email; } diff --git a/src/main/java/com/glxp/api/service/sup/UserCompanyService.java b/src/main/java/com/glxp/api/service/sup/UserCompanyService.java index c33ac78..5dc6ee6 100644 --- a/src/main/java/com/glxp/api/service/sup/UserCompanyService.java +++ b/src/main/java/com/glxp/api/service/sup/UserCompanyService.java @@ -6,6 +6,7 @@ import com.glxp.api.entity.sup.UserCompanyEntity; import com.glxp.api.entity.sup.UserRegisterEntity; import com.glxp.api.req.auth.FilterUserComapanyRequest; import com.glxp.api.req.basic.ProductInfoFilterRequest; +import com.glxp.api.res.sup.UserCompanyResponse; import java.util.List; @@ -17,4 +18,6 @@ public interface UserCompanyService extends IService { List filterCompanyName(FilterUserComapanyRequest filterUserComapanyRequest); + UserCompanyResponse filterCompanyInfo(FilterUserComapanyRequest filterUserComapanyRequest); + } diff --git a/src/main/java/com/glxp/api/service/sup/impl/UserCompanyServiceImpl.java b/src/main/java/com/glxp/api/service/sup/impl/UserCompanyServiceImpl.java index eb7603c..72e948d 100644 --- a/src/main/java/com/glxp/api/service/sup/impl/UserCompanyServiceImpl.java +++ b/src/main/java/com/glxp/api/service/sup/impl/UserCompanyServiceImpl.java @@ -5,6 +5,7 @@ import com.glxp.api.entity.basic.ProductInfoEntity; import com.glxp.api.entity.sup.UserCompanyEntity; import com.glxp.api.req.auth.FilterUserComapanyRequest; import com.glxp.api.req.basic.ProductInfoFilterRequest; +import com.glxp.api.res.sup.UserCompanyResponse; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.glxp.api.dao.sup.UserCompanyMapper; @@ -40,4 +41,15 @@ public class UserCompanyServiceImpl extends ServiceImpl data = userCompanyMapper.filterCompanyName(filterUserComapanyRequest); return data; } + + @Override + public UserCompanyResponse filterCompanyInfo(FilterUserComapanyRequest filterUserComapanyRequest) { + if (filterUserComapanyRequest == null) { + return null; + } + int offset = (filterUserComapanyRequest.getPage() - 1) * filterUserComapanyRequest.getLimit(); + PageHelper.offsetPage(offset, filterUserComapanyRequest.getLimit()); + UserCompanyResponse data = userCompanyMapper.filterCompanyInfo(filterUserComapanyRequest); + return data; + } } diff --git a/src/main/resources/mybatis/mapper/sup/UserCompanyMapper.xml b/src/main/resources/mybatis/mapper/sup/UserCompanyMapper.xml index c8f64a8..e506897 100644 --- a/src/main/resources/mybatis/mapper/sup/UserCompanyMapper.xml +++ b/src/main/resources/mybatis/mapper/sup/UserCompanyMapper.xml @@ -6,6 +6,9 @@ SELECT * FROM user_company + + and id = #{id} + AND companyName LIKE concat('%', #{companyName}, '%') @@ -18,4 +21,16 @@ GROUP BY companyName + +