|
@@ -1,10 +1,26 @@
|
|
package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
|
+import com.yh.saas.common.support.util.IdGenerator;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.AgentCargoOwnerInfo;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.CargoOwnerCompInfo;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.CargoOwnerInfo;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.CargoOwnerInfo;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.CompanyInfo;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.exception.YException;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.CargoOwnerInfoMapper;
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.CargoOwnerInfoMapper;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.IAgentCargoOwnerInfoService;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.ICargoOwnerCompInfoService;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.ICargoOwnerInfoService;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.ICargoOwnerInfoService;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.ICompanyInfoService;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -17,4 +33,90 @@ import org.springframework.stereotype.Service;
|
|
@Service
|
|
@Service
|
|
public class CargoOwnerInfoServiceImpl extends ServiceImpl<CargoOwnerInfoMapper, CargoOwnerInfo> implements ICargoOwnerInfoService {
|
|
public class CargoOwnerInfoServiceImpl extends ServiceImpl<CargoOwnerInfoMapper, CargoOwnerInfo> implements ICargoOwnerInfoService {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICargoOwnerCompInfoService cargoOwnerCompInfoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICompanyInfoService companyInfoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IAgentCargoOwnerInfoService agentCargoOwnerInfoService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ *货主认证列表
|
|
|
|
+ * @param commonId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public CargoOwnerInfo selectCargoOwner(String commonId) {
|
|
|
|
+ //根据用户id查询货主个人信息
|
|
|
|
+ CargoOwnerInfo cargoOwnerInfo = this.selectOne(new EntityWrapper<CargoOwnerInfo>()
|
|
|
|
+ .eq(CargoOwnerInfo.QueryFiles.COMMON_ID, commonId).eq(CargoOwnerInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
|
|
|
|
+ //根据货主个人信息查询货主所属公司信息
|
|
|
|
+ List<CargoOwnerCompInfo> cargoOwnerCompInfoList = cargoOwnerCompInfoService.selectList(new EntityWrapper<CargoOwnerCompInfo>()
|
|
|
|
+ .eq(CargoOwnerCompInfo.QueryFiles.COMMON_ID, commonId).eq(CargoOwnerCompInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
|
|
|
|
+ cargoOwnerInfo.setCargoOwnerCompInfoList(cargoOwnerCompInfoList);
|
|
|
|
+ return cargoOwnerInfo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加认证信息
|
|
|
|
+ * @param cargoOwnerInfo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public String addCargoOwner(CargoOwnerInfo cargoOwnerInfo){
|
|
|
|
+ //根据用户id查询货主个人信息
|
|
|
|
+ CargoOwnerInfo cargoOwnerInfo1 = this.selectOne(new EntityWrapper<CargoOwnerInfo>()
|
|
|
|
+ .eq(CargoOwnerInfo.QueryFiles.COMMON_ID,cargoOwnerInfo.getCommonId()).eq(CargoOwnerInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
|
|
|
|
+ //如果货主信息为空,新增货主个人信息
|
|
|
|
+ if(cargoOwnerInfo1 == null){
|
|
|
|
+ //新增主键id
|
|
|
|
+ cargoOwnerInfo.setId(IdGenerator.generateUUID());
|
|
|
|
+ cargoOwnerInfo.setAuthenticationStatus(StatusEnum.IDENTITY_REVIEWED.getName());
|
|
|
|
+ cargoOwnerInfo.setAuthenticationStatusKey(StatusEnum.IDENTITY_REVIEWED.getFlag());
|
|
|
|
+ this.insert(cargoOwnerInfo);
|
|
|
|
+ }
|
|
|
|
+ //所属公司新增
|
|
|
|
+ CargoOwnerCompInfo cargoOwnerCompInfo = cargoOwnerInfo.getCargoOwnerCompInfo();
|
|
|
|
+ cargoOwnerCompInfo.setId(IdGenerator.generateUUID());
|
|
|
|
+ cargoOwnerCompInfo.setCargoOwnerId(cargoOwnerInfo.getId());
|
|
|
|
+ cargoOwnerCompInfo.setCommonId(cargoOwnerInfo.getCommonId());
|
|
|
|
+ cargoOwnerCompInfo.setStatus(StatusEnum.IDENTITY_REVIEWED.getName());
|
|
|
|
+ cargoOwnerCompInfo.setStatusKey(StatusEnum.IDENTITY_REVIEWED.getFlag());
|
|
|
|
+ cargoOwnerCompInfoService.insert(cargoOwnerCompInfo);
|
|
|
|
+ //根据公司名称和法人名称获取公司用户id
|
|
|
|
+ CompanyInfo companyInfo = companyInfoService.selectOne(new EntityWrapper<CompanyInfo>()
|
|
|
|
+ .eq("company_name",cargoOwnerCompInfo.getCompany())
|
|
|
|
+ .eq("legal_person_name",cargoOwnerCompInfo.getLegalPersonName())
|
|
|
|
+ .eq("delete_flag","0"));
|
|
|
|
+ //新增代理货主信息
|
|
|
|
+ AgentCargoOwnerInfo agentCargoOwnerInfo = new AgentCargoOwnerInfo();
|
|
|
|
+ agentCargoOwnerInfo.setId(IdGenerator.generateUUID());
|
|
|
|
+ agentCargoOwnerInfo.setCommonId(companyInfo.getCommonId());
|
|
|
|
+ agentCargoOwnerInfo.setAgentCommonId(cargoOwnerCompInfo.getCommonId());
|
|
|
|
+ agentCargoOwnerInfo.setName(cargoOwnerInfo.getName());
|
|
|
|
+ agentCargoOwnerInfo.setPhone(cargoOwnerInfo.getPhone());
|
|
|
|
+ agentCargoOwnerInfo.setCompany(cargoOwnerCompInfo.getCompany());
|
|
|
|
+ agentCargoOwnerInfo.setCertificateAddressUrl(cargoOwnerCompInfo.getCertificateAddressUrl());
|
|
|
|
+ agentCargoOwnerInfo.setStatus(StatusEnum.TO_BE_REVIEWED.getName());
|
|
|
|
+ agentCargoOwnerInfo.setStatusKey(StatusEnum.TO_BE_REVIEWED.getFlag());
|
|
|
|
+ agentCargoOwnerInfoService.insert(agentCargoOwnerInfo);
|
|
|
|
+
|
|
|
|
+ return "OK";
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 编辑货主个人信息
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public String editCargoOwner(CargoOwnerInfo cargoOwnerInfo) {
|
|
|
|
+ CargoOwnerInfo cargoOwnerInfo1 = this.selectById(cargoOwnerInfo.getId());
|
|
|
|
+ if (cargoOwnerInfo1 != null){
|
|
|
|
+ //信息编辑
|
|
|
|
+ cargoOwnerInfo1.setAuthenticationStatus(StatusEnum.IDENTITY_REVIEWED.getName());
|
|
|
|
+ cargoOwnerInfo1.setAuthenticationStatusKey(StatusEnum.IDENTITY_REVIEWED.getFlag());
|
|
|
|
+ this.updateById(cargoOwnerInfo1);
|
|
|
|
+ }
|
|
|
|
+ return "OK";
|
|
|
|
+ }
|
|
}
|
|
}
|