物资资质新增--新增配送产品资质信息

dev
黄泽腾 2 years ago
parent 6647fbb9d7
commit f69b85697c

@ -17,6 +17,7 @@ public enum ResultEnum {
DATA_CHANGE(6, "数据没有任何更改"), DATA_CHANGE(6, "数据没有任何更改"),
DATA_REPEAT(7, "数据已存在"), DATA_REPEAT(7, "数据已存在"),
DATA_ERROR(8, "参数错误"), DATA_ERROR(8, "参数错误"),
; ;
private Integer code; private Integer code;

@ -86,11 +86,10 @@ public class SupProductController {
@PostMapping("/sup/product/addRegistration") @PostMapping("/sup/product/addRegistration")
@Log(title = "资质证书", businessType = BusinessType.INSERT) @Log(title = "资质证书", businessType = BusinessType.INSERT)
public BaseResponse addRegistration(@RequestBody SupProductEntity supProductEntity) { public BaseResponse addRegistration(@RequestBody SupProductEntity supProductEntity) {
System.out.println(supProductEntity.toString());
//提交审核 //提交审核
if (supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) { if (supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) {
//判断是否上级供应商是否审核通过 //判断是否上级供应商是否审核通过
SupManufacturerEntity supManufacturerEntity = supManufacturerService.findManufacturer(supProductEntity.getManufacturerIdFk()); SupManufacturerEntity supManufacturerEntity = supManufacturerService.findManufacturer(supProductEntity.getManufacturerIdFk());
if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN
|| supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_DRAFT) { || supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_DRAFT) {
@ -135,6 +134,9 @@ public class SupProductController {
return ResultVOUtils.error(500, errMsg.substring(1) + "等证书未上传,无法提交审核!"); return ResultVOUtils.error(500, errMsg.substring(1) + "等证书未上传,无法提交审核!");
} }
} }
int i = supProductService.findProduct(supProductEntity);
System.out.println(i);
if (i == 0) {
supProductEntity.setCreateTime(new Date()); supProductEntity.setCreateTime(new Date());
supProductEntity.setUpdateTime(new Date()); supProductEntity.setUpdateTime(new Date());
supProductEntity.setId(IdUtil.getSnowflakeNextId()); supProductEntity.setId(IdUtil.getSnowflakeNextId());
@ -144,6 +146,10 @@ public class SupProductController {
} else { } else {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK); return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
} }
} else {
return ResultVOUtils.error(ResultEnum.DATA_REPEAT);
}
} }
@ -153,9 +159,9 @@ public class SupProductController {
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectUdiId(Long.valueOf(selectProductBindRequest.getRelIdFk())); UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectUdiId(Long.valueOf(selectProductBindRequest.getRelIdFk()));
SupProductEntity supProductEntity = supProductService.findByManufactury(udiRelevanceResponse.getCpmctymc(), udiRelevanceResponse.getManufactory(), selectProductBindRequest.getManufacturerId()); SupProductEntity supProductEntity = supProductService.findByManufactury(udiRelevanceResponse.getCpmctymc(), udiRelevanceResponse.getManufactory(), selectProductBindRequest.getManufacturerId());
if (supProductEntity != null) { // if (supProductEntity != null) {
return ResultVOUtils.error(500, "该产品资质已存在,请勿重复添加!"); //// return ResultVOUtils.error(500, "该产品资质已存在,请勿重复添加!");
} else { // } else {
supProductEntity = new SupProductEntity(); supProductEntity = new SupProductEntity();
BeanUtils.copyProperties(udiRelevanceResponse, supProductEntity); BeanUtils.copyProperties(udiRelevanceResponse, supProductEntity);
supProductEntity.setProductId(selectProductBindRequest.getProductId()); supProductEntity.setProductId(selectProductBindRequest.getProductId());
@ -173,7 +179,7 @@ public class SupProductController {
supProductEntity.setHchzsb(udiRelevanceResponse.getCplb()); supProductEntity.setHchzsb(udiRelevanceResponse.getCplb());
// supProductEntity.setCompanyName(selectProductBindRequest.getCompanyName()); // supProductEntity.setCompanyName(selectProductBindRequest.getCompanyName());
supProductEntity.setAuditStatus(selectProductBindRequest.getAuditStatus()); supProductEntity.setAuditStatus(selectProductBindRequest.getAuditStatus());
} // }
return ResultVOUtils.success(supProductEntity); return ResultVOUtils.success(supProductEntity);

@ -26,7 +26,7 @@ public interface SupProductDao extends BaseMapperPlus<SupProductDao,SupProductEn
boolean insertRegistration(SupProductEntity supProductEntity); boolean insertRegistration(SupProductEntity supProductEntity);
boolean deleteById(@Param("id") String id); boolean deleteById(@Param("id") String id);
int findProduct(SupProductEntity supProductEntity);
boolean deleteByEnterpriseId(@Param("enterpriseId") String enterpriseId); boolean deleteByEnterpriseId(@Param("enterpriseId") String enterpriseId);
} }

@ -18,7 +18,7 @@ public interface SupProductService extends IService<SupProductEntity> {
SupProductEntity findByRelIdFk(String relIdFk); SupProductEntity findByRelIdFk(String relIdFk);
SupProductEntity findByManufactury(String cpmctymc, String manufactory,String manufacturerIdFk); SupProductEntity findByManufactury(String cpmctymc, String manufactory, String manufacturerIdFk);
SupProductResponse findByPassByReCert(String registerCert); SupProductResponse findByPassByReCert(String registerCert);
@ -34,6 +34,8 @@ public interface SupProductService extends IService<SupProductEntity> {
boolean insertRegistration(SupProductEntity supProductEntity); boolean insertRegistration(SupProductEntity supProductEntity);
int findProduct(SupProductEntity supProductEntity);
boolean deleteById(@Param("id") String id); boolean deleteById(@Param("id") String id);
boolean deleteByEnterpriseId(@Param("enterpriseId") String enterpriseId); boolean deleteByEnterpriseId(@Param("enterpriseId") String enterpriseId);

@ -143,6 +143,10 @@ public class SupProductServiceImpl extends ServiceImpl<SupProductDao, SupProduct
return supProductDao.insert(companyEntity) > 0 ? true : false; return supProductDao.insert(companyEntity) > 0 ? true : false;
} }
@Override
public int findProduct(SupProductEntity supProductEntity) {
return supProductDao.findProduct(supProductEntity);
}
@Override @Override
public boolean deleteById(String id) { public boolean deleteById(String id) {
return supProductDao.deleteById(id); return supProductDao.deleteById(id);

@ -389,4 +389,18 @@
FROM sup_product FROM sup_product
WHERE enterpriseId = #{enterpriseId} WHERE enterpriseId = #{enterpriseId}
</delete> </delete>
<select id="findProduct" parameterType="com.glxp.api.entity.purchase.SupProductEntity"
resultType="java.lang.Integer" >
SELECT count(*)
FROM sup_product
inner join sup_company
on sup_product.customerId = sup_company.customerId
INNER JOIN sup_manufacturer
on sup_manufacturer.manufacturerId =
sup_product.manufacturerIdFk
WHERE sup_manufacturer.companyName=(SELECT companyName FROM sup_manufacturer WHERE manufacturerId = #{manufacturerIdFk})
and recordCode=#{recordCode} and recordProductName=#{recordProductName}
</select>
</mapper> </mapper>

Loading…
Cancel
Save