|
|
@@ -159,17 +159,23 @@ public class CmsYhShopCommonServiceImpl implements CmsYhShopCommonService {
|
|
|
Long id = yhShop.getId();
|
|
|
YhShop dbShop = yhShopMapper.selectById(id);
|
|
|
Assert.notNull(dbShop, "请检查店铺是否存在");
|
|
|
- if (businessId != null) {
|
|
|
+ if (businessId == null && dbShop.getBusinessId() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (businessId == null && dbShop.getBusinessId() != 0) {
|
|
|
+ yhShopMapper.update(null, Wrappers.lambdaUpdate(YhShop.class)
|
|
|
+ .set(YhShop::getBusinessId, 0)
|
|
|
+ .set(YhShop::getBusinessBindTime, null)
|
|
|
+ .eq(YhShop::getId, id));
|
|
|
+ }
|
|
|
+ if (!dbShop.getBusinessId().equals(businessId)) {
|
|
|
if (!userBusinessRateService.isBusiness(businessId)) {
|
|
|
- throw BusinessRuntimeException.getInstance("请选择对应的商务人员");
|
|
|
+ throw BusinessRuntimeException.getInstance("请选择正确的商务人员");
|
|
|
}
|
|
|
+ dbShop.setBusinessId(businessId);
|
|
|
+ dbShop.setBusinessBindTime(DateTime.now());
|
|
|
+ yhShopMapper.updateById(dbShop);
|
|
|
}
|
|
|
- yhShopMapper.update(null, Wrappers.lambdaUpdate(YhShop.class)
|
|
|
- .set(businessId == null, YhShop::getBusinessId, 0)
|
|
|
- .set(businessId == null, YhShop::getBusinessBindTime, null)
|
|
|
- .set(businessId != null, YhShop::getBusinessId, businessId)
|
|
|
- .set(businessId != null, YhShop::getBusinessBindTime, DateTime.now())
|
|
|
- .eq(YhShop::getId, id));
|
|
|
}
|
|
|
|
|
|
@Override
|