|
@@ -20,6 +20,8 @@ import com.yc.ship.framework.security.core.LoginUser;
|
|
import com.yc.ship.framework.security.core.util.SecurityFrameworkUtils;
|
|
import com.yc.ship.framework.security.core.util.SecurityFrameworkUtils;
|
|
import com.yc.ship.framework.tenant.core.aop.TenantIgnore;
|
|
import com.yc.ship.framework.tenant.core.aop.TenantIgnore;
|
|
import com.yc.ship.framework.tenant.core.context.TenantContextHolder;
|
|
import com.yc.ship.framework.tenant.core.context.TenantContextHolder;
|
|
|
|
+import com.yc.ship.module.ota.api.OtaDistributorApi;
|
|
|
|
+import com.yc.ship.module.ota.api.dto.DistributorRespDTO;
|
|
import com.yc.ship.module.otc.api.store.dto.StoreCardRespDTO;
|
|
import com.yc.ship.module.otc.api.store.dto.StoreCardRespDTO;
|
|
import com.yc.ship.module.otc.api.store.dto.StoreMachineDTO;
|
|
import com.yc.ship.module.otc.api.store.dto.StoreMachineDTO;
|
|
import com.yc.ship.module.otc.api.store.dto.StoreProductReqDTO;
|
|
import com.yc.ship.module.otc.api.store.dto.StoreProductReqDTO;
|
|
@@ -90,8 +92,8 @@ public class StoreServiceImpl implements StoreService {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private StoreCardService storeCardService;
|
|
private StoreCardService storeCardService;
|
|
-// @Resource
|
|
|
|
-// private OtaDistributorApi otaDistributorApi;
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private OtaDistributorApi otaDistributorApi;
|
|
@Resource
|
|
@Resource
|
|
private StorePlatCreditLogService platCreditLogService;
|
|
private StorePlatCreditLogService platCreditLogService;
|
|
|
|
|
|
@@ -99,14 +101,12 @@ public class StoreServiceImpl implements StoreService {
|
|
@Transactional
|
|
@Transactional
|
|
public Long createStore(StoreSaveReqVO createReqVO) {
|
|
public Long createStore(StoreSaveReqVO createReqVO) {
|
|
LoginUser loginUser = getLoginUser();
|
|
LoginUser loginUser = getLoginUser();
|
|
- if (loginUser != null) {
|
|
|
|
-// DistributorRespDTO distributor = otaDistributorApi.getDistributorByAccountTenantId(loginUser.getTenantId()).getCheckedData();
|
|
|
|
-// if (distributor != null && distributor.getSelfSupport()==0 ) {
|
|
|
|
-// List<Map<String, Object>> mapList = storeMapper.selectOtaBillList(distributor.getId());
|
|
|
|
-// if (mapList != null && !mapList.isEmpty()) {
|
|
|
|
-// throw exception(OVERDUE_BILL_EXISTS);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+ Long distributorId = null;
|
|
|
|
+ DistributorRespDTO distributor = otaDistributorApi.getDistributorByLoginUserId(loginUser.getId());
|
|
|
|
+ if(distributor == null) {
|
|
|
|
+ throw new ServiceException(NOT_ASSOCIATED_DISTRIBUTOR);
|
|
|
|
+ }else {
|
|
|
|
+ distributorId = distributor.getId();
|
|
}
|
|
}
|
|
|
|
|
|
// 插入
|
|
// 插入
|
|
@@ -114,6 +114,7 @@ public class StoreServiceImpl implements StoreService {
|
|
long id = IdWorker.getId(store);
|
|
long id = IdWorker.getId(store);
|
|
store.setId(id);
|
|
store.setId(id);
|
|
store.setDeleted(false);
|
|
store.setDeleted(false);
|
|
|
|
+ store.setAgencyId(distributorId);
|
|
if(store.getAuditStatus() == null) {
|
|
if(store.getAuditStatus() == null) {
|
|
store.setAuditStatus(0);
|
|
store.setAuditStatus(0);
|
|
}
|
|
}
|
|
@@ -194,6 +195,12 @@ public class StoreServiceImpl implements StoreService {
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
public PageResult<StoreDO> getStorePage(StorePageReqVO pageReqVO) {
|
|
public PageResult<StoreDO> getStorePage(StorePageReqVO pageReqVO) {
|
|
|
|
+ Long loginUserId = getLoginUserId();
|
|
|
|
+ DistributorRespDTO distributor = otaDistributorApi.getDistributorByLoginUserId(loginUserId);
|
|
|
|
+ if(distributor == null) {
|
|
|
|
+ throw new ServiceException(NOT_ASSOCIATED_DISTRIBUTOR);
|
|
|
|
+ }
|
|
|
|
+ pageReqVO.setAgencyId(distributor.getId());
|
|
return storeMapper.selectPage(pageReqVO);
|
|
return storeMapper.selectPage(pageReqVO);
|
|
}
|
|
}
|
|
|
|
|