代码完善

cert
1178634255 2 years ago
parent ceee3e35d2
commit 2fcae8d05f

@ -16,6 +16,7 @@ import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.purchase.*; import com.glxp.api.entity.purchase.*;
import com.glxp.api.entity.sup.UserCertEntity; import com.glxp.api.entity.sup.UserCertEntity;
import com.glxp.api.entity.sup.UserCertSetEntity; import com.glxp.api.entity.sup.UserCertSetEntity;
import com.glxp.api.entity.sup.UserCompanyEntity;
import com.glxp.api.entity.system.SysPdfTemplateRelevanceStatemenEntity; import com.glxp.api.entity.system.SysPdfTemplateRelevanceStatemenEntity;
import com.glxp.api.entity.system.SystemPDFTemplateEntity; import com.glxp.api.entity.system.SystemPDFTemplateEntity;
import com.glxp.api.exception.JsonException; import com.glxp.api.exception.JsonException;
@ -189,9 +190,11 @@ public class SupCertController {
@PostMapping("/directToCpt/sup/info/selectAllCert") @PostMapping("/directToCpt/sup/info/selectAllCert")
@Log(title = "资质证书", businessType = BusinessType.INSERT) @Log(title = "资质证书", businessType = BusinessType.INSERT)
public BaseResponse selectAllCert(@RequestBody PostSelCertRequest postSelCertRequest) { public BaseResponse selectAllCert(@RequestBody PostSelCertRequest postSelCertRequest) {
String customerId = null; String customerId = null;
if (StrUtil.isEmpty(postSelCertRequest.getCustomerId())) if (StrUtil.isEmpty(postSelCertRequest.getCustomerId()))
customerId = getCustomerId(); customerId = getCompanyId();
else { else {
customerId = postSelCertRequest.getCustomerId(); customerId = postSelCertRequest.getCustomerId();
} }

@ -17,6 +17,7 @@ import com.glxp.api.entity.purchase.SupCertEntity;
import com.glxp.api.entity.purchase.SupCertSetEntity; import com.glxp.api.entity.purchase.SupCertSetEntity;
import com.glxp.api.entity.purchase.SupCompanyEntity; import com.glxp.api.entity.purchase.SupCompanyEntity;
import com.glxp.api.entity.purchase.SupManufacturerEntity; import com.glxp.api.entity.purchase.SupManufacturerEntity;
import com.glxp.api.entity.sup.UserCompanyEntity;
import com.glxp.api.exception.JsonException; import com.glxp.api.exception.JsonException;
import com.glxp.api.req.basic.FilterUdiRelRequest; import com.glxp.api.req.basic.FilterUdiRelRequest;
import com.glxp.api.req.purchase.FilterCertSetsRequest; import com.glxp.api.req.purchase.FilterCertSetsRequest;
@ -236,6 +237,7 @@ public class SupManufacturerController {
public BaseResponse directToCptAddCompany(@RequestBody SupManufacturerEntity supManufacturerEntity) { public BaseResponse directToCptAddCompany(@RequestBody SupManufacturerEntity supManufacturerEntity) {
String customerId = getCustomerId(); String customerId = getCustomerId();
// String customerId = getCustomerId();
supManufacturerEntity.setCustomerId(customerId); supManufacturerEntity.setCustomerId(customerId);
//判断用户名和社会信用代码不能重复 //判断用户名和社会信用代码不能重复
FilterSupManufacturerRequest filterSupManufacturerRequest = new FilterSupManufacturerRequest(); FilterSupManufacturerRequest filterSupManufacturerRequest = new FilterSupManufacturerRequest();
@ -256,6 +258,8 @@ public class SupManufacturerController {
if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE || supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) { if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE || supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) {
//判断是否上级供应商是否审核通过 //判断是否上级供应商是否审核通过
SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(supManufacturerEntity.getCustomerId()); SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(supManufacturerEntity.getCustomerId());
System.out.println(supCompanyEntity.toString());
System.out.println(supCompanyEntity.getAuditStatus()+"zhi");
if (supCompanyEntity.getAuditStatus() == null || supCompanyEntity.getAuditStatus() != ConstantStatus.AUDIT_PASS if (supCompanyEntity.getAuditStatus() == null || supCompanyEntity.getAuditStatus() != ConstantStatus.AUDIT_PASS
) { ) {
return ResultVOUtils.error(500, "所属配送企业资质未通过审核,暂时无法提交!"); return ResultVOUtils.error(500, "所属配送企业资质未通过审核,暂时无法提交!");
@ -643,15 +647,24 @@ public class SupManufacturerController {
} }
// 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 getCustomerId() { public String getCustomerId() {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) { if (attributes == null) {
throw new JsonException(ResultEnum.NOT_NETWORK); throw new JsonException(ResultEnum.NOT_NETWORK);
} }
HttpServletRequest request = attributes.getRequest(); HttpServletRequest request = attributes.getRequest();
String userId = request.getHeader("ADMIN_ID"); String companyId = request.getHeader("companyId");
AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId)); return companyId;
return authAdmin.getCustomerId() + "";
} }
public String getCompanyId() { public String getCompanyId() {
@ -663,4 +676,5 @@ public class SupManufacturerController {
String companyId = request.getHeader("companyId"); String companyId = request.getHeader("companyId");
return companyId; return companyId;
} }
} }

@ -2,6 +2,7 @@ package com.glxp.api.dao.purchase;
import com.glxp.api.dao.BaseMapperPlus; import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.purchase.SupCertEntity; import com.glxp.api.entity.purchase.SupCertEntity;
import com.glxp.api.entity.purchase.SupCompanyEntity; import com.glxp.api.entity.purchase.SupCompanyEntity;
import com.glxp.api.entity.sup.UserCompanyEntity; import com.glxp.api.entity.sup.UserCompanyEntity;
@ -26,7 +27,7 @@ public interface SupCompanyDao extends BaseMapperPlus<SupCompanyDao, SupCompanyE
List<SupCompanyEntity> filterCompany(FilterSupCompanyRequest companyRequest); List<SupCompanyEntity> filterCompany(FilterSupCompanyRequest companyRequest);
List<UserCompanyEntity> filterUserCompany(FilterUserCompanyRequest companyRequest); List<UserCompanyEntity> filterUserCompany(FilterUserCompanyRequest companyRequest);
UserCompanyEntity findById(Long id);
boolean modifyCompany(SupCompanyEntity companyEntity); boolean modifyCompany(SupCompanyEntity companyEntity);
boolean insertCompany(SupCompanyEntity companyEntity); boolean insertCompany(SupCompanyEntity companyEntity);

@ -3,6 +3,7 @@ package com.glxp.api.service.purchase;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.purchase.SupCompanyEntity; import com.glxp.api.entity.purchase.SupCompanyEntity;
import com.glxp.api.entity.sup.UserCompanyEntity; import com.glxp.api.entity.sup.UserCompanyEntity;
import com.glxp.api.req.purchase.FilterSupCompanyRequest; import com.glxp.api.req.purchase.FilterSupCompanyRequest;
@ -11,9 +12,21 @@ import com.glxp.api.req.purchase.FilterUserCompanyRequest;
import java.util.List; import java.util.List;
public interface SupCompanyService extends IService<SupCompanyEntity> { public interface SupCompanyService extends IService<SupCompanyEntity> {
UserCompanyEntity findByid(Long id);
// SupCompanyEntity findCompanyByUnitFk(String unitFk); // SupCompanyEntity findCompanyByUnitFk(String unitFk);
// @Override
// public SupCompanyEntity findCompanyByUnitFk(String unitFk) {
// FilterSupCompanyRequest filterSupCompanyRequest = new FilterSupCompanyRequest();
// filterSupCompanyRequest.setUnitIdFk(unitFk);
// List<SupCompanyEntity> companyEntities = supCompanyDao.filterCompany(filterSupCompanyRequest);
// if (companyEntities != null && companyEntities.size() > 0) {
// return companyEntities.get(0);
// }
// return null;
// }
List<UserCompanyEntity> filterUserCompany(FilterUserCompanyRequest companyRequest); List<UserCompanyEntity> filterUserCompany(FilterUserCompanyRequest companyRequest);
List<SupCompanyEntity> filterCompany(FilterSupCompanyRequest companyRequest); List<SupCompanyEntity> filterCompany(FilterSupCompanyRequest companyRequest);

@ -22,6 +22,15 @@ public class SupCompanyServiceImpl extends ServiceImpl<SupCompanyDao, SupCompany
@Resource @Resource
SupCompanyDao supCompanyDao; SupCompanyDao supCompanyDao;
@Override
public UserCompanyEntity findByid(Long id) {
return supCompanyDao.findById(id);
}
// @Override // @Override
// public SupCompanyEntity findCompanyByUnitFk(String unitFk) { // public SupCompanyEntity findCompanyByUnitFk(String unitFk) {
// FilterSupCompanyRequest filterSupCompanyRequest = new FilterSupCompanyRequest(); // FilterSupCompanyRequest filterSupCompanyRequest = new FilterSupCompanyRequest();
@ -32,6 +41,8 @@ public class SupCompanyServiceImpl extends ServiceImpl<SupCompanyDao, SupCompany
// } // }
// return null; // return null;
// } // }
@Override @Override
public List<UserCompanyEntity> filterUserCompany(FilterUserCompanyRequest companyRequest) { public List<UserCompanyEntity> filterUserCompany(FilterUserCompanyRequest companyRequest) {
if (companyRequest == null) { if (companyRequest == null) {

@ -57,6 +57,15 @@
</if> </if>
</where> </where>
</select> </select>
<select id="findById" parameterType="hashmap" resultType="com.glxp.api.entity.sup.UserCompanyEntity">
SELECT *
FROM user_company
<where>
id = #{id}
</where>
LIMIT 1
</select>
<select id="filterUserCompany" parameterType="com.glxp.api.req.purchase.FilterUserCompanyRequest" <select id="filterUserCompany" parameterType="com.glxp.api.req.purchase.FilterUserCompanyRequest"
resultType="com.glxp.api.entity.sup.UserCompanyEntity"> resultType="com.glxp.api.entity.sup.UserCompanyEntity">
SELECT SELECT

@ -33,7 +33,7 @@
</select> </select>
<select id="filterCompanyCert" parameterType="com.glxp.api.req.purchase.FilterSupCertRequest" <select id="filterCompanyCert" parameterType="com.glxp.api.req.purchase.FilterSupCertRequest"
resultType="com.glxp.api.entity.sup.UserCertEntity"> resultType="com.glxp.api.entity.sup.UserCertEntity">
select * from user_cert select * from sup_cert
<where> <where>
<if test="businessId != '' and businessId!=null"> <if test="businessId != '' and businessId!=null">
and businessId = #{businessId} and businessId = #{businessId}

Loading…
Cancel
Save