资质审核增加审核不通过等动作供应商状态不更新的bug

dev_drug
qiuyt 1 month ago
parent 20512b825d
commit 031fcd2dcd

@ -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;
}

@ -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<SupCompanyDao,SupCompanyEntity> implements SupCompanyService {
public class SupCompanyServiceImpl extends ServiceImpl<SupCompanyDao, SupCompanyEntity> implements SupCompanyService {
@Resource
SupCompanyDao supCompanyDao;
@Resource
private SupCertServiceImpl supCertService;
@Override
public SupCompanyEntity findCompanyByUnitFk(String unitFk) {
@ -39,6 +43,24 @@ public class SupCompanyServiceImpl extends ServiceImpl<SupCompanyDao,SupCompanyE
if (null != companyRequest.getPage() && null != companyRequest.getLimit()) {
PageHelper.offsetPage((companyRequest.getPage() - 1) * companyRequest.getLimit(), companyRequest.getLimit());
}
List<SupCompanyEntity> 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);
}

@ -15,7 +15,10 @@
<select id="filterCompany" parameterType="com.glxp.api.req.purchase.FilterSupCompanyRequest"
resultType="com.glxp.api.entity.purchase.SupCompanyEntity">
SELECT
*
*,
(select count(1) from sup_cert c where sup_company.customerId = c.customerId and type = 1 and auditStatus != 0 ) as 'supCertCount',
(select count(1) from sup_cert c where sup_company.customerId = c.customerId and type = 1 and auditStatus = 1 ) as 'supCertOkCount',
(select count(1) from sup_cert c where sup_company.customerId = c.customerId and type = 1 and auditStatus = 6 ) as 'supCertNotCount'
<if test="manufacturerStatus!=null">
,(SELECT count(*) FROM sup_manufacturer WHERE sup_company.customerId=sup_manufacturer.customerId AND sup_manufacturer.auditStatus!=1 AND sup_manufacturer.auditStatus!=0 AND sup_manufacturer.auditStatus!=4 ) as failCout,
(SELECT count(*) FROM sup_manufacturer WHERE sup_company.customerId=sup_manufacturer.customerId AND (sup_manufacturer.auditStatus=1 OR sup_manufacturer.auditStatus=4) ) as passCout

Loading…
Cancel
Save