diff --git a/src/main/java/com/glxp/api/entity/purchase/SupCompanyEntity.java b/src/main/java/com/glxp/api/entity/purchase/SupCompanyEntity.java index 5abf15a3..5469f8e5 100644 --- a/src/main/java/com/glxp/api/entity/purchase/SupCompanyEntity.java +++ b/src/main/java/com/glxp/api/entity/purchase/SupCompanyEntity.java @@ -314,6 +314,12 @@ public class SupCompanyEntity { private String productFailCout; @TableField(exist = false) private String prouctPassCout; + // 资质证书审核状态总数 + @TableField(exist = false) + private Integer supCertCount; + @TableField(exist = false) + private Integer supCertOkCount; - + @TableField(exist = false) + private Integer supCertNotCount; } diff --git a/src/main/java/com/glxp/api/service/purchase/impl/SupCompanyServiceImpl.java b/src/main/java/com/glxp/api/service/purchase/impl/SupCompanyServiceImpl.java index c8936902..1579f630 100644 --- a/src/main/java/com/glxp/api/service/purchase/impl/SupCompanyServiceImpl.java +++ b/src/main/java/com/glxp/api/service/purchase/impl/SupCompanyServiceImpl.java @@ -1,9 +1,11 @@ package com.glxp.api.service.purchase.impl; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.pagehelper.PageHelper; import com.glxp.api.dao.purchase.SupCompanyDao; import com.glxp.api.entity.purchase.SupCompanyEntity; +import com.glxp.api.req.purchase.FilterSupCertRequest; import com.glxp.api.req.purchase.FilterSupCompanyRequest; import com.glxp.api.service.purchase.SupCompanyService; import org.springframework.stereotype.Service; @@ -15,10 +17,12 @@ import java.util.List; @Service @Transactional(rollbackFor = Exception.class) -public class SupCompanyServiceImpl extends ServiceImpl implements SupCompanyService { +public class SupCompanyServiceImpl extends ServiceImpl implements SupCompanyService { @Resource SupCompanyDao supCompanyDao; + @Resource + private SupCertServiceImpl supCertService; @Override public SupCompanyEntity findCompanyByUnitFk(String unitFk) { @@ -39,6 +43,24 @@ public class SupCompanyServiceImpl extends ServiceImpl companyEntities = supCompanyDao.filterCompany(companyRequest); + if (CollUtil.isNotEmpty(companyEntities)) { + for (SupCompanyEntity companyEntity : companyEntities) { + + if (companyEntity.getAuditStatus() == 1 && companyEntity.getSupCertCount() != companyEntity.getSupCertOkCount()) { + SupCompanyEntity supCompanyEntityNew = new SupCompanyEntity(); + supCompanyEntityNew.setCustomerId(companyEntity.getCustomerId()); + supCompanyEntityNew.setAuditStatus(3); + supCompanyDao.updateById(supCompanyEntityNew); + } else if (companyEntity.getSupCertCount() == companyEntity.getSupCertOkCount()) { + SupCompanyEntity supCompanyEntityNew = new SupCompanyEntity(); + supCompanyEntityNew.setCustomerId(companyEntity.getCustomerId()); + supCompanyEntityNew.setAuditStatus(1); + supCompanyDao.updateById(supCompanyEntityNew); + } + + } + } return supCompanyDao.filterCompany(companyRequest); } diff --git a/src/main/resources/mybatis/mapper/purchase/SupCompanyDao.xml b/src/main/resources/mybatis/mapper/purchase/SupCompanyDao.xml index de088107..b47a58f7 100644 --- a/src/main/resources/mybatis/mapper/purchase/SupCompanyDao.xml +++ b/src/main/resources/mybatis/mapper/purchase/SupCompanyDao.xml @@ -15,7 +15,10 @@