|
|
@@ -28,7 +28,6 @@ import com.yc.ship.module.ota.api.dto.DistributorRespDTO;
|
|
|
import com.yc.ship.module.ota.dal.dataobject.distributor.DistributorDO;
|
|
|
import com.yc.ship.module.ota.dal.dataobject.distributortype.DistributorTypeDO;
|
|
|
import com.yc.ship.module.ota.dal.dataobject.otaDistributorRegion.OtaDistributorRegionDO;
|
|
|
-import com.yc.ship.module.ota.dal.dataobject.otaRegion.OtaRegionDO;
|
|
|
import com.yc.ship.module.ota.dal.mysql.distributor.DistributorMapper;
|
|
|
import com.yc.ship.module.ota.dal.mysql.otaDistributorRegion.OtaDistributorRegionMapper;
|
|
|
import com.yc.ship.module.ota.enums.DistributorTypeEnum;
|
|
|
@@ -58,7 +57,6 @@ import java.util.concurrent.atomic.AtomicReference;
|
|
|
import static com.yc.ship.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
import static com.yc.ship.framework.common.pojo.CommonResult.error;
|
|
|
import static com.yc.ship.framework.common.pojo.CommonResult.success;
|
|
|
-import static com.yc.ship.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
|
|
import static com.yc.ship.module.ota.enums.ErrorCodeConstants.*;
|
|
|
|
|
|
|
|
|
@@ -172,15 +170,12 @@ public class DistributorServiceImpl implements DistributorService {
|
|
|
List<OtaDistributorRegionDO> list = new ArrayList<>();
|
|
|
if (StringUtils.isNotBlank(regionAgency)){
|
|
|
String[] split = regionAgency.split(",");
|
|
|
- if(split.length>0){
|
|
|
- for (int i = 0; i < split.length; i++) {
|
|
|
- String s = split[i];
|
|
|
- OtaDistributorRegionDO otaDistributorRegionDO = new OtaDistributorRegionDO();
|
|
|
- otaDistributorRegionDO.setId(IdWorker.getId());
|
|
|
- otaDistributorRegionDO.setDistributorId(distributor.getId());
|
|
|
- otaDistributorRegionDO.setDistributorRegionId(s);
|
|
|
- list.add(otaDistributorRegionDO);
|
|
|
- }
|
|
|
+ for (String s : split) {
|
|
|
+ OtaDistributorRegionDO otaDistributorRegionDO = new OtaDistributorRegionDO();
|
|
|
+ otaDistributorRegionDO.setId(IdWorker.getId());
|
|
|
+ otaDistributorRegionDO.setDistributorId(distributor.getId());
|
|
|
+ otaDistributorRegionDO.setDistributorRegionId(s);
|
|
|
+ list.add(otaDistributorRegionDO);
|
|
|
}
|
|
|
}
|
|
|
if(!list.isEmpty()) {
|
|
|
@@ -200,15 +195,14 @@ public class DistributorServiceImpl implements DistributorService {
|
|
|
distributor.setSelfSupport(0);
|
|
|
distributor.setLoginName(distributorImportExcelVO.getUserName());
|
|
|
try {
|
|
|
- Long s = createDistributor(distributor);
|
|
|
+ createDistributor(distributor);
|
|
|
System.out.println("分销商:"+distributor.getName()+"创建成功");
|
|
|
}catch (Exception e){
|
|
|
System.out.println("分销商:"+distributor.getName()+"创建失败");
|
|
|
}
|
|
|
}
|
|
|
- DistributorImportRespVO respVO = DistributorImportRespVO.builder().createSuppliers(new ArrayList<>())
|
|
|
+ return DistributorImportRespVO.builder().createSuppliers(new ArrayList<>())
|
|
|
.updateSuppliers(new ArrayList<>()).failureSuppliers(new LinkedHashMap<>()).build();
|
|
|
- return respVO;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -262,15 +256,12 @@ public class DistributorServiceImpl implements DistributorService {
|
|
|
List<OtaDistributorRegionDO> list = new ArrayList<>();
|
|
|
if (StringUtils.isNotBlank(regionAgency)){
|
|
|
String[] split = regionAgency.split(",");
|
|
|
- if(split.length>0){
|
|
|
- for (int i = 0; i < split.length; i++) {
|
|
|
- String s = split[i];
|
|
|
- OtaDistributorRegionDO otaDistributorRegionDO = new OtaDistributorRegionDO();
|
|
|
- otaDistributorRegionDO.setId(IdWorker.getId());
|
|
|
- otaDistributorRegionDO.setDistributorId(updateObj.getId());
|
|
|
- otaDistributorRegionDO.setDistributorRegionId(s);
|
|
|
- list.add(otaDistributorRegionDO);
|
|
|
- }
|
|
|
+ for (String s : split) {
|
|
|
+ OtaDistributorRegionDO otaDistributorRegionDO = new OtaDistributorRegionDO();
|
|
|
+ otaDistributorRegionDO.setId(IdWorker.getId());
|
|
|
+ otaDistributorRegionDO.setDistributorId(updateObj.getId());
|
|
|
+ otaDistributorRegionDO.setDistributorRegionId(s);
|
|
|
+ list.add(otaDistributorRegionDO);
|
|
|
}
|
|
|
}
|
|
|
if(!list.isEmpty()) {
|
|
|
@@ -337,6 +328,16 @@ public class DistributorServiceImpl implements DistributorService {
|
|
|
|
|
|
@Override
|
|
|
public List<DistributorDO> getSimpleList(DistributorListReqVO reqVO) {
|
|
|
+ LoginUser loginUser = otaAuthUtils.getAgencyLoginUser();
|
|
|
+ if(loginUser != null) {
|
|
|
+ //是否旅行社登录
|
|
|
+ Long distributorId = loginUser.getDistributorId();
|
|
|
+ if(distributorId != null) {
|
|
|
+ DistributorRespVO distributor = distributorMapper.getDistributorById(distributorId);
|
|
|
+ DistributorDO distributorDO = BeanUtils.toBean(distributor, DistributorDO.class);
|
|
|
+ return Collections.singletonList(distributorDO);
|
|
|
+ }
|
|
|
+ }
|
|
|
return distributorMapper.getSimpleList(reqVO);
|
|
|
}
|
|
|
|
|
|
@@ -430,7 +431,6 @@ public class DistributorServiceImpl implements DistributorService {
|
|
|
|
|
|
/**
|
|
|
* 创建默认部门
|
|
|
- * @param distributor
|
|
|
*/
|
|
|
private void createDefaultDept(DistributorDO distributor) {
|
|
|
DeptReqDTO reqDTO = new DeptReqDTO();
|
|
|
@@ -455,7 +455,7 @@ public class DistributorServiceImpl implements DistributorService {
|
|
|
@TenantIgnore
|
|
|
public CommonResult<DistributorRespDTO> getDistributorByAccountTenantId(Long accountTenantId) {
|
|
|
List<DistributorDO> distributor = distributorMapper.selectList(DistributorDO::getAccountTenantId, accountTenantId);
|
|
|
- if(distributor!=null && distributor.size()>0){
|
|
|
+ if(distributor!=null && !distributor.isEmpty()){
|
|
|
return success(BeanUtils.toBean(distributor.get(0), DistributorRespDTO.class));
|
|
|
}else{
|
|
|
return error(500,"未查询到分销商信息");
|
|
|
@@ -567,8 +567,6 @@ public class DistributorServiceImpl implements DistributorService {
|
|
|
updateWrapper.set("pay_credit", afterBigDecimal);
|
|
|
distributorMapper.update(updateWrapper);
|
|
|
logId = saveLog(distributorDO, mode, beforeBigDecimal, afterBigDecimal, amount, userId, orderId, refundId);
|
|
|
- } catch (Exception ex) {
|
|
|
- throw ex;
|
|
|
} finally {
|
|
|
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
|
|
lock.unlock();
|
|
|
@@ -616,19 +614,6 @@ public class DistributorServiceImpl implements DistributorService {
|
|
|
typeRespVO.setAccountTenantId(distributorDO.getAccountTenantId());
|
|
|
typeRespVO.setTenantId(distributorDO.getTenantId());
|
|
|
typeRespVO.setDistributorName(distributorDO.getName());
|
|
|
- } else {
|
|
|
- long loginUserId = getLoginUserId();
|
|
|
-// AdminUserRespDTO respDTO = userApi.getUser(loginUserId).getCheckedData();
|
|
|
-// distributorDO = distributorList.stream().filter(distributor -> distributor.getLoginName().equals(respDTO.getUsername())).findFirst().orElse(null);
|
|
|
-// if (distributorDO != null) {
|
|
|
-// // OTA 端
|
|
|
-// typeRespVO = new LoginTypeRespVO();
|
|
|
-// typeRespVO.setType(2);
|
|
|
-// typeRespVO.setDistributorId(distributorDO.getId());
|
|
|
-// typeRespVO.setAccountTenantId(distributorDO.getAccountTenantId());
|
|
|
-// typeRespVO.setTenantId(distributorDO.getTenantId());
|
|
|
-// typeRespVO.setDistributorName(distributorDO.getName());
|
|
|
-// }
|
|
|
}
|
|
|
}
|
|
|
loginType.set(typeRespVO);
|