增加我是企业相关功能

20240109-yw
yuanwei 1 year ago
parent 5b77a886a2
commit 58a9080bcf

@ -2,12 +2,20 @@ package com.glxp.api.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.constant.Constant;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.exception.JsonException;
import com.glxp.api.service.auth.AuthAdminService;
import com.glxp.api.service.auth.CustomerService;
import org.springframework.beans.factory.annotation.Value;
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;
/**
*
@ -15,9 +23,18 @@ import javax.annotation.Resource;
@ApiIgnore
public class BaseController {
@Value("${COMPANY_ID}")
private String companyIdSet;
@Value("${ADMIN_ID}")
private String ADMIN_ID;
@Resource
CustomerService customerService;
@Resource
AuthAdminService authAdminService;
/**
*
*/
@ -52,4 +69,29 @@ public class BaseController {
return false;
}
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");
if(StringUtils.isBlank(companyId)){
companyId = companyIdSet;
}
return companyId;
}
public String getClientCustomerId() {
// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// if (attributes == null) {
// throw new JsonException(ResultEnum.NOT_NETWORK);
// }
// HttpServletRequest request = attributes.getRequest();
// String userId = request.getHeader("ADMIN_ID");
// AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId));
// return authAdmin.getCustomerId() + "";
return ADMIN_ID;
}
}

@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo;
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.sup.UserCertEntity;
import com.glxp.api.entity.sup.UserCertSetEntity;
import com.glxp.api.entity.sup.UserRegisterEntity;
@ -40,7 +41,7 @@ import java.util.List;
*/
@ApiIgnore
@RestController
public class ResgitserCertController {
public class ResgitserCertController extends BaseController {
@Resource
private UserCertService userCertService;
@Value("${file_path}")
@ -145,15 +146,5 @@ public class ResgitserCertController {
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;
}
}

@ -10,6 +10,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.constant.ConstantStatus;
import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.entity.sup.UserCompanyEntity;
@ -43,7 +44,7 @@ import java.util.List;
*
*/
@RestController
public class BasicCorpController {
public class BasicCorpController extends BaseController {
@Resource
private BasicCorpService basicUnitMaintainService;
@ -183,25 +184,4 @@ public class BasicCorpController {
basicUnitMaintainService.deleteById(id);
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;
}
public String getCustomerId() {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
throw new JsonException(ResultEnum.NOT_NETWORK);
}
HttpServletRequest request = attributes.getRequest();
String userId = request.getHeader("ADMIN_ID");
AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId));
return authAdmin.getCustomerId() + "";
}
}

@ -3,6 +3,7 @@ package com.glxp.api.controller.basic;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
@ -29,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -71,6 +73,7 @@ public class UdiRelController extends BaseController {
} else {
filterUdiRelRequest.setDiType(1);
}
filterUdiRelRequest.setCompanyIdFk(getCompanyId());
List<BasicUdiRelResponse> udiDlDeviceResponse = basicUdiRelService.filtersList(filterUdiRelRequest);
PageInfo<BasicUdiRelResponse> basicUdiRelResponsePageInfo = new PageInfo<>(udiDlDeviceResponse);
PageSimpleResponse<BasicUdiRelResponse> basicUdiRelResponsePageSimpleResponse = new PageSimpleResponse<>();
@ -227,5 +230,24 @@ public class UdiRelController extends BaseController {
return ResultVOUtils.success(nmapTotalResponse);
}
//列表单选提交接口
@AuthRuleAnnotation("")
@ApiOperation(value = "列表单选提交接口", response = BaseResponse.class)
@PostMapping("udi/basic/rel/filterProductInfoDetail")
public BaseResponse filterProductInfoDetail(String uuid) {
System.out.println("接收到的参数为:" + uuid);
if (uuid != null && uuid != "") {
BasicUdiRelRequest basicUdiRelRequest = basicUdiRelService.filterProductInfoDetail(uuid,getCompanyId());
UdiSelectRequest udiSelectRequest = new UdiSelectRequest();
List<BasicUdiRelRequest> basicUdiRelRequestList = new ArrayList<>(){};
basicUdiRelRequestList.add(basicUdiRelRequest);
udiSelectRequest.setProducts(basicUdiRelRequestList);
udiSelectRequest.setCompanyId(Long.parseLong(getCompanyId()));
return batchSaveRel(udiSelectRequest);
}
return ResultVOUtils.success("提交成功!");
}
}

@ -12,6 +12,7 @@ import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BusinessType;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.entity.purchase.*;
@ -67,7 +68,7 @@ import java.util.stream.Collectors;
@Api(tags = "供应商资质相关接口")
@ApiIgnore
@RestController
public class SupCertController {
public class SupCertController extends BaseController {
@Resource
private AuthAdminService authAdminService;
@Resource
@ -229,7 +230,7 @@ public class SupCertController {
@AuthRuleAnnotation("")
@GetMapping("/sale/info/getCompanyCert")
public BaseResponse getCompanyCert(FilterSupCertRequest filterSupCertRequest) {
filterSupCertRequest.setCustomerId(getCustomerId());
filterSupCertRequest.setCustomerId(getClientCustomerId());
List<SupCertEntity> companyCertEntities = supCertService.getCompanyCert(filterSupCertRequest);
PageInfo<SupCertEntity> pageInfo = new PageInfo<>(companyCertEntities);
PageSimpleResponse<SupCertEntity> pageSimpleResponse = new PageSimpleResponse<>();
@ -359,27 +360,6 @@ public class SupCertController {
return ResultVOUtils.success("成功");
}
public String getCustomerId() {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
throw new JsonException(ResultEnum.NOT_NETWORK);
}
HttpServletRequest request = attributes.getRequest();
String userId = request.getHeader("ADMIN_ID");
AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId));
return authAdmin.getCustomerId() + "";
}
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;
}
/**
*
*

@ -11,6 +11,7 @@ import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BusinessType;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.basic.UdiEntity;
import com.glxp.api.entity.purchase.SupCertEntity;
@ -51,7 +52,7 @@ import java.util.List;
import java.util.ListIterator;
@RestController
public class SupManufacturerController {
public class SupManufacturerController extends BaseController {
@Resource
private SupManufacturerService supManufacturerService;
@Resource
@ -87,7 +88,7 @@ public class SupManufacturerController {
@AuthRuleAnnotation("")
@GetMapping("/sup/manufacturer/getCompanyBySup")
public BaseResponse getCompanyBySup(FilterSupManufacturerRequest filterSupManufacturerRequest) {
filterSupManufacturerRequest.setCustomerId(getCustomerId());
filterSupManufacturerRequest.setCustomerId(getClientCustomerId());
List<SupManufacturerEntity> companyEntities = supManufacturerService.getCompany(filterSupManufacturerRequest);
PageInfo<SupManufacturerEntity> pageInfo = new PageInfo<>(companyEntities);
PageSimpleResponse<SupManufacturerEntity> pageSimpleResponse = new PageSimpleResponse<>();
@ -102,18 +103,18 @@ public class SupManufacturerController {
@Log(title = "资质证书", businessType = BusinessType.INSERT)
public BaseResponse directToCptAddCompany(@RequestBody SupManufacturerEntity supManufacturerEntity) {
String customerId = getCustomerId();
String customerId = getClientCustomerId();
supManufacturerEntity.setCustomerId(customerId);
//判断用户名和社会信用代码不能重复
FilterSupManufacturerRequest filterSupManufacturerRequest = new FilterSupManufacturerRequest();
filterSupManufacturerRequest.setCompanyName(supManufacturerEntity.getCompanyName());
filterSupManufacturerRequest.setCustomerId(getCustomerId());
filterSupManufacturerRequest.setCustomerId(getClientCustomerId());
List<SupManufacturerEntity> companyEntities = supManufacturerService.getCompanyByNameAndCode(filterSupManufacturerRequest);
if (companyEntities.size() > 0) {
return ResultVOUtils.error(999, "企业名称不能重复!");
}
filterSupManufacturerRequest = new FilterSupManufacturerRequest();
filterSupManufacturerRequest.setCustomerId(getCustomerId());
filterSupManufacturerRequest.setCustomerId(getClientCustomerId());
filterSupManufacturerRequest.setCreditCode(supManufacturerEntity.getCreditCode());
companyEntities = supManufacturerService.getCompanyByNameAndCode(filterSupManufacturerRequest);
if (companyEntities.size() > 0) {
@ -209,13 +210,13 @@ public class SupManufacturerController {
//判断用户名和社会信用代码不能重复
FilterSupManufacturerRequest filterSupManufacturerRequest = new FilterSupManufacturerRequest();
filterSupManufacturerRequest.setCompanyName(supManufacturerEntity.getCompanyName());
filterSupManufacturerRequest.setCustomerId(getCustomerId());
filterSupManufacturerRequest.setCustomerId(getClientCustomerId());
List<SupManufacturerEntity> companyEntities = supManufacturerService.getCompanyByNameAndCode(filterSupManufacturerRequest);
if (companyEntities.size() > 0) {
return ResultVOUtils.error(999, "企业名称不能重复!");
}
filterSupManufacturerRequest = new FilterSupManufacturerRequest();
filterSupManufacturerRequest.setCustomerId(getCustomerId());
filterSupManufacturerRequest.setCustomerId(getClientCustomerId());
filterSupManufacturerRequest.setCreditCode(supManufacturerEntity.getCreditCode());
companyEntities = supManufacturerService.getCompanyByNameAndCode(filterSupManufacturerRequest);
if (companyEntities.size() > 0) {
@ -425,25 +426,4 @@ public class SupManufacturerController {
return ResultVOUtils.success(pageSimpleResponse);
}
public String getCustomerId() {
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;
}
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;
}
}

@ -559,17 +559,6 @@ public class SupProductController {
}
}
public String getCustomerId() {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
throw new JsonException(ResultEnum.NOT_NETWORK);
}
HttpServletRequest request = attributes.getRequest();
String userId = request.getHeader("ADMIN_ID");
AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId));
return authAdmin.getCustomerId() + "";
}
@GetMapping("/sup/product/app/cert/search")
public BaseResponse getProductCert(FilterPoductRequest filterPoductRequest) {

@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo;
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.sup.UserPersonEntity;
import com.glxp.api.exception.JsonException;
import com.glxp.api.req.auth.UserPersonFilterRequest;
@ -34,7 +35,7 @@ import java.util.List;
*/
@Api(tags = "用户个人相关接口")
@RestController
public class userPersonController {
public class userPersonController extends BaseController {
@Resource
private UserPersonService userPersonService;
@ -110,15 +111,6 @@ 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;
}
}

@ -254,14 +254,4 @@ 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;
}
}

@ -3,6 +3,7 @@ package com.glxp.api.dao.basic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.basic.BasicUdiRelEntity;
import com.glxp.api.entity.sup.UserCompanyEntity;
import com.glxp.api.req.basic.BasicUdiRelRequest;
import com.glxp.api.req.basic.FilterUdiRelRequest;
import com.glxp.api.res.basic.BasicUdiRelResponse;
import com.glxp.api.res.sup.UserCompanyResponse;
@ -34,5 +35,7 @@ public interface BasicUdiRelMapper extends BaseMapper<BasicUdiRelEntity> {
List<BasicUdiRelResponse> statCompanyCount(String companyIdFk);
List<BasicUdiRelResponse> statBusTypeCount(Integer bussinessStatus);
BasicUdiRelRequest filterProductInfoDetailByUuid(@Param("uuid") String uuid,@Param("companyId") String companyId);
}

@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.glxp.api.entity.sup.UserCompanyEntity;
import com.glxp.api.req.basic.BasicUdiRelRequest;
import com.glxp.api.req.basic.FilterUdiRelRequest;
import com.glxp.api.res.basic.BasicUdiRelResponse;
import com.glxp.api.res.stat.NmapTotalResponse;
@ -347,5 +348,8 @@ public class BasicUdiRelService extends ServiceImpl<BasicUdiRelMapper, BasicUdiR
return nmapTotalResponse;
}
public BasicUdiRelRequest filterProductInfoDetail(String uuid,String companyId) {
BasicUdiRelRequest basicUdiRelRequest = basicUdiRelMapper.filterProductInfoDetailByUuid(uuid,companyId);
return basicUdiRelRequest;
}
}

@ -36,8 +36,8 @@ spring:
rabbitmq:
host: 127.0.0.1
port: 5672
username: cpt
password: 123456
username: guest
password: guest
virtual-host: /
publisher-confirms: false
connection-timeout: 15000
@ -91,3 +91,5 @@ SPMS_KEY: lCOdWCBKS6Kw45wdnnqUTELXyuSKnXEs
back_file_path: D:/share/udisps/back/
API_KEY: 1101
API_SECRET: zBITspLNvuoEd4FaamlSoqxRHmNsmQ9L
COMPANY_ID: 1675781446031753216
ADMIN_ID: 1675781446031753216

@ -323,4 +323,11 @@
left join user_company uc on bur.companyIdFk = uc.id
where uc.bussinessStatus = #{bussinessStatus}
</select>
<select id="filterProductInfoDetailByUuid" parameterType="java.lang.String"
resultType="com.glxp.api.req.basic.BasicUdiRelRequest">
SELECT *
FROM basic_udi_rel
where uuid = #{uuid} and companyIdFk = #{companyId}
</select>
</mapper>

Loading…
Cancel
Save