资质审核代码

cert
schry 2 years ago
parent 7e79828244
commit 551ab7d663

@ -1,7 +1,454 @@
package com.glxp.api.controller.purchase;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.annotation.Log;
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.BusinessType;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.entity.purchase.SupCertEntity;
import com.glxp.api.entity.purchase.SupCertSetEntity;
import com.glxp.api.entity.purchase.SupManufacturerEntity;
import com.glxp.api.entity.purchase.SupProductEntity;
import com.glxp.api.exception.JsonException;
import com.glxp.api.req.purchase.FilterCertSetsRequest;
import com.glxp.api.req.purchase.FilterPoductRequest;
import com.glxp.api.req.purchase.FilterSupCertRequest;
import com.glxp.api.req.purchase.SelectProductBindRequest;
import com.glxp.api.req.system.DeleteCompanyFileRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.res.purchase.SupProductResponse;
import com.glxp.api.service.auth.AuthAdminService;
import com.glxp.api.service.basic.UdiRelevanceService;
import com.glxp.api.service.purchase.SupCertService;
import com.glxp.api.service.purchase.SupCertSetService;
import com.glxp.api.service.purchase.SupManufacturerService;
import com.glxp.api.service.purchase.SupProductService;
import org.springframework.beans.BeanUtils;
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.Date;
import java.util.List;
import java.util.ListIterator;
@RestController
public class SupProductController {
@Resource
private AuthAdminService authAdminService;
@Resource
private SupProductService supProductService;
@Resource
UdiRelevanceService udiRelevanceService;
@Resource
private SupCertService supCertService;
@Resource
SupManufacturerService supManufacturerService;
@Resource
SupCertSetService supCertSetService;
@AuthRuleAnnotation("")
@GetMapping("/sup/product/getRegistrationInfo")
public BaseResponse getRegistrationInfo(FilterPoductRequest filterPoductRequest) {
SupProductEntity supProductEntity = supProductService.findRegistration(filterPoductRequest.getId());
if (supProductEntity != null) {
return ResultVOUtils.success(supProductEntity);
}
return ResultVOUtils.error(500, "企业信息为空");
}
@AuthRuleAnnotation("")
@GetMapping("/sup/product/getRegistrationList")
public BaseResponse getRegistrationList(FilterPoductRequest filterPoductRequest) {
List<SupProductResponse> companyEntities = supProductService.getRegistration(filterPoductRequest);
PageInfo<SupProductResponse> pageInfo = new PageInfo<>(companyEntities);
PageSimpleResponse<SupProductResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(companyEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@PostMapping("/sup/product/addRegistration")
@Log(title = "资质证书", businessType = BusinessType.INSERT)
public BaseResponse addRegistration(@RequestBody SupProductEntity supProductEntity) {
//提交审核
if (supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) {
//判断是否上级供应商是否审核通过
SupManufacturerEntity supManufacturerEntity = supManufacturerService.findManufacturer(supProductEntity.getManufacturerIdFk());
if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN
|| supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_DRAFT) {
return ResultVOUtils.error(500, "所属生产企业资质未通过审核,暂时无法提交!");
}
//验证证书是否齐全
FilterCertSetsRequest filterCertSetsRequest = new FilterCertSetsRequest();
filterCertSetsRequest.setType(ConstantStatus.CERT_PRODUCT);
filterCertSetsRequest.setNeed(0);
List<SupCertSetEntity> supCertSetEntities = supCertSetService.filterCertSets(filterCertSetsRequest);
List<SupCertEntity> supCertEntityList = supCertService.findAll(supProductEntity.getCustomerId(), supProductEntity.getManufacturerIdFk(), supProductEntity.getProductId());
ListIterator<SupCertSetEntity> iterable = supCertSetEntities.listIterator();
while (iterable.hasNext()) {
SupCertSetEntity supCertSetEntity = iterable.next();
if (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 1 || StrUtil.isNotEmpty(supCertSetEntity.getCplx()) && supCertSetEntity.getCplx().equals("全部")
|| StrUtil.isNotEmpty(supCertSetEntity.getHchzsb()) && supCertSetEntity.getHchzsb().equals("全部")
|| (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 2
&& StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进"))
|| (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 3 && !StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进"))
|| (StrUtil.trimToEmpty(supProductEntity.getProductType()).equals(supCertSetEntity.getCplx()))
|| (StrUtil.trimToEmpty(supProductEntity.getHchzsb()).equals(supCertSetEntity.getHchzsb()))
|| StrUtil.isNotEmpty(supCertSetEntity.getFlbm()) && (supCertSetEntity.getFlbm().contains(StrUtil.trimToEmpty(supProductEntity.getProductDirectoryCode())))
) {
for (SupCertEntity supCertEntity : supCertEntityList) {
if (supCertEntity.getName().equals(supCertSetEntity.getName())) {
if (StrUtil.isNotEmpty(supCertEntity.getFilePath())) {
iterable.remove();
break;
}
}
}
} else {
iterable.remove();
}
}
String errMsg = "";
if (supCertSetEntities.size() > 0) {
for (SupCertSetEntity supCertSetEntity : supCertSetEntities) {
errMsg = errMsg + "," + supCertSetEntity.getName();
}
return ResultVOUtils.error(500, errMsg.substring(1) + "等证书未上传,无法提交审核!");
}
}
supProductEntity.setCreateTime(new Date());
supProductEntity.setUpdateTime(new Date());
supProductEntity.setId(IdUtil.getSnowflakeNextId());
boolean b = supProductService.insertRegistration(supProductEntity);
if (b) {
return ResultVOUtils.success("添加成功");
} else {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
}
@AuthRuleAnnotation("")
@PostMapping("/sup/product/selectBind")
public BaseResponse selectBind(@RequestBody SelectProductBindRequest selectProductBindRequest) {
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectUdiId(Long.valueOf(selectProductBindRequest.getRelIdFk()));
SupProductEntity supProductEntity = supProductService.findByManufactury(udiRelevanceResponse.getCpmctymc(), udiRelevanceResponse.getManufactory(),selectProductBindRequest.getManufacturerId());
if (supProductEntity != null) {
return ResultVOUtils.error(500, "该产品资质已存在,请勿重复添加!");
}else{
supProductEntity = new SupProductEntity();
BeanUtils.copyProperties(udiRelevanceResponse, supProductEntity);
supProductEntity.setProductId(selectProductBindRequest.getProductId());
supProductEntity.setRecordCode(udiRelevanceResponse.getZczbhhzbapzbh());
supProductEntity.setRelIdFk(udiRelevanceResponse.getId() + "");
supProductEntity.setRecordProductName(udiRelevanceResponse.getCpmctymc());
supProductEntity.setProductType(udiRelevanceResponse.getQxlb());
supProductEntity.setProductDirectoryCode(udiRelevanceResponse.getFlbm());
supProductEntity.setRecordPeopleName(udiRelevanceResponse.getYlqxzcrbarmc());
supProductEntity.setSpecification(udiRelevanceResponse.getGgxh());
supProductEntity.setCreateTime(new Date());
supProductEntity.setUpdateTime(new Date());
supProductEntity.setManufacturerIdFk(selectProductBindRequest.getManufacturerId());
supProductEntity.setCustomerId(selectProductBindRequest.getCustomerId());
supProductEntity.setHchzsb(udiRelevanceResponse.getCplb());
supProductEntity.setCompanyName(selectProductBindRequest.getCompanyName());
supProductEntity.setAuditStatus(selectProductBindRequest.getAuditStatus());
}
return ResultVOUtils.success(supProductEntity);
// boolean b = supProductService.insertRegistration(supProductEntity);
// if (b) {
// return ResultVOUtils.success(supProductEntity);
// } else {
// return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
// }
}
@AuthRuleAnnotation("")
@PostMapping("/sup/product/modifyRegistration")
@Log(title = "资质证书", businessType = BusinessType.UPDATE)
public BaseResponse modifyRegistration(@RequestBody SupProductEntity supProductEntity) {
if (StrUtil.isEmpty(supProductEntity.getProductId()) || StrUtil.isEmpty(supProductEntity.getManufacturerIdFk()) || StrUtil.isEmpty(supProductEntity.getCustomerId())) {
return ResultVOUtils.error(500, "参数错误!");
}
//提交审核
if (supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE || supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) {
//判断是不是存在草稿
List<SupCertEntity> supCertEntityList1 = supCertService.findAll(supProductEntity.getCustomerId(), supProductEntity.getManufacturerIdFk(), supProductEntity.getProductId());
for (SupCertEntity obj : supCertEntityList1) {
if (obj.getAuditStatus() == 0) {
return ResultVOUtils.error(999, "证书中存在草稿不允许提交!");
}
}
//判断是否上级供应商是否审核通过
SupManufacturerEntity supManufacturerEntity = supManufacturerService.findManufacturer(supProductEntity.getManufacturerIdFk());
if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN
|| supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_DRAFT) {
return ResultVOUtils.error(500, "所属生产企业资质未通过审核,暂时无法提交!");
}
//验证证书是否齐全
FilterCertSetsRequest filterCertSetsRequest = new FilterCertSetsRequest();
filterCertSetsRequest.setType(ConstantStatus.CERT_PRODUCT);
List<SupCertSetEntity> supCertSetEntities = supCertSetService.filterCertSets(filterCertSetsRequest);
List<SupCertEntity> supCertEntityList = supCertService.findAll(supProductEntity.getCustomerId(), supProductEntity.getManufacturerIdFk(), supProductEntity.getProductId());
ListIterator<SupCertSetEntity> iterable = supCertSetEntities.listIterator();
while (iterable.hasNext()) {
SupCertSetEntity supCertSetEntity = iterable.next();
if (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 1 || StrUtil.isNotEmpty(supCertSetEntity.getCplx()) && supCertSetEntity.getCplx().equals("全部")
|| StrUtil.isNotEmpty(supCertSetEntity.getHchzsb()) && supCertSetEntity.getHchzsb().equals("全部")
|| (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 2
&& StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进"))
|| (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 3 && !StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进"))
|| (StrUtil.trimToEmpty(supProductEntity.getProductType()).equals(supCertSetEntity.getCplx()))
|| (StrUtil.trimToEmpty(supProductEntity.getHchzsb()).equals(supCertSetEntity.getHchzsb()))
|| StrUtil.isNotEmpty(supCertSetEntity.getFlbm()) && (supCertSetEntity.getFlbm().contains(StrUtil.trimToEmpty(supProductEntity.getProductDirectoryCode())))
) {
for (SupCertEntity supCertEntity : supCertEntityList) {
if (supCertEntity.getName().equals(supCertSetEntity.getName())) {
if (StrUtil.isNotEmpty(supCertEntity.getFilePath())) {
iterable.remove();
break;
}
}
}
} else {
iterable.remove();
}
}
String errMsg = "";
if (supCertSetEntities.size() > 0) {
for (SupCertSetEntity supCertSetEntity : supCertSetEntities) {
errMsg = errMsg + "," + supCertSetEntity.getName();
}
return ResultVOUtils.error(500, errMsg.substring(1) + "等证书未上传,无法提交审核!");
}
}
supProductEntity.setUpdateTime(new Date());
SupProductResponse originEntity = supProductService.findByProductId(supProductEntity.getProductId());
supCertService.updateProductId(originEntity.getCustomerId(), supProductEntity.getCustomerId(), originEntity.getManufacturerIdFk(),
supProductEntity.getManufacturerIdFk(), originEntity.getProductId(), supProductEntity.getProductId());
boolean b = supProductService.modifyRegistration(supProductEntity);
if (b) {
return ResultVOUtils.success("修改成功");
} else {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
}
@AuthRuleAnnotation("")
@PostMapping("/udiwms/pur/suppliers/product/audit")
public BaseResponse auditProduct(@RequestBody SupProductEntity supProductEntity) {
if (supProductEntity.getAuditStatus() == null) {
return ResultVOUtils.error(500, "参数错误!");
}
if (supProductEntity.getAuditStatus() == 1) {
//查询用户上传的证书
FilterSupCertRequest filterSupCertRequest = new FilterSupCertRequest();
filterSupCertRequest.setCustomerId(supProductEntity.getCustomerId());
filterSupCertRequest.setManufacturerIdFk(supProductEntity.getManufacturerIdFk());
filterSupCertRequest.setProductIdFk(supProductEntity.getProductId());
filterSupCertRequest.setType(ConstantStatus.CERT_PRODUCT);
List<SupCertEntity> supCertEntityList = supCertService.filterCompanyCert(filterSupCertRequest);
//查询用户该上传的证书
FilterCertSetsRequest filterCertSetsRequest = new FilterCertSetsRequest();
filterCertSetsRequest.setType(ConstantStatus.CERT_PRODUCT);
List<SupCertSetEntity> supCertSetEntities = supCertSetService.filterCertSets(filterCertSetsRequest);
ListIterator<SupCertSetEntity> iterable = supCertSetEntities.listIterator();
while (iterable.hasNext()) {
SupCertSetEntity supCertSetEntity = iterable.next();
if (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 1 || StrUtil.isNotEmpty(supCertSetEntity.getCplx()) && supCertSetEntity.getCplx().equals("全部")
|| StrUtil.isNotEmpty(supCertSetEntity.getHchzsb()) && supCertSetEntity.getHchzsb().equals("全部")
|| (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 2
&& StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进"))
|| (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 3 && !StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进"))
|| (StrUtil.trimToEmpty(supProductEntity.getProductType()).equals(supCertSetEntity.getCplx()))
|| (StrUtil.trimToEmpty(supProductEntity.getHchzsb()).equals(supCertSetEntity.getHchzsb()))
|| StrUtil.isNotEmpty(supCertSetEntity.getFlbm()) && (supCertSetEntity.getFlbm().contains(StrUtil.trimToEmpty(supProductEntity.getProductDirectoryCode())))
) {
for (SupCertEntity supCertEntity : supCertEntityList) {
if (supCertEntity.getName().equals(supCertSetEntity.getName())) {
if (StrUtil.isNotEmpty(supCertEntity.getFilePath())) {
iterable.remove();
break;
}
}
}
} else {
iterable.remove();
}
}
String errMsg = "";
if (supCertSetEntities.size() > 0) {
for (SupCertSetEntity supCertSetEntity : supCertSetEntities) {
errMsg = errMsg + "," + supCertSetEntity.getName();
}
return ResultVOUtils.error(500, "必传证书不齐全");
}
}
String msg = "";
// 查询是否包含审核未通过的证书
if (supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_PASS ||
supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE_PASS) {
FilterSupCertRequest filterSupCertRequest = new FilterSupCertRequest();
filterSupCertRequest.setAuditStatus(24);
filterSupCertRequest.setCustomerId(supProductEntity.getCustomerId());
filterSupCertRequest.setManufacturerIdFk(supProductEntity.getManufacturerIdFk());
filterSupCertRequest.setProductIdFk(supProductEntity.getProductId());
filterSupCertRequest.setType(ConstantStatus.CERT_PRODUCT);
List<SupCertEntity> supCertEntityList = supCertService.filterCompanyCert(filterSupCertRequest);
if (CollUtil.isNotEmpty(supCertEntityList)) {
for (SupCertEntity supCertEntity : supCertEntityList) {
msg += supCertEntity.getName() + ",";
}
return ResultVOUtils.error(500, "审核失败,还有必须提交证书未确认(" + msg.substring(0, msg.length() - 1) + ")");
}
}
supProductEntity.setUpdateTime(new Date());
boolean b = supProductService.modifyRegistration(supProductEntity);
if (StrUtil.isNotEmpty(supProductEntity.getRelIdFk())) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(Long.parseLong(supProductEntity.getRelIdFk()));
if (udiRelevanceEntity != null) {
udiRelevanceEntity.setDispatch(true);
udiRelevanceService.updateUdiRelevance(udiRelevanceEntity);
}
}
// if (supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_PASS) {
// SupProductResponse supProductResponse = supProductService.findJoinRegistration(supProductEntity.getId());
//
// //步骤1先添加到主系统第三方产品信息
// BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectMainThrSys();
// ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
// thrProductsEntity.setCode(gennerOrderUtils.getRelId() + "");
// thrProductsEntity.setThirdSys(basicThirdSysEntity.getThirdId());
// thrProductsEntity.setThirdSysFk(basicThirdSysEntity.getThirdId());
// thrProductsEntity.setName(supProductEntity.getRecordProductName());
// thrProductsEntity.setSpec(supProductEntity.getSpecification());
// thrProductsEntity.setStandard(supProductEntity.getSpecification());
// thrProductsEntity.setManufactory(supProductResponse.getManufacturerName());
// thrProductsService.insertThrProducts(thrProductsEntity);
//
//
// //步骤2添加到关联表
// String uuid = CustomUtil.getUUId();
// UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity();
// udiRelevanceEntity.setThirdId(thrProductsEntity.getCode());
// udiRelevanceEntity.setThirdName(thrProductsEntity.getName());
// udiRelevanceEntity.setMainId(thrProductsEntity.getCode());
// udiRelevanceEntity.setMainName(thrProductsEntity.getName());
// udiRelevanceEntity.setMeasname(thrProductsEntity.getMeasname());
// String time = DateUtil.getDateTime();
// udiRelevanceEntity.setUpdateTime(time);
// udiRelevanceEntity.setModifyTime(time);
// udiRelevanceEntity.setUuid(uuid);
// udiRelevanceEntity.setManufactory(supProductResponse.getManufacturerName());
// udiRelevanceEntity.setSupName(supProductResponse.getSupName());
// udiRelevanceEntity.setId(gennerOrderUtils.getRelId() + "");
// udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
//
//
// //步骤3添加基础信息表
// UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
// udiInfoEntity.setNameCode(thrProductsEntity.getCode());
// udiInfoEntity.setCpmctymc(thrProductsEntity.getName());
// udiInfoEntity.setManufactory(thrProductsEntity.getManufactory());
// udiInfoEntity.setYlqxzcrbarmc(supProductEntity.getRecordPeopleName());
// udiInfoEntity.setGgxh(thrProductsEntity.getSpec());
// udiInfoEntity.setZczbhhzbapzbh(supProductEntity.getRecordCode());
// udiInfoEntity.setUuid(udiRelevanceEntity.getUuid());
// udiInfoEntity.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD);
// udiInfoEntity.setDiType(1);
// udiInfoEntity.setScbssfbhph("是");
// udiInfoEntity.setScbssfbhscrq("是");
// udiInfoEntity.setScbssfbhsxrq("是");
// udiInfoEntity.setScbssfbhxlh("否");
// udiInfoEntity = UdiInfoUtil.initUdiInfoEntity(udiInfoEntity);
// udiInfoService.insertUdiInfo(udiInfoEntity);
//
//
// //步骤4添加供应商关联表
// CompanyProductRelevanceEntity companyProductRelevanceEntity = new CompanyProductRelevanceEntity();
// companyProductRelevanceEntity.setCreate_time(new Date());
// companyProductRelevanceEntity.setUpdate_time(new Date());
// companyProductRelevanceEntity.setAuditStatus("3");
// companyProductRelevanceEntity.setUnitFk(supProductResponse.getCustomerId());
// companyProductRelevanceEntity.setUdiRlIdFk(udiRelevanceEntity.getId());
// companyProductRelevanceEntity.setCustomerId(supProductResponse.getCustomerId());
// companyProductRelevanceEntity.setProductId(supProductEntity.getProductId());
// companyProductRelevanceEntity.setRegistrationId(supProductEntity.getProductId());
// companyProductRelevanceEntity.setEnterpriseId(supProductEntity.getManufacturerIdFk());
// companyProductRelevanceService.insertCompanyProductRelevance(companyProductRelevanceEntity);
//
//
// }
if (b) {
return ResultVOUtils.success("审核通过!");
} else {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
}
@AuthRuleAnnotation("")
@GetMapping("/sup/product/delete")
@Log(title = "资质证书", businessType = BusinessType.DELETE)
public BaseResponse delete(DeleteCompanyFileRequest deleteCompanyFileRequest) {
boolean b = supProductService.deleteById(deleteCompanyFileRequest.getId());
if (b)
return ResultVOUtils.success("删除成功");
else {
return ResultVOUtils.error(500, "删除失败");
}
}
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() + "";
}
}

@ -0,0 +1,20 @@
package com.glxp.api.dao.basic;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.req.basic.FilterUdiRelRequest;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface UdiRelevanceDao extends BaseMapperPlus<UdiRelevanceDao, UdiRelevanceEntity, UdiRelevanceEntity> {
List<UdiRelevanceResponse> filterUdiRelevance(FilterUdiRelRequest filterUdiRelRequest);
List<UdiRelevanceEntity> batchSelectByIds(@Param("ids") List<String> ids);
boolean updateUdiRelevance(UdiRelevanceEntity udiRelevanceEntity);
}

@ -0,0 +1,41 @@
package com.glxp.api.dao.thrsys;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.req.thrsys.FilterBasicThirdSysRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ThrSystemDao {
boolean updateBasicThiSys(ThrSystemEntity thrSystemEntity);
ThrSystemEntity selectByThirdId(@Param("thirdId") String thirdId);
List<ThrSystemEntity> filterBasicThiSys(FilterBasicThirdSysRequest filterBasicThirdSysRequest);
/**
* ID
*/
List<String> selectEnabledThirdId();
/**
*
*/
int selectCountByThirdName(@Param("thirdName") String thirdName);
/**
* ID
*/
ThrSystemEntity selectByThirdIdAndThirdName(@Param("thirdId") String thirdId, @Param("thirdName") String thirdName);
/**
* ID
*/
String selectThirdNameByThirdId(@Param("thirdId") String thirdId);
int countThirdSys(FilterBasicThirdSysRequest filterBasicThirdSysRequest);
}

@ -0,0 +1,32 @@
package com.glxp.api.entity.thrsys;
import lombok.Data;
@Data
public class ThrSystemEntity {
private String id;
private String thirdId;
private String thirdName;
private Boolean enabled;
private String remark;
private String guideUrl;
private String thridUrl;
private Boolean mainSys;
//第三方系统IP地址
private String thirdSysUrl;
//第三方系统授权码
private String apikey;
//第三方系统接口秘钥
private String secretkey;
//业务字段
//本系统授权码
private String licenseApikey;
//本系统秘钥
private String licenseSecretkey;
}

@ -10,4 +10,6 @@ public class SelectProductBindRequest {
private String manufacturerId;
private String customerId;
private Integer auditStatus;
private String companyName;
private String manufacturerIdFk;
}

@ -0,0 +1,17 @@
package com.glxp.api.req.thrsys;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
@Data
public class FilterBasicThirdSysRequest extends ListPageRequest {
private String thirdId;
private String thirdName;
private Boolean enabled;
private Integer fromType;
private Boolean mainSys;
private Boolean filter;
private Boolean isBuType;
}

@ -0,0 +1,14 @@
package com.glxp.api.service.basic;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.res.basic.UdiRelevanceResponse;
public interface UdiRelevanceService extends IService<UdiRelevanceEntity> {
UdiRelevanceResponse selectUdiId(Long id);
UdiRelevanceEntity selectById(Long id);
boolean updateUdiRelevance(UdiRelevanceEntity udiRelevanceEntity);
}

@ -0,0 +1,59 @@
package com.glxp.api.service.basic.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.basic.UdiRelevanceDao;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.req.basic.FilterUdiRelRequest;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.service.basic.UdiRelevanceService;
import com.glxp.api.service.thrsys.ThrSystemService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class UdiRelevanceServiceImpl extends ServiceImpl<UdiRelevanceDao, UdiRelevanceEntity> implements UdiRelevanceService {
@Resource
UdiRelevanceDao udiRelevanceDao;
@Resource
ThrSystemService basicThirdSysService;
@Override
public UdiRelevanceResponse selectUdiId(Long id) {
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
filterUdiRelRequest.setId(id);
List<UdiRelevanceResponse> data = udiRelevanceDao.filterUdiRelevance(filterUdiRelRequest);
if (data != null && data.size() > 0)
return data.get(0);
return null;
}
@Override
public UdiRelevanceEntity selectById(Long id) {
return udiRelevanceDao.selectById(id);
}
@Override
public boolean updateUdiRelevance(UdiRelevanceEntity udiRelevanceEntity) {
ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectMainThrSys();
String mainSys = basicThirdSysEntity.getThirdId();
if (mainSys.equals("thirdId")) {
udiRelevanceEntity.setMainId(udiRelevanceEntity.getThirdId());
} else if (mainSys.equals("thirdId1")) {
udiRelevanceEntity.setMainId(udiRelevanceEntity.getThirdId1());
} else if (mainSys.equals("thirdId2")) {
udiRelevanceEntity.setMainId(udiRelevanceEntity.getThirdId2());
} else if (mainSys.equals("thirdId3")) {
udiRelevanceEntity.setMainId(udiRelevanceEntity.getThirdId3());
} else if (mainSys.equals("thirdId4")) {
udiRelevanceEntity.setMainId(udiRelevanceEntity.getThirdId4());
}
return udiRelevanceDao.updateUdiRelevance(udiRelevanceEntity);
}
}

@ -0,0 +1,7 @@
package com.glxp.api.service.thrsys;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
public interface ThrSystemService {
ThrSystemEntity selectMainThrSys();
}

@ -0,0 +1,28 @@
package com.glxp.api.service.thrsys.impl;
import com.glxp.api.dao.thrsys.ThrSystemDao;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.req.thrsys.FilterBasicThirdSysRequest;
import com.glxp.api.service.thrsys.ThrSystemService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class ThrSystemServiceImpl implements ThrSystemService {
@Resource
private ThrSystemDao thrSystemDao;
@Override
public ThrSystemEntity selectMainThrSys() {
FilterBasicThirdSysRequest filterBasicThirdSysRequest = new FilterBasicThirdSysRequest();
filterBasicThirdSysRequest.setMainSys(true);
List<ThrSystemEntity> data = thrSystemDao.filterBasicThiSys(filterBasicThirdSysRequest);
if (data != null && data.size() > 0) {
return data.get(0);
}
return null;
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.thrsys.ThrSystemDao">
<update id="updateBasicThiSys" parameterType="com.glxp.api.entity.thrsys.ThrSystemEntity">
UPDATE thr_system
<trim prefix="set" suffixOverrides=",">
<if test="thirdId != null">thirdId=#{thirdId},</if>
<if test="thirdName != null">thirdName=#{thirdName},</if>
<if test="guideUrl != null">guideUrl=#{guideUrl},</if>
<if test="remark != null">remark=#{remark},</if>
<if test="thridUrl != null">thridUrl=#{thridUrl},</if>
<if test="enabled != null">enabled=#{enabled},</if>
<if test="mainSys != null">mainSys=#{mainSys},</if>
<if test="thirdSysUrl != null">thirdSysUrl=#{thirdSysUrl},</if>
<if test="apikey != null">apikey=#{apikey},</if>
<if test="secretkey != null">secretkey=#{secretkey}</if>
</trim>
WHERE id=#{id}
</update>
<select id="filterBasicThiSys" parameterType="com.glxp.api.req.thrsys.FilterBasicThirdSysRequest"
resultType="com.glxp.api.entity.thrsys.ThrSystemEntity">
SELECT * FROM thr_system
<where>
<if test="thirdId != '' and thirdId != null">
AND thirdId like concat('%',#{thirdId},'%')
</if>
<if test="thirdName != '' and thirdName != null">
AND thirdName like concat('%',#{thirdName},'%')
</if>
<if test="enabled != null">
AND enabled = #{enabled}
</if>
<if test="mainSys != '' and mainSys != null">
AND mainSys = #{mainSys}
</if>
</where>
</select>
<select id="selectByThirdId" parameterType="Map" resultType="com.glxp.api.entity.thrsys.ThrSystemEntity">
select *
FROM thr_system
WHERE thirdId = #{thirdId}
</select>
<select id="selectEnabledThirdId" resultType="java.lang.String">
select thirdId
from thr_system
where enabled = true
</select>
<select id="selectCountByThirdName" resultType="java.lang.Integer">
select count(*)
from thr_system
where thirdName = #{thirdName}
</select>
<select id="selectByThirdIdAndThirdName" resultType="com.glxp.api.entity.thrsys.ThrSystemEntity">
select *
from thr_system
where thirdId = #{thirdId}
and thirdName = #{thirdName}
</select>
<select id="selectThirdNameByThirdId" resultType="java.lang.String">
select thirdName
from thr_system
where thirdId = #{thirdId}
</select>
<select id="countThirdSys" resultType="java.lang.Integer">
select count(*) from thr_system
<where>
<if test="enabled != null">
AND enabled = #{enabled}
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save