|
|
@@ -792,6 +792,73 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Su
|
|
|
return supplierInfoVo1.getSupplyStatus();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean srmUpdateByBo(SupplierInfoBo bo) {
|
|
|
+ Long id = bo.getId();
|
|
|
+ SupplierInfo supplierInfo = baseMapper.selectById(id);
|
|
|
+ //如果是待审核 随便改
|
|
|
+ if (bo.getSupplyStatus() == SupplierStatusEnum.PENDING_REVIEW.getCode()){
|
|
|
+ SupplierInfo update = MapstructUtils.convert(bo, SupplierInfo.class);
|
|
|
+ return baseMapper.updateById(update) > 0;
|
|
|
+ }
|
|
|
+ //如果是启用状态,就变成待修改审核状态
|
|
|
+ if (supplierInfo.getSupplyStatus() == SupplierStatusEnum.OFFICIAL_SUPPLIER.getCode()){
|
|
|
+ SupplierInfoTemporary supplierInfoTemporary = supplierInfoTemporaryService.querBySupplierId(id);
|
|
|
+ if (supplierInfoTemporary == null){
|
|
|
+ BeanUtils.copyProperties(bo, supplierInfoTemporary,"id");
|
|
|
+ supplierInfoTemporary.setSupplierId(id);
|
|
|
+ supplierInfoTemporary.setSupplyStatus(SupplierStatusEnum.REVIEW_UPDATED.getCode());
|
|
|
+ boolean save = supplierInfoTemporaryService.save(supplierInfoTemporary);
|
|
|
+ if (save == false){
|
|
|
+ throw new RuntimeException("保存供应商待审核数据失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //一共三个地方
|
|
|
+ boolean flag =false;
|
|
|
+ //1.简称
|
|
|
+ if (bo.getShortName() != null && StringUtils.isNotBlank(bo.getShortName())){
|
|
|
+ supplierInfoTemporary.setShortName(bo.getShortName());
|
|
|
+ flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
|
|
|
+ }
|
|
|
+ //2.供货品牌
|
|
|
+ if (bo.getOperatingBrand() != null && StringUtils.isNotBlank(bo.getOperatingBrand())){
|
|
|
+ supplierInfoTemporary.setOperatingBrand(bo.getOperatingBrand());
|
|
|
+ flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
|
|
|
+ }
|
|
|
+ //3.供货类目
|
|
|
+ if (bo.getOperatingCategory() != null && StringUtils.isNotBlank(bo.getOperatingCategory())){
|
|
|
+ supplierInfoTemporary.setOperatingCategory(bo.getOperatingCategory());
|
|
|
+ flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
|
|
|
+ }
|
|
|
+
|
|
|
+ supplierInfo.setSupplyStatus(SupplierStatusEnum.REVIEW_UPDATED.getCode());
|
|
|
+ boolean update =baseMapper.updateById(supplierInfo) > 0;
|
|
|
+ return update && flag;
|
|
|
+ }
|
|
|
+ //如果是待审核状态,就变成待修改审核状态
|
|
|
+ if (supplierInfo.getSupplyStatus() == SupplierStatusEnum.REVIEW_UPDATED.getCode()){
|
|
|
+ SupplierInfoTemporary supplierInfoTemporary = supplierInfoTemporaryService.querBySupplierId(id);
|
|
|
+ //一共三个地方
|
|
|
+ boolean flag =false;
|
|
|
+ //1.简称
|
|
|
+ if (bo.getShortName() != null && StringUtils.isNotBlank(bo.getShortName())){
|
|
|
+ supplierInfoTemporary.setShortName(bo.getShortName());
|
|
|
+ flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
|
|
|
+ }
|
|
|
+ //2.供货品牌
|
|
|
+ if (bo.getOperatingBrand() != null && StringUtils.isNotBlank(bo.getOperatingBrand())){
|
|
|
+ supplierInfoTemporary.setOperatingBrand(bo.getOperatingBrand());
|
|
|
+ flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
|
|
|
+ }
|
|
|
+ //3.供货类目
|
|
|
+ if (bo.getOperatingCategory() != null && StringUtils.isNotBlank(bo.getOperatingCategory())){
|
|
|
+ supplierInfoTemporary.setOperatingCategory(bo.getOperatingCategory());
|
|
|
+ flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
@Override
|