Commit 768a3cc2 by kangxiaoshan

v1.3

parent b10cb188
......@@ -78,7 +78,7 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
List<Contract> findByTwoIds(Long relationContract, Long relationContract1);
@Query(value="SELECT * from contract where platform =?1 and email = ?2 and (status <> 'end' or status <> 'cancel')",nativeQuery=true)
List<Contract> findByPlatformAndEmailStatus(String platgorm, String email, int status);
List<Contract> findByPlatformAndEmailStatus(String platgorm, String email);
@Query(value = "select * from contract where contract_code =?2 and platform = ?1 ",nativeQuery = true)
Contract findOneByCode(String platform, String contractId);
......
......@@ -30,10 +30,14 @@ public class AccountCommonServiceImpl implements AccountCommonService {
@Override
public Account4Web findOne(String platgorm, String email) {
List<Contract> contract = contractRepository.findByPlatformAndEmailStatus(platgorm, email, 1);
List<Contract> contract = contractRepository.findByPlatformAndEmailStatus(platgorm, email);
Account4Web account4Web = new Account4Web();
Contract thecontract = contract.get(0);
account4Web.setEmail(thecontract.getEmail());
account4Web.setAccountId(0L);
account4Web.setId(0L);
PackageBase packageBase = packageBaseRepository.findOne(thecontract.getPriceLevel());
account4Web.setPackageType(packageBase.getPackageName());
......
......@@ -1339,10 +1339,10 @@ public class ContractServiceImpl implements ContractService {
@Override
public Contract change(User loginUser, ContractChange resource, FlowChange flowChange) {
Map<Long, String> packageMap = getPackageMap();
Map<Long, String> saleMap = getSaleMap();
Contract contract = contractRepository.findByCode(resource.getContractCode());
Map<Long, String> packageMap = getPackageMap(contract);
// ChangeDelInfo changeDelInfo = new ChangeDelInfo();
// changeDelInfo.setContractCode(contract.getContractCode());
// changeDelInfo.setEmail(contract.getEmail());
......@@ -1636,14 +1636,8 @@ public class ContractServiceImpl implements ContractService {
saleMap.put(s.getId(), s.getName());
}
}
List<PackageType> typeList = packageTypeRepository.findAll();
Map<Long, String> typeMap = new HashMap<>();
if (ValidateUtil.isValid(typeList)) {
for (PackageType s : typeList) {
typeMap.put(s.getId(), s.getPackageName());
}
}
Map<Long, String> typeMap = this.getPackageMap(contract);
save.setSaleName(saleMap.containsKey(save.getSale()) ? saleMap.get(save.getSale()) : "");
save.setPriceLevelName(typeMap.containsKey(save.getPriceLevel()) ? typeMap.get(save.getPriceLevel()) : "");
save.setCreateName(saleMap.containsKey(save.getSale()) ? saleMap.get(save.getSale()) : "");
......@@ -1744,16 +1738,34 @@ public class ContractServiceImpl implements ContractService {
return data;
}
public Map<Long, String> getPackageMap() {
public Map<Long, String> getPackageMap(Contract contract) {
// List<PackageType> typeList = packageTypeRepository.findAll();
List<PackageType> typeList = packageTypeRepository.findIsNewAll();
Map<Long, String> typeMap = new HashMap<>();
if (ValidateUtil.isValid(typeList)) {
for (PackageType s : typeList) {
typeMap.put(s.getId(), s.getPackageName());
String platform = contract.getPlatform();
if("trackio".equals(platform)){
List<PackageType> typeList = packageTypeRepository.findIsNewAll();
Map<Long, String> typeMap = new HashMap<>();
if (ValidateUtil.isValid(typeList)) {
for (PackageType s : typeList) {
typeMap.put(s.getId(), s.getPackageName());
}
}
return typeMap;
}else{
List<PackageBase> packageBases = packageBaseRepository.findByPlatAndStatus(platform,1);
Map<Long, String> typeMap = new HashMap<>();
for (PackageBase packageBase : packageBases) {
typeMap.put(packageBase.getId(),packageBase.getPackageName());
}
return typeMap;
}
return typeMap;
}
public Map<Long, String> getSaleMap() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment